Skip to content

Commit 871e39a

Browse files
committed
Update iot-client-go dependency
1 parent 9171cda commit 871e39a

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/arduino/go-paths-helper v1.6.1
1212
github.com/arduino/go-properties-orderedmap v1.7.0 // indirect
1313
github.com/arduino/go-win32-utils v0.0.0-20180330194947-ed041402e83b
14-
github.com/arduino/iot-client-go v1.4.0
14+
github.com/arduino/iot-client-go v1.4.2
1515
github.com/daaku/go.zipexe v1.0.1 // indirect
1616
github.com/gofrs/uuid v4.2.0+incompatible
1717
github.com/google/go-cmp v0.5.6

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ github.com/arduino/go-win32-utils v0.0.0-20180330194947-ed041402e83b h1:3PjgYG5g
8989
github.com/arduino/go-win32-utils v0.0.0-20180330194947-ed041402e83b/go.mod h1:iIPnclBMYm1g32Q5kXoqng4jLhMStReIP7ZxaoUC2y8=
9090
github.com/arduino/iot-client-go v1.4.0 h1:pWaWgfrh77JkrdqOORYG6kwAeOg96CngACnrn9diZWI=
9191
github.com/arduino/iot-client-go v1.4.0/go.mod h1:gYvpMt7Qw+OSScTLyIlCnpbvy9y96ey/2zhB4w6FoK0=
92+
github.com/arduino/iot-client-go v1.4.2 h1:uZC8A26ytxSkuxNBFL2b/4w0TYjsR3ny2BbB5aVe4kw=
93+
github.com/arduino/iot-client-go v1.4.2/go.mod h1:gYvpMt7Qw+OSScTLyIlCnpbvy9y96ey/2zhB4w6FoK0=
9294
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
9395
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
9496
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=

internal/iot/client.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (cl *Client) DeviceCreate(fqbn, name, serial, dType string) (*iotclient.Ard
5454
Serial: serial,
5555
Type: dType,
5656
}
57-
dev, _, err := cl.api.DevicesV2Api.DevicesV2Create(cl.ctx, payload)
57+
dev, _, err := cl.api.DevicesV2Api.DevicesV2Create(cl.ctx, payload, nil)
5858
if err != nil {
5959
err = fmt.Errorf("creating device, %w", errorDetail(err))
6060
return nil, err
@@ -105,7 +105,7 @@ func (cl *Client) DevicePassSet(id string) (*iotclient.ArduinoDevicev2Pass, erro
105105
// DeviceDelete deletes the device corresponding to the passed ID
106106
// from Arduino IoT Cloud.
107107
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)
109109
if err != nil {
110110
err = fmt.Errorf("deleting device: %w", errorDetail(err))
111111
return err
@@ -137,7 +137,7 @@ func (cl *Client) DeviceList(tags map[string]string) ([]iotclient.ArduinoDevicev
137137
// DeviceShow allows to retrieve a specific device, given its id,
138138
// from Arduino IoT Cloud.
139139
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)
141141
if err != nil {
142142
err = fmt.Errorf("retrieving device, %w", errorDetail(err))
143143
return nil, err
@@ -150,6 +150,7 @@ func (cl *Client) DeviceShow(id string) (*iotclient.ArduinoDevicev2, error) {
150150
func (cl *Client) DeviceOTA(id string, file *os.File, expireMins int) error {
151151
opt := &iotclient.DevicesV2OtaUploadOpts{
152152
ExpireInMins: optional.NewInt32(int32(expireMins)),
153+
Async: optional.NewBool(true),
153154
}
154155
_, err := cl.api.DevicesV2OtaApi.DevicesV2OtaUpload(cl.ctx, id, file, opt)
155156
if err != nil {
@@ -313,7 +314,7 @@ func (cl *Client) ThingTagsDelete(id string, keys []string) error {
313314

314315
// DashboardCreate adds a new dashboard on Arduino IoT Cloud.
315316
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)
317318
if err != nil {
318319
return nil, fmt.Errorf("%s: %w", "adding new dashboard", errorDetail(err))
319320
}
@@ -323,7 +324,7 @@ func (cl *Client) DashboardCreate(dashboard *iotclient.Dashboardv2) (*iotclient.
323324
// DashboardShow allows to retrieve a specific dashboard, given its id,
324325
// from Arduino IoT Cloud.
325326
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)
327328
if err != nil {
328329
err = fmt.Errorf("retrieving dashboard, %w", errorDetail(err))
329330
return nil, err
@@ -343,7 +344,7 @@ func (cl *Client) DashboardList() ([]iotclient.ArduinoDashboardv2, error) {
343344

344345
// DashboardDelete deletes a dashboard from Arduino IoT Cloud.
345346
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)
347348
if err != nil {
348349
err = fmt.Errorf("deleting dashboard: %w", errorDetail(err))
349350
return err
@@ -362,8 +363,6 @@ func (cl *Client) setup(client, secret, organization string) error {
362363
// We use the token to create a context that will be passed to any API call
363364
cl.ctx = context.WithValue(context.Background(), iotclient.ContextAccessToken, tok.AccessToken)
364365

365-
// Create an instance of the iot-api Go client, we pass an empty config
366-
// because defaults are ok
367366
config := iotclient.NewConfiguration()
368367
if organization != "" {
369368
config.DefaultHeader = map[string]string{"X-Organization": organization}

0 commit comments

Comments
 (0)