Skip to content

Commit 499ea9f

Browse files
committed
Update iotclient library dependency
1 parent f3cc402 commit 499ea9f

File tree

7 files changed

+23
-17
lines changed

7 files changed

+23
-17
lines changed

command/thing/bind.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func Bind(params *BindParams) error {
4242
return err
4343
}
4444

45-
thing := &iotclient.Thing{
45+
thing := &iotclient.ThingUpdate{
4646
DeviceId: params.DeviceID,
4747
}
4848

command/thing/clone.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ func Clone(params *CloneParams) (*ThingInfo, error) {
5757
return getThingInfo(newThing), nil
5858
}
5959

60-
func retrieve(client iot.Client, thingID string) (*iotclient.Thing, error) {
60+
func retrieve(client iot.Client, thingID string) (*iotclient.ThingCreate, error) {
6161
clone, err := client.ThingShow(thingID)
6262
if err != nil {
6363
return nil, fmt.Errorf("%s: %w", "retrieving the thing to be cloned", err)
6464
}
6565

66-
thing := &iotclient.Thing{}
66+
thing := &iotclient.ThingCreate{}
6767

6868
// Copy variables
6969
for _, p := range clone.Properties {

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/antihax/optional v1.0.0
77
github.com/arduino/arduino-cli v0.0.0-20210607095659-16f41352eac3
88
github.com/arduino/go-paths-helper v1.6.1
9-
github.com/arduino/iot-client-go v1.3.4-0.20211103115604-d4d372164262
9+
github.com/arduino/iot-client-go v1.3.4-0.20211116175324-9a98dd4ad269
1010
github.com/gofrs/uuid v4.0.0+incompatible
1111
github.com/google/go-cmp v0.5.6
1212
github.com/howeyc/crc16 v0.0.0-20171223171357-2b2a61e366a6
@@ -16,8 +16,8 @@ require (
1616
github.com/spf13/viper v1.7.0
1717
github.com/stretchr/testify v1.6.1
1818
go.bug.st/serial v1.3.0
19-
golang.org/x/net v0.0.0-20211101193420-4a448f8816b3 // indirect
20-
golang.org/x/oauth2 v0.0.0-20211028175245-ba495a64dcb5
19+
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
20+
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
2121
golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6 // indirect
2222
google.golang.org/appengine v1.6.7 // indirect
2323
google.golang.org/genproto v0.0.0-20210504143626-3b2ad6ccc450 // indirect

go.sum

+6
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ github.com/arduino/iot-client-go v1.3.4-0.20210930122852-04551f4cb061 h1:uQeaIHz
6464
github.com/arduino/iot-client-go v1.3.4-0.20210930122852-04551f4cb061/go.mod h1:gYvpMt7Qw+OSScTLyIlCnpbvy9y96ey/2zhB4w6FoK0=
6565
github.com/arduino/iot-client-go v1.3.4-0.20211103115604-d4d372164262 h1:qVq8cdkaRPaLc9DAjY/6rH3ocs6ZvnEJtD26f5++/RU=
6666
github.com/arduino/iot-client-go v1.3.4-0.20211103115604-d4d372164262/go.mod h1:gYvpMt7Qw+OSScTLyIlCnpbvy9y96ey/2zhB4w6FoK0=
67+
github.com/arduino/iot-client-go v1.3.4-0.20211116175324-9a98dd4ad269 h1:01RHB48b1QRN5viXtdtmSkvyudxHqczDV+OD+1PuE6M=
68+
github.com/arduino/iot-client-go v1.3.4-0.20211116175324-9a98dd4ad269/go.mod h1:gYvpMt7Qw+OSScTLyIlCnpbvy9y96ey/2zhB4w6FoK0=
6769
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
6870
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
6971
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
@@ -503,6 +505,8 @@ golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d h1:LO7XpTYMwTqxjLcGWPijK3vRX
503505
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
504506
golang.org/x/net v0.0.0-20211101193420-4a448f8816b3 h1:VrJZAjbekhoRn7n5FBujY31gboH+iB3pdLxn3gE9FjU=
505507
golang.org/x/net v0.0.0-20211101193420-4a448f8816b3/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
508+
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE=
509+
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
506510
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
507511
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
508512
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -512,6 +516,8 @@ golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f h1:Qmd2pbz05z7z6lm0DrgQVV
512516
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
513517
golang.org/x/oauth2 v0.0.0-20211028175245-ba495a64dcb5 h1:v79phzBz03tsVCUTbvTBmmC3CUXF5mKYt7DA4ZVldpM=
514518
golang.org/x/oauth2 v0.0.0-20211028175245-ba495a64dcb5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
519+
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg=
520+
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
515521
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
516522
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
517523
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

internal/iot/client.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ type Client interface {
3636
DeviceTagsCreate(id string, tags map[string]string) error
3737
DeviceTagsDelete(id string, keys []string) error
3838
CertificateCreate(id, csr string) (*iotclient.ArduinoCompressedv2, error)
39-
ThingCreate(thing *iotclient.Thing, force bool) (*iotclient.ArduinoThing, error)
40-
ThingUpdate(id string, thing *iotclient.Thing, force bool) error
39+
ThingCreate(thing *iotclient.ThingCreate, force bool) (*iotclient.ArduinoThing, error)
40+
ThingUpdate(id string, thing *iotclient.ThingUpdate, force bool) error
4141
ThingDelete(id string) error
4242
ThingShow(id string) (*iotclient.ArduinoThing, error)
4343
ThingList(ids []string, device *string, props bool, tags map[string]string) ([]iotclient.ArduinoThing, error)
@@ -185,7 +185,7 @@ func (cl *client) CertificateCreate(id, csr string) (*iotclient.ArduinoCompresse
185185
}
186186

187187
// ThingCreate adds a new thing on Arduino IoT Cloud.
188-
func (cl *client) ThingCreate(thing *iotclient.Thing, force bool) (*iotclient.ArduinoThing, error) {
188+
func (cl *client) ThingCreate(thing *iotclient.ThingCreate, force bool) (*iotclient.ArduinoThing, error) {
189189
opt := &iotclient.ThingsV2CreateOpts{Force: optional.NewBool(force)}
190190
newThing, _, err := cl.api.ThingsV2Api.ThingsV2Create(cl.ctx, *thing, opt)
191191
if err != nil {
@@ -195,7 +195,7 @@ func (cl *client) ThingCreate(thing *iotclient.Thing, force bool) (*iotclient.Ar
195195
}
196196

197197
// ThingUpdate updates a thing on Arduino IoT Cloud.
198-
func (cl *client) ThingUpdate(id string, thing *iotclient.Thing, force bool) error {
198+
func (cl *client) ThingUpdate(id string, thing *iotclient.ThingUpdate, force bool) error {
199199
opt := &iotclient.ThingsV2UpdateOpts{Force: optional.NewBool(force)}
200200
_, _, err := cl.api.ThingsV2Api.ThingsV2Update(cl.ctx, id, *thing, opt)
201201
if err != nil {

internal/iot/mocks/Client.go

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/template/load.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func loadTemplate(file string, template interface{}) error {
5757
}
5858

5959
// LoadThing loads a thing from a thing template file.
60-
func LoadThing(file string) (*iotclient.Thing, error) {
60+
func LoadThing(file string) (*iotclient.ThingCreate, error) {
6161
var template map[string]interface{}
6262
err := loadTemplate(file, &template)
6363
if err != nil {
@@ -70,7 +70,7 @@ func LoadThing(file string) (*iotclient.Thing, error) {
7070
delete(template, "variables")
7171

7272
// Convert template into thing structure exploiting json marshalling/unmarshalling
73-
thing := &iotclient.Thing{}
73+
thing := &iotclient.ThingCreate{}
7474

7575
t, err := json.Marshal(template)
7676
if err != nil {

0 commit comments

Comments
 (0)