@scaleway/sdk-test 2.2.1 → 2.3.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 CHANGED
@@ -83,6 +83,7 @@ const api = new Test.v1.API(client)
83
83
  ## Support
84
84
 
85
85
  We love feedback! Feel free to reach us on:
86
+
86
87
  - [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
87
88
  - [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
88
89
 
@@ -93,4 +94,3 @@ This repository is at its early stage and is still in active development. If you
93
94
  ## License
94
95
 
95
96
  This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
96
-
@@ -0,0 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __exportAll = (all, no_symbols) => {
3
+ let target = {};
4
+ for (var name in all) __defProp(target, name, {
5
+ get: all[name],
6
+ enumerable: true
7
+ });
8
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
9
+ return target;
10
+ };
11
+ export { __exportAll };
package/dist/index.gen.js CHANGED
@@ -1,4 +1,2 @@
1
- import * as index_gen from "./v1/index.gen.js";
2
- export {
3
- index_gen as Testv1
4
- };
1
+ import { index_gen_exports } from "./v1/index.gen.js";
2
+ export { index_gen_exports as Testv1 };
@@ -1,155 +1,115 @@
1
- import { API as API$1, urlParams, enrichForPagination, validatePathParam, waitForResource } from "@scaleway/sdk-client";
2
1
  import { HUMAN_TRANSIENT_STATUSES } from "./content.gen.js";
3
- import { marshalRegisterRequest, unmarshalRegisterResponse, unmarshalListHumansResponse, unmarshalHuman, marshalCreateHumanRequest, marshalUpdateHumanRequest } from "./marshalling.gen.js";
4
- const jsonContentHeaders = {
5
- "Content-Type": "application/json; charset=utf-8"
6
- };
7
- class API extends API$1 {
8
- /**
9
- * Register a user. Register a human and return a access-key and a secret-key that must be used in all other commands.
10
-
11
- Hint: you can use other test commands by setting the SCW_SECRET_KEY env variable.
12
- *
13
- * @param request - The request {@link RegisterRequest}
14
- * @returns A Promise of RegisterResponse
15
- */
16
- register = (request) => this.client.fetch(
17
- {
18
- body: JSON.stringify(
19
- marshalRegisterRequest(request, this.client.settings)
20
- ),
21
- headers: jsonContentHeaders,
22
- method: "POST",
23
- path: `/test/v1/register`
24
- },
25
- unmarshalRegisterResponse
26
- );
27
- pageOfListHumans = (request = {}) => this.client.fetch(
28
- {
29
- method: "GET",
30
- path: `/test/v1/humans`,
31
- urlParams: urlParams(
32
- ["order_by", request.orderBy],
33
- ["organization_id", request.organizationId],
34
- ["page", request.page],
35
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
36
- ["project_id", request.projectId]
37
- )
38
- },
39
- unmarshalListHumansResponse
40
- );
41
- /**
42
- * List all your humans.
43
- *
44
- * @param request - The request {@link ListHumansRequest}
45
- * @returns A Promise of ListHumansResponse
46
- */
47
- listHumans = (request = {}) => enrichForPagination("humans", this.pageOfListHumans, request);
48
- /**
49
- * Get human details. Get the human details associated with the given id.
50
- *
51
- * @param request - The request {@link GetHumanRequest}
52
- * @returns A Promise of Human
53
- */
54
- getHuman = (request) => this.client.fetch(
55
- {
56
- method: "GET",
57
- path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}`
58
- },
59
- unmarshalHuman
60
- );
61
- /**
62
- * Waits for {@link Human} to be in a final state.
63
- *
64
- * @param request - The request {@link GetHumanRequest}
65
- * @param options - The waiting options
66
- * @returns A Promise of Human
67
- */
68
- waitForHuman = (request, options) => waitForResource(
69
- options?.stop ?? ((res) => Promise.resolve(!HUMAN_TRANSIENT_STATUSES.includes(res.status))),
70
- this.getHuman,
71
- request,
72
- options
73
- );
74
- /**
75
- * Create a new human.
76
- *
77
- * @param request - The request {@link CreateHumanRequest}
78
- * @returns A Promise of Human
79
- */
80
- createHuman = (request) => this.client.fetch(
81
- {
82
- body: JSON.stringify(
83
- marshalCreateHumanRequest(request, this.client.settings)
84
- ),
85
- headers: jsonContentHeaders,
86
- method: "POST",
87
- path: `/test/v1/humans`
88
- },
89
- unmarshalHuman
90
- );
91
- /**
92
- * Update an existing human. Update the human associated with the given id.
93
- *
94
- * @param request - The request {@link UpdateHumanRequest}
95
- * @returns A Promise of Human
96
- */
97
- updateHuman = (request) => this.client.fetch(
98
- {
99
- body: JSON.stringify(
100
- marshalUpdateHumanRequest(request, this.client.settings)
101
- ),
102
- headers: jsonContentHeaders,
103
- method: "PATCH",
104
- path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}`
105
- },
106
- unmarshalHuman
107
- );
108
- /**
109
- * Delete an existing human. Delete the human associated with the given id.
110
- *
111
- * @param request - The request {@link DeleteHumanRequest}
112
- * @returns A Promise of Human
113
- */
114
- deleteHuman = (request) => this.client.fetch(
115
- {
116
- method: "DELETE",
117
- path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}`
118
- },
119
- unmarshalHuman
120
- );
121
- /**
122
- * Start a 1h running for the given human. Start a one hour running for the given human.
123
- *
124
- * @param request - The request {@link RunHumanRequest}
125
- * @returns A Promise of Human
126
- */
127
- runHuman = (request) => this.client.fetch(
128
- {
129
- body: "{}",
130
- headers: jsonContentHeaders,
131
- method: "POST",
132
- path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}/run`
133
- },
134
- unmarshalHuman
135
- );
136
- /**
137
- * Make a human smoke.
138
- *
139
- * @deprecated
140
- * @param request - The request {@link SmokeHumanRequest}
141
- * @returns A Promise of Human
142
- */
143
- smokeHuman = (request) => this.client.fetch(
144
- {
145
- body: "{}",
146
- headers: jsonContentHeaders,
147
- method: "POST",
148
- path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}/smoke`
149
- },
150
- unmarshalHuman
151
- );
152
- }
153
- export {
154
- API
2
+ import { marshalCreateHumanRequest, marshalRegisterRequest, marshalUpdateHumanRequest, unmarshalHuman, unmarshalListHumansResponse, unmarshalRegisterResponse } from "./marshalling.gen.js";
3
+ import { API, enrichForPagination, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
+ var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
5
+ /**
6
+ * Fake API.
7
+
8
+ No Auth Service for end-to-end testing.
9
+ */
10
+ var API$1 = class extends API {
11
+ /**
12
+ * Register a user. Register a human and return a access-key and a secret-key that must be used in all other commands.
13
+
14
+ Hint: you can use other test commands by setting the SCW_SECRET_KEY env variable.
15
+ *
16
+ * @param request - The request {@link RegisterRequest}
17
+ * @returns A Promise of RegisterResponse
18
+ */
19
+ register = (request) => this.client.fetch({
20
+ body: JSON.stringify(marshalRegisterRequest(request, this.client.settings)),
21
+ headers: jsonContentHeaders,
22
+ method: "POST",
23
+ path: `/test/v1/register`
24
+ }, unmarshalRegisterResponse);
25
+ pageOfListHumans = (request = {}) => this.client.fetch({
26
+ method: "GET",
27
+ path: `/test/v1/humans`,
28
+ urlParams: urlParams(["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId])
29
+ }, unmarshalListHumansResponse);
30
+ /**
31
+ * List all your humans.
32
+ *
33
+ * @param request - The request {@link ListHumansRequest}
34
+ * @returns A Promise of ListHumansResponse
35
+ */
36
+ listHumans = (request = {}) => enrichForPagination("humans", this.pageOfListHumans, request);
37
+ /**
38
+ * Get human details. Get the human details associated with the given id.
39
+ *
40
+ * @param request - The request {@link GetHumanRequest}
41
+ * @returns A Promise of Human
42
+ */
43
+ getHuman = (request) => this.client.fetch({
44
+ method: "GET",
45
+ path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}`
46
+ }, unmarshalHuman);
47
+ /**
48
+ * Waits for {@link Human} to be in a final state.
49
+ *
50
+ * @param request - The request {@link GetHumanRequest}
51
+ * @param options - The waiting options
52
+ * @returns A Promise of Human
53
+ */
54
+ waitForHuman = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!HUMAN_TRANSIENT_STATUSES.includes(res.status))), this.getHuman, request, options);
55
+ /**
56
+ * Create a new human.
57
+ *
58
+ * @param request - The request {@link CreateHumanRequest}
59
+ * @returns A Promise of Human
60
+ */
61
+ createHuman = (request) => this.client.fetch({
62
+ body: JSON.stringify(marshalCreateHumanRequest(request, this.client.settings)),
63
+ headers: jsonContentHeaders,
64
+ method: "POST",
65
+ path: `/test/v1/humans`
66
+ }, unmarshalHuman);
67
+ /**
68
+ * Update an existing human. Update the human associated with the given id.
69
+ *
70
+ * @param request - The request {@link UpdateHumanRequest}
71
+ * @returns A Promise of Human
72
+ */
73
+ updateHuman = (request) => this.client.fetch({
74
+ body: JSON.stringify(marshalUpdateHumanRequest(request, this.client.settings)),
75
+ headers: jsonContentHeaders,
76
+ method: "PATCH",
77
+ path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}`
78
+ }, unmarshalHuman);
79
+ /**
80
+ * Delete an existing human. Delete the human associated with the given id.
81
+ *
82
+ * @param request - The request {@link DeleteHumanRequest}
83
+ * @returns A Promise of Human
84
+ */
85
+ deleteHuman = (request) => this.client.fetch({
86
+ method: "DELETE",
87
+ path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}`
88
+ }, unmarshalHuman);
89
+ /**
90
+ * Start a 1h running for the given human. Start a one hour running for the given human.
91
+ *
92
+ * @param request - The request {@link RunHumanRequest}
93
+ * @returns A Promise of Human
94
+ */
95
+ runHuman = (request) => this.client.fetch({
96
+ body: "{}",
97
+ headers: jsonContentHeaders,
98
+ method: "POST",
99
+ path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}/run`
100
+ }, unmarshalHuman);
101
+ /**
102
+ * Make a human smoke.
103
+ *
104
+ * @deprecated
105
+ * @param request - The request {@link SmokeHumanRequest}
106
+ * @returns A Promise of Human
107
+ */
108
+ smokeHuman = (request) => this.client.fetch({
109
+ body: "{}",
110
+ headers: jsonContentHeaders,
111
+ method: "POST",
112
+ path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}/smoke`
113
+ }, unmarshalHuman);
155
114
  };
115
+ export { API$1 as API };
@@ -1,6 +1,3 @@
1
- const HUMAN_TRANSIENT_STATUSES = [
2
- "running"
3
- ];
4
- export {
5
- HUMAN_TRANSIENT_STATUSES
6
- };
1
+ /** Lists transient statutes of the enum {@link HumanStatus}. */
2
+ const HUMAN_TRANSIENT_STATUSES = ["running"];
3
+ export { HUMAN_TRANSIENT_STATUSES };
@@ -1,13 +1,15 @@
1
- import { API } from "./api.gen.js";
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
2
  import { HUMAN_TRANSIENT_STATUSES } from "./content.gen.js";
3
3
  import { marshalCreateHumanRequest, marshalRegisterRequest, marshalUpdateHumanRequest, unmarshalHuman, unmarshalListHumansResponse, unmarshalRegisterResponse } from "./marshalling.gen.js";
4
- export {
5
- API,
6
- HUMAN_TRANSIENT_STATUSES,
7
- marshalCreateHumanRequest,
8
- marshalRegisterRequest,
9
- marshalUpdateHumanRequest,
10
- unmarshalHuman,
11
- unmarshalListHumansResponse,
12
- unmarshalRegisterResponse
13
- };
4
+ import { API } from "./api.gen.js";
5
+ var index_gen_exports = /* @__PURE__ */ __exportAll({
6
+ API: () => API,
7
+ HUMAN_TRANSIENT_STATUSES: () => HUMAN_TRANSIENT_STATUSES,
8
+ marshalCreateHumanRequest: () => marshalCreateHumanRequest,
9
+ marshalRegisterRequest: () => marshalRegisterRequest,
10
+ marshalUpdateHumanRequest: () => marshalUpdateHumanRequest,
11
+ unmarshalHuman: () => unmarshalHuman,
12
+ unmarshalListHumansResponse: () => unmarshalListHumansResponse,
13
+ unmarshalRegisterResponse: () => unmarshalRegisterResponse
14
+ });
15
+ export { index_gen_exports };
@@ -1,92 +1,68 @@
1
- import { resolveOneOf, isJSONObject, unmarshalDate, unmarshalArrayOfObject } from "@scaleway/sdk-client";
1
+ import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
2
2
  const unmarshalHuman = (data) => {
3
- if (!isJSONObject(data)) {
4
- throw new TypeError(
5
- `Unmarshalling the type 'Human' failed as data isn't a dictionary.`
6
- );
7
- }
8
- return {
9
- altitudeInMeter: data.altitude_in_meter,
10
- altitudeInMillimeter: data.altitude_in_millimeter,
11
- createdAt: unmarshalDate(data.created_at),
12
- eyesColor: data.eyes_color,
13
- fingersCount: data.fingers_count,
14
- hairCount: data.hair_count,
15
- height: data.height,
16
- id: data.id,
17
- isHappy: data.is_happy,
18
- name: data.name,
19
- organizationId: data.organization_id,
20
- projectId: data.project_id,
21
- shoeSize: data.shoe_size,
22
- status: data.status,
23
- updatedAt: unmarshalDate(data.updated_at)
24
- };
3
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Human' failed as data isn't a dictionary.`);
4
+ return {
5
+ altitudeInMeter: data.altitude_in_meter,
6
+ altitudeInMillimeter: data.altitude_in_millimeter,
7
+ createdAt: unmarshalDate(data.created_at),
8
+ eyesColor: data.eyes_color,
9
+ fingersCount: data.fingers_count,
10
+ hairCount: data.hair_count,
11
+ height: data.height,
12
+ id: data.id,
13
+ isHappy: data.is_happy,
14
+ name: data.name,
15
+ organizationId: data.organization_id,
16
+ projectId: data.project_id,
17
+ shoeSize: data.shoe_size,
18
+ status: data.status,
19
+ updatedAt: unmarshalDate(data.updated_at)
20
+ };
25
21
  };
26
22
  const unmarshalListHumansResponse = (data) => {
27
- if (!isJSONObject(data)) {
28
- throw new TypeError(
29
- `Unmarshalling the type 'ListHumansResponse' failed as data isn't a dictionary.`
30
- );
31
- }
32
- return {
33
- humans: unmarshalArrayOfObject(data.humans, unmarshalHuman),
34
- totalCount: data.total_count
35
- };
23
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListHumansResponse' failed as data isn't a dictionary.`);
24
+ return {
25
+ humans: unmarshalArrayOfObject(data.humans, unmarshalHuman),
26
+ totalCount: data.total_count
27
+ };
36
28
  };
37
29
  const unmarshalRegisterResponse = (data) => {
38
- if (!isJSONObject(data)) {
39
- throw new TypeError(
40
- `Unmarshalling the type 'RegisterResponse' failed as data isn't a dictionary.`
41
- );
42
- }
43
- return {
44
- accessKey: data.access_key,
45
- secretKey: data.secret_key
46
- };
30
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'RegisterResponse' failed as data isn't a dictionary.`);
31
+ return {
32
+ accessKey: data.access_key,
33
+ secretKey: data.secret_key
34
+ };
47
35
  };
48
36
  const marshalCreateHumanRequest = (request, defaults) => ({
49
- altitude_in_meter: request.altitudeInMeter,
50
- altitude_in_millimeter: request.altitudeInMillimeter,
51
- eyes_color: request.eyesColor,
52
- fingers_count: request.fingersCount,
53
- hair_count: request.hairCount,
54
- height: request.height,
55
- is_happy: request.isHappy,
56
- name: request.name,
57
- shoe_size: request.shoeSize,
58
- ...resolveOneOf([
59
- {
60
- default: defaults.defaultProjectId,
61
- param: "project_id",
62
- value: request.projectId
63
- },
64
- {
65
- default: defaults.defaultOrganizationId,
66
- param: "organization_id",
67
- value: request.organizationId
68
- }
69
- ])
70
- });
71
- const marshalRegisterRequest = (request, defaults) => ({
72
- username: request.username
37
+ altitude_in_meter: request.altitudeInMeter,
38
+ altitude_in_millimeter: request.altitudeInMillimeter,
39
+ eyes_color: request.eyesColor,
40
+ fingers_count: request.fingersCount,
41
+ hair_count: request.hairCount,
42
+ height: request.height,
43
+ is_happy: request.isHappy,
44
+ name: request.name,
45
+ shoe_size: request.shoeSize,
46
+ ...resolveOneOf([{
47
+ default: defaults.defaultProjectId,
48
+ param: "project_id",
49
+ value: request.projectId
50
+ }, {
51
+ default: defaults.defaultOrganizationId,
52
+ param: "organization_id",
53
+ value: request.organizationId
54
+ }])
73
55
  });
56
+ const marshalRegisterRequest = (request, defaults) => ({ username: request.username });
74
57
  const marshalUpdateHumanRequest = (request, defaults) => ({
75
- altitude_in_meter: request.altitudeInMeter,
76
- altitude_in_millimeter: request.altitudeInMillimeter,
77
- eyes_color: request.eyesColor,
78
- fingers_count: request.fingersCount,
79
- hair_count: request.hairCount,
80
- height: request.height,
81
- is_happy: request.isHappy,
82
- name: request.name,
83
- shoe_size: request.shoeSize
58
+ altitude_in_meter: request.altitudeInMeter,
59
+ altitude_in_millimeter: request.altitudeInMillimeter,
60
+ eyes_color: request.eyesColor,
61
+ fingers_count: request.fingersCount,
62
+ hair_count: request.hairCount,
63
+ height: request.height,
64
+ is_happy: request.isHappy,
65
+ name: request.name,
66
+ shoe_size: request.shoeSize
84
67
  });
85
- export {
86
- marshalCreateHumanRequest,
87
- marshalRegisterRequest,
88
- marshalUpdateHumanRequest,
89
- unmarshalHuman,
90
- unmarshalListHumansResponse,
91
- unmarshalRegisterResponse
92
- };
68
+ export { marshalCreateHumanRequest, marshalRegisterRequest, marshalUpdateHumanRequest, unmarshalHuman, unmarshalListHumansResponse, unmarshalRegisterResponse };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-test",
3
- "version": "2.2.1",
3
+ "version": "2.3.1",
4
4
  "description": "Scaleway SDK test",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -27,13 +27,13 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@scaleway/random-name": "5.1.2",
30
- "@scaleway/sdk-std": "2.1.1"
30
+ "@scaleway/sdk-std": "2.2.1"
31
31
  },
32
32
  "peerDependencies": {
33
- "@scaleway/sdk-client": "^2.1.0"
33
+ "@scaleway/sdk-client": "^2.2.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@scaleway/sdk-client": "^2.1.0"
36
+ "@scaleway/sdk-client": "^2.2.1"
37
37
  },
38
38
  "scripts": {
39
39
  "package:check": "pnpm publint",