@scaleway/sdk-account 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-account
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@scaleway/sdk-account.svg)](https://www.npmjs.com/package/@scaleway/sdk-account)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@scaleway/sdk-account.svg)](https://www.npmjs.com/package/@scaleway/sdk-account)
5
+ [![license](https://img.shields.io/npm/l/@scaleway/sdk-account.svg)](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
6
+
7
+ Scaleway SDK for Account 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-account @scaleway/sdk-client
16
+ ```
17
+
18
+ or with pnpm:
19
+
20
+ ```bash
21
+ pnpm add @scaleway/sdk-account @scaleway/sdk-client
22
+ ```
23
+
24
+ or with yarn:
25
+
26
+ ```bash
27
+ yarn add @scaleway/sdk-account @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 { Account } from '@scaleway/sdk-account'
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 Account.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 { Account } from '@scaleway/sdk-account'
62
+
63
+ const profile = loadProfileFromConfigurationFile()
64
+ const client = createClient(profile)
65
+ const api = new Account.v1.API(client)
66
+ ```
67
+
68
+ ## Documentation
69
+
70
+ - 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
71
+ - 🌐 [Scaleway Account API Documentation](https://www.scaleway.com/en/developers/api/account/)
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
+
@@ -10,12 +10,17 @@ class ContractAPI extends API {
10
10
  * @param request - The request {@link ContractApiDownloadContractSignatureRequest}
11
11
  * @returns A Promise of Blob
12
12
  */
13
- downloadContractSignature = (request) => this.client.fetch({
14
- method: "GET",
15
- path: `/account/v3/contract-signatures/${validatePathParam("contractSignatureId", request.contractSignatureId)}/download`,
16
- urlParams: urlParams(["dl", 1], ["locale", request.locale]),
17
- responseType: "blob"
18
- });
13
+ downloadContractSignature = (request) => this.client.fetch(
14
+ {
15
+ method: "GET",
16
+ path: `/account/v3/contract-signatures/${validatePathParam("contractSignatureId", request.contractSignatureId)}/download`,
17
+ urlParams: urlParams(
18
+ ["dl", 1],
19
+ ["locale", request.locale]
20
+ ),
21
+ responseType: "blob"
22
+ }
23
+ );
19
24
  /**
20
25
  * Create a signature for your Organization for the latest version of the requested contract.
21
26
  *
@@ -25,10 +30,7 @@ class ContractAPI extends API {
25
30
  createContractSignature = (request) => this.client.fetch(
26
31
  {
27
32
  body: JSON.stringify(
28
- marshalContractApiCreateContractSignatureRequest(
29
- request,
30
- this.client.settings
31
- )
33
+ marshalContractApiCreateContractSignatureRequest(request, this.client.settings)
32
34
  ),
33
35
  headers: jsonContentHeaders,
34
36
  method: "POST",
@@ -60,10 +62,7 @@ class ContractAPI extends API {
60
62
  checkContractSignature = (request) => this.client.fetch(
61
63
  {
62
64
  body: JSON.stringify(
63
- marshalContractApiCheckContractSignatureRequest(
64
- request,
65
- this.client.settings
66
- )
65
+ marshalContractApiCheckContractSignatureRequest(request, this.client.settings)
67
66
  ),
68
67
  headers: jsonContentHeaders,
69
68
  method: "POST",
@@ -77,15 +76,9 @@ class ContractAPI extends API {
77
76
  path: `/account/v3/contract-signatures`,
78
77
  urlParams: urlParams(
79
78
  ["order_by", request.orderBy],
80
- [
81
- "organization_id",
82
- request.organizationId ?? this.client.settings.defaultOrganizationId
83
- ],
79
+ ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId],
84
80
  ["page", request.page],
85
- [
86
- "page_size",
87
- request.pageSize ?? this.client.settings.defaultPageSize
88
- ]
81
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
89
82
  )
90
83
  },
91
84
  unmarshalListContractSignaturesResponse
@@ -96,11 +89,7 @@ class ContractAPI extends API {
96
89
  * @param request - The request {@link ContractApiListContractSignaturesRequest}
97
90
  * @returns A Promise of ListContractSignaturesResponse
98
91
  */
99
- listContractSignatures = (request = {}) => enrichForPagination(
100
- "contractSignatures",
101
- this.pageOfListContractSignatures,
102
- request
103
- );
92
+ listContractSignatures = (request = {}) => enrichForPagination("contractSignatures", this.pageOfListContractSignatures, request);
104
93
  }
105
94
  class ProjectAPI extends API {
106
95
  /**
@@ -127,15 +116,9 @@ class ProjectAPI extends API {
127
116
  urlParams: urlParams(
128
117
  ["name", request.name],
129
118
  ["order_by", request.orderBy],
130
- [
131
- "organization_id",
132
- request.organizationId ?? this.client.settings.defaultOrganizationId
133
- ],
119
+ ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId],
134
120
  ["page", request.page],
135
- [
136
- "page_size",
137
- request.pageSize ?? this.client.settings.defaultPageSize
138
- ],
121
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
139
122
  ["project_ids", request.projectIds]
140
123
  )
141
124
  },
@@ -166,10 +149,12 @@ class ProjectAPI extends API {
166
149
  *
167
150
  * @param request - The request {@link ProjectApiDeleteProjectRequest}
168
151
  */
169
- deleteProject = (request = {}) => this.client.fetch({
170
- method: "DELETE",
171
- path: `/account/v3/projects/${validatePathParam("projectId", request.projectId ?? this.client.settings.defaultProjectId)}`
172
- });
152
+ deleteProject = (request = {}) => this.client.fetch(
153
+ {
154
+ method: "DELETE",
155
+ path: `/account/v3/projects/${validatePathParam("projectId", request.projectId ?? this.client.settings.defaultProjectId)}`
156
+ }
157
+ );
173
158
  /**
174
159
  * Update Project. Update the parameters of an existing Project, specified by its Project ID. These parameters include the name and description.
175
160
  *
@@ -196,10 +181,7 @@ class ProjectAPI extends API {
196
181
  setProjectQualification = (request = {}) => this.client.fetch(
197
182
  {
198
183
  body: JSON.stringify(
199
- marshalProjectApiSetProjectQualificationRequest(
200
- request,
201
- this.client.settings
202
- )
184
+ marshalProjectApiSetProjectQualificationRequest(request, this.client.settings)
203
185
  ),
204
186
  headers: jsonContentHeaders,
205
187
  method: "POST",
@@ -135,9 +135,7 @@ const unmarshalQualification = (data) => {
135
135
  hostApplication: data.host_application ? unmarshalQualificationHostApplication(data.host_application) : void 0,
136
136
  hostWebsite: data.host_website ? unmarshalQualificationHostWebsite(data.host_website) : void 0,
137
137
  otherUseCase: data.other_use_case ? unmarshalQualificationOtherUseCase(data.other_use_case) : void 0,
138
- setScalewayEnvironment: data.set_scaleway_environment ? unmarshalQualificationSetScalewayEnvironment(
139
- data.set_scaleway_environment
140
- ) : void 0,
138
+ setScalewayEnvironment: data.set_scaleway_environment ? unmarshalQualificationSetScalewayEnvironment(data.set_scaleway_environment) : void 0,
141
139
  shareData: data.share_data ? unmarshalQualificationShareData(data.share_data) : void 0
142
140
  };
143
141
  };
@@ -175,10 +173,7 @@ const unmarshalListContractSignaturesResponse = (data) => {
175
173
  );
176
174
  }
177
175
  return {
178
- contractSignatures: unmarshalArrayOfObject(
179
- data.contract_signatures,
180
- unmarshalContractSignature
181
- ),
176
+ contractSignatures: unmarshalArrayOfObject(data.contract_signatures, unmarshalContractSignature),
182
177
  totalCount: data.total_count
183
178
  };
184
179
  };
@@ -256,9 +251,7 @@ const marshalQualification = (request, defaults) => ({
256
251
  },
257
252
  {
258
253
  param: "host_application",
259
- value: request.hostApplication !== void 0 ? marshalQualificationHostApplication(
260
- request.hostApplication
261
- ) : void 0
254
+ value: request.hostApplication !== void 0 ? marshalQualificationHostApplication(request.hostApplication) : void 0
262
255
  },
263
256
  {
264
257
  param: "deploy_software",
@@ -266,9 +259,7 @@ const marshalQualification = (request, defaults) => ({
266
259
  },
267
260
  {
268
261
  param: "set_scaleway_environment",
269
- value: request.setScalewayEnvironment !== void 0 ? marshalQualificationSetScalewayEnvironment(
270
- request.setScalewayEnvironment
271
- ) : void 0
262
+ value: request.setScalewayEnvironment !== void 0 ? marshalQualificationSetScalewayEnvironment(request.setScalewayEnvironment) : void 0
272
263
  },
273
264
  {
274
265
  param: "ai_machine",
package/package.json CHANGED
@@ -1,23 +1,20 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-account",
3
- "version": "1.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Scaleway SDK account",
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/account"
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("./v3/index.gen.cjs");
4
- exports.Accountv3 = index_gen;
@@ -1,214 +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
- const jsonContentHeaders = {
6
- "Content-Type": "application/json; charset=utf-8"
7
- };
8
- class ContractAPI extends sdkClient.API {
9
- /**
10
- * Download a contract content.
11
- *
12
- * @param request - The request {@link ContractApiDownloadContractSignatureRequest}
13
- * @returns A Promise of Blob
14
- */
15
- downloadContractSignature = (request) => this.client.fetch({
16
- method: "GET",
17
- path: `/account/v3/contract-signatures/${sdkClient.validatePathParam("contractSignatureId", request.contractSignatureId)}/download`,
18
- urlParams: sdkClient.urlParams(["dl", 1], ["locale", request.locale]),
19
- responseType: "blob"
20
- });
21
- /**
22
- * Create a signature for your Organization for the latest version of the requested contract.
23
- *
24
- * @param request - The request {@link ContractApiCreateContractSignatureRequest}
25
- * @returns A Promise of ContractSignature
26
- */
27
- createContractSignature = (request) => this.client.fetch(
28
- {
29
- body: JSON.stringify(
30
- marshalling_gen.marshalContractApiCreateContractSignatureRequest(
31
- request,
32
- this.client.settings
33
- )
34
- ),
35
- headers: jsonContentHeaders,
36
- method: "POST",
37
- path: `/account/v3/contract-signatures`
38
- },
39
- marshalling_gen.unmarshalContractSignature
40
- );
41
- /**
42
- * Sign a contract for your Organization.
43
- *
44
- * @param request - The request {@link ContractApiValidateContractSignatureRequest}
45
- * @returns A Promise of ContractSignature
46
- */
47
- validateContractSignature = (request) => this.client.fetch(
48
- {
49
- body: "{}",
50
- headers: jsonContentHeaders,
51
- method: "POST",
52
- path: `/account/v3/contract-signatures/${sdkClient.validatePathParam("contractSignatureId", request.contractSignatureId)}/validate`
53
- },
54
- marshalling_gen.unmarshalContractSignature
55
- );
56
- /**
57
- * Check if a contract is signed for your Organization.
58
- *
59
- * @param request - The request {@link ContractApiCheckContractSignatureRequest}
60
- * @returns A Promise of CheckContractSignatureResponse
61
- */
62
- checkContractSignature = (request) => this.client.fetch(
63
- {
64
- body: JSON.stringify(
65
- marshalling_gen.marshalContractApiCheckContractSignatureRequest(
66
- request,
67
- this.client.settings
68
- )
69
- ),
70
- headers: jsonContentHeaders,
71
- method: "POST",
72
- path: `/account/v3/contract-signatures/check`
73
- },
74
- marshalling_gen.unmarshalCheckContractSignatureResponse
75
- );
76
- pageOfListContractSignatures = (request = {}) => this.client.fetch(
77
- {
78
- method: "GET",
79
- path: `/account/v3/contract-signatures`,
80
- urlParams: sdkClient.urlParams(
81
- ["order_by", request.orderBy],
82
- [
83
- "organization_id",
84
- request.organizationId ?? this.client.settings.defaultOrganizationId
85
- ],
86
- ["page", request.page],
87
- [
88
- "page_size",
89
- request.pageSize ?? this.client.settings.defaultPageSize
90
- ]
91
- )
92
- },
93
- marshalling_gen.unmarshalListContractSignaturesResponse
94
- );
95
- /**
96
- * List contract signatures for an Organization.
97
- *
98
- * @param request - The request {@link ContractApiListContractSignaturesRequest}
99
- * @returns A Promise of ListContractSignaturesResponse
100
- */
101
- listContractSignatures = (request = {}) => sdkClient.enrichForPagination(
102
- "contractSignatures",
103
- this.pageOfListContractSignatures,
104
- request
105
- );
106
- }
107
- class ProjectAPI extends sdkClient.API {
108
- /**
109
- * Create a new Project for an Organization. Generate a new Project for an Organization, specifying its configuration including name and description.
110
- *
111
- * @param request - The request {@link ProjectApiCreateProjectRequest}
112
- * @returns A Promise of Project
113
- */
114
- createProject = (request) => this.client.fetch(
115
- {
116
- body: JSON.stringify(
117
- marshalling_gen.marshalProjectApiCreateProjectRequest(request, this.client.settings)
118
- ),
119
- headers: jsonContentHeaders,
120
- method: "POST",
121
- path: `/account/v3/projects`
122
- },
123
- marshalling_gen.unmarshalProject
124
- );
125
- pageOfListProjects = (request = {}) => this.client.fetch(
126
- {
127
- method: "GET",
128
- path: `/account/v3/projects`,
129
- urlParams: sdkClient.urlParams(
130
- ["name", request.name],
131
- ["order_by", request.orderBy],
132
- [
133
- "organization_id",
134
- request.organizationId ?? this.client.settings.defaultOrganizationId
135
- ],
136
- ["page", request.page],
137
- [
138
- "page_size",
139
- request.pageSize ?? this.client.settings.defaultPageSize
140
- ],
141
- ["project_ids", request.projectIds]
142
- )
143
- },
144
- marshalling_gen.unmarshalListProjectsResponse
145
- );
146
- /**
147
- * List all Projects of an Organization. List all Projects of an Organization. The response will include the total number of Projects as well as their associated Organizations, names, and IDs. Other information includes the creation and update date of the Project.
148
- *
149
- * @param request - The request {@link ProjectApiListProjectsRequest}
150
- * @returns A Promise of ListProjectsResponse
151
- */
152
- listProjects = (request = {}) => sdkClient.enrichForPagination("projects", this.pageOfListProjects, request);
153
- /**
154
- * Get an existing Project. Retrieve information about an existing Project, specified by its Project ID. Its full details, including ID, name and description, are returned in the response object.
155
- *
156
- * @param request - The request {@link ProjectApiGetProjectRequest}
157
- * @returns A Promise of Project
158
- */
159
- getProject = (request = {}) => this.client.fetch(
160
- {
161
- method: "GET",
162
- path: `/account/v3/projects/${sdkClient.validatePathParam("projectId", request.projectId ?? this.client.settings.defaultProjectId)}`
163
- },
164
- marshalling_gen.unmarshalProject
165
- );
166
- /**
167
- * Delete an existing Project. Delete an existing Project, specified by its Project ID. The Project needs to be empty (meaning there are no resources left in it) to be deleted effectively. Note that deleting a Project is permanent, and cannot be undone.
168
- *
169
- * @param request - The request {@link ProjectApiDeleteProjectRequest}
170
- */
171
- deleteProject = (request = {}) => this.client.fetch({
172
- method: "DELETE",
173
- path: `/account/v3/projects/${sdkClient.validatePathParam("projectId", request.projectId ?? this.client.settings.defaultProjectId)}`
174
- });
175
- /**
176
- * Update Project. Update the parameters of an existing Project, specified by its Project ID. These parameters include the name and description.
177
- *
178
- * @param request - The request {@link ProjectApiUpdateProjectRequest}
179
- * @returns A Promise of Project
180
- */
181
- updateProject = (request = {}) => this.client.fetch(
182
- {
183
- body: JSON.stringify(
184
- marshalling_gen.marshalProjectApiUpdateProjectRequest(request, this.client.settings)
185
- ),
186
- headers: jsonContentHeaders,
187
- method: "PATCH",
188
- path: `/account/v3/projects/${sdkClient.validatePathParam("projectId", request.projectId ?? this.client.settings.defaultProjectId)}`
189
- },
190
- marshalling_gen.unmarshalProject
191
- );
192
- /**
193
- * Set project use case. Set the project use case for a new or existing Project, specified by its Project ID. You can customize the use case, sub use case, and architecture type you want to use in the Project.
194
- *
195
- * @param request - The request {@link ProjectApiSetProjectQualificationRequest}
196
- * @returns A Promise of ProjectQualification
197
- */
198
- setProjectQualification = (request = {}) => this.client.fetch(
199
- {
200
- body: JSON.stringify(
201
- marshalling_gen.marshalProjectApiSetProjectQualificationRequest(
202
- request,
203
- this.client.settings
204
- )
205
- ),
206
- headers: jsonContentHeaders,
207
- method: "POST",
208
- path: `/account/v3/projects/${sdkClient.validatePathParam("projectId", request.projectId ?? this.client.settings.defaultProjectId)}/project-qualification`
209
- },
210
- marshalling_gen.unmarshalProjectQualification
211
- );
212
- }
213
- exports.ContractAPI = ContractAPI;
214
- exports.ProjectAPI = ProjectAPI;
@@ -1,19 +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
- const validationRules_gen = require("./validation-rules.gen.cjs");
6
- exports.ContractAPI = api_gen.ContractAPI;
7
- exports.ProjectAPI = api_gen.ProjectAPI;
8
- exports.marshalContractApiCheckContractSignatureRequest = marshalling_gen.marshalContractApiCheckContractSignatureRequest;
9
- exports.marshalContractApiCreateContractSignatureRequest = marshalling_gen.marshalContractApiCreateContractSignatureRequest;
10
- exports.marshalProjectApiCreateProjectRequest = marshalling_gen.marshalProjectApiCreateProjectRequest;
11
- exports.marshalProjectApiSetProjectQualificationRequest = marshalling_gen.marshalProjectApiSetProjectQualificationRequest;
12
- exports.marshalProjectApiUpdateProjectRequest = marshalling_gen.marshalProjectApiUpdateProjectRequest;
13
- exports.unmarshalCheckContractSignatureResponse = marshalling_gen.unmarshalCheckContractSignatureResponse;
14
- exports.unmarshalContractSignature = marshalling_gen.unmarshalContractSignature;
15
- exports.unmarshalListContractSignaturesResponse = marshalling_gen.unmarshalListContractSignaturesResponse;
16
- exports.unmarshalListProjectsResponse = marshalling_gen.unmarshalListProjectsResponse;
17
- exports.unmarshalProject = marshalling_gen.unmarshalProject;
18
- exports.unmarshalProjectQualification = marshalling_gen.unmarshalProjectQualification;
19
- exports.ValidationRules = validationRules_gen;
@@ -1,314 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const randomName = require("@scaleway/random-name");
4
- const sdkClient = require("@scaleway/sdk-client");
5
- const unmarshalContract = (data) => {
6
- if (!sdkClient.isJSONObject(data)) {
7
- throw new TypeError(
8
- `Unmarshalling the type 'Contract' failed as data isn't a dictionary.`
9
- );
10
- }
11
- return {
12
- createdAt: sdkClient.unmarshalDate(data.created_at),
13
- id: data.id,
14
- name: data.name,
15
- type: data.type,
16
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
17
- version: data.version
18
- };
19
- };
20
- const unmarshalContractSignature = (data) => {
21
- if (!sdkClient.isJSONObject(data)) {
22
- throw new TypeError(
23
- `Unmarshalling the type 'ContractSignature' failed as data isn't a dictionary.`
24
- );
25
- }
26
- return {
27
- contract: data.contract ? unmarshalContract(data.contract) : void 0,
28
- createdAt: sdkClient.unmarshalDate(data.created_at),
29
- expiresAt: sdkClient.unmarshalDate(data.expires_at),
30
- id: data.id,
31
- organizationId: data.organization_id,
32
- signedAt: sdkClient.unmarshalDate(data.signed_at)
33
- };
34
- };
35
- const unmarshalQualificationAiMachine = (data) => {
36
- if (!sdkClient.isJSONObject(data)) {
37
- throw new TypeError(
38
- `Unmarshalling the type 'QualificationAiMachine' failed as data isn't a dictionary.`
39
- );
40
- }
41
- return {
42
- subUseCase: data.sub_use_case
43
- };
44
- };
45
- const unmarshalQualificationArchiveData = (data) => {
46
- if (!sdkClient.isJSONObject(data)) {
47
- throw new TypeError(
48
- `Unmarshalling the type 'QualificationArchiveData' failed as data isn't a dictionary.`
49
- );
50
- }
51
- return {
52
- subUseCase: data.sub_use_case
53
- };
54
- };
55
- const unmarshalQualificationContainer = (data) => {
56
- if (!sdkClient.isJSONObject(data)) {
57
- throw new TypeError(
58
- `Unmarshalling the type 'QualificationContainer' failed as data isn't a dictionary.`
59
- );
60
- }
61
- return {
62
- subUseCase: data.sub_use_case
63
- };
64
- };
65
- const unmarshalQualificationDeploySoftware = (data) => {
66
- if (!sdkClient.isJSONObject(data)) {
67
- throw new TypeError(
68
- `Unmarshalling the type 'QualificationDeploySoftware' failed as data isn't a dictionary.`
69
- );
70
- }
71
- return {
72
- subUseCase: data.sub_use_case
73
- };
74
- };
75
- const unmarshalQualificationHostApplication = (data) => {
76
- if (!sdkClient.isJSONObject(data)) {
77
- throw new TypeError(
78
- `Unmarshalling the type 'QualificationHostApplication' failed as data isn't a dictionary.`
79
- );
80
- }
81
- return {
82
- subUseCase: data.sub_use_case
83
- };
84
- };
85
- const unmarshalQualificationHostWebsite = (data) => {
86
- if (!sdkClient.isJSONObject(data)) {
87
- throw new TypeError(
88
- `Unmarshalling the type 'QualificationHostWebsite' failed as data isn't a dictionary.`
89
- );
90
- }
91
- return {
92
- subUseCase: data.sub_use_case
93
- };
94
- };
95
- const unmarshalQualificationOtherUseCase = (data) => {
96
- if (!sdkClient.isJSONObject(data)) {
97
- throw new TypeError(
98
- `Unmarshalling the type 'QualificationOtherUseCase' failed as data isn't a dictionary.`
99
- );
100
- }
101
- return {
102
- subUseCase: data.sub_use_case
103
- };
104
- };
105
- const unmarshalQualificationSetScalewayEnvironment = (data) => {
106
- if (!sdkClient.isJSONObject(data)) {
107
- throw new TypeError(
108
- `Unmarshalling the type 'QualificationSetScalewayEnvironment' failed as data isn't a dictionary.`
109
- );
110
- }
111
- return {
112
- subUseCase: data.sub_use_case
113
- };
114
- };
115
- const unmarshalQualificationShareData = (data) => {
116
- if (!sdkClient.isJSONObject(data)) {
117
- throw new TypeError(
118
- `Unmarshalling the type 'QualificationShareData' failed as data isn't a dictionary.`
119
- );
120
- }
121
- return {
122
- subUseCase: data.sub_use_case
123
- };
124
- };
125
- const unmarshalQualification = (data) => {
126
- if (!sdkClient.isJSONObject(data)) {
127
- throw new TypeError(
128
- `Unmarshalling the type 'Qualification' failed as data isn't a dictionary.`
129
- );
130
- }
131
- return {
132
- aiMachine: data.ai_machine ? unmarshalQualificationAiMachine(data.ai_machine) : void 0,
133
- architectureType: data.architecture_type,
134
- archiveData: data.archive_data ? unmarshalQualificationArchiveData(data.archive_data) : void 0,
135
- container: data.container ? unmarshalQualificationContainer(data.container) : void 0,
136
- deploySoftware: data.deploy_software ? unmarshalQualificationDeploySoftware(data.deploy_software) : void 0,
137
- hostApplication: data.host_application ? unmarshalQualificationHostApplication(data.host_application) : void 0,
138
- hostWebsite: data.host_website ? unmarshalQualificationHostWebsite(data.host_website) : void 0,
139
- otherUseCase: data.other_use_case ? unmarshalQualificationOtherUseCase(data.other_use_case) : void 0,
140
- setScalewayEnvironment: data.set_scaleway_environment ? unmarshalQualificationSetScalewayEnvironment(
141
- data.set_scaleway_environment
142
- ) : void 0,
143
- shareData: data.share_data ? unmarshalQualificationShareData(data.share_data) : void 0
144
- };
145
- };
146
- const unmarshalProject = (data) => {
147
- if (!sdkClient.isJSONObject(data)) {
148
- throw new TypeError(
149
- `Unmarshalling the type 'Project' failed as data isn't a dictionary.`
150
- );
151
- }
152
- return {
153
- createdAt: sdkClient.unmarshalDate(data.created_at),
154
- description: data.description,
155
- id: data.id,
156
- name: data.name,
157
- organizationId: data.organization_id,
158
- qualification: data.qualification ? unmarshalQualification(data.qualification) : void 0,
159
- updatedAt: sdkClient.unmarshalDate(data.updated_at)
160
- };
161
- };
162
- const unmarshalCheckContractSignatureResponse = (data) => {
163
- if (!sdkClient.isJSONObject(data)) {
164
- throw new TypeError(
165
- `Unmarshalling the type 'CheckContractSignatureResponse' failed as data isn't a dictionary.`
166
- );
167
- }
168
- return {
169
- created: data.created,
170
- validated: data.validated
171
- };
172
- };
173
- const unmarshalListContractSignaturesResponse = (data) => {
174
- if (!sdkClient.isJSONObject(data)) {
175
- throw new TypeError(
176
- `Unmarshalling the type 'ListContractSignaturesResponse' failed as data isn't a dictionary.`
177
- );
178
- }
179
- return {
180
- contractSignatures: sdkClient.unmarshalArrayOfObject(
181
- data.contract_signatures,
182
- unmarshalContractSignature
183
- ),
184
- totalCount: data.total_count
185
- };
186
- };
187
- const unmarshalListProjectsResponse = (data) => {
188
- if (!sdkClient.isJSONObject(data)) {
189
- throw new TypeError(
190
- `Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary.`
191
- );
192
- }
193
- return {
194
- projects: sdkClient.unmarshalArrayOfObject(data.projects, unmarshalProject),
195
- totalCount: data.total_count
196
- };
197
- };
198
- const unmarshalProjectQualification = (data) => {
199
- if (!sdkClient.isJSONObject(data)) {
200
- throw new TypeError(
201
- `Unmarshalling the type 'ProjectQualification' failed as data isn't a dictionary.`
202
- );
203
- }
204
- return {
205
- projectId: data.project_id,
206
- qualification: data.qualification ? unmarshalQualification(data.qualification) : void 0
207
- };
208
- };
209
- const marshalContractApiCheckContractSignatureRequest = (request, defaults) => ({
210
- contract_name: request.contractName,
211
- contract_type: request.contractType,
212
- organization_id: request.organizationId ?? defaults.defaultOrganizationId
213
- });
214
- const marshalContractApiCreateContractSignatureRequest = (request, defaults) => ({
215
- contract_name: request.contractName,
216
- contract_type: request.contractType,
217
- organization_id: request.organizationId ?? defaults.defaultOrganizationId,
218
- validated: request.validated
219
- });
220
- const marshalProjectApiCreateProjectRequest = (request, defaults) => ({
221
- description: request.description,
222
- name: request.name || randomName("proj"),
223
- organization_id: request.organizationId ?? defaults.defaultOrganizationId
224
- });
225
- const marshalQualificationAiMachine = (request, defaults) => ({
226
- sub_use_case: request.subUseCase
227
- });
228
- const marshalQualificationArchiveData = (request, defaults) => ({
229
- sub_use_case: request.subUseCase
230
- });
231
- const marshalQualificationContainer = (request, defaults) => ({
232
- sub_use_case: request.subUseCase
233
- });
234
- const marshalQualificationDeploySoftware = (request, defaults) => ({
235
- sub_use_case: request.subUseCase
236
- });
237
- const marshalQualificationHostApplication = (request, defaults) => ({
238
- sub_use_case: request.subUseCase
239
- });
240
- const marshalQualificationHostWebsite = (request, defaults) => ({
241
- sub_use_case: request.subUseCase
242
- });
243
- const marshalQualificationOtherUseCase = (request, defaults) => ({
244
- sub_use_case: request.subUseCase
245
- });
246
- const marshalQualificationSetScalewayEnvironment = (request, defaults) => ({
247
- sub_use_case: request.subUseCase
248
- });
249
- const marshalQualificationShareData = (request, defaults) => ({
250
- sub_use_case: request.subUseCase
251
- });
252
- const marshalQualification = (request, defaults) => ({
253
- architecture_type: request.architectureType,
254
- ...sdkClient.resolveOneOf([
255
- {
256
- param: "host_website",
257
- value: request.hostWebsite !== void 0 ? marshalQualificationHostWebsite(request.hostWebsite) : void 0
258
- },
259
- {
260
- param: "host_application",
261
- value: request.hostApplication !== void 0 ? marshalQualificationHostApplication(
262
- request.hostApplication
263
- ) : void 0
264
- },
265
- {
266
- param: "deploy_software",
267
- value: request.deploySoftware !== void 0 ? marshalQualificationDeploySoftware(request.deploySoftware) : void 0
268
- },
269
- {
270
- param: "set_scaleway_environment",
271
- value: request.setScalewayEnvironment !== void 0 ? marshalQualificationSetScalewayEnvironment(
272
- request.setScalewayEnvironment
273
- ) : void 0
274
- },
275
- {
276
- param: "ai_machine",
277
- value: request.aiMachine !== void 0 ? marshalQualificationAiMachine(request.aiMachine) : void 0
278
- },
279
- {
280
- param: "container",
281
- value: request.container !== void 0 ? marshalQualificationContainer(request.container) : void 0
282
- },
283
- {
284
- param: "archive_data",
285
- value: request.archiveData !== void 0 ? marshalQualificationArchiveData(request.archiveData) : void 0
286
- },
287
- {
288
- param: "share_data",
289
- value: request.shareData !== void 0 ? marshalQualificationShareData(request.shareData) : void 0
290
- },
291
- {
292
- param: "other_use_case",
293
- value: request.otherUseCase !== void 0 ? marshalQualificationOtherUseCase(request.otherUseCase) : void 0
294
- }
295
- ])
296
- });
297
- const marshalProjectApiSetProjectQualificationRequest = (request, defaults) => ({
298
- qualification: request.qualification !== void 0 ? marshalQualification(request.qualification) : void 0
299
- });
300
- const marshalProjectApiUpdateProjectRequest = (request, defaults) => ({
301
- description: request.description,
302
- name: request.name
303
- });
304
- exports.marshalContractApiCheckContractSignatureRequest = marshalContractApiCheckContractSignatureRequest;
305
- exports.marshalContractApiCreateContractSignatureRequest = marshalContractApiCreateContractSignatureRequest;
306
- exports.marshalProjectApiCreateProjectRequest = marshalProjectApiCreateProjectRequest;
307
- exports.marshalProjectApiSetProjectQualificationRequest = marshalProjectApiSetProjectQualificationRequest;
308
- exports.marshalProjectApiUpdateProjectRequest = marshalProjectApiUpdateProjectRequest;
309
- exports.unmarshalCheckContractSignatureResponse = unmarshalCheckContractSignatureResponse;
310
- exports.unmarshalContractSignature = unmarshalContractSignature;
311
- exports.unmarshalListContractSignaturesResponse = unmarshalListContractSignaturesResponse;
312
- exports.unmarshalListProjectsResponse = unmarshalListProjectsResponse;
313
- exports.unmarshalProject = unmarshalProject;
314
- exports.unmarshalProjectQualification = unmarshalProjectQualification;
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const ContractApiCheckContractSignatureRequest = {
4
- contractName: {
5
- minLength: 1
6
- }
7
- };
8
- const ContractApiCreateContractSignatureRequest = {
9
- contractName: {
10
- minLength: 1
11
- }
12
- };
13
- const ContractApiListContractSignaturesRequest = {
14
- page: {
15
- greaterThan: 0
16
- },
17
- pageSize: {
18
- greaterThanOrEqual: 1,
19
- lessThanOrEqual: 100
20
- }
21
- };
22
- const ProjectApiCreateProjectRequest = {
23
- description: {
24
- maxLength: 200
25
- },
26
- name: {
27
- maxLength: 64,
28
- minLength: 1,
29
- pattern: /^[a-zA-Z0-9\._\- ]+$/
30
- }
31
- };
32
- const ProjectApiListProjectsRequest = {
33
- name: {
34
- maxLength: 64,
35
- minLength: 1,
36
- pattern: /^[a-zA-Z0-9\._\- ]+$/
37
- },
38
- page: {
39
- greaterThan: 0
40
- },
41
- pageSize: {
42
- greaterThanOrEqual: 1,
43
- lessThanOrEqual: 100
44
- }
45
- };
46
- const ProjectApiUpdateProjectRequest = {
47
- description: {
48
- maxLength: 200
49
- },
50
- name: {
51
- maxLength: 64,
52
- minLength: 1,
53
- pattern: /^[a-zA-Z0-9\._\- ]+$/
54
- }
55
- };
56
- exports.ContractApiCheckContractSignatureRequest = ContractApiCheckContractSignatureRequest;
57
- exports.ContractApiCreateContractSignatureRequest = ContractApiCreateContractSignatureRequest;
58
- exports.ContractApiListContractSignaturesRequest = ContractApiListContractSignaturesRequest;
59
- exports.ProjectApiCreateProjectRequest = ProjectApiCreateProjectRequest;
60
- exports.ProjectApiListProjectsRequest = ProjectApiListProjectsRequest;
61
- exports.ProjectApiUpdateProjectRequest = ProjectApiUpdateProjectRequest;