/// <inheritdoc/> public async Task <WriteResultModel> NodeWriteAsync( EndpointApiModel endpoint, WriteRequestModel request) { var result = await _client.NodeWriteAsync(endpoint, request.Map <WriteRequestApiModel>()); return(result.Map <WriteResultModel>()); }
/// <inheritdoc/> public async Task <WriteResultModel> NodeWriteAsync( string endpoint, WriteRequestModel request) { var result = await _client.NodeWriteAsync(endpoint, Map <WriteRequestApiModel>(request)); return(Map <WriteResultModel>(result)); }
/// <inheritdoc/> public async Task <WriteResultModel> NodeWriteAsync( string endpoint, WriteRequestModel request) { var result = await _client.NodeWriteAsync(endpoint, request.ToApiModel()); return(result.ToServiceModel()); }
/// <summary> /// Create from service model /// </summary> /// <param name="model"></param> public WriteRequestApiModel(WriteRequestModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } Attributes = model.Attributes? .Select(a => a == null ? null : new AttributeWriteRequestApiModel(a)) .ToList(); Header = model.Header == null ? null : new RequestHeaderApiModel(model.Header); }
/// <summary> /// Create from service model /// </summary> /// <param name="model"></param> public static WriteRequestApiModel ToApiModel( this WriteRequestModel model) { if (model == null) { return(null); } return(new WriteRequestApiModel { Attributes = model.Attributes? .Select(a => a.ToApiModel()) .ToList(), Header = model.Header.ToApiModel() }); }
/// <inheritdoc/> public async Task <WriteResultModel> NodeWriteAsync( string endpointId, WriteRequestModel request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } if (request.Attributes == null || request.Attributes.Count == 0) { throw new ArgumentNullException(nameof(request.Attributes)); } if (request.Attributes.Any(r => string.IsNullOrEmpty(r.NodeId))) { throw new ArgumentException(nameof(request.Attributes)); } return(await CallServiceOnTwin <WriteRequestModel, WriteResultModel>( "NodeWrite_V2", endpointId, request)); }
/// <inheritdoc/> public async Task <WriteResultModel> NodeWriteAsync( EndpointRegistrationModel registration, WriteRequestModel request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } if (request.Attributes == null || request.Attributes.Count == 0) { throw new ArgumentNullException(nameof(request.Attributes)); } if (request.Attributes.Any(r => string.IsNullOrEmpty(r.NodeId))) { throw new ArgumentException(nameof(request.Attributes)); } var result = await CallServiceOnSupervisorAsync <WriteRequestModel, WriteResultModel>( "NodeWrite_V2", registration, request); return(result); }
/// <inheritdoc/> public Task <WriteResultModel> NodeWriteAsync( string endpointId, WriteRequestModel request) { return(_nodes.NodeWriteAsync(Endpoint, request)); }