public async Task <IActionResult> Device([FromBody] DeviceSyncRequest request) { string userId = User.GetId(); await throtteledPushService.PushThrotteled(userId, request); return(StatusCode(201)); }
public async Task Device(DeviceSyncRequest deviceSyncRequest) { var client = await clientFactory(); var json = JsonConvert.SerializeObject(deviceSyncRequest); var res = await client.PostAsync($"api/{userId}/digit-sync/device", new StringContent(json, Encoding.UTF8, "application/json")); if (!res.IsSuccessStatusCode) { throw new DigitPushServiceException($"Push creation request resulted in {res.StatusCode}."); } }
public async Task <IActionResult> RequestSync(string id, [FromBody] DeviceSyncRequest deviceSyncRequest) { if (!ModelState.IsValid) { return(BadRequest()); } try { await _deviceSyncService.RequestSynchronizationAsync(User.GetId(), id, deviceSyncRequest); return(Ok()); } catch (DeviceClaimedException ex) { return(Forbid()); } }