コード例 #1
0
        public async Task AddUserRegistrationOrganizationAsync(IEnumerable <string> deviceIds, string organizationId)
        {
            if (!deviceIds.Any())
            {
                return;
            }

            var tokenStateResponse = await HandleTokenStateAsync();

            if (!tokenStateResponse)
            {
                return;
            }

            var requestModel = new PushUpdateRequestModel(deviceIds, organizationId);
            var message      = new TokenHttpRequestMessage(requestModel, AccessToken)
            {
                Method     = HttpMethod.Put,
                RequestUri = new Uri(string.Concat(PushClient.BaseAddress, "/push/add-organization"))
            };

            try
            {
                await PushClient.SendAsync(message);
            }
            catch (Exception e)
            {
                _logger.LogError(12337, e, "Unable to add user org push registration.");
            }
        }
コード例 #2
0
        public async Task DeleteUserRegistrationOrganizationAsync(IEnumerable <string> deviceIds, string organizationId)
        {
            if (!deviceIds.Any())
            {
                return;
            }

            var requestModel = new PushUpdateRequestModel(deviceIds, organizationId);

            await SendAsync(HttpMethod.Put, "push/delete-organization", requestModel);
        }
コード例 #3
0
 public async Task PutDeleteOrganization([FromBody] PushUpdateRequestModel model)
 {
     CheckUsage();
     await _pushRegistrationService.DeleteUserRegistrationOrganizationAsync(
         model.DeviceIds.Select(d => Prefix(d)), Prefix(model.OrganizationId));
 }