@scaleway/sdk-marketplace 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-marketplace
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@scaleway/sdk-marketplace.svg)](https://www.npmjs.com/package/@scaleway/sdk-marketplace)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@scaleway/sdk-marketplace.svg)](https://www.npmjs.com/package/@scaleway/sdk-marketplace)
5
+ [![license](https://img.shields.io/npm/l/@scaleway/sdk-marketplace.svg)](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
6
+
7
+ Scaleway SDK for Marketplace 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-marketplace @scaleway/sdk-client
16
+ ```
17
+
18
+ or with pnpm:
19
+
20
+ ```bash
21
+ pnpm add @scaleway/sdk-marketplace @scaleway/sdk-client
22
+ ```
23
+
24
+ or with yarn:
25
+
26
+ ```bash
27
+ yarn add @scaleway/sdk-marketplace @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 { Marketplace } from '@scaleway/sdk-marketplace'
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 Marketplace.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 { Marketplace } from '@scaleway/sdk-marketplace'
62
+
63
+ const profile = loadProfileFromConfigurationFile()
64
+ const client = createClient(profile)
65
+ const api = new Marketplace.v1.API(client)
66
+ ```
67
+
68
+ ## Documentation
69
+
70
+ - 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
71
+ - 🌐 [Scaleway Marketplace API Documentation](https://www.scaleway.com/en/developers/api/marketplace/)
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
+
@@ -11,10 +11,7 @@ class API extends API$1 {
11
11
  ["include_eol", request.includeEol],
12
12
  ["order_by", request.orderBy],
13
13
  ["page", request.page],
14
- [
15
- "page_size",
16
- request.pageSize ?? this.client.settings.defaultPageSize
17
- ]
14
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
18
15
  )
19
16
  },
20
17
  unmarshalListImagesResponse
@@ -47,10 +44,7 @@ class API extends API$1 {
47
44
  ["image_id", request.imageId],
48
45
  ["order_by", request.orderBy],
49
46
  ["page", request.page],
50
- [
51
- "page_size",
52
- request.pageSize ?? this.client.settings.defaultPageSize
53
- ]
47
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
54
48
  )
55
49
  },
56
50
  unmarshalListVersionsResponse
@@ -83,19 +77,23 @@ class API extends API$1 {
83
77
  ["arch", request.arch],
84
78
  ["order_by", request.orderBy],
85
79
  ["page", request.page],
86
- [
87
- "page_size",
88
- request.pageSize ?? this.client.settings.defaultPageSize
89
- ],
80
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
90
81
  ["type", request.type],
91
82
  ["zone", request.zone],
92
- ...Object.entries(
93
- resolveOneOf([
94
- { param: "image_id", value: request.imageId },
95
- { param: "version_id", value: request.versionId },
96
- { param: "image_label", value: request.imageLabel }
97
- ])
98
- )
83
+ ...Object.entries(resolveOneOf([
84
+ {
85
+ param: "image_id",
86
+ value: request.imageId
87
+ },
88
+ {
89
+ param: "version_id",
90
+ value: request.versionId
91
+ },
92
+ {
93
+ param: "image_label",
94
+ value: request.imageLabel
95
+ }
96
+ ]))
99
97
  )
100
98
  },
101
99
  unmarshalListLocalImagesResponse
@@ -126,10 +124,7 @@ class API extends API$1 {
126
124
  path: `/marketplace/v2/categories`,
127
125
  urlParams: urlParams(
128
126
  ["page", request.page],
129
- [
130
- "page_size",
131
- request.pageSize ?? this.client.settings.defaultPageSize
132
- ]
127
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
133
128
  )
134
129
  },
135
130
  unmarshalListCategoriesResponse
@@ -1,3 +1,3 @@
1
- export { API } from './api.gen.js';
1
+ export { API, } from './api.gen.js';
2
2
  export * from './marshalling.gen.js';
3
3
  export type { Category, GetCategoryRequest, GetImageRequest, GetLocalImageRequest, GetVersionRequest, Image, ListCategoriesRequest, ListCategoriesResponse, ListImagesRequest, ListImagesRequestOrderBy, ListImagesResponse, ListLocalImagesRequest, ListLocalImagesRequestOrderBy, ListLocalImagesResponse, ListVersionsRequest, ListVersionsRequestOrderBy, ListVersionsResponse, LocalImage, LocalImageType, Version, } from './types.gen.js';
package/package.json CHANGED
@@ -1,23 +1,20 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-marketplace",
3
- "version": "1.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Scaleway SDK marketplace",
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/marketplace"
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("./v2/index.gen.cjs");
4
- exports.Marketplacev2 = index_gen;
@@ -1,160 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sdkClient = require("@scaleway/sdk-client");
4
- const marshalling_gen = require("./marshalling.gen.cjs");
5
- class API extends sdkClient.API {
6
- pageOfListImages = (request) => this.client.fetch(
7
- {
8
- method: "GET",
9
- path: `/marketplace/v2/images`,
10
- urlParams: sdkClient.urlParams(
11
- ["arch", request.arch],
12
- ["category", request.category],
13
- ["include_eol", request.includeEol],
14
- ["order_by", request.orderBy],
15
- ["page", request.page],
16
- [
17
- "page_size",
18
- request.pageSize ?? this.client.settings.defaultPageSize
19
- ]
20
- )
21
- },
22
- marshalling_gen.unmarshalListImagesResponse
23
- );
24
- /**
25
- * List marketplace images. List all available images on the marketplace, their UUID, CPU architecture and description.
26
- *
27
- * @param request - The request {@link ListImagesRequest}
28
- * @returns A Promise of ListImagesResponse
29
- */
30
- listImages = (request) => sdkClient.enrichForPagination("images", this.pageOfListImages, request);
31
- /**
32
- * Get a specific marketplace image. Get detailed information about a marketplace image, specified by its `image_id` (UUID format).
33
- *
34
- * @param request - The request {@link GetImageRequest}
35
- * @returns A Promise of Image
36
- */
37
- getImage = (request) => this.client.fetch(
38
- {
39
- method: "GET",
40
- path: `/marketplace/v2/images/${sdkClient.validatePathParam("imageId", request.imageId)}`
41
- },
42
- marshalling_gen.unmarshalImage
43
- );
44
- pageOfListVersions = (request) => this.client.fetch(
45
- {
46
- method: "GET",
47
- path: `/marketplace/v2/versions`,
48
- urlParams: sdkClient.urlParams(
49
- ["image_id", request.imageId],
50
- ["order_by", request.orderBy],
51
- ["page", request.page],
52
- [
53
- "page_size",
54
- request.pageSize ?? this.client.settings.defaultPageSize
55
- ]
56
- )
57
- },
58
- marshalling_gen.unmarshalListVersionsResponse
59
- );
60
- /**
61
- * List versions of an Image. Get a list of all available version of an image, specified by its `image_id` (UUID format).
62
- *
63
- * @param request - The request {@link ListVersionsRequest}
64
- * @returns A Promise of ListVersionsResponse
65
- */
66
- listVersions = (request) => sdkClient.enrichForPagination("versions", this.pageOfListVersions, request);
67
- /**
68
- * Get a specific image version. Get information such as the name, creation date, last update and published date for an image version specified by its `version_id` (UUID format).
69
- *
70
- * @param request - The request {@link GetVersionRequest}
71
- * @returns A Promise of Version
72
- */
73
- getVersion = (request) => this.client.fetch(
74
- {
75
- method: "GET",
76
- path: `/marketplace/v2/versions/${sdkClient.validatePathParam("versionId", request.versionId)}`
77
- },
78
- marshalling_gen.unmarshalVersion
79
- );
80
- pageOfListLocalImages = (request = {}) => this.client.fetch(
81
- {
82
- method: "GET",
83
- path: `/marketplace/v2/local-images`,
84
- urlParams: sdkClient.urlParams(
85
- ["arch", request.arch],
86
- ["order_by", request.orderBy],
87
- ["page", request.page],
88
- [
89
- "page_size",
90
- request.pageSize ?? this.client.settings.defaultPageSize
91
- ],
92
- ["type", request.type],
93
- ["zone", request.zone],
94
- ...Object.entries(
95
- sdkClient.resolveOneOf([
96
- { param: "image_id", value: request.imageId },
97
- { param: "version_id", value: request.versionId },
98
- { param: "image_label", value: request.imageLabel }
99
- ])
100
- )
101
- )
102
- },
103
- marshalling_gen.unmarshalListLocalImagesResponse
104
- );
105
- /**
106
- * List local images from a specific image or version. List information about local images in a specific Availability Zone, specified by its `image_id` (UUID format), `version_id` (UUID format) or `image_label`. Only one of these three parameters may be set.
107
- *
108
- * @param request - The request {@link ListLocalImagesRequest}
109
- * @returns A Promise of ListLocalImagesResponse
110
- */
111
- listLocalImages = (request = {}) => sdkClient.enrichForPagination("localImages", this.pageOfListLocalImages, request);
112
- /**
113
- * Get a specific local image by ID. Get detailed information about a local image, including compatible commercial types, supported architecture, labels and the Availability Zone of the image, specified by its `local_image_id` (UUID format).
114
- *
115
- * @param request - The request {@link GetLocalImageRequest}
116
- * @returns A Promise of LocalImage
117
- */
118
- getLocalImage = (request) => this.client.fetch(
119
- {
120
- method: "GET",
121
- path: `/marketplace/v2/local-images/${sdkClient.validatePathParam("localImageId", request.localImageId)}`
122
- },
123
- marshalling_gen.unmarshalLocalImage
124
- );
125
- pageOfListCategories = (request = {}) => this.client.fetch(
126
- {
127
- method: "GET",
128
- path: `/marketplace/v2/categories`,
129
- urlParams: sdkClient.urlParams(
130
- ["page", request.page],
131
- [
132
- "page_size",
133
- request.pageSize ?? this.client.settings.defaultPageSize
134
- ]
135
- )
136
- },
137
- marshalling_gen.unmarshalListCategoriesResponse
138
- );
139
- /**
140
- * List existing image categories. Get a list of all existing categories. The output can be paginated.
141
- *
142
- * @param request - The request {@link ListCategoriesRequest}
143
- * @returns A Promise of ListCategoriesResponse
144
- */
145
- listCategories = (request = {}) => sdkClient.enrichForPagination("categories", this.pageOfListCategories, request);
146
- /**
147
- * Get a specific category. Get information about a specific category of the marketplace catalog, specified by its `category_id` (UUID format).
148
- *
149
- * @param request - The request {@link GetCategoryRequest}
150
- * @returns A Promise of Category
151
- */
152
- getCategory = (request) => this.client.fetch(
153
- {
154
- method: "GET",
155
- path: `/marketplace/v2/categories/${sdkClient.validatePathParam("categoryId", request.categoryId)}`
156
- },
157
- marshalling_gen.unmarshalCategory
158
- );
159
- }
160
- exports.API = API;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const api_gen = require("./api.gen.cjs");
4
- const marshalling_gen = require("./marshalling.gen.cjs");
5
- exports.API = api_gen.API;
6
- exports.unmarshalCategory = marshalling_gen.unmarshalCategory;
7
- exports.unmarshalImage = marshalling_gen.unmarshalImage;
8
- exports.unmarshalListCategoriesResponse = marshalling_gen.unmarshalListCategoriesResponse;
9
- exports.unmarshalListImagesResponse = marshalling_gen.unmarshalListImagesResponse;
10
- exports.unmarshalListLocalImagesResponse = marshalling_gen.unmarshalListLocalImagesResponse;
11
- exports.unmarshalListVersionsResponse = marshalling_gen.unmarshalListVersionsResponse;
12
- exports.unmarshalLocalImage = marshalling_gen.unmarshalLocalImage;
13
- exports.unmarshalVersion = marshalling_gen.unmarshalVersion;
@@ -1,114 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sdkClient = require("@scaleway/sdk-client");
4
- const unmarshalCategory = (data) => {
5
- if (!sdkClient.isJSONObject(data)) {
6
- throw new TypeError(
7
- `Unmarshalling the type 'Category' failed as data isn't a dictionary.`
8
- );
9
- }
10
- return {
11
- description: data.description,
12
- id: data.id,
13
- name: data.name
14
- };
15
- };
16
- const unmarshalImage = (data) => {
17
- if (!sdkClient.isJSONObject(data)) {
18
- throw new TypeError(
19
- `Unmarshalling the type 'Image' failed as data isn't a dictionary.`
20
- );
21
- }
22
- return {
23
- categories: data.categories,
24
- createdAt: sdkClient.unmarshalDate(data.created_at),
25
- description: data.description,
26
- id: data.id,
27
- label: data.label,
28
- logo: data.logo,
29
- name: data.name,
30
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
31
- validUntil: sdkClient.unmarshalDate(data.valid_until)
32
- };
33
- };
34
- const unmarshalLocalImage = (data) => {
35
- if (!sdkClient.isJSONObject(data)) {
36
- throw new TypeError(
37
- `Unmarshalling the type 'LocalImage' failed as data isn't a dictionary.`
38
- );
39
- }
40
- return {
41
- arch: data.arch,
42
- compatibleCommercialTypes: data.compatible_commercial_types,
43
- id: data.id,
44
- label: data.label,
45
- type: data.type,
46
- zone: data.zone
47
- };
48
- };
49
- const unmarshalVersion = (data) => {
50
- if (!sdkClient.isJSONObject(data)) {
51
- throw new TypeError(
52
- `Unmarshalling the type 'Version' failed as data isn't a dictionary.`
53
- );
54
- }
55
- return {
56
- createdAt: sdkClient.unmarshalDate(data.created_at),
57
- id: data.id,
58
- name: data.name,
59
- publishedAt: sdkClient.unmarshalDate(data.published_at),
60
- updatedAt: sdkClient.unmarshalDate(data.updated_at)
61
- };
62
- };
63
- const unmarshalListCategoriesResponse = (data) => {
64
- if (!sdkClient.isJSONObject(data)) {
65
- throw new TypeError(
66
- `Unmarshalling the type 'ListCategoriesResponse' failed as data isn't a dictionary.`
67
- );
68
- }
69
- return {
70
- categories: sdkClient.unmarshalArrayOfObject(data.categories, unmarshalCategory),
71
- totalCount: data.total_count
72
- };
73
- };
74
- const unmarshalListImagesResponse = (data) => {
75
- if (!sdkClient.isJSONObject(data)) {
76
- throw new TypeError(
77
- `Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`
78
- );
79
- }
80
- return {
81
- images: sdkClient.unmarshalArrayOfObject(data.images, unmarshalImage),
82
- totalCount: data.total_count
83
- };
84
- };
85
- const unmarshalListLocalImagesResponse = (data) => {
86
- if (!sdkClient.isJSONObject(data)) {
87
- throw new TypeError(
88
- `Unmarshalling the type 'ListLocalImagesResponse' failed as data isn't a dictionary.`
89
- );
90
- }
91
- return {
92
- localImages: sdkClient.unmarshalArrayOfObject(data.local_images, unmarshalLocalImage),
93
- totalCount: data.total_count
94
- };
95
- };
96
- const unmarshalListVersionsResponse = (data) => {
97
- if (!sdkClient.isJSONObject(data)) {
98
- throw new TypeError(
99
- `Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`
100
- );
101
- }
102
- return {
103
- totalCount: data.total_count,
104
- versions: sdkClient.unmarshalArrayOfObject(data.versions, unmarshalVersion)
105
- };
106
- };
107
- exports.unmarshalCategory = unmarshalCategory;
108
- exports.unmarshalImage = unmarshalImage;
109
- exports.unmarshalListCategoriesResponse = unmarshalListCategoriesResponse;
110
- exports.unmarshalListImagesResponse = unmarshalListImagesResponse;
111
- exports.unmarshalListLocalImagesResponse = unmarshalListLocalImagesResponse;
112
- exports.unmarshalListVersionsResponse = unmarshalListVersionsResponse;
113
- exports.unmarshalLocalImage = unmarshalLocalImage;
114
- exports.unmarshalVersion = unmarshalVersion;