C# Class Amazon.CognitoSync.SyncManager.CognitoSyncManager

Show file Open project: aws/aws-sdk-net Class Usage Examples

Public Methods

Method Description
BeginRefreshDatasetMetadata ( AsyncCallback callback, object state ) : IAsyncResult

Initiates the asynchronous execution of the RefreshDatasetMetadata operation. Refreshes dataset metadata. Dataset metadata is pulled from remote storage and stored in local storage. Their record data isn't pulled down until you sync each dataset.

CognitoSyncManager ( CognitoAWSCredentials cognitoCredentials ) : System

Creates an instance of CognitoSyncManager using Cognito Credentials, the region is picked up from the config if it available CognitoSyncManager cognitoSyncManager = new CognitoSyncManager(credentials)

CognitoSyncManager ( CognitoAWSCredentials cognitoCredentials, AmazonCognitoSyncConfig config ) : System

Creates an instance of CognitoSyncManager using cognito credentials and a configuration object CognitoSyncManager cognitoSyncManager = new CognitoSyncManager(credentials,new AmazonCognitoSyncConfig { RegionEndpoint = RegionEndpoint.USEAST1})

CognitoSyncManager ( CognitoAWSCredentials cognitoCredentials, RegionEndpoint endpoint ) : System

Creates an instance of CognitoSyncManager using cognito credentials and a specific region CognitoSyncManager cognitoSyncManager = new CognitoSyncManager(credentials, RegionEndpoint.USEAST1)

Dispose ( ) : void

Releases the resources consumed by this object

EndRefreshDatasetMetadata ( IAsyncResult asyncResult ) : List

Finishes the asynchronous execution of the RefreshDatasetMetadata operation.

ListDatasets ( ) : List

Retrieves a list of datasets from local storage. It may not reflect the latest dataset on the remote storage until the RefreshDatasetMetadata operation is performed.

OpenOrCreateDataset ( string datasetName ) : Dataset

Opens or creates a dataset. If the dataset doesn't exist, an empty one with the given name will be created. Otherwise, the dataset is loaded from local storage. If a dataset is marked as deleted but hasn't been deleted on remote via the RefreshDatasetMetadata operation, it will throw System.InvalidOperationException. Dataset dataset = cognitoSyncManager.OpenOrCreateDataset("myDatasetName");

RefreshDatasetMetadataAsync ( CancellationToken cancellationToken = default(CancellationToken) ) : Task>

Refreshes dataset metadata. Dataset metadata is pulled from remote storage and stored in local storage. Their record data isn't pulled down until you sync each dataset.

RefreshDatasetMetadataAsync ( AmazonCognitoSyncCallback callback, AsyncOptions options = null ) : void

Refreshes dataset metadata. Dataset metadata is pulled from remote storage and stored in local storage. Their record data isn't pulled down until you sync each dataset.

WipeData ( ) : void

Wipes all user data cached locally, including identity id, session credentials, dataset metadata, and all records. Any data that hasn't been synced will be lost. This method is usually used when customer logs out.

WipeData ( bool wipeCredentialsAndID ) : void

Wipes all user data cached locally, including dataset metadata, and all records, and optionally identity id and session credentials. Any data that hasn't been synced will be lost. This method is usually used when customer logs out. Wipe Credentials and IdentityId.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the resources consumed by this object if disposing is true.

IdentityChanged ( object sender, EventArgs e ) : void

This is triggered when an Identity Change event occurs. The dataset are then remapped to the new identity id. This may happend for example when a user is working with unauthenticated id and later decides to authenticate himself with a public login provider

Private Methods

Method Description
ValidateParameters ( ) : void

Method Details

BeginRefreshDatasetMetadata() public method

Initiates the asynchronous execution of the RefreshDatasetMetadata operation. Refreshes dataset metadata. Dataset metadata is pulled from remote storage and stored in local storage. Their record data isn't pulled down until you sync each dataset.
public BeginRefreshDatasetMetadata ( AsyncCallback callback, object state ) : IAsyncResult
callback AsyncCallback An AsyncCallback delegate that is invoked when the operation completes.
state object A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.
return IAsyncResult

CognitoSyncManager() public method

Creates an instance of CognitoSyncManager using Cognito Credentials, the region is picked up from the config if it available CognitoSyncManager cognitoSyncManager = new CognitoSyncManager(credentials)
public CognitoSyncManager ( CognitoAWSCredentials cognitoCredentials ) : System
cognitoCredentials CognitoAWSCredentials
return System

CognitoSyncManager() public method

Creates an instance of CognitoSyncManager using cognito credentials and a configuration object CognitoSyncManager cognitoSyncManager = new CognitoSyncManager(credentials,new AmazonCognitoSyncConfig { RegionEndpoint = RegionEndpoint.USEAST1})
public CognitoSyncManager ( CognitoAWSCredentials cognitoCredentials, AmazonCognitoSyncConfig config ) : System
cognitoCredentials CognitoAWSCredentials
config AmazonCognitoSyncConfig
return System

CognitoSyncManager() public method

Creates an instance of CognitoSyncManager using cognito credentials and a specific region CognitoSyncManager cognitoSyncManager = new CognitoSyncManager(credentials, RegionEndpoint.USEAST1)
public CognitoSyncManager ( CognitoAWSCredentials cognitoCredentials, RegionEndpoint endpoint ) : System
cognitoCredentials CognitoAWSCredentials
endpoint RegionEndpoint
return System

Dispose() public method

Releases the resources consumed by this object
public Dispose ( ) : void
return void

Dispose() protected method

Releases the resources consumed by this object if disposing is true.
protected Dispose ( bool disposing ) : void
disposing bool
return void

EndRefreshDatasetMetadata() public method

Finishes the asynchronous execution of the RefreshDatasetMetadata operation.
public EndRefreshDatasetMetadata ( IAsyncResult asyncResult ) : List
asyncResult IAsyncResult The IAsyncResult returned by the call to BeginRefreshDatasetMetadata.
return List

IdentityChanged() protected method

This is triggered when an Identity Change event occurs. The dataset are then remapped to the new identity id. This may happend for example when a user is working with unauthenticated id and later decides to authenticate himself with a public login provider
protected IdentityChanged ( object sender, EventArgs e ) : void
sender object The object which triggered this methos
e System.EventArgs Event Arguments
return void

ListDatasets() public method

Retrieves a list of datasets from local storage. It may not reflect the latest dataset on the remote storage until the RefreshDatasetMetadata operation is performed.
public ListDatasets ( ) : List
return List

OpenOrCreateDataset() public method

Opens or creates a dataset. If the dataset doesn't exist, an empty one with the given name will be created. Otherwise, the dataset is loaded from local storage. If a dataset is marked as deleted but hasn't been deleted on remote via the RefreshDatasetMetadata operation, it will throw System.InvalidOperationException. Dataset dataset = cognitoSyncManager.OpenOrCreateDataset("myDatasetName");
public OpenOrCreateDataset ( string datasetName ) : Dataset
datasetName string DatasetName, must be [a-zA-Z0=9_.:-]+
return Dataset

RefreshDatasetMetadataAsync() public method

Refreshes dataset metadata. Dataset metadata is pulled from remote storage and stored in local storage. Their record data isn't pulled down until you sync each dataset.
Thrown when fail to fresh dataset metadata
public RefreshDatasetMetadataAsync ( CancellationToken cancellationToken = default(CancellationToken) ) : Task>
cancellationToken System.Threading.CancellationToken /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. ///
return Task>

RefreshDatasetMetadataAsync() public method

Refreshes dataset metadata. Dataset metadata is pulled from remote storage and stored in local storage. Their record data isn't pulled down until you sync each dataset.
Thrown when fail to fresh dataset metadata
public RefreshDatasetMetadataAsync ( AmazonCognitoSyncCallback callback, AsyncOptions options = null ) : void
callback AmazonCognitoSyncCallback Callback once the refresh is complete
options AsyncOptions Options for asynchronous execution
return void

WipeData() public method

Wipes all user data cached locally, including identity id, session credentials, dataset metadata, and all records. Any data that hasn't been synced will be lost. This method is usually used when customer logs out.
public WipeData ( ) : void
return void

WipeData() public method

Wipes all user data cached locally, including dataset metadata, and all records, and optionally identity id and session credentials. Any data that hasn't been synced will be lost. This method is usually used when customer logs out. Wipe Credentials and IdentityId.
public WipeData ( bool wipeCredentialsAndID ) : void
wipeCredentialsAndID bool
return void