public async Task <bool> SendDoorCommand(int channelIndex, string deviceId, DoorCommandType doorCommand, CancellationToken cancellationToken = default) { var requestObject = new SendDoorCommandRequestObject(channelIndex, deviceId, doorCommand); var stringContent = GetStringContent(requestObject); var httpResponseMessage = await HttpClient.PostAsync("hmip/device/control/sendDoorCommand", stringContent, cancellationToken); if (httpResponseMessage.IsSuccessStatusCode) { return(true); } throw new ArgumentException($"Request failed: {httpResponseMessage.ReasonPhrase}"); }
public SendDoorCommandRequestObject(int channelIndex, string deviceId, DoorCommandType doorCommand) { ChannelIndex = channelIndex; DeviceId = deviceId; DoorCommand = doorCommand; }