/// <summary> /// Gets the device from the Cognito service using the device key and user's access /// token using an asynchronous call /// </summary> public async Task GetDeviceAsync() { GetDeviceRequest getDeviceRequest = CreateGetDeviceRequest(); GetDeviceResponse getDeviceResponse = await User.Provider.GetDeviceAsync(getDeviceRequest).ConfigureAwait(false); UpdateThisDevice(getDeviceResponse.Device); }
private void GetDevices(Connection connection, int requestNumber) { GetDeviceResponse response = new GetDeviceResponse(requestNumber) { Error = null, Result = deviceCache.GetDevices() }; connection.Send(PrepareJson(response)); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { GetDeviceResponse response = new GetDeviceResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("deviceArn", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.DeviceArn = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("deviceCapabilities", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.DeviceCapabilities = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("deviceName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.DeviceName = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("deviceStatus", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.DeviceStatus = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("deviceType", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.DeviceType = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("providerName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.ProviderName = unmarshaller.Unmarshall(context); continue; } } return(response); }
public IActionResult Get(int id) { GetDeviceResponse response = new GetDeviceResponse(); Device device = GetDevice(id); if (device == null) { return(NotFound(device)); } response.Device = mapper.Map <GetDeviceResponse.DeviceItem>(device); return(Ok(response)); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { GetDeviceResponse response = new GetDeviceResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Device", targetDepth)) { var unmarshaller = DeviceUnmarshaller.Instance; response.Device = unmarshaller.Unmarshall(context); continue; } } return(response); }