public async Task UpdateGatewayAsync(string GatewayId, [FromBody][Required] GatewayUpdateApiModel request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } await _Gateways.UpdateGatewayAsync(GatewayId, request.ToServiceModel()); }
/// <summary> /// Convert to service model /// </summary> /// <param name="model"></param> /// <returns></returns> public static GatewayUpdateModel ToServiceModel( this GatewayUpdateApiModel model) { if (model == null) { return(null); } return(new GatewayUpdateModel { SiteId = model.SiteId, }); }
/// <inheritdoc/> public async Task UpdateGatewayAsync(string gatewayId, GatewayUpdateApiModel content, CancellationToken ct) { if (content == null) { throw new ArgumentNullException(nameof(content)); } if (string.IsNullOrEmpty(gatewayId)) { throw new ArgumentNullException(nameof(gatewayId)); } var request = _httpClient.NewRequest($"{_serviceUri}/v2/gateways/{gatewayId}", _resourceId); request.SetContent(content); var response = await _httpClient.PatchAsync(request, ct).ConfigureAwait(false); response.Validate(); }