public async Task <DeviceGroup> Create(DeviceGroup request) { try { var bodyParams = new DeviceGroup { CustomAttributes = request.CustomAttributes, Description = request.Description, Name = request.Name, }; return(await Client.CallApi <DeviceGroup>(path : "/v3/device-groups/", bodyParams : bodyParams, objectToUnpack : request, method : HttpMethods.POST)); } catch (ApiException e) { throw new CloudApiException(e.ErrorCode, e.Message, e.ErrorContent); } }
public async Task <DeviceGroup> Update(string id, DeviceGroup request) { try { var pathParams = new Dictionary <string, object> { { "device-group-id", id }, }; var bodyParams = new DeviceGroup { CustomAttributes = request.CustomAttributes, Description = request.Description, Name = request.Name, }; return(await Client.CallApi <DeviceGroup>(path : "/v3/device-groups/{device-group-id}/", pathParams : pathParams, bodyParams : bodyParams, objectToUnpack : request, method : HttpMethods.PUT)); } catch (ApiException e) { throw new CloudApiException(e.ErrorCode, e.Message, e.ErrorContent); } }
public async Task AddDevice(string id, DeviceGroup request, string deviceId = null) { try { var pathParams = new Dictionary <string, object> { { "device-group-id", id }, }; var externalBodyParams = new { deviceId = deviceId, }; await Client.CallApi <DeviceGroup>(path : "/v3/device-groups/{device-group-id}/devices/add/", pathParams : pathParams, externalBodyParams : externalBodyParams, objectToUnpack : request, method : HttpMethods.POST); } catch (ApiException e) { throw new CloudApiException(e.ErrorCode, e.Message, e.ErrorContent); } }