@scaleway/sdk 1.4.0 → 1.5.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/dist/index.js CHANGED
@@ -16,45 +16,47 @@ import * as index$2 from './api/applesilicon/index.js';
16
16
  export { index$2 as AppleSilicon };
17
17
  import * as index$3 from './api/baremetal/index.js';
18
18
  export { index$3 as BareMetal };
19
- import * as index$4 from './api/cockpit/index.js';
20
- export { index$4 as Cockpit };
21
- import * as index$5 from './api/container/index.js';
22
- export { index$5 as Container };
23
- import * as index$6 from './api/domain/index.js';
24
- export { index$6 as Domain };
25
- import * as index$7 from './api/flexibleip/index.js';
26
- export { index$7 as FlexibleIP };
27
- import * as index$8 from './api/function/index.js';
28
- export { index$8 as Function };
29
- import * as index$9 from './api/iam/index.js';
30
- export { index$9 as IAM };
31
- import * as index$a from './api/instance/index.js';
32
- export { index$a as Instance };
33
- import * as index$b from './api/iot/index.js';
34
- export { index$b as IOT };
35
- import * as index$c from './api/k8s/index.js';
36
- export { index$c as K8S };
37
- import * as index$d from './api/lb/index.js';
38
- export { index$d as LB };
39
- import * as index$e from './api/marketplace/index.js';
40
- export { index$e as Marketplace };
41
- import * as index$f from './api/mnq/index.js';
42
- export { index$f as MNQ };
43
- import * as index$g from './api/rdb/index.js';
44
- export { index$g as RDB };
45
- import * as index$h from './api/redis/index.js';
46
- export { index$h as Redis };
47
- import * as index$i from './api/registry/index.js';
48
- export { index$i as Registry };
49
- import * as index$j from './api/secret/index.js';
50
- export { index$j as Secret };
51
- import * as index$k from './api/test/index.js';
52
- export { index$k as Test };
53
- import * as index$l from './api/tem/index.js';
54
- export { index$l as TransactionalEmail };
55
- import * as index$m from './api/vpc/index.js';
56
- export { index$m as VPC };
57
- import * as index$n from './api/vpcgw/index.js';
58
- export { index$n as VPCGW };
59
- import * as index$o from './api/webhosting/index.js';
60
- export { index$o as Webhosting };
19
+ import * as index$4 from './api/billing/index.js';
20
+ export { index$4 as Billing };
21
+ import * as index$5 from './api/cockpit/index.js';
22
+ export { index$5 as Cockpit };
23
+ import * as index$6 from './api/container/index.js';
24
+ export { index$6 as Container };
25
+ import * as index$7 from './api/domain/index.js';
26
+ export { index$7 as Domain };
27
+ import * as index$8 from './api/flexibleip/index.js';
28
+ export { index$8 as FlexibleIP };
29
+ import * as index$9 from './api/function/index.js';
30
+ export { index$9 as Function };
31
+ import * as index$a from './api/iam/index.js';
32
+ export { index$a as IAM };
33
+ import * as index$b from './api/instance/index.js';
34
+ export { index$b as Instance };
35
+ import * as index$c from './api/iot/index.js';
36
+ export { index$c as IOT };
37
+ import * as index$d from './api/k8s/index.js';
38
+ export { index$d as K8S };
39
+ import * as index$e from './api/lb/index.js';
40
+ export { index$e as LB };
41
+ import * as index$f from './api/marketplace/index.js';
42
+ export { index$f as Marketplace };
43
+ import * as index$g from './api/mnq/index.js';
44
+ export { index$g as MNQ };
45
+ import * as index$h from './api/rdb/index.js';
46
+ export { index$h as RDB };
47
+ import * as index$i from './api/redis/index.js';
48
+ export { index$i as Redis };
49
+ import * as index$j from './api/registry/index.js';
50
+ export { index$j as Registry };
51
+ import * as index$k from './api/secret/index.js';
52
+ export { index$k as Secret };
53
+ import * as index$l from './api/test/index.js';
54
+ export { index$l as Test };
55
+ import * as index$m from './api/tem/index.js';
56
+ export { index$m as TransactionalEmail };
57
+ import * as index$n from './api/vpc/index.js';
58
+ export { index$n as VPC };
59
+ import * as index$o from './api/vpcgw/index.js';
60
+ export { index$o as VPCGW };
61
+ import * as index$p from './api/webhosting/index.js';
62
+ export { index$p as Webhosting };
@@ -1,4 +1,4 @@
1
- const version = 'v1.3.0';
1
+ const version = 'v1.4.0';
2
2
  const userAgent = `scaleway-sdk-js/${version}`;
3
3
 
4
4
  export { userAgent, version };
@@ -1,3 +1,4 @@
1
+ import { isResponse } from '../../helpers/is-response.js';
1
2
  import { isJSONObject } from '../../helpers/json.js';
2
3
  import { parseScalewayError } from '../errors/error-parser.js';
3
4
  import { ScalewayError } from '../errors/scw-error.js';
@@ -45,7 +46,7 @@ const fixLegacyTotalCount = (obj, headers) => {
45
46
  * @internal
46
47
  */
47
48
  const responseParser = (unmarshaller, responseType) => async response => {
48
- if (!(response instanceof Response)) {
49
+ if (!isResponse(response)) {
49
50
  throw new TypeError('Invalid response object');
50
51
  }
51
52
  if (response.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Scaleway SDK.",
6
6
  "keywords": [
@@ -35,5 +35,5 @@
35
35
  "bundledDependencies": [
36
36
  "@scaleway/random-name"
37
37
  ],
38
- "gitHead": "ba3d9093e2aca9b301c9a3f1f1a0f379fd87e807"
38
+ "gitHead": "a3aad988f8b23ba9b3554a3e59693a0f018546ea"
39
39
  }
@@ -1,85 +0,0 @@
1
- import { API as API$1 } from '../../../scw/api.js';
2
- import { urlParams, validatePathParam } from '../../../helpers/marshalling.js';
3
- import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
- import { unmarshalListSSHKeysResponse, marshalCreateSSHKeyRequest, unmarshalSSHKey, marshalUpdateSSHKeyRequest } from './marshalling.gen.js';
5
-
6
- // This file was automatically generated. DO NOT EDIT.
7
- const jsonContentHeaders = {
8
- 'Content-Type': 'application/json; charset=utf-8'
9
- };
10
-
11
- /** Account API. */
12
- class AccountV2Alpha1GenAPI extends API$1 {
13
- constructor() {
14
- var _this;
15
- super(...arguments);
16
- _this = this;
17
- this.pageOfListSSHKeys = function (request) {
18
- if (request === void 0) {
19
- request = {};
20
- }
21
- return _this.client.fetch({
22
- method: 'GET',
23
- path: `/account/v2alpha1/ssh-keys`,
24
- urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
25
- }, unmarshalListSSHKeysResponse);
26
- };
27
- /**
28
- * List all SSH keys of your project
29
- *
30
- * @param request - The request {@link ListSSHKeysRequest}
31
- * @returns A Promise of ListSSHKeysResponse
32
- */
33
- this.listSSHKeys = function (request) {
34
- if (request === void 0) {
35
- request = {};
36
- }
37
- return enrichForPagination('sshKeys', _this.pageOfListSSHKeys, request);
38
- };
39
- /**
40
- * Add an SSH key to your project
41
- *
42
- * @param request - The request {@link CreateSSHKeyRequest}
43
- * @returns A Promise of SSHKey
44
- */
45
- this.createSSHKey = request => this.client.fetch({
46
- body: JSON.stringify(marshalCreateSSHKeyRequest(request, this.client.settings)),
47
- headers: jsonContentHeaders,
48
- method: 'POST',
49
- path: `/account/v2alpha1/ssh-keys`
50
- }, unmarshalSSHKey);
51
- /**
52
- * Get an SSH key from your project
53
- *
54
- * @param request - The request {@link GetSSHKeyRequest}
55
- * @returns A Promise of SSHKey
56
- */
57
- this.getSSHKey = request => this.client.fetch({
58
- method: 'GET',
59
- path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
60
- }, unmarshalSSHKey);
61
- /**
62
- * Update an SSH key on your project
63
- *
64
- * @param request - The request {@link UpdateSSHKeyRequest}
65
- * @returns A Promise of SSHKey
66
- */
67
- this.updateSSHKey = request => this.client.fetch({
68
- body: JSON.stringify(marshalUpdateSSHKeyRequest(request, this.client.settings)),
69
- headers: jsonContentHeaders,
70
- method: 'PATCH',
71
- path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
72
- }, unmarshalSSHKey);
73
- /**
74
- * Remove an SSH key from your project
75
- *
76
- * @param request - The request {@link DeleteSSHKeyRequest}
77
- */
78
- this.deleteSSHKey = request => this.client.fetch({
79
- method: 'DELETE',
80
- path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
81
- });
82
- }
83
- }
84
-
85
- export { AccountV2Alpha1GenAPI };
@@ -1 +0,0 @@
1
- export { AccountV2Alpha1GenAPI as API } from './api.gen.js';
@@ -1,57 +0,0 @@
1
- import { isJSONObject } from '../../../helpers/json.js';
2
- import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
3
-
4
- // This file was automatically generated. DO NOT EDIT.
5
- const unmarshalSSHKeyCreationInfo = data => {
6
- if (!isJSONObject(data)) {
7
- throw new TypeError(`Unmarshalling the type 'SSHKeyCreationInfo' failed as data isn't a dictionary.`);
8
- }
9
- return {
10
- address: data.address,
11
- countryCode: data.country_code,
12
- userAgent: data.user_agent
13
- };
14
- };
15
- const unmarshalSSHKey = data => {
16
- if (!isJSONObject(data)) {
17
- throw new TypeError(`Unmarshalling the type 'SSHKey' failed as data isn't a dictionary.`);
18
- }
19
- return {
20
- createdAt: unmarshalDate(data.created_at),
21
- creationInfo: data.creation_info ? unmarshalSSHKeyCreationInfo(data.creation_info) : undefined,
22
- fingerprint: data.fingerprint,
23
- id: data.id,
24
- name: data.name,
25
- organizationId: data.organization_id,
26
- projectId: data.project_id,
27
- publicKey: data.public_key,
28
- updatedAt: unmarshalDate(data.updated_at)
29
- };
30
- };
31
- const unmarshalListSSHKeysResponse = data => {
32
- if (!isJSONObject(data)) {
33
- throw new TypeError(`Unmarshalling the type 'ListSSHKeysResponse' failed as data isn't a dictionary.`);
34
- }
35
- return {
36
- sshKeys: unmarshalArrayOfObject(data.ssh_keys, unmarshalSSHKey),
37
- totalCount: data.total_count
38
- };
39
- };
40
- const marshalCreateSSHKeyRequest = (request, defaults) => ({
41
- name: request.name,
42
- public_key: request.publicKey,
43
- ...resolveOneOf([{
44
- default: defaults.defaultProjectId,
45
- param: 'project_id',
46
- value: request.projectId
47
- }, {
48
- default: defaults.defaultOrganizationId,
49
- param: 'organization_id',
50
- value: request.organizationId
51
- }])
52
- });
53
- const marshalUpdateSSHKeyRequest = (request, defaults) => ({
54
- name: request.name
55
- });
56
-
57
- export { marshalCreateSSHKeyRequest, marshalUpdateSSHKeyRequest, unmarshalListSSHKeysResponse, unmarshalSSHKey };