@scaleway/sdk-iot 2.2.0 → 2.3.0

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