@scaleway/sdk-iot 2.2.1 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,599 +1,433 @@
1
- import { API as API$1, toApiLocality, urlParams, validatePathParam, enrichForPagination, waitForResource } from "@scaleway/sdk-client";
2
1
  import { HUB_TRANSIENT_STATUSES } from "./content.gen.js";
3
- import { unmarshalListHubsResponse, marshalCreateHubRequest, unmarshalHub, marshalUpdateHubRequest, unmarshalGetHubMetricsResponse, marshalSetHubCARequest, unmarshalGetHubCAResponse, unmarshalListDevicesResponse, marshalCreateDeviceRequest, unmarshalCreateDeviceResponse, unmarshalDevice, marshalUpdateDeviceRequest, unmarshalRenewDeviceCertificateResponse, marshalSetDeviceCertificateRequest, unmarshalSetDeviceCertificateResponse, unmarshalGetDeviceCertificateResponse, unmarshalGetDeviceMetricsResponse, unmarshalListRoutesResponse, marshalCreateRouteRequest, unmarshalRoute, marshalUpdateRouteRequest, unmarshalListNetworksResponse, marshalCreateNetworkRequest, unmarshalCreateNetworkResponse, unmarshalNetwork, unmarshalTwinDocument, marshalPutTwinDocumentRequest, marshalPatchTwinDocumentRequest, unmarshalListTwinDocumentsResponse } from "./marshalling.gen.js";
4
- const jsonContentHeaders = {
5
- "Content-Type": "application/json; charset=utf-8"
6
- };
7
- class API extends API$1 {
8
- /**
9
- * Locality of this API.
10
- * type ∈ {'zone','region','global','unspecified'}
11
- */
12
- static LOCALITY = toApiLocality({
13
- regions: [
14
- "fr-par"
15
- ]
16
- });
17
- pageOfListHubs = (request = {}) => this.client.fetch(
18
- {
19
- method: "GET",
20
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs`,
21
- urlParams: urlParams(
22
- ["name", request.name],
23
- ["order_by", request.orderBy],
24
- ["organization_id", request.organizationId],
25
- ["page", request.page],
26
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
27
- ["project_id", request.projectId]
28
- )
29
- },
30
- unmarshalListHubsResponse
31
- );
32
- /**
33
- * List hubs. List all Hubs in the specified zone. By default, returned Hubs are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
34
- *
35
- * @param request - The request {@link ListHubsRequest}
36
- * @returns A Promise of ListHubsResponse
37
- */
38
- listHubs = (request = {}) => enrichForPagination("hubs", this.pageOfListHubs, request);
39
- /**
40
- * Create a hub. Create a new Hub in the targeted region, specifying its configuration including name and product plan.
41
- *
42
- * @param request - The request {@link CreateHubRequest}
43
- * @returns A Promise of Hub
44
- */
45
- createHub = (request) => this.client.fetch(
46
- {
47
- body: JSON.stringify(
48
- marshalCreateHubRequest(request, this.client.settings)
49
- ),
50
- headers: jsonContentHeaders,
51
- method: "POST",
52
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs`
53
- },
54
- unmarshalHub
55
- );
56
- /**
57
- * Get a hub. Retrieve information about an existing IoT Hub, specified by its Hub ID. Its full details, including name, status and endpoint, are returned in the response object.
58
- *
59
- * @param request - The request {@link GetHubRequest}
60
- * @returns A Promise of Hub
61
- */
62
- getHub = (request) => this.client.fetch(
63
- {
64
- method: "GET",
65
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}`
66
- },
67
- unmarshalHub
68
- );
69
- /**
70
- * Waits for {@link Hub} to be in a final state.
71
- *
72
- * @param request - The request {@link GetHubRequest}
73
- * @param options - The waiting options
74
- * @returns A Promise of Hub
75
- */
76
- waitForHub = (request, options) => waitForResource(
77
- options?.stop ?? ((res) => Promise.resolve(!HUB_TRANSIENT_STATUSES.includes(res.status))),
78
- this.getHub,
79
- request,
80
- options
81
- );
82
- /**
83
- * Update a hub. Update the parameters of an existing IoT Hub, specified by its Hub ID.
84
- *
85
- * @param request - The request {@link UpdateHubRequest}
86
- * @returns A Promise of Hub
87
- */
88
- updateHub = (request) => this.client.fetch(
89
- {
90
- body: JSON.stringify(
91
- marshalUpdateHubRequest(request, this.client.settings)
92
- ),
93
- headers: jsonContentHeaders,
94
- method: "PATCH",
95
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}`
96
- },
97
- unmarshalHub
98
- );
99
- /**
100
- * Enable a hub. Enable an existing IoT Hub, specified by its Hub ID.
101
- *
102
- * @param request - The request {@link EnableHubRequest}
103
- * @returns A Promise of Hub
104
- */
105
- enableHub = (request) => this.client.fetch(
106
- {
107
- body: "{}",
108
- headers: jsonContentHeaders,
109
- method: "POST",
110
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}/enable`
111
- },
112
- unmarshalHub
113
- );
114
- /**
115
- * Disable a hub. Disable an existing IoT Hub, specified by its Hub ID.
116
- *
117
- * @param request - The request {@link DisableHubRequest}
118
- * @returns A Promise of Hub
119
- */
120
- disableHub = (request) => this.client.fetch(
121
- {
122
- body: "{}",
123
- headers: jsonContentHeaders,
124
- method: "POST",
125
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}/disable`
126
- },
127
- unmarshalHub
128
- );
129
- /**
130
- * Delete a hub. Delete an existing IoT Hub, specified by its Hub ID. Deleting a Hub is permanent, and cannot be undone.
131
- *
132
- * @param request - The request {@link DeleteHubRequest}
133
- */
134
- deleteHub = (request) => this.client.fetch(
135
- {
136
- method: "DELETE",
137
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}`,
138
- urlParams: urlParams(
139
- ["delete_devices", request.deleteDevices]
140
- )
141
- }
142
- );
143
- /**
144
- * Get a hub's metrics. Get the metrics of an existing IoT Hub, specified by its Hub ID.
145
- *
146
- * @deprecated
147
- * @param request - The request {@link GetHubMetricsRequest}
148
- * @returns A Promise of GetHubMetricsResponse
149
- */
150
- getHubMetrics = (request) => this.client.fetch(
151
- {
152
- method: "GET",
153
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}/metrics`,
154
- urlParams: urlParams(
155
- ["start_date", request.startDate]
156
- )
157
- },
158
- unmarshalGetHubMetricsResponse
159
- );
160
- /**
161
- * Set the certificate authority of a hub. Set a particular PEM-encoded certificate, specified by the Hub ID.
162
- *
163
- * @param request - The request {@link SetHubCARequest}
164
- * @returns A Promise of Hub
165
- */
166
- setHubCA = (request) => this.client.fetch(
167
- {
168
- body: JSON.stringify(
169
- marshalSetHubCARequest(request, this.client.settings)
170
- ),
171
- headers: jsonContentHeaders,
172
- method: "POST",
173
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}/ca`
174
- },
175
- unmarshalHub
176
- );
177
- /**
178
- * Get the certificate authority of a hub. Get information for a particular PEM-encoded certificate, specified by the Hub ID.
179
- *
180
- * @param request - The request {@link GetHubCARequest}
181
- * @returns A Promise of GetHubCAResponse
182
- */
183
- getHubCA = (request) => this.client.fetch(
184
- {
185
- method: "GET",
186
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}/ca`
187
- },
188
- unmarshalGetHubCAResponse
189
- );
190
- pageOfListDevices = (request = {}) => this.client.fetch(
191
- {
192
- method: "GET",
193
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices`,
194
- urlParams: urlParams(
195
- ["allow_insecure", request.allowInsecure],
196
- ["hub_id", request.hubId],
197
- ["name", request.name],
198
- ["order_by", request.orderBy],
199
- ["page", request.page],
200
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
201
- ["status", request.status]
202
- )
203
- },
204
- unmarshalListDevicesResponse
205
- );
206
- /**
207
- * List devices. List all devices in the specified region. By default, returned devices are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
208
- *
209
- * @param request - The request {@link ListDevicesRequest}
210
- * @returns A Promise of ListDevicesResponse
211
- */
212
- listDevices = (request = {}) => enrichForPagination("devices", this.pageOfListDevices, request);
213
- /**
214
- * Add a device. Attach a device to a given Hub.
215
- *
216
- * @param request - The request {@link CreateDeviceRequest}
217
- * @returns A Promise of CreateDeviceResponse
218
- */
219
- createDevice = (request) => this.client.fetch(
220
- {
221
- body: JSON.stringify(
222
- marshalCreateDeviceRequest(request, this.client.settings)
223
- ),
224
- headers: jsonContentHeaders,
225
- method: "POST",
226
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices`
227
- },
228
- unmarshalCreateDeviceResponse
229
- );
230
- /**
231
- * Get a device. Retrieve information about an existing device, specified by its device ID. Its full details, including name, status and ID, are returned in the response object.
232
- *
233
- * @param request - The request {@link GetDeviceRequest}
234
- * @returns A Promise of Device
235
- */
236
- getDevice = (request) => this.client.fetch(
237
- {
238
- method: "GET",
239
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}`
240
- },
241
- unmarshalDevice
242
- );
243
- /**
244
- * Update a device. Update the parameters of an existing device, specified by its device ID.
245
- *
246
- * @param request - The request {@link UpdateDeviceRequest}
247
- * @returns A Promise of Device
248
- */
249
- updateDevice = (request) => this.client.fetch(
250
- {
251
- body: JSON.stringify(
252
- marshalUpdateDeviceRequest(request, this.client.settings)
253
- ),
254
- headers: jsonContentHeaders,
255
- method: "PATCH",
256
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}`
257
- },
258
- unmarshalDevice
259
- );
260
- /**
261
- * Enable a device. Enable a specific device, specified by its device ID.
262
- *
263
- * @param request - The request {@link EnableDeviceRequest}
264
- * @returns A Promise of Device
265
- */
266
- enableDevice = (request) => this.client.fetch(
267
- {
268
- body: "{}",
269
- headers: jsonContentHeaders,
270
- method: "POST",
271
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}/enable`
272
- },
273
- unmarshalDevice
274
- );
275
- /**
276
- * Disable a device. Disable an existing device, specified by its device ID.
277
- *
278
- * @param request - The request {@link DisableDeviceRequest}
279
- * @returns A Promise of Device
280
- */
281
- disableDevice = (request) => this.client.fetch(
282
- {
283
- body: "{}",
284
- headers: jsonContentHeaders,
285
- method: "POST",
286
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}/disable`
287
- },
288
- unmarshalDevice
289
- );
290
- /**
291
- * Renew a device certificate. Renew the certificate of an existing device, specified by its device ID.
292
- *
293
- * @param request - The request {@link RenewDeviceCertificateRequest}
294
- * @returns A Promise of RenewDeviceCertificateResponse
295
- */
296
- renewDeviceCertificate = (request) => this.client.fetch(
297
- {
298
- body: "{}",
299
- headers: jsonContentHeaders,
300
- method: "POST",
301
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}/renew-certificate`
302
- },
303
- unmarshalRenewDeviceCertificateResponse
304
- );
305
- /**
306
- * Set a custom certificate on a device. Switch the existing certificate of a given device with an EM-encoded custom certificate.
307
- *
308
- * @param request - The request {@link SetDeviceCertificateRequest}
309
- * @returns A Promise of SetDeviceCertificateResponse
310
- */
311
- setDeviceCertificate = (request) => this.client.fetch(
312
- {
313
- body: JSON.stringify(
314
- marshalSetDeviceCertificateRequest(request, this.client.settings)
315
- ),
316
- headers: jsonContentHeaders,
317
- method: "PUT",
318
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}/certificate`
319
- },
320
- unmarshalSetDeviceCertificateResponse
321
- );
322
- /**
323
- * Get a device's certificate. Get information for a particular PEM-encoded certificate, specified by the device ID. The response returns full details of the device, including its type of certificate.
324
- *
325
- * @param request - The request {@link GetDeviceCertificateRequest}
326
- * @returns A Promise of GetDeviceCertificateResponse
327
- */
328
- getDeviceCertificate = (request) => this.client.fetch(
329
- {
330
- method: "GET",
331
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}/certificate`
332
- },
333
- unmarshalGetDeviceCertificateResponse
334
- );
335
- /**
336
- * Remove a device. Remove a specific device from the specific Hub it is attached to.
337
- *
338
- * @param request - The request {@link DeleteDeviceRequest}
339
- */
340
- deleteDevice = (request) => this.client.fetch(
341
- {
342
- method: "DELETE",
343
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}`
344
- }
345
- );
346
- /**
347
- * Get a device's metrics. Get the metrics of an existing device, specified by its device ID.
348
- *
349
- * @deprecated
350
- * @param request - The request {@link GetDeviceMetricsRequest}
351
- * @returns A Promise of GetDeviceMetricsResponse
352
- */
353
- getDeviceMetrics = (request) => this.client.fetch(
354
- {
355
- method: "GET",
356
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}/metrics`,
357
- urlParams: urlParams(
358
- ["start_date", request.startDate]
359
- )
360
- },
361
- unmarshalGetDeviceMetricsResponse
362
- );
363
- pageOfListRoutes = (request = {}) => this.client.fetch(
364
- {
365
- method: "GET",
366
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes`,
367
- urlParams: urlParams(
368
- ["hub_id", request.hubId],
369
- ["name", request.name],
370
- ["order_by", request.orderBy],
371
- ["page", request.page],
372
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
373
- )
374
- },
375
- unmarshalListRoutesResponse
376
- );
377
- /**
378
- * List routes. List all routes in the specified region. By default, returned routes are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
379
- *
380
- * @param request - The request {@link ListRoutesRequest}
381
- * @returns A Promise of ListRoutesResponse
382
- */
383
- listRoutes = (request = {}) => enrichForPagination("routes", this.pageOfListRoutes, request);
384
- /**
385
- * Create a route. Multiple kinds of routes can be created, such as:
386
- - Database Route
387
- Create a route that will record subscribed MQTT messages into your database.
388
- <b>You need to manage the database by yourself</b>.
389
- - REST Route.
390
- Create a route that will call a REST API on received subscribed MQTT messages.
391
- - Amazon S3 Routes.
392
- Create a route that will put subscribed MQTT messages into an Object Storage bucket.
393
- You need to create the bucket yourself and grant write access.
394
- Granting can be done with s3cmd (`s3cmd setacl s3://<my-bucket> --acl-grant=write:555c69c3-87d0-4bf8-80f1-99a2f757d031:555c69c3-87d0-4bf8-80f1-99a2f757d031`).
395
- *
396
- * @param request - The request {@link CreateRouteRequest}
397
- * @returns A Promise of Route
398
- */
399
- createRoute = (request) => this.client.fetch(
400
- {
401
- body: JSON.stringify(
402
- marshalCreateRouteRequest(request, this.client.settings)
403
- ),
404
- headers: jsonContentHeaders,
405
- method: "POST",
406
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes`
407
- },
408
- unmarshalRoute
409
- );
410
- /**
411
- * Update a route. Update the parameters of an existing route, specified by its route ID.
412
- *
413
- * @param request - The request {@link UpdateRouteRequest}
414
- * @returns A Promise of Route
415
- */
416
- updateRoute = (request) => this.client.fetch(
417
- {
418
- body: JSON.stringify(
419
- marshalUpdateRouteRequest(request, this.client.settings)
420
- ),
421
- headers: jsonContentHeaders,
422
- method: "PATCH",
423
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam("routeId", request.routeId)}`
424
- },
425
- unmarshalRoute
426
- );
427
- /**
428
- * Get a route. Get information for a particular route, specified by the route ID. The response returns full details of the route, including its type, the topic it subscribes to and its configuration.
429
- *
430
- * @param request - The request {@link GetRouteRequest}
431
- * @returns A Promise of Route
432
- */
433
- getRoute = (request) => this.client.fetch(
434
- {
435
- method: "GET",
436
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam("routeId", request.routeId)}`
437
- },
438
- unmarshalRoute
439
- );
440
- /**
441
- * Delete a route. Delete an existing route, specified by its route ID. Deleting a route is permanent, and cannot be undone.
442
- *
443
- * @param request - The request {@link DeleteRouteRequest}
444
- */
445
- deleteRoute = (request) => this.client.fetch(
446
- {
447
- method: "DELETE",
448
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam("routeId", request.routeId)}`
449
- }
450
- );
451
- pageOfListNetworks = (request = {}) => this.client.fetch(
452
- {
453
- method: "GET",
454
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/networks`,
455
- urlParams: urlParams(
456
- ["hub_id", request.hubId],
457
- ["name", request.name],
458
- ["order_by", request.orderBy],
459
- ["page", request.page],
460
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
461
- ["topic_prefix", request.topicPrefix]
462
- )
463
- },
464
- unmarshalListNetworksResponse
465
- );
466
- /**
467
- * List the networks.
468
- *
469
- * @param request - The request {@link ListNetworksRequest}
470
- * @returns A Promise of ListNetworksResponse
471
- */
472
- listNetworks = (request = {}) => enrichForPagination("networks", this.pageOfListNetworks, request);
473
- /**
474
- * Create a new network. Create a new network for an existing hub. Beside the default network, you can add networks for different data providers. Possible network types are Sigfox and REST.
475
- *
476
- * @param request - The request {@link CreateNetworkRequest}
477
- * @returns A Promise of CreateNetworkResponse
478
- */
479
- createNetwork = (request) => this.client.fetch(
480
- {
481
- body: JSON.stringify(
482
- marshalCreateNetworkRequest(request, this.client.settings)
483
- ),
484
- headers: jsonContentHeaders,
485
- method: "POST",
486
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/networks`
487
- },
488
- unmarshalCreateNetworkResponse
489
- );
490
- /**
491
- * Retrieve a specific network. Retrieve an existing network, specified by its network ID. The response returns full details of the network, including its type, the topic prefix and its endpoint.
492
- *
493
- * @param request - The request {@link GetNetworkRequest}
494
- * @returns A Promise of Network
495
- */
496
- getNetwork = (request) => this.client.fetch(
497
- {
498
- method: "GET",
499
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/networks/${validatePathParam("networkId", request.networkId)}`
500
- },
501
- unmarshalNetwork
502
- );
503
- /**
504
- * Delete a Network. Delete an existing network, specified by its network ID. Deleting a network is permanent, and cannot be undone.
505
- *
506
- * @param request - The request {@link DeleteNetworkRequest}
507
- */
508
- deleteNetwork = (request) => this.client.fetch(
509
- {
510
- method: "DELETE",
511
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/networks/${validatePathParam("networkId", request.networkId)}`
512
- }
513
- );
514
- /**
515
- * BETA - Get a Cloud Twin Document.
516
- *
517
- * @param request - The request {@link GetTwinDocumentRequest}
518
- * @returns A Promise of TwinDocument
519
- */
520
- getTwinDocument = (request) => this.client.fetch(
521
- {
522
- method: "GET",
523
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}/documents/${validatePathParam("documentName", request.documentName)}`
524
- },
525
- unmarshalTwinDocument
526
- );
527
- /**
528
- * BETA - Update a Cloud Twin Document.
529
- *
530
- * @param request - The request {@link PutTwinDocumentRequest}
531
- * @returns A Promise of TwinDocument
532
- */
533
- putTwinDocument = (request) => this.client.fetch(
534
- {
535
- body: JSON.stringify(
536
- marshalPutTwinDocumentRequest(request, this.client.settings)
537
- ),
538
- headers: jsonContentHeaders,
539
- method: "PUT",
540
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}/documents/${validatePathParam("documentName", request.documentName)}`
541
- },
542
- unmarshalTwinDocument
543
- );
544
- /**
545
- * BETA - Patch a Cloud Twin Document.
546
- *
547
- * @param request - The request {@link PatchTwinDocumentRequest}
548
- * @returns A Promise of TwinDocument
549
- */
550
- patchTwinDocument = (request) => this.client.fetch(
551
- {
552
- body: JSON.stringify(
553
- marshalPatchTwinDocumentRequest(request, this.client.settings)
554
- ),
555
- headers: jsonContentHeaders,
556
- method: "PATCH",
557
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}/documents/${validatePathParam("documentName", request.documentName)}`
558
- },
559
- unmarshalTwinDocument
560
- );
561
- /**
562
- * BETA - Delete a Cloud Twin Document.
563
- *
564
- * @param request - The request {@link DeleteTwinDocumentRequest}
565
- */
566
- deleteTwinDocument = (request) => this.client.fetch(
567
- {
568
- method: "DELETE",
569
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}/documents/${validatePathParam("documentName", request.documentName)}`
570
- }
571
- );
572
- /**
573
- * BETA - List the documents of a Cloud Twin.
574
- *
575
- * @param request - The request {@link ListTwinDocumentsRequest}
576
- * @returns A Promise of ListTwinDocumentsResponse
577
- */
578
- listTwinDocuments = (request) => this.client.fetch(
579
- {
580
- method: "GET",
581
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}`
582
- },
583
- unmarshalListTwinDocumentsResponse
584
- );
585
- /**
586
- * BETA - Delete all the documents of a Cloud Twin.
587
- *
588
- * @param request - The request {@link DeleteTwinDocumentsRequest}
589
- */
590
- deleteTwinDocuments = (request) => this.client.fetch(
591
- {
592
- method: "DELETE",
593
- path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}`
594
- }
595
- );
596
- }
597
- export {
598
- API
2
+ import { marshalCreateDeviceRequest, marshalCreateHubRequest, marshalCreateNetworkRequest, marshalCreateRouteRequest, marshalPatchTwinDocumentRequest, marshalPutTwinDocumentRequest, marshalSetDeviceCertificateRequest, marshalSetHubCARequest, marshalUpdateDeviceRequest, marshalUpdateHubRequest, marshalUpdateRouteRequest, unmarshalCreateDeviceResponse, unmarshalCreateNetworkResponse, unmarshalDevice, unmarshalGetDeviceCertificateResponse, unmarshalGetDeviceMetricsResponse, unmarshalGetHubCAResponse, unmarshalGetHubMetricsResponse, unmarshalHub, unmarshalListDevicesResponse, unmarshalListHubsResponse, unmarshalListNetworksResponse, unmarshalListRoutesResponse, unmarshalListTwinDocumentsResponse, unmarshalNetwork, unmarshalRenewDeviceCertificateResponse, unmarshalRoute, unmarshalSetDeviceCertificateResponse, unmarshalTwinDocument } from "./marshalling.gen.js";
3
+ import { API, enrichForPagination, toApiLocality, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
+ var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
5
+ /**
6
+ * IoT Hub API.
7
+
8
+ This API allows you to manage your IoT hubs and devices.
9
+ */
10
+ var API$1 = class extends API {
11
+ /**
12
+ * Locality of this API.
13
+ * type ∈ {'zone','region','global','unspecified'}
14
+ */
15
+ static LOCALITY = toApiLocality({ regions: ["fr-par"] });
16
+ pageOfListHubs = (request = {}) => this.client.fetch({
17
+ method: "GET",
18
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs`,
19
+ urlParams: urlParams(["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId])
20
+ }, unmarshalListHubsResponse);
21
+ /**
22
+ * List hubs. List all Hubs in the specified zone. By default, returned Hubs are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
23
+ *
24
+ * @param request - The request {@link ListHubsRequest}
25
+ * @returns A Promise of ListHubsResponse
26
+ */
27
+ listHubs = (request = {}) => enrichForPagination("hubs", this.pageOfListHubs, request);
28
+ /**
29
+ * Create a hub. Create a new Hub in the targeted region, specifying its configuration including name and product plan.
30
+ *
31
+ * @param request - The request {@link CreateHubRequest}
32
+ * @returns A Promise of Hub
33
+ */
34
+ createHub = (request) => this.client.fetch({
35
+ body: JSON.stringify(marshalCreateHubRequest(request, this.client.settings)),
36
+ headers: jsonContentHeaders,
37
+ method: "POST",
38
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs`
39
+ }, unmarshalHub);
40
+ /**
41
+ * Get a hub. Retrieve information about an existing IoT Hub, specified by its Hub ID. Its full details, including name, status and endpoint, are returned in the response object.
42
+ *
43
+ * @param request - The request {@link GetHubRequest}
44
+ * @returns A Promise of Hub
45
+ */
46
+ getHub = (request) => this.client.fetch({
47
+ method: "GET",
48
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}`
49
+ }, unmarshalHub);
50
+ /**
51
+ * Waits for {@link Hub} to be in a final state.
52
+ *
53
+ * @param request - The request {@link GetHubRequest}
54
+ * @param options - The waiting options
55
+ * @returns A Promise of Hub
56
+ */
57
+ waitForHub = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!HUB_TRANSIENT_STATUSES.includes(res.status))), this.getHub, request, options);
58
+ /**
59
+ * Update a hub. Update the parameters of an existing IoT Hub, specified by its Hub ID.
60
+ *
61
+ * @param request - The request {@link UpdateHubRequest}
62
+ * @returns A Promise of Hub
63
+ */
64
+ updateHub = (request) => this.client.fetch({
65
+ body: JSON.stringify(marshalUpdateHubRequest(request, this.client.settings)),
66
+ headers: jsonContentHeaders,
67
+ method: "PATCH",
68
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}`
69
+ }, unmarshalHub);
70
+ /**
71
+ * Enable a hub. Enable an existing IoT Hub, specified by its Hub ID.
72
+ *
73
+ * @param request - The request {@link EnableHubRequest}
74
+ * @returns A Promise of Hub
75
+ */
76
+ enableHub = (request) => this.client.fetch({
77
+ body: "{}",
78
+ headers: jsonContentHeaders,
79
+ method: "POST",
80
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}/enable`
81
+ }, unmarshalHub);
82
+ /**
83
+ * Disable a hub. Disable an existing IoT Hub, specified by its Hub ID.
84
+ *
85
+ * @param request - The request {@link DisableHubRequest}
86
+ * @returns A Promise of Hub
87
+ */
88
+ disableHub = (request) => this.client.fetch({
89
+ body: "{}",
90
+ headers: jsonContentHeaders,
91
+ method: "POST",
92
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}/disable`
93
+ }, unmarshalHub);
94
+ /**
95
+ * Delete a hub. Delete an existing IoT Hub, specified by its Hub ID. Deleting a Hub is permanent, and cannot be undone.
96
+ *
97
+ * @param request - The request {@link DeleteHubRequest}
98
+ */
99
+ deleteHub = (request) => this.client.fetch({
100
+ method: "DELETE",
101
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}`,
102
+ urlParams: urlParams(["delete_devices", request.deleteDevices])
103
+ });
104
+ /**
105
+ * Get a hub's metrics. Get the metrics of an existing IoT Hub, specified by its Hub ID.
106
+ *
107
+ * @deprecated
108
+ * @param request - The request {@link GetHubMetricsRequest}
109
+ * @returns A Promise of GetHubMetricsResponse
110
+ */
111
+ getHubMetrics = (request) => this.client.fetch({
112
+ method: "GET",
113
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}/metrics`,
114
+ urlParams: urlParams(["start_date", request.startDate])
115
+ }, unmarshalGetHubMetricsResponse);
116
+ /**
117
+ * Set the certificate authority of a hub. Set a particular PEM-encoded certificate, specified by the Hub ID.
118
+ *
119
+ * @param request - The request {@link SetHubCARequest}
120
+ * @returns A Promise of Hub
121
+ */
122
+ setHubCA = (request) => this.client.fetch({
123
+ body: JSON.stringify(marshalSetHubCARequest(request, this.client.settings)),
124
+ headers: jsonContentHeaders,
125
+ method: "POST",
126
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}/ca`
127
+ }, unmarshalHub);
128
+ /**
129
+ * Get the certificate authority of a hub. Get information for a particular PEM-encoded certificate, specified by the Hub ID.
130
+ *
131
+ * @param request - The request {@link GetHubCARequest}
132
+ * @returns A Promise of GetHubCAResponse
133
+ */
134
+ getHubCA = (request) => this.client.fetch({
135
+ method: "GET",
136
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}/ca`
137
+ }, unmarshalGetHubCAResponse);
138
+ pageOfListDevices = (request = {}) => this.client.fetch({
139
+ method: "GET",
140
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices`,
141
+ urlParams: urlParams(["allow_insecure", request.allowInsecure], ["hub_id", request.hubId], ["name", request.name], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["status", request.status])
142
+ }, unmarshalListDevicesResponse);
143
+ /**
144
+ * List devices. List all devices in the specified region. By default, returned devices are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
145
+ *
146
+ * @param request - The request {@link ListDevicesRequest}
147
+ * @returns A Promise of ListDevicesResponse
148
+ */
149
+ listDevices = (request = {}) => enrichForPagination("devices", this.pageOfListDevices, request);
150
+ /**
151
+ * Add a device. Attach a device to a given Hub.
152
+ *
153
+ * @param request - The request {@link CreateDeviceRequest}
154
+ * @returns A Promise of CreateDeviceResponse
155
+ */
156
+ createDevice = (request) => this.client.fetch({
157
+ body: JSON.stringify(marshalCreateDeviceRequest(request, this.client.settings)),
158
+ headers: jsonContentHeaders,
159
+ method: "POST",
160
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices`
161
+ }, unmarshalCreateDeviceResponse);
162
+ /**
163
+ * Get a device. Retrieve information about an existing device, specified by its device ID. Its full details, including name, status and ID, are returned in the response object.
164
+ *
165
+ * @param request - The request {@link GetDeviceRequest}
166
+ * @returns A Promise of Device
167
+ */
168
+ getDevice = (request) => this.client.fetch({
169
+ method: "GET",
170
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}`
171
+ }, unmarshalDevice);
172
+ /**
173
+ * Update a device. Update the parameters of an existing device, specified by its device ID.
174
+ *
175
+ * @param request - The request {@link UpdateDeviceRequest}
176
+ * @returns A Promise of Device
177
+ */
178
+ updateDevice = (request) => this.client.fetch({
179
+ body: JSON.stringify(marshalUpdateDeviceRequest(request, this.client.settings)),
180
+ headers: jsonContentHeaders,
181
+ method: "PATCH",
182
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}`
183
+ }, unmarshalDevice);
184
+ /**
185
+ * Enable a device. Enable a specific device, specified by its device ID.
186
+ *
187
+ * @param request - The request {@link EnableDeviceRequest}
188
+ * @returns A Promise of Device
189
+ */
190
+ enableDevice = (request) => this.client.fetch({
191
+ body: "{}",
192
+ headers: jsonContentHeaders,
193
+ method: "POST",
194
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}/enable`
195
+ }, unmarshalDevice);
196
+ /**
197
+ * Disable a device. Disable an existing device, specified by its device ID.
198
+ *
199
+ * @param request - The request {@link DisableDeviceRequest}
200
+ * @returns A Promise of Device
201
+ */
202
+ disableDevice = (request) => this.client.fetch({
203
+ body: "{}",
204
+ headers: jsonContentHeaders,
205
+ method: "POST",
206
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}/disable`
207
+ }, unmarshalDevice);
208
+ /**
209
+ * Renew a device certificate. Renew the certificate of an existing device, specified by its device ID.
210
+ *
211
+ * @param request - The request {@link RenewDeviceCertificateRequest}
212
+ * @returns A Promise of RenewDeviceCertificateResponse
213
+ */
214
+ renewDeviceCertificate = (request) => this.client.fetch({
215
+ body: "{}",
216
+ headers: jsonContentHeaders,
217
+ method: "POST",
218
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}/renew-certificate`
219
+ }, unmarshalRenewDeviceCertificateResponse);
220
+ /**
221
+ * Set a custom certificate on a device. Switch the existing certificate of a given device with an EM-encoded custom certificate.
222
+ *
223
+ * @param request - The request {@link SetDeviceCertificateRequest}
224
+ * @returns A Promise of SetDeviceCertificateResponse
225
+ */
226
+ setDeviceCertificate = (request) => this.client.fetch({
227
+ body: JSON.stringify(marshalSetDeviceCertificateRequest(request, this.client.settings)),
228
+ headers: jsonContentHeaders,
229
+ method: "PUT",
230
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}/certificate`
231
+ }, unmarshalSetDeviceCertificateResponse);
232
+ /**
233
+ * Get a device's certificate. Get information for a particular PEM-encoded certificate, specified by the device ID. The response returns full details of the device, including its type of certificate.
234
+ *
235
+ * @param request - The request {@link GetDeviceCertificateRequest}
236
+ * @returns A Promise of GetDeviceCertificateResponse
237
+ */
238
+ getDeviceCertificate = (request) => this.client.fetch({
239
+ method: "GET",
240
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}/certificate`
241
+ }, unmarshalGetDeviceCertificateResponse);
242
+ /**
243
+ * Remove a device. Remove a specific device from the specific Hub it is attached to.
244
+ *
245
+ * @param request - The request {@link DeleteDeviceRequest}
246
+ */
247
+ deleteDevice = (request) => this.client.fetch({
248
+ method: "DELETE",
249
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}`
250
+ });
251
+ /**
252
+ * Get a device's metrics. Get the metrics of an existing device, specified by its device ID.
253
+ *
254
+ * @deprecated
255
+ * @param request - The request {@link GetDeviceMetricsRequest}
256
+ * @returns A Promise of GetDeviceMetricsResponse
257
+ */
258
+ getDeviceMetrics = (request) => this.client.fetch({
259
+ method: "GET",
260
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}/metrics`,
261
+ urlParams: urlParams(["start_date", request.startDate])
262
+ }, unmarshalGetDeviceMetricsResponse);
263
+ pageOfListRoutes = (request = {}) => this.client.fetch({
264
+ method: "GET",
265
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes`,
266
+ urlParams: urlParams(["hub_id", request.hubId], ["name", request.name], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
267
+ }, unmarshalListRoutesResponse);
268
+ /**
269
+ * List routes. List all routes in the specified region. By default, returned routes are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
270
+ *
271
+ * @param request - The request {@link ListRoutesRequest}
272
+ * @returns A Promise of ListRoutesResponse
273
+ */
274
+ listRoutes = (request = {}) => enrichForPagination("routes", this.pageOfListRoutes, request);
275
+ /**
276
+ * Create a route. Multiple kinds of routes can be created, such as:
277
+ - Database Route
278
+ Create a route that will record subscribed MQTT messages into your database.
279
+ <b>You need to manage the database by yourself</b>.
280
+ - REST Route.
281
+ Create a route that will call a REST API on received subscribed MQTT messages.
282
+ - Amazon S3 Routes.
283
+ Create a route that will put subscribed MQTT messages into an Object Storage bucket.
284
+ You need to create the bucket yourself and grant write access.
285
+ Granting can be done with s3cmd (`s3cmd setacl s3://<my-bucket> --acl-grant=write:555c69c3-87d0-4bf8-80f1-99a2f757d031:555c69c3-87d0-4bf8-80f1-99a2f757d031`).
286
+ *
287
+ * @param request - The request {@link CreateRouteRequest}
288
+ * @returns A Promise of Route
289
+ */
290
+ createRoute = (request) => this.client.fetch({
291
+ body: JSON.stringify(marshalCreateRouteRequest(request, this.client.settings)),
292
+ headers: jsonContentHeaders,
293
+ method: "POST",
294
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes`
295
+ }, unmarshalRoute);
296
+ /**
297
+ * Update a route. Update the parameters of an existing route, specified by its route ID.
298
+ *
299
+ * @param request - The request {@link UpdateRouteRequest}
300
+ * @returns A Promise of Route
301
+ */
302
+ updateRoute = (request) => this.client.fetch({
303
+ body: JSON.stringify(marshalUpdateRouteRequest(request, this.client.settings)),
304
+ headers: jsonContentHeaders,
305
+ method: "PATCH",
306
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam("routeId", request.routeId)}`
307
+ }, unmarshalRoute);
308
+ /**
309
+ * Get a route. Get information for a particular route, specified by the route ID. The response returns full details of the route, including its type, the topic it subscribes to and its configuration.
310
+ *
311
+ * @param request - The request {@link GetRouteRequest}
312
+ * @returns A Promise of Route
313
+ */
314
+ getRoute = (request) => this.client.fetch({
315
+ method: "GET",
316
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam("routeId", request.routeId)}`
317
+ }, unmarshalRoute);
318
+ /**
319
+ * Delete a route. Delete an existing route, specified by its route ID. Deleting a route is permanent, and cannot be undone.
320
+ *
321
+ * @param request - The request {@link DeleteRouteRequest}
322
+ */
323
+ deleteRoute = (request) => this.client.fetch({
324
+ method: "DELETE",
325
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam("routeId", request.routeId)}`
326
+ });
327
+ pageOfListNetworks = (request = {}) => this.client.fetch({
328
+ method: "GET",
329
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/networks`,
330
+ urlParams: urlParams(["hub_id", request.hubId], ["name", request.name], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["topic_prefix", request.topicPrefix])
331
+ }, unmarshalListNetworksResponse);
332
+ /**
333
+ * List the networks.
334
+ *
335
+ * @param request - The request {@link ListNetworksRequest}
336
+ * @returns A Promise of ListNetworksResponse
337
+ */
338
+ listNetworks = (request = {}) => enrichForPagination("networks", this.pageOfListNetworks, request);
339
+ /**
340
+ * Create a new network. Create a new network for an existing hub. Beside the default network, you can add networks for different data providers. Possible network types are Sigfox and REST.
341
+ *
342
+ * @param request - The request {@link CreateNetworkRequest}
343
+ * @returns A Promise of CreateNetworkResponse
344
+ */
345
+ createNetwork = (request) => this.client.fetch({
346
+ body: JSON.stringify(marshalCreateNetworkRequest(request, this.client.settings)),
347
+ headers: jsonContentHeaders,
348
+ method: "POST",
349
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/networks`
350
+ }, unmarshalCreateNetworkResponse);
351
+ /**
352
+ * Retrieve a specific network. Retrieve an existing network, specified by its network ID. The response returns full details of the network, including its type, the topic prefix and its endpoint.
353
+ *
354
+ * @param request - The request {@link GetNetworkRequest}
355
+ * @returns A Promise of Network
356
+ */
357
+ getNetwork = (request) => this.client.fetch({
358
+ method: "GET",
359
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/networks/${validatePathParam("networkId", request.networkId)}`
360
+ }, unmarshalNetwork);
361
+ /**
362
+ * Delete a Network. Delete an existing network, specified by its network ID. Deleting a network is permanent, and cannot be undone.
363
+ *
364
+ * @param request - The request {@link DeleteNetworkRequest}
365
+ */
366
+ deleteNetwork = (request) => this.client.fetch({
367
+ method: "DELETE",
368
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/networks/${validatePathParam("networkId", request.networkId)}`
369
+ });
370
+ /**
371
+ * BETA - Get a Cloud Twin Document.
372
+ *
373
+ * @param request - The request {@link GetTwinDocumentRequest}
374
+ * @returns A Promise of TwinDocument
375
+ */
376
+ getTwinDocument = (request) => this.client.fetch({
377
+ method: "GET",
378
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}/documents/${validatePathParam("documentName", request.documentName)}`
379
+ }, unmarshalTwinDocument);
380
+ /**
381
+ * BETA - Update a Cloud Twin Document.
382
+ *
383
+ * @param request - The request {@link PutTwinDocumentRequest}
384
+ * @returns A Promise of TwinDocument
385
+ */
386
+ putTwinDocument = (request) => this.client.fetch({
387
+ body: JSON.stringify(marshalPutTwinDocumentRequest(request, this.client.settings)),
388
+ headers: jsonContentHeaders,
389
+ method: "PUT",
390
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}/documents/${validatePathParam("documentName", request.documentName)}`
391
+ }, unmarshalTwinDocument);
392
+ /**
393
+ * BETA - Patch a Cloud Twin Document.
394
+ *
395
+ * @param request - The request {@link PatchTwinDocumentRequest}
396
+ * @returns A Promise of TwinDocument
397
+ */
398
+ patchTwinDocument = (request) => this.client.fetch({
399
+ body: JSON.stringify(marshalPatchTwinDocumentRequest(request, this.client.settings)),
400
+ headers: jsonContentHeaders,
401
+ method: "PATCH",
402
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}/documents/${validatePathParam("documentName", request.documentName)}`
403
+ }, unmarshalTwinDocument);
404
+ /**
405
+ * BETA - Delete a Cloud Twin Document.
406
+ *
407
+ * @param request - The request {@link DeleteTwinDocumentRequest}
408
+ */
409
+ deleteTwinDocument = (request) => this.client.fetch({
410
+ method: "DELETE",
411
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}/documents/${validatePathParam("documentName", request.documentName)}`
412
+ });
413
+ /**
414
+ * BETA - List the documents of a Cloud Twin.
415
+ *
416
+ * @param request - The request {@link ListTwinDocumentsRequest}
417
+ * @returns A Promise of ListTwinDocumentsResponse
418
+ */
419
+ listTwinDocuments = (request) => this.client.fetch({
420
+ method: "GET",
421
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}`
422
+ }, unmarshalListTwinDocumentsResponse);
423
+ /**
424
+ * BETA - Delete all the documents of a Cloud Twin.
425
+ *
426
+ * @param request - The request {@link DeleteTwinDocumentsRequest}
427
+ */
428
+ deleteTwinDocuments = (request) => this.client.fetch({
429
+ method: "DELETE",
430
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}`
431
+ });
599
432
  };
433
+ export { API$1 as API };