コード例 #1
0
 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);
     }
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 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);
     }
 }