@@ -54,7 +54,7 @@ func (cl *Client) DeviceCreate(fqbn, name, serial, dType string) (*iotclient.Ard
54
54
Serial : serial ,
55
55
Type : dType ,
56
56
}
57
- dev , _ , err := cl .api .DevicesV2Api .DevicesV2Create (cl .ctx , payload )
57
+ dev , _ , err := cl .api .DevicesV2Api .DevicesV2Create (cl .ctx , payload , nil )
58
58
if err != nil {
59
59
err = fmt .Errorf ("creating device, %w" , errorDetail (err ))
60
60
return nil , err
@@ -105,7 +105,7 @@ func (cl *Client) DevicePassSet(id string) (*iotclient.ArduinoDevicev2Pass, erro
105
105
// DeviceDelete deletes the device corresponding to the passed ID
106
106
// from Arduino IoT Cloud.
107
107
func (cl * Client ) DeviceDelete (id string ) error {
108
- _ , err := cl .api .DevicesV2Api .DevicesV2Delete (cl .ctx , id )
108
+ _ , err := cl .api .DevicesV2Api .DevicesV2Delete (cl .ctx , id , nil )
109
109
if err != nil {
110
110
err = fmt .Errorf ("deleting device: %w" , errorDetail (err ))
111
111
return err
@@ -137,7 +137,7 @@ func (cl *Client) DeviceList(tags map[string]string) ([]iotclient.ArduinoDevicev
137
137
// DeviceShow allows to retrieve a specific device, given its id,
138
138
// from Arduino IoT Cloud.
139
139
func (cl * Client ) DeviceShow (id string ) (* iotclient.ArduinoDevicev2 , error ) {
140
- dev , _ , err := cl .api .DevicesV2Api .DevicesV2Show (cl .ctx , id )
140
+ dev , _ , err := cl .api .DevicesV2Api .DevicesV2Show (cl .ctx , id , nil )
141
141
if err != nil {
142
142
err = fmt .Errorf ("retrieving device, %w" , errorDetail (err ))
143
143
return nil , err
@@ -150,6 +150,7 @@ func (cl *Client) DeviceShow(id string) (*iotclient.ArduinoDevicev2, error) {
150
150
func (cl * Client ) DeviceOTA (id string , file * os.File , expireMins int ) error {
151
151
opt := & iotclient.DevicesV2OtaUploadOpts {
152
152
ExpireInMins : optional .NewInt32 (int32 (expireMins )),
153
+ Async : optional .NewBool (true ),
153
154
}
154
155
_ , err := cl .api .DevicesV2OtaApi .DevicesV2OtaUpload (cl .ctx , id , file , opt )
155
156
if err != nil {
@@ -313,7 +314,7 @@ func (cl *Client) ThingTagsDelete(id string, keys []string) error {
313
314
314
315
// DashboardCreate adds a new dashboard on Arduino IoT Cloud.
315
316
func (cl * Client ) DashboardCreate (dashboard * iotclient.Dashboardv2 ) (* iotclient.ArduinoDashboardv2 , error ) {
316
- newDashboard , _ , err := cl .api .DashboardsV2Api .DashboardsV2Create (cl .ctx , * dashboard )
317
+ newDashboard , _ , err := cl .api .DashboardsV2Api .DashboardsV2Create (cl .ctx , * dashboard , nil )
317
318
if err != nil {
318
319
return nil , fmt .Errorf ("%s: %w" , "adding new dashboard" , errorDetail (err ))
319
320
}
@@ -323,7 +324,7 @@ func (cl *Client) DashboardCreate(dashboard *iotclient.Dashboardv2) (*iotclient.
323
324
// DashboardShow allows to retrieve a specific dashboard, given its id,
324
325
// from Arduino IoT Cloud.
325
326
func (cl * Client ) DashboardShow (id string ) (* iotclient.ArduinoDashboardv2 , error ) {
326
- dashboard , _ , err := cl .api .DashboardsV2Api .DashboardsV2Show (cl .ctx , id )
327
+ dashboard , _ , err := cl .api .DashboardsV2Api .DashboardsV2Show (cl .ctx , id , nil )
327
328
if err != nil {
328
329
err = fmt .Errorf ("retrieving dashboard, %w" , errorDetail (err ))
329
330
return nil , err
@@ -343,7 +344,7 @@ func (cl *Client) DashboardList() ([]iotclient.ArduinoDashboardv2, error) {
343
344
344
345
// DashboardDelete deletes a dashboard from Arduino IoT Cloud.
345
346
func (cl * Client ) DashboardDelete (id string ) error {
346
- _ , err := cl .api .DashboardsV2Api .DashboardsV2Delete (cl .ctx , id )
347
+ _ , err := cl .api .DashboardsV2Api .DashboardsV2Delete (cl .ctx , id , nil )
347
348
if err != nil {
348
349
err = fmt .Errorf ("deleting dashboard: %w" , errorDetail (err ))
349
350
return err
@@ -362,8 +363,6 @@ func (cl *Client) setup(client, secret, organization string) error {
362
363
// We use the token to create a context that will be passed to any API call
363
364
cl .ctx = context .WithValue (context .Background (), iotclient .ContextAccessToken , tok .AccessToken )
364
365
365
- // Create an instance of the iot-api Go client, we pass an empty config
366
- // because defaults are ok
367
366
config := iotclient .NewConfiguration ()
368
367
if organization != "" {
369
368
config .DefaultHeader = map [string ]string {"X-Organization" : organization }
0 commit comments