Namespace Realms.Sync
Classes
ApiKey
A class representing an API key for a User. It can be used to represent the user when logging in
instead of their regular credentials. These keys are created or fetched through Api
An API key's Value is only available when the key is created and cannot be obtained after that.
This means that it's the caller's responsibility to safely store an API key's value upon creation.
App
An App is the main client-side entry point for interacting with a Atlas App Services application.
The App can be used to:
-
Register uses and perform various user-related operations through authentication providers (e.g. Api
Keys , EmailPassword ).Auth -
Synchronize data between the local device and a remote Realm App with Synchronized Realms (using Sync
Configuration ).Base - Invoke Realm App functions with Functions (using Functions).
-
Access remote data from MongoDB databases with a Mongo
Client (using GetMongo ).Client(string)
To create an app that is linked with a remote Realm App initialize Realm and configure the App as shown below:
var appConfig = new AppConfiguration("my-realm-app-id");
var app = new App(appConfig);
After configuring the App you can start managing users, configure Synchronized Realms, call remote Realm Functions, and access remote data through Mongo Collections.
To register a new user and/or login with an existing user do as shown below:
await app.EmailPassword.RegisterUserAsync("foo@bar.com", "password");
// Login with existing user
var user = app.LoginAsync(Credentials.EmailPassword("foo@bar.com", "password");
With an authorized user you can synchronize data between the local device and the remote Realm App by opening a Realm with a Syncvar syncConfig = new PartitionSyncConfiguration("some-partition-value", user);
using var realm = await Realm.GetInstanceAsync(syncConfig);
realm.Write(() =>
{
realm.Add(...);
});
await realm.GetSession().WaitForUploadAsync();
You can call remote Realm functions as shown below:
var result = await user.Functions.CallAsync<int>("sum", 1, 2, 3, 4, 5);
And access collections from the remote Realm App as shown here:
var client = user.GetMongoClient("atlas-service");
var db = client.GetDatabase("my-db");
var collection = db.GetCollection("foos");
var foosCount = await collection.CountAsync();
AppConfiguration
A class exposing configuration options for a App.
Credentials
A class, representing the credentials used for authenticating a User.
FlexibleSyncConfiguration
A Flexible
MongoClient
The remote MongoClient used for working with data in MongoDB remotely via Realm.
MongoClient.Collection<TDocument>
An object representing a remote MongoDB collection.
MongoClient.Database
An object representing a remote MongoDB database.
MongoClient.DeleteResult
The result of Delete
MongoClient.InsertManyResult
The result of Insert
MongoClient.InsertResult
The result of Insert
MongoClient.UpdateResult
The result of Update
PartitionSyncConfiguration
A Partition
ReconnectBackoffOptions
Options for configuring the reconnection delay used by the sync client.
Session
An object encapsulating a synchronization session. Sessions represent the communication between the client (and a local Realm file on disk), and MongoDB Atlas. Sessions are always created by the SDK and vended out through various APIs. The lifespans of sessions associated with Realms are managed automatically.
Subscription
A class representing a single query subscription. The server will continuously evaluate the Query that the app subscribed to and will send data that matches it as well as remove data that no longer does.
SubscriptionOptions
A class providing various options to Add<T>(IQueryable<T>, Subscription
SubscriptionSet
A collection representing the set of active subscriptions for a Realm
instance. This is used in combination with Flexible
SyncConfigurationBase
A Sync
SyncTimeoutOptions
Options for configuring timeouts and intervals used by the sync client.
User
This class represents a user in a Atlas App Services application. The credentials are provided by various 3rd party providers (Facebook, Google, etc.). A user can log in to the server and, if access is granted, it is possible to synchronize the local and the remote Realm. Moreover, synchronization is halted when the user is logged out. It is possible to persist a user. By retrieving a user, there is no need to log in to the 3rd party provider again. Persisting a user between sessions, the user's credentials are stored locally on the device, and should be treated as sensitive data.
User.ApiKeyClient
A class exposing functionality for users to manage API keys from the client. It is always scoped
to a particular User and can only be accessed via Api
User.FunctionsClient
A class exposing functionality for calling remote Atlas Functions.
UserIdentity
A class containing information about an identity associated with a user.
UserProfile
A class containing profile information about User.
Structs
App.EmailPasswordClient
A class, encapsulating functionality for users, logged in with the Email
App.SyncClient
A sync manager, handling synchronization of local Realm with MongoDB Atlas. It is always scoped to a particular app and can only be accessed via Sync.
SyncProgress
A struct containing information about the progress state at a given instant.
Enums
ConnectionState
The current connection state of a sync session object.
Credentials.AuthProvider
An enum containing the possible authentication providers. These have to manually be enabled for your app before they can be used.
GoogleCredentialType
The type of the Google credential.
MetadataPersistenceMode
Enumeration that specifies how and if logged-in User objects are persisted across application launches.
ProgressDirection
The transfer direction (upload or download) tracked by a given progress notification subscription.
ProgressMode
The desired behavior of a progress notification subscription.
SessionState
The current state of a sync session object.
SubscriptionSetState
An enum representing the state of a Realm's subscription set.
UserState
The state of the user object.
WaitForSyncMode
An enum controlling when query.
Delegates
FlexibleSyncConfiguration.InitialSubscriptionsDelegate
A delegate invoked when a flexible sync Realm is first opened.
SyncConfigurationBase.SessionErrorCallback
Callback triggered when an error occurs in a session.