public void AddSyncAccount(GoogleDriveSyncAccount syncAccount)
        {
            RemoveSyncAccount(syncAccount.Id);

            Configuration.SyncAccounts.Add(syncAccount);

            Plugin.Instance.SaveConfiguration();
        }
        public void AddSyncAccount(GoogleDriveSyncAccount syncAccount)
        {
            RemoveSyncAccount(syncAccount.Id);

            Configuration.SyncAccounts.Add(syncAccount);

            Plugin.Instance.SaveConfiguration();
        }
        public async Task Post(AddSyncTarget request)
        {
            var config = _configurationRetriever.GetGeneralConfiguration();
            var refreshToken = await GetRefreshToken(request);

            var syncAccount = new GoogleDriveSyncAccount
            {
                Id = Guid.NewGuid().ToString(),
                Name = WebUtility.UrlDecode(request.Name),
                EnableForEveryone = request.EnableForEveryone,
                UserIds = request.UserIds,
                RefreshToken = refreshToken,
                FolderId = await GetOrCreateFolder(config.GoogleDriveClientId, config.GoogleDriveClientSecret, refreshToken)
            };

            if (!string.IsNullOrEmpty(request.Id))
            {
                syncAccount.Id = request.Id;
            }

            _configurationRetriever.AddSyncAccount(syncAccount);
        }
 private SyncTarget CreateSyncTarget(GoogleDriveSyncAccount syncAccount)
 {
     return new SyncTarget
     {
         Id = syncAccount.Id,
         Name = syncAccount.Name
     };
 }