public async Task CreateOrUpdateRegistrationAsync(string pushToken, string deviceId, string userId, string identifier, DeviceType type) { var tokenStateResponse = await HandleTokenStateAsync(); if (!tokenStateResponse) { return; } var requestModel = new PushRegistrationRequestModel { DeviceId = deviceId, Identifier = identifier, PushToken = pushToken, Type = type, UserId = userId }; var message = new TokenHttpRequestMessage(requestModel, AccessToken) { Method = HttpMethod.Post, RequestUri = new Uri(string.Concat(PushClient.BaseAddress, "/push/register")) }; try { await PushClient.SendAsync(message); } catch (Exception e) { _logger.LogError(12335, e, "Unable to create push registration."); } }
public async Task CreateOrUpdateRegistrationAsync(string pushToken, string deviceId, string userId, string identifier, DeviceType type) { var requestModel = new PushRegistrationRequestModel { DeviceId = deviceId, Identifier = identifier, PushToken = pushToken, Type = type, UserId = userId }; await SendAsync(HttpMethod.Post, "push/register", requestModel); }
public async Task PostRegister([FromBody] PushRegistrationRequestModel model) { CheckUsage(); await _pushRegistrationService.CreateOrUpdateRegistrationAsync(model.PushToken, Prefix(model.DeviceId), Prefix(model.UserId), Prefix(model.Identifier), model.Type); }