@scaleway/sdk-test 2.2.0 → 2.3.0

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,158 +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
- [
36
- "page_size",
37
- request.pageSize ?? this.client.settings.defaultPageSize
38
- ],
39
- ["project_id", request.projectId]
40
- )
41
- },
42
- unmarshalListHumansResponse
43
- );
44
- /**
45
- * List all your humans.
46
- *
47
- * @param request - The request {@link ListHumansRequest}
48
- * @returns A Promise of ListHumansResponse
49
- */
50
- listHumans = (request = {}) => enrichForPagination("humans", this.pageOfListHumans, request);
51
- /**
52
- * Get human details. Get the human details associated with the given id.
53
- *
54
- * @param request - The request {@link GetHumanRequest}
55
- * @returns A Promise of Human
56
- */
57
- getHuman = (request) => this.client.fetch(
58
- {
59
- method: "GET",
60
- path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}`
61
- },
62
- unmarshalHuman
63
- );
64
- /**
65
- * Waits for {@link Human} to be in a final state.
66
- *
67
- * @param request - The request {@link GetHumanRequest}
68
- * @param options - The waiting options
69
- * @returns A Promise of Human
70
- */
71
- waitForHuman = (request, options) => waitForResource(
72
- options?.stop ?? ((res) => Promise.resolve(!HUMAN_TRANSIENT_STATUSES.includes(res.status))),
73
- this.getHuman,
74
- request,
75
- options
76
- );
77
- /**
78
- * Create a new human.
79
- *
80
- * @param request - The request {@link CreateHumanRequest}
81
- * @returns A Promise of Human
82
- */
83
- createHuman = (request) => this.client.fetch(
84
- {
85
- body: JSON.stringify(
86
- marshalCreateHumanRequest(request, this.client.settings)
87
- ),
88
- headers: jsonContentHeaders,
89
- method: "POST",
90
- path: `/test/v1/humans`
91
- },
92
- unmarshalHuman
93
- );
94
- /**
95
- * Update an existing human. Update the human associated with the given id.
96
- *
97
- * @param request - The request {@link UpdateHumanRequest}
98
- * @returns A Promise of Human
99
- */
100
- updateHuman = (request) => this.client.fetch(
101
- {
102
- body: JSON.stringify(
103
- marshalUpdateHumanRequest(request, this.client.settings)
104
- ),
105
- headers: jsonContentHeaders,
106
- method: "PATCH",
107
- path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}`
108
- },
109
- unmarshalHuman
110
- );
111
- /**
112
- * Delete an existing human. Delete the human associated with the given id.
113
- *
114
- * @param request - The request {@link DeleteHumanRequest}
115
- * @returns A Promise of Human
116
- */
117
- deleteHuman = (request) => this.client.fetch(
118
- {
119
- method: "DELETE",
120
- path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}`
121
- },
122
- unmarshalHuman
123
- );
124
- /**
125
- * Start a 1h running for the given human. Start a one hour running for the given human.
126
- *
127
- * @param request - The request {@link RunHumanRequest}
128
- * @returns A Promise of Human
129
- */
130
- runHuman = (request) => this.client.fetch(
131
- {
132
- body: "{}",
133
- headers: jsonContentHeaders,
134
- method: "POST",
135
- path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}/run`
136
- },
137
- unmarshalHuman
138
- );
139
- /**
140
- * Make a human smoke.
141
- *
142
- * @deprecated
143
- * @param request - The request {@link SmokeHumanRequest}
144
- * @returns A Promise of Human
145
- */
146
- smokeHuman = (request) => this.client.fetch(
147
- {
148
- body: "{}",
149
- headers: jsonContentHeaders,
150
- method: "POST",
151
- path: `/test/v1/humans/${validatePathParam("humanId", request.humanId)}/smoke`
152
- },
153
- unmarshalHuman
154
- );
155
- }
156
- export {
157
- 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);
158
114
  };
115
+ export { API$1 as API };
@@ -1,4 +1,3 @@
1
+ /** Lists transient statutes of the enum {@link HumanStatus}. */
1
2
  const HUMAN_TRANSIENT_STATUSES = ["running"];
2
- export {
3
- HUMAN_TRANSIENT_STATUSES
4
- };
3
+ export { HUMAN_TRANSIENT_STATUSES };
@@ -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 { CreateHumanRequest, DeleteHumanRequest, EyeColors, GetHumanRequest, Human, HumanStatus, ListHumansRequest, ListHumansRequestOrderBy, ListHumansResponse, RegisterRequest, RegisterResponse, RunHumanRequest, SmokeHumanRequest, UpdateHumanRequest, } from './types.gen.js';
@@ -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.0",
3
+ "version": "2.3.0",
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.0"
30
+ "@scaleway/sdk-std": "2.2.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@scaleway/sdk-client": "^2.1.0"
33
+ "@scaleway/sdk-client": "^2.2.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@scaleway/sdk-client": "^2.1.0"
36
+ "@scaleway/sdk-client": "^2.2.0"
37
37
  },
38
38
  "scripts": {
39
39
  "package:check": "pnpm publint",