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