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