@@ -38,7 +38,7 @@ type Client interface {
38
38
ThingUpdate (id string , thing * iotclient.Thing , force bool ) error
39
39
ThingDelete (id string ) error
40
40
ThingShow (id string ) (* iotclient.ArduinoThing , error )
41
- ThingList (ids []string , device * string , props bool ) ([]iotclient.ArduinoThing , error )
41
+ ThingList (ids []string , device * string , props bool , tags map [ string ] string ) ([]iotclient.ArduinoThing , error )
42
42
DashboardCreate (dashboard * iotclient.Dashboardv2 ) (* iotclient.ArduinoDashboardv2 , error )
43
43
DashboardShow (id string ) (* iotclient.ArduinoDashboardv2 , error )
44
44
DashboardDelete (id string ) error
@@ -186,7 +186,7 @@ func (cl *client) ThingShow(id string) (*iotclient.ArduinoThing, error) {
186
186
}
187
187
188
188
// ThingList returns a list of things on Arduino IoT Cloud.
189
- func (cl * client ) ThingList (ids []string , device * string , props bool ) ([]iotclient.ArduinoThing , error ) {
189
+ func (cl * client ) ThingList (ids []string , device * string , props bool , tags map [ string ] string ) ([]iotclient.ArduinoThing , error ) {
190
190
opts := & iotclient.ThingsV2ListOpts {}
191
191
opts .ShowProperties = optional .NewBool (props )
192
192
@@ -198,6 +198,15 @@ func (cl *client) ThingList(ids []string, device *string, props bool) ([]iotclie
198
198
opts .DeviceId = optional .NewString (* device )
199
199
}
200
200
201
+ if tags != nil {
202
+ t := make ([]string , 0 , len (tags ))
203
+ for key , val := range tags {
204
+ // Use the 'key:value' format required from the backend
205
+ t = append (t , key + ":" + val )
206
+ }
207
+ opts .Tags = optional .NewInterface (t )
208
+ }
209
+
201
210
things , _ , err := cl .api .ThingsV2Api .ThingsV2List (cl .ctx , opts )
202
211
if err != nil {
203
212
err = fmt .Errorf ("retrieving things, %w" , errorDetail (err ))
0 commit comments