コード例 #1
0
        /// <summary>
        /// Insert a new submission to AVERT into the store
        /// </summary>
        /// <param name="storageConsistencyMode">consistency to use</param>
        /// <param name="reportHandle">uniquely identifies this report</param>
        /// <param name="appHandle">uniquely identifies the app that the user is in</param>
        /// <param name="reportType">is the complaint against a user or content?</param>
        /// <param name="requestTime">when the request was submitted to AVERT</param>
        /// <param name="requestBody">body of the request to AVERT</param>
        /// <returns>a task that inserts the submission into the store</returns>
        public async Task InsertSubmission(
            StorageConsistencyMode storageConsistencyMode,
            string reportHandle,
            string appHandle,
            ReportType reportType,
            DateTime requestTime,
            string requestBody)
        {
            // check input
            if (string.IsNullOrWhiteSpace(reportHandle))
            {
                throw new ArgumentNullException("reportHandle");
            }

            // get the table interface
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.AVERT);

            ObjectTable lookupTable = this.tableStoreManager.GetTable(ContainerIdentifier.AVERT, TableIdentifier.AVERTLookup) as ObjectTable;

            // create the entity that will be inserted into the table
            AVERTTransactionEntity avertTransactionEntity = new AVERTTransactionEntity()
            {
                ReportHandle = reportHandle,
                AppHandle    = appHandle,
                ReportType   = reportType,
                RequestTime  = requestTime,
                RequestBody  = requestBody,
                ResponseTime = TimeUtils.BeginningOfUnixTime,
                ResponseBody = null
            };

            // insert it
            await store.ExecuteOperationAsync(Operation.Insert(lookupTable, reportHandle, reportHandle, avertTransactionEntity), storageConsistencyMode.ToConsistencyMode());
        }
コード例 #2
0
        /// <summary>
        /// Insert reply
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="replyHandle">Reply handle</param>
        /// <param name="commentHandle">Comment handle</param>
        /// <param name="topicHandle">Topic handle</param>
        /// <param name="text">Reply text</param>
        /// <param name="language">Reply language</param>
        /// <param name="userHandle">User handle</param>
        /// <param name="createdTime">Created time</param>
        /// <param name="reviewStatus">Review status</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="requestId">Request id associated with the create reply request</param>
        /// <returns>Insert reply task</returns>
        public async Task InsertReply(
            StorageConsistencyMode storageConsistencyMode,
            string replyHandle,
            string commentHandle,
            string topicHandle,
            string text,
            string language,
            string userHandle,
            DateTime createdTime,
            ReviewStatus reviewStatus,
            string appHandle,
            string requestId)
        {
            ReplyEntity replyEntity = new ReplyEntity()
            {
                CommentHandle   = commentHandle,
                TopicHandle     = topicHandle,
                Text            = text,
                Language        = language,
                UserHandle      = userHandle,
                CreatedTime     = createdTime,
                LastUpdatedTime = createdTime,
                AppHandle       = appHandle,
                ReviewStatus    = reviewStatus,
                RequestId       = requestId
            };

            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Replies);

            ObjectTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.Replies, TableIdentifier.RepliesObject) as ObjectTable;
            Operation   operation = Operation.Insert(table, replyHandle, replyHandle, replyEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #3
0
        /// <summary>
        /// Insert push registrations
        /// </summary>
        /// <param name="storageConsistencyMode">Consistency mode</param>
        /// <param name="userHandle">User handle</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="platformType">Platform type</param>
        /// <param name="registrationId">OS registration id</param>
        /// <param name="hubRegistrationId">Hub registration id</param>
        /// <param name="language">Client language</param>
        /// <param name="lastUpdatedTime">Last updated time</param>
        /// <returns>Insert push registration task</returns>
        public async Task InsertPushRegistration(
            StorageConsistencyMode storageConsistencyMode,
            string userHandle,
            string appHandle,
            PlatformType platformType,
            string registrationId,
            string hubRegistrationId,
            string language,
            DateTime lastUpdatedTime)
        {
            PushRegistrationFeedEntity entity = new PushRegistrationFeedEntity()
            {
                UserHandle        = userHandle,
                AppHandle         = appHandle,
                PlatformType      = platformType,
                OSRegistrationId  = registrationId,
                HubRegistrationId = hubRegistrationId,
                Language          = language,
                LastUpdatedTime   = lastUpdatedTime
            };

            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.PushRegistrations);

            FeedTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.PushRegistrations, TableIdentifier.PushRegistrationsFeed) as FeedTable;
            Operation operation = Operation.InsertOrReplace(table, userHandle, appHandle, registrationId, entity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #4
0
        /// <summary>
        /// Insert a response from AVERT into the store
        /// </summary>
        /// <param name="storageConsistencyMode">consistency to use</param>
        /// <param name="reportHandle">uniquely identifies this report</param>
        /// <param name="responseTime">when the response was received from AVERT</param>
        /// <param name="responseBody">body of the response from AVERT</param>
        /// <param name="entity">AVERT transaction entity to update</param>
        /// <returns>a task that inserts the response into the store</returns>
        public async Task InsertResponse(
            StorageConsistencyMode storageConsistencyMode,
            string reportHandle,
            DateTime responseTime,
            string responseBody,
            IAVERTTransactionEntity entity)
        {
            // check inputs
            if (string.IsNullOrWhiteSpace(reportHandle))
            {
                throw new ArgumentNullException("reportHandle");
            }

            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            // get the table interface
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.AVERT);

            ObjectTable lookupTable = this.tableStoreManager.GetTable(ContainerIdentifier.AVERT, TableIdentifier.AVERTLookup) as ObjectTable;

            // update the entity
            entity.ResponseTime = responseTime;
            entity.ResponseBody = responseBody;

            // update it in the store
            await store.ExecuteOperationAsync(Operation.Replace(lookupTable, reportHandle, reportHandle, entity as AVERTTransactionEntity), storageConsistencyMode.ToConsistencyMode());
        }
コード例 #5
0
        /// <summary>
        /// Update a comment
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="commentHandle">Comment handle</param>
        /// <param name="commentEntity">Comment entity</param>
        /// <returns>Update comment task</returns>
        public async Task UpdateComment(StorageConsistencyMode storageConsistencyMode, string commentHandle, ICommentEntity commentEntity)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Comments);

            ObjectTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.Comments, TableIdentifier.CommentsObject) as ObjectTable;
            Operation   operation = Operation.Replace(table, commentHandle, commentHandle, commentEntity as CommentEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #6
0
        /// <summary>
        /// Delete blob metadata
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="userHandle">User handle</param>
        /// <param name="blobHandle">Blob handle</param>
        /// <returns>Delete blob metadata task</returns>
        public async Task DeleteBlobMetadata(StorageConsistencyMode storageConsistencyMode, string appHandle, string userHandle, string blobHandle)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Blobs);

            ObjectTable table        = this.tableStoreManager.GetTable(ContainerIdentifier.Blobs, TableIdentifier.BlobsMetadata) as ObjectTable;
            string      partitionKey = this.GetPartitionKey(appHandle, userHandle);
            Operation   operation    = Operation.Delete(table, partitionKey, blobHandle);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #7
0
        /// <summary>
        /// Delete a CVS transaction
        /// </summary>
        /// <param name="storageConsistencyMode">consistency to use</param>
        /// <param name="moderationHandle">moderation handle</param>
        /// <returns>a task that deletes the CVS transaction</returns>
        public async Task DeleteTransaction(StorageConsistencyMode storageConsistencyMode, string moderationHandle)
        {
            // get the table interface
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.CVS);

            ObjectTable lookupTable = this.tableStoreManager.GetTable(ContainerIdentifier.CVS, TableIdentifier.CVSLookup) as ObjectTable;

            var operation = Operation.Delete(lookupTable, moderationHandle, moderationHandle);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #8
0
        /// <summary>
        /// Delete app key index
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appKey">App key</param>
        /// <returns>Delete app key index task</returns>
        public async Task DeleteAppKeyIndex(
            StorageConsistencyMode storageConsistencyMode,
            string appKey)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.AppKeys);

            ObjectTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.AppKeys, TableIdentifier.AppKeysIndex) as ObjectTable;
            Operation   operation = Operation.Delete(table, appKey, appKey);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #9
0
        /// <summary>
        /// Delete all app
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appHandle">App handle</param>
        /// <returns>Delete all app task</returns>
        public async Task DeleteAllApp(
            StorageConsistencyMode storageConsistencyMode,
            string appHandle)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.AllApps);

            FeedTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.AllApps, TableIdentifier.AllAppsFeed) as FeedTable;
            Operation operation = Operation.Delete(table, ContainerIdentifier.AllApps.ToString(), this.tableStoreManager.DefaultFeedKey, appHandle);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #10
0
        /// <summary>
        /// Delete topic
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="topicHandle">Topic handle</param>
        /// <returns>Delete topic task</returns>
        public async Task DeleteTopic(
            StorageConsistencyMode storageConsistencyMode,
            string topicHandle)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Topics);

            ObjectTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.Topics, TableIdentifier.TopicsObject) as ObjectTable;
            Operation   operation = Operation.Delete(table, topicHandle, topicHandle);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #11
0
        /// <summary>
        /// Update reply
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="replyHandle">Reply handle</param>
        /// <param name="replyEntity">Reply entity</param>
        /// <returns>Update reply task</returns>
        public async Task UpdateReply(
            StorageConsistencyMode storageConsistencyMode,
            string replyHandle,
            IReplyEntity replyEntity)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Replies);

            ObjectTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.Replies, TableIdentifier.RepliesObject) as ObjectTable;
            Operation   operation = Operation.Replace(table, replyHandle, replyHandle, replyEntity as ReplyEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #12
0
        /// <summary>
        /// Delete client name from ClientNamesFeed in AppKey container
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appKey">App key</param>
        /// <param name="clientName">Client name</param>
        /// <returns>Delete client name from its feed</returns>
        public async Task DeleteClientName(
            StorageConsistencyMode storageConsistencyMode,
            string appKey,
            string clientName)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.AppKeys);

            FeedTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.AppKeys, TableIdentifier.ClientNamesFeed) as FeedTable;
            Operation operation = Operation.Delete(table, appKey, this.tableStoreManager.DefaultFeedKey, clientName);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #13
0
        /// <summary>
        /// Delete linked account
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="userHandle">User handle</param>
        /// <param name="identityProviderType">Identity provider type</param>
        /// <returns>Delete linked account task</returns>
        public async Task DeleteLinkedAccount(
            StorageConsistencyMode storageConsistencyMode,
            string userHandle,
            IdentityProviderType identityProviderType)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Users);

            FeedTable accountsTable = this.tableStoreManager.GetTable(ContainerIdentifier.Users, TableIdentifier.UserLinkedAccountsFeed) as FeedTable;
            Operation operation     = Operation.Delete(accountsTable, userHandle, this.tableStoreManager.DefaultFeedKey, identityProviderType.ToString());
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #14
0
        /// <summary>
        /// Update validation configuration
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="validationConfigurationEntity">Validation configuration entity</param>
        /// <returns>Update validation configuration task</returns>
        public async Task UpdateValidationConfiguration(
            StorageConsistencyMode storageConsistencyMode,
            string appHandle,
            IValidationConfigurationEntity validationConfigurationEntity)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Apps);

            ObjectTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.Apps, TableIdentifier.AppValidationConfigurationsObject) as ObjectTable;
            Operation   operation = Operation.Replace(table, appHandle, appHandle, validationConfigurationEntity as ValidationConfigurationEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #15
0
        /// <summary>
        /// Update push notifications configuration
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="platformType">Platform type</param>
        /// <param name="pushNotificationsConfigurationEntity">Push notifications configuration entity</param>
        /// <returns>Update push notifications configuration task</returns>
        public async Task UpdatePushNotificationsConfiguration(
            StorageConsistencyMode storageConsistencyMode,
            string appHandle,
            PlatformType platformType,
            IPushNotificationsConfigurationEntity pushNotificationsConfigurationEntity)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Apps);

            ObjectTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.Apps, TableIdentifier.AppPushNotificationsConfigurationsObject) as ObjectTable;
            Operation   operation = Operation.Replace(table, appHandle, platformType.ToString(), pushNotificationsConfigurationEntity as PushNotificationsConfigurationEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #16
0
        /// <summary>
        /// Delete user from table of app administrators
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="userHandle">User handle</param>
        /// <returns>Delete app administrator task</returns>
        public async Task DeleteAdminUser(
            StorageConsistencyMode storageConsistencyMode,
            string appHandle,
            string userHandle)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.AppAdmins);

            ObjectTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.AppAdmins, TableIdentifier.AppAdminsObject) as ObjectTable;
            var         objectKey = this.GetAppAdminObjectKey(appHandle, userHandle);
            Operation   operation = Operation.Delete(table, appHandle, objectKey);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #17
0
        /// <summary>
        /// Update identity provider credentials
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="identityProviderType">Identity provider type</param>
        /// <param name="identityProviderCredentialsEntity">Identity provider credentials entity</param>
        /// <returns>Update identity provider credentials task</returns>
        public async Task UpdateIdentityProviderCredentials(
            StorageConsistencyMode storageConsistencyMode,
            string appHandle,
            IdentityProviderType identityProviderType,
            IIdentityProviderCredentialsEntity identityProviderCredentialsEntity)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Apps);

            ObjectTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.Apps, TableIdentifier.AppIdentityProviderCredentialsObject) as ObjectTable;
            Operation   operation = Operation.Replace(table, appHandle, identityProviderType.ToString(), identityProviderCredentialsEntity as IdentityProviderCredentialsEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #18
0
        /// <summary>
        /// Delete push registrations
        /// </summary>
        /// <param name="storageConsistencyMode">Consistency mode</param>
        /// <param name="userHandle">User handle</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="registrationId">OS registration id</param>
        /// <returns>Delete push registration task</returns>
        public async Task DeletePushRegistration(
            StorageConsistencyMode storageConsistencyMode,
            string userHandle,
            string appHandle,
            string registrationId)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.PushRegistrations);

            FeedTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.PushRegistrations, TableIdentifier.PushRegistrationsFeed) as FeedTable;
            Operation operation = Operation.Delete(table, userHandle, appHandle, registrationId);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #19
0
        /// <summary>
        /// Delete linked account index
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="identityProviderType">Identity provider type</param>
        /// <param name="accountId">Account id</param>
        /// <returns>Delete linked account index task</returns>
        public async Task DeleteLinkedAccountIndex(
            StorageConsistencyMode storageConsistencyMode,
            IdentityProviderType identityProviderType,
            string accountId)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.LinkedAccounts);

            ObjectTable indexTable = this.tableStoreManager.GetTable(ContainerIdentifier.LinkedAccounts, TableIdentifier.LinkedAccountsIndex) as ObjectTable;
            string      key        = this.GetLinkedAccountKey(identityProviderType, accountId);
            Operation   operation  = Operation.Delete(indexTable, key, this.tableStoreManager.DefaultObjectKey);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #20
0
        /// <summary>
        /// Updates image review status
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="userHandle">User handle</param>
        /// <param name="blobHandle">Blob handle</param>
        /// <param name="reviewStatus">Review status</param>
        /// <param name="imageMetadataEntity">Image metadata entity</param>
        /// <returns>Update image review status task</returns>
        public async Task UpdateImageReviewStatus(StorageConsistencyMode storageConsistencyMode, string appHandle, string userHandle, string blobHandle, ReviewStatus reviewStatus, IImageMetadataEntity imageMetadataEntity)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Images);

            ObjectTable table        = this.tableStoreManager.GetTable(ContainerIdentifier.Images, TableIdentifier.ImagesMetadata) as ObjectTable;
            string      partitionKey = this.GetPartitionKey(appHandle, userHandle);

            imageMetadataEntity.ReviewStatus = reviewStatus;

            Operation operation = Operation.Replace(table, partitionKey, blobHandle, imageMetadataEntity as ImageMetadataEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #21
0
        /// <summary>
        /// Delete client config
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="developerId">Developer id</param>
        /// <param name="clientName">Client name</param>
        /// <returns>Delete client config task</returns>
        public async Task DeleteClientConfig(
            StorageConsistencyMode storageConsistencyMode,
            string developerId,
            string clientName)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.ClientConfigs);

            ObjectTable clientConfigsTable = this.tableStoreManager.GetTable(ContainerIdentifier.ClientConfigs, TableIdentifier.ClientConfigsObject) as ObjectTable;
            var         objectKey          = this.GetClientConfigsObjectKey(developerId, clientName);
            Operation   operation          = Operation.Delete(clientConfigsTable, objectKey, objectKey);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #22
0
        /// <summary>
        /// Update user
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="userHandle">User handle</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="userProfileEntity">User profile entity</param>
        /// <returns>Update user task</returns>
        public async Task UpdateUserProfile(
            StorageConsistencyMode storageConsistencyMode,
            string userHandle,
            string appHandle,
            IUserProfileEntity userProfileEntity)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Users);

            ObjectTable profilesTable = this.tableStoreManager.GetTable(ContainerIdentifier.Users, TableIdentifier.UserProfilesObject) as ObjectTable;
            Operation   operation     = Operation.Replace(profilesTable, userHandle, appHandle, userProfileEntity as UserProfileEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #23
0
        /// <summary>
        /// Update topic name
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="topicName">Topic name</param>
        /// <param name="topicNameEntity">Topic name entity</param>
        /// <returns>Update topic name task</returns>
        public async Task UpdateTopicName(
            StorageConsistencyMode storageConsistencyMode,
            string appHandle,
            string topicName,
            ITopicNameEntity topicNameEntity)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.TopicNames);

            ObjectTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.TopicNames, TableIdentifier.TopicNamesObject) as ObjectTable;
            string      objectKey = this.GetTopicNameObjectKey(appHandle, topicName);
            Operation   operation = Operation.Replace(table, objectKey, objectKey, topicNameEntity as TopicNameEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #24
0
        /// <summary>
        /// Delete content moderation entity
        /// </summary>
        /// <param name="storageConsistencyMode">consistency to use</param>
        /// <param name="moderationHandle">moderation handle</param>
        /// <param name="appHandle">app handle</param>
        /// <returns>A task that deletes the content moderation entity</returns>
        public async Task DeleteModeration(
            StorageConsistencyMode storageConsistencyMode,
            string moderationHandle,
            string appHandle)
        {
            // get content moderation table
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Moderation);

            ObjectTable lookupTable = this.tableStoreManager.GetTable(
                ContainerIdentifier.Moderation,
                TableIdentifier.ModerationObject) as ObjectTable;

            // delete moderation entity from the store
            var operation = Operation.Delete(lookupTable, appHandle, moderationHandle);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #25
0
        /// <summary>
        /// Create app key index
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appKey">App key</param>
        /// <param name="appHandle">App handle</param>
        /// <returns>Create app key index task</returns>
        public async Task InsertAppKeyIndex(
            StorageConsistencyMode storageConsistencyMode,
            string appKey,
            string appHandle)
        {
            AppLookupEntity appLookupEntity = new AppLookupEntity()
            {
                AppHandle = appHandle
            };

            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.AppKeys);

            ObjectTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.AppKeys, TableIdentifier.AppKeysIndex) as ObjectTable;
            Operation   operation = Operation.Insert(table, appKey, appKey, appLookupEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #26
0
        /// <summary>
        /// Insert developer app
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="developerId">Developer id</param>
        /// <param name="appHandle">App handle</param>
        /// <returns>Insert developer app task</returns>
        public async Task InsertDeveloperApp(
            StorageConsistencyMode storageConsistencyMode,
            string developerId,
            string appHandle)
        {
            AppFeedEntity appFeedEntity = new AppFeedEntity()
            {
                AppHandle = appHandle
            };

            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.DeveloperApps);

            FeedTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.DeveloperApps, TableIdentifier.DeveloperAppsFeed) as FeedTable;
            Operation operation = Operation.Insert(table, developerId, this.tableStoreManager.DefaultFeedKey, appHandle, appFeedEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #27
0
        /// <summary>
        /// Insert a new CVS transaction into the store
        /// </summary>
        /// <param name="storageConsistencyMode">consistency to use</param>
        /// <param name="moderationHandle">uniquely identifies moderation request</param>
        /// <param name="appHandle">uniquely identifies the app that the user is in</param>
        /// <param name="reportType">is the complaint against a user or content?</param>
        /// <param name="requestTime">when the request was submitted to CVS</param>
        /// <param name="requestBody">body of the request to CVS</param>
        /// <param name="jobId">job id assigned by CVS</param>
        /// <param name="callbackUrl">callback url for CVS callback</param>
        /// <returns>a task that inserts a CVS transaction into the store</returns>
        public async Task InsertTransaction(
            StorageConsistencyMode storageConsistencyMode,
            string moderationHandle,
            string appHandle,
            ReportType reportType,
            DateTime requestTime,
            string requestBody,
            string jobId,
            string callbackUrl)
        {
            // check input
            if (string.IsNullOrWhiteSpace(appHandle))
            {
                throw new ArgumentNullException("appHandle");
            }

            if (string.IsNullOrWhiteSpace(moderationHandle))
            {
                throw new ArgumentNullException("moderationHandle");
            }

            // get the table interface
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.CVS);

            ObjectTable lookupTable = this.tableStoreManager.GetTable(ContainerIdentifier.CVS, TableIdentifier.CVSLookup) as ObjectTable;

            // create the entity that will be inserted into the table
            CVSTransactionEntity cvsTransactionEntity = new CVSTransactionEntity()
            {
                ModerationHandle     = moderationHandle,
                AppHandle            = appHandle,
                ReportType           = reportType,
                RequestTime          = requestTime,
                RequestBody          = requestBody,
                JobId                = jobId,
                CallbackUrl          = callbackUrl,
                CallbackTime         = TimeUtils.BeginningOfUnixTime,
                CallbackResponseBody = string.Empty
            };

            var operation = Operation.Insert(lookupTable, moderationHandle, moderationHandle, cvsTransactionEntity);

            // execute the insert
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #28
0
        /// <summary>
        /// Insert topic
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="topicHandle">Topic handle</param>
        /// <param name="title">Topic title</param>
        /// <param name="text">Topic text</param>
        /// <param name="blobType">Blob type</param>
        /// <param name="blobHandle">Blob handle</param>
        /// <param name="categories">Topic categories</param>
        /// <param name="language">Topic language</param>
        /// <param name="group">Topic group</param>
        /// <param name="deepLink">Topic deep link</param>
        /// <param name="friendlyName">Topic friendly name</param>
        /// <param name="publisherType">Publisher type</param>
        /// <param name="userHandle">User handle</param>
        /// <param name="createdTime">Created time</param>
        /// <param name="reviewStatus">Review status</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="requestId">Request id associated with the create topic request</param>
        /// <returns>Insert topic task</returns>
        public async Task InsertTopic(
            StorageConsistencyMode storageConsistencyMode,
            string topicHandle,
            string title,
            string text,
            BlobType blobType,
            string blobHandle,
            string categories,
            string language,
            string group,
            string deepLink,
            string friendlyName,
            PublisherType publisherType,
            string userHandle,
            DateTime createdTime,
            ReviewStatus reviewStatus,
            string appHandle,
            string requestId)
        {
            TopicEntity topicEntity = new TopicEntity()
            {
                Title           = title,
                Text            = text,
                BlobType        = blobType,
                BlobHandle      = blobHandle,
                Categories      = categories,
                Language        = language,
                Group           = group,
                DeepLink        = deepLink,
                FriendlyName    = friendlyName,
                PublisherType   = publisherType,
                UserHandle      = userHandle,
                CreatedTime     = createdTime,
                LastUpdatedTime = createdTime,
                AppHandle       = appHandle,
                ReviewStatus    = reviewStatus,
                RequestId       = requestId
            };

            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Topics);

            ObjectTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.Topics, TableIdentifier.TopicsObject) as ObjectTable;
            Operation   operation = Operation.Insert(table, topicHandle, topicHandle, topicEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #29
0
        /// <summary>
        /// Insert app key
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="appKey">App key</param>
        /// <param name="createdTime">Created time</param>
        /// <returns>Insert app key task</returns>
        public async Task InsertAppKey(
            StorageConsistencyMode storageConsistencyMode,
            string appHandle,
            string appKey,
            DateTime createdTime)
        {
            AppKeyFeedEntity appKeyFeedEntity = new AppKeyFeedEntity()
            {
                AppKey      = appKey,
                CreatedTime = createdTime
            };

            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Apps);

            FeedTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.Apps, TableIdentifier.AppKeysFeed) as FeedTable;
            Operation operation = Operation.Insert(table, appHandle, this.tableStoreManager.DefaultFeedKey, appKey, appKeyFeedEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }
コード例 #30
0
        /// <summary>
        /// Insert linked account
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="userHandle">User handle</param>
        /// <param name="identityProviderType">Identity provider type</param>
        /// <param name="accountId">Account id from identity provider</param>
        /// <returns>Insert linked account task</returns>
        public async Task InsertLinkedAccount(
            StorageConsistencyMode storageConsistencyMode,
            string userHandle,
            IdentityProviderType identityProviderType,
            string accountId)
        {
            LinkedAccountFeedEntity linkedAccountFeedEntity = new LinkedAccountFeedEntity()
            {
                IdentityProviderType = identityProviderType,
                AccountId            = accountId
            };

            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Users);

            FeedTable accountsTable = this.tableStoreManager.GetTable(ContainerIdentifier.Users, TableIdentifier.UserLinkedAccountsFeed) as FeedTable;
            Operation operation     = Operation.Insert(accountsTable, userHandle, this.tableStoreManager.DefaultFeedKey, identityProviderType.ToString(), linkedAccountFeedEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }