using Amazon.Runtime; using Amazon.Util.Internal; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace Amazon.CognitoSync.SyncManager { public partial class CognitoSyncManager { /// /// 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. /// /// Callback once the refresh is complete /// Options for asynchronous execution /// Thrown when fail to fresh dataset metadata public void RefreshDatasetMetadataAsync(AmazonCognitoSyncCallback> callback, AsyncOptions options = null) { options = options ?? new AsyncOptions(); AmazonCognitoSyncResult> cognitoResult = new AmazonCognitoSyncResult>(options.State); InternalSDKUtils.AsyncExecutor(() => { try { var response = Remote.ListDatasetMetadata(); Local.UpdateDatasetMetadata(IdentityId, response); cognitoResult.Response = response; } catch (Exception e) { cognitoResult.Exception = e; } callback(cognitoResult); }, options); } } }