Skip to content

Commit

Permalink
Update docs on public interface
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenko committed Apr 9, 2022
1 parent 9a17d45 commit 73e2e4c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
31 changes: 24 additions & 7 deletions lib/src/application_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ import 'dart:io';
import 'package:meta/meta.dart';
import 'package:pub_semver/pub_semver.dart';

/// Specify if and how to persists user objects.
enum MetadataPersistenceMode {
plainText,
/// Persist [User] objects, but do not encrypt them.
unencrypted,
/// Persist [User] objects in an encrypted store.
encrypted,
/// Do not persist [User] objects.
disabled,
}

@immutable
Expand All @@ -31,10 +36,13 @@ class ApplicationConfiguration {
final String appId;

/// The [baseFilePath] is the [Directory] relative to which all local data for this application will be stored.
/// This data includes metadata for users and synchronized Realms.
///
/// This data includes metadata for users and synchronized Realms. If set, you must ensure that the [baseFilePath]
/// directory exists.
final Directory? baseFilePath;

/// The [baseUrl] is the [Uri] used to reach the MongoDB Realm server.
///
/// [baseUrl] only needs to be set if for some reason your application isn't hosted on realm.mongodb.com.
/// This can be the case if you're testing locally or are using a pre-production environment.
final Uri? baseUrl;
Expand All @@ -43,36 +51,45 @@ class ApplicationConfiguration {
final Duration? defaultRequestTimeout;

/// The [localAppName] is the friendly name identifying the current client application.
///
/// This is typically used to differentiate between client applications that use the same
/// MongoDB Realm app. These can be the same conceptual app developed for different platforms, or
/// MongoDB Realm app.
///
/// These can be the same conceptual app developed for different platforms, or
/// significantly different client side applications that operate on the same data - e.g. an event managing
/// service that has different clients apps for organizers and attendees.
final String? localAppName;

/// The [localAppVersion]
/// The [localAppVersion] can be specified, if you wish to distinguish different client versions of the
/// same application.
final Version? localAppVersion;

final MetadataPersistenceMode metadataPersistenceMode;

/// The encryption key for user metadata on this device.
/// This will not change the encryption key for individual Realms, which is set in the [Configuration]
/// The encryption key to use for user metadata on this device, if [metadataPersistenceMode] is
/// [MetadataPersistenceMode.encrypted].
///
/// The [metadataEncryptionKey] must be exactly 64 bytes.
/// Setting this will not change the encryption key for individual Realms, which is set in the [Configuration].
final List<int>? metadataEncryptionKey;

/// The [HttpClient] that will be used for HTTP requests during authentication.
///
/// You can use this to override the default http client handler and configure settings like proxies,
/// client certificates, and cookies. While these are not required to connect to MongoDB Realm under
/// normal circumstances, they can be useful if client devices are behind corporate firewall or use
/// a more complex networking setup.
final HttpClient httpClient;

/// Instantiates a new [ApplicationConfiguration].
ApplicationConfiguration(
this.appId, {
this.baseUrl,
this.baseFilePath,
this.defaultRequestTimeout,
this.localAppName,
this.localAppVersion,
this.metadataPersistenceMode = MetadataPersistenceMode.plainText,
this.metadataPersistenceMode = MetadataPersistenceMode.unencrypted,
this.metadataEncryptionKey,
HttpClient? httpClient,
}) : httpClient = httpClient ?? HttpClient();
Expand Down
2 changes: 1 addition & 1 deletion lib/src/realm_class.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import 'realm_object.dart';
import 'results.dart';

// always expose with `show` to explicitly control the public API surface
export "application_configuration.dart" show ApplicationConfiguration;
export "application_configuration.dart" show ApplicationConfiguration, MetadataPersistenceMode;
export 'package:realm_common/realm_common.dart'
show Ignored, Indexed, MapTo, PrimaryKey, RealmError, RealmModel, RealmUnsupportedSetError, RealmStateError, RealmCollectionType, RealmPropertyType;
export "configuration.dart" show Configuration, RealmSchema, SchemaObject;
Expand Down

0 comments on commit 73e2e4c

Please sign in to comment.