@scaleway/sdk-iot 1.1.0 → 2.1.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.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @scaleway/sdk-iot
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@scaleway/sdk-iot.svg)](https://www.npmjs.com/package/@scaleway/sdk-iot)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@scaleway/sdk-iot.svg)](https://www.npmjs.com/package/@scaleway/sdk-iot)
5
+ [![license](https://img.shields.io/npm/l/@scaleway/sdk-iot.svg)](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
6
+
7
+ Scaleway SDK for Iot API.
8
+
9
+ > **Note**
10
+ > This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @scaleway/sdk-iot @scaleway/sdk-client
16
+ ```
17
+
18
+ or with pnpm:
19
+
20
+ ```bash
21
+ pnpm add @scaleway/sdk-iot @scaleway/sdk-client
22
+ ```
23
+
24
+ or with yarn:
25
+
26
+ ```bash
27
+ yarn add @scaleway/sdk-iot @scaleway/sdk-client
28
+ ```
29
+
30
+ ## Getting Started
31
+
32
+ You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
33
+
34
+ ### Basic Usage
35
+
36
+ ```typescript
37
+ import { createClient } from '@scaleway/sdk-client'
38
+ import { Iot } from '@scaleway/sdk-iot'
39
+
40
+ const client = createClient({
41
+ accessKey: 'SCWXXXXXXXXXXXXXXXXX',
42
+ secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
43
+ defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
44
+ defaultRegion: 'fr-par',
45
+ defaultZone: 'fr-par-1',
46
+ })
47
+
48
+ const api = new Iot.v1.API(client)
49
+
50
+ // Use the API
51
+ // Example: await api.listServers()
52
+ ```
53
+
54
+ ### Using Configuration Loader
55
+
56
+ For a simpler setup, you can load credentials from the configuration file or environment variables:
57
+
58
+ ```typescript
59
+ import { createClient } from '@scaleway/sdk-client'
60
+ import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
61
+ import { Iot } from '@scaleway/sdk-iot'
62
+
63
+ const profile = loadProfileFromConfigurationFile()
64
+ const client = createClient(profile)
65
+ const api = new Iot.v1.API(client)
66
+ ```
67
+
68
+ ## Documentation
69
+
70
+ - 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
71
+ - 🌐 [Scaleway Iot API Documentation](https://www.scaleway.com/en/developers/api/iot/)
72
+ - 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
73
+ - 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
74
+
75
+ ## Features
76
+
77
+ - ✅ Full TypeScript support with complete type definitions
78
+ - ✅ Promise-based API
79
+ - ✅ Automatic pagination helpers
80
+ - ✅ Built-in error handling
81
+ - ✅ Compatible with Node.js ≥ 20
82
+
83
+ ## Support
84
+
85
+ We love feedback! Feel free to reach us on:
86
+ - [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
87
+ - [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
88
+
89
+ ## Contributing
90
+
91
+ This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
92
+
93
+ ## License
94
+
95
+ This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
96
+
@@ -1,5 +1,5 @@
1
- import { API as ParentAPI } from '@scaleway/sdk-client';
2
1
  import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client';
2
+ import { API as ParentAPI } from '@scaleway/sdk-client';
3
3
  import type { CreateDeviceRequest, CreateDeviceResponse, CreateHubRequest, CreateNetworkRequest, CreateNetworkResponse, CreateRouteRequest, DeleteDeviceRequest, DeleteHubRequest, DeleteNetworkRequest, DeleteRouteRequest, DeleteTwinDocumentRequest, DeleteTwinDocumentsRequest, Device, DisableDeviceRequest, DisableHubRequest, EnableDeviceRequest, EnableHubRequest, GetDeviceCertificateRequest, GetDeviceCertificateResponse, GetDeviceMetricsRequest, GetDeviceMetricsResponse, GetDeviceRequest, GetHubCARequest, GetHubCAResponse, GetHubMetricsRequest, GetHubMetricsResponse, GetHubRequest, GetNetworkRequest, GetRouteRequest, GetTwinDocumentRequest, Hub, ListDevicesRequest, ListDevicesResponse, ListHubsRequest, ListHubsResponse, ListNetworksRequest, ListNetworksResponse, ListRoutesRequest, ListRoutesResponse, ListTwinDocumentsRequest, ListTwinDocumentsResponse, Network, PatchTwinDocumentRequest, PutTwinDocumentRequest, RenewDeviceCertificateRequest, RenewDeviceCertificateResponse, Route, SetDeviceCertificateRequest, SetDeviceCertificateResponse, SetHubCARequest, TwinDocument, UpdateDeviceRequest, UpdateHubRequest, UpdateRouteRequest } from './types.gen.js';
4
4
  /**
5
5
  * IoT Hub API.
@@ -10,7 +10,9 @@ class API extends API$1 {
10
10
  * type ∈ {'zone','region','global','unspecified'}
11
11
  */
12
12
  static LOCALITY = toApiLocality({
13
- regions: ["fr-par"]
13
+ regions: [
14
+ "fr-par"
15
+ ]
14
16
  });
15
17
  pageOfListHubs = (request = {}) => this.client.fetch(
16
18
  {
@@ -21,10 +23,7 @@ class API extends API$1 {
21
23
  ["order_by", request.orderBy],
22
24
  ["organization_id", request.organizationId],
23
25
  ["page", request.page],
24
- [
25
- "page_size",
26
- request.pageSize ?? this.client.settings.defaultPageSize
27
- ],
26
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
28
27
  ["project_id", request.projectId]
29
28
  )
30
29
  },
@@ -132,11 +131,15 @@ class API extends API$1 {
132
131
  *
133
132
  * @param request - The request {@link DeleteHubRequest}
134
133
  */
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
- });
134
+ deleteHub = (request) => this.client.fetch(
135
+ {
136
+ method: "DELETE",
137
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam("hubId", request.hubId)}`,
138
+ urlParams: urlParams(
139
+ ["delete_devices", request.deleteDevices]
140
+ )
141
+ }
142
+ );
140
143
  /**
141
144
  * Get a hub's metrics. Get the metrics of an existing IoT Hub, specified by its Hub ID.
142
145
  *
@@ -148,7 +151,9 @@ class API extends API$1 {
148
151
  {
149
152
  method: "GET",
150
153
  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])
154
+ urlParams: urlParams(
155
+ ["start_date", request.startDate]
156
+ )
152
157
  },
153
158
  unmarshalGetHubMetricsResponse
154
159
  );
@@ -192,10 +197,7 @@ class API extends API$1 {
192
197
  ["name", request.name],
193
198
  ["order_by", request.orderBy],
194
199
  ["page", request.page],
195
- [
196
- "page_size",
197
- request.pageSize ?? this.client.settings.defaultPageSize
198
- ],
200
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
199
201
  ["status", request.status]
200
202
  )
201
203
  },
@@ -335,10 +337,12 @@ class API extends API$1 {
335
337
  *
336
338
  * @param request - The request {@link DeleteDeviceRequest}
337
339
  */
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
- });
340
+ deleteDevice = (request) => this.client.fetch(
341
+ {
342
+ method: "DELETE",
343
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/devices/${validatePathParam("deviceId", request.deviceId)}`
344
+ }
345
+ );
342
346
  /**
343
347
  * Get a device's metrics. Get the metrics of an existing device, specified by its device ID.
344
348
  *
@@ -350,7 +354,9 @@ class API extends API$1 {
350
354
  {
351
355
  method: "GET",
352
356
  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])
357
+ urlParams: urlParams(
358
+ ["start_date", request.startDate]
359
+ )
354
360
  },
355
361
  unmarshalGetDeviceMetricsResponse
356
362
  );
@@ -363,10 +369,7 @@ class API extends API$1 {
363
369
  ["name", request.name],
364
370
  ["order_by", request.orderBy],
365
371
  ["page", request.page],
366
- [
367
- "page_size",
368
- request.pageSize ?? this.client.settings.defaultPageSize
369
- ]
372
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
370
373
  )
371
374
  },
372
375
  unmarshalListRoutesResponse
@@ -439,10 +442,12 @@ class API extends API$1 {
439
442
  *
440
443
  * @param request - The request {@link DeleteRouteRequest}
441
444
  */
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
- });
445
+ deleteRoute = (request) => this.client.fetch(
446
+ {
447
+ method: "DELETE",
448
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam("routeId", request.routeId)}`
449
+ }
450
+ );
446
451
  pageOfListNetworks = (request = {}) => this.client.fetch(
447
452
  {
448
453
  method: "GET",
@@ -452,10 +457,7 @@ class API extends API$1 {
452
457
  ["name", request.name],
453
458
  ["order_by", request.orderBy],
454
459
  ["page", request.page],
455
- [
456
- "page_size",
457
- request.pageSize ?? this.client.settings.defaultPageSize
458
- ],
460
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
459
461
  ["topic_prefix", request.topicPrefix]
460
462
  )
461
463
  },
@@ -503,10 +505,12 @@ class API extends API$1 {
503
505
  *
504
506
  * @param request - The request {@link DeleteNetworkRequest}
505
507
  */
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
- });
508
+ deleteNetwork = (request) => this.client.fetch(
509
+ {
510
+ method: "DELETE",
511
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/networks/${validatePathParam("networkId", request.networkId)}`
512
+ }
513
+ );
510
514
  /**
511
515
  * BETA - Get a Cloud Twin Document.
512
516
  *
@@ -559,10 +563,12 @@ class API extends API$1 {
559
563
  *
560
564
  * @param request - The request {@link DeleteTwinDocumentRequest}
561
565
  */
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
+ deleteTwinDocument = (request) => this.client.fetch(
567
+ {
568
+ method: "DELETE",
569
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}/documents/${validatePathParam("documentName", request.documentName)}`
570
+ }
571
+ );
566
572
  /**
567
573
  * BETA - List the documents of a Cloud Twin.
568
574
  *
@@ -581,10 +587,12 @@ class API extends API$1 {
581
587
  *
582
588
  * @param request - The request {@link DeleteTwinDocumentsRequest}
583
589
  */
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
- });
590
+ deleteTwinDocuments = (request) => this.client.fetch(
591
+ {
592
+ method: "DELETE",
593
+ path: `/iot/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/twins/${validatePathParam("twinId", request.twinId)}`
594
+ }
595
+ );
588
596
  }
589
597
  export {
590
598
  API
@@ -1,4 +1,7 @@
1
- const HUB_TRANSIENT_STATUSES = ["enabling", "disabling"];
1
+ const HUB_TRANSIENT_STATUSES = [
2
+ "enabling",
3
+ "disabling"
4
+ ];
2
5
  export {
3
6
  HUB_TRANSIENT_STATUSES
4
7
  };
@@ -1,4 +1,4 @@
1
- export { API } from './api.gen.js';
1
+ export { API, } from './api.gen.js';
2
2
  export * from './content.gen.js';
3
3
  export * from './marshalling.gen.js';
4
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.js';
@@ -251,10 +251,7 @@ const unmarshalListTwinDocumentsResponse = (data) => {
251
251
  );
252
252
  }
253
253
  return {
254
- documents: unmarshalArrayOfObject(
255
- data.documents,
256
- unmarshalListTwinDocumentsResponseDocumentSummary
257
- )
254
+ documents: unmarshalArrayOfObject(data.documents, unmarshalListTwinDocumentsResponseDocumentSummary)
258
255
  };
259
256
  };
260
257
  const unmarshalRenewDeviceCertificateResponse = (data) => {
@@ -214,7 +214,7 @@ export interface Hub {
214
214
  */
215
215
  organizationId: string;
216
216
  /**
217
- * When an unknown device connects to your hub using a valid certificate chain, it will be automatically provisioned inside your Hub. The Hub uses the common name of the device certifcate to find out if a device with the same name already exists. This setting can only be enabled on a hub with a custom certificate authority.
217
+ * When an unknown device connects to your hub using a valid certificate chain, it will be automatically provisioned inside your Hub. The Hub uses the common name of the device certificate to find out if a device with the same name already exists. This setting can only be enabled on a hub with a custom certificate authority.
218
218
  */
219
219
  enableDeviceAutoProvisioning: boolean;
220
220
  /**
package/package.json CHANGED
@@ -1,23 +1,20 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-iot",
3
- "version": "1.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Scaleway SDK iot",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
+ "README.md",
7
8
  "dist"
8
9
  ],
9
10
  "type": "module",
10
11
  "exports": {
11
12
  ".": {
12
13
  "types": "./dist/index.gen.d.ts",
13
- "import": "./dist/index.gen.js",
14
- "require": "./dist/index.gen.cjs",
15
14
  "default": "./dist/index.gen.js"
16
15
  },
17
16
  "./*": {
18
17
  "types": "./dist/*/index.gen.d.ts",
19
- "import": "./dist/*/index.gen.js",
20
- "require": "./dist/*/index.gen.cjs",
21
18
  "default": "./dist/*/index.gen.js"
22
19
  }
23
20
  },
@@ -26,17 +23,17 @@
26
23
  "directory": "packages_generated/iot"
27
24
  },
28
25
  "engines": {
29
- "node": ">=20.19.4"
26
+ "node": ">=20.19.6"
30
27
  },
31
28
  "dependencies": {
32
29
  "@scaleway/random-name": "5.1.2",
33
- "@scaleway/sdk-std": "1.1.0"
30
+ "@scaleway/sdk-std": "2.1.0"
34
31
  },
35
32
  "peerDependencies": {
36
- "@scaleway/sdk-client": "^1.3.2"
33
+ "@scaleway/sdk-client": "^2.1.0"
37
34
  },
38
35
  "devDependencies": {
39
- "@scaleway/sdk-client": "^1.3.2"
36
+ "@scaleway/sdk-client": "^2.1.0"
40
37
  },
41
38
  "scripts": {
42
39
  "package:check": "pnpm publint",
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index_gen = require("./v1/index.gen.cjs");
4
- exports.Iotv1 = index_gen;