@scaleway/sdk 3.0.0-alpha.0 → 3.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/dist/index.gen.d.ts +362 -0
- package/dist/index.gen.js +323 -0
- package/package.json +71 -25
- package/README.md +0 -46
- package/dist/api/account/index.js +0 -4
- package/dist/api/account/v2/api.gen.js +0 -147
- package/dist/api/account/v2/index.gen.js +0 -4
- package/dist/api/account/v2/marshalling.gen.js +0 -39
- package/dist/api/account/v3/api.gen.js +0 -129
- package/dist/api/account/v3/index.gen.js +0 -6
- package/dist/api/account/v3/marshalling.gen.js +0 -39
- package/dist/api/account/v3/validation-rules.gen.js +0 -39
- package/dist/api/applesilicon/index.js +0 -2
- package/dist/api/applesilicon/v1alpha1/api.gen.js +0 -220
- package/dist/api/applesilicon/v1alpha1/content.gen.js +0 -7
- package/dist/api/applesilicon/v1alpha1/index.gen.js +0 -5
- package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +0 -113
- package/dist/api/baremetal/index.js +0 -2
- package/dist/api/baremetal/v1/api.gen.js +0 -523
- package/dist/api/baremetal/v1/api.utils.js +0 -27
- package/dist/api/baremetal/v1/content.gen.js +0 -13
- package/dist/api/baremetal/v1/index.js +0 -5
- package/dist/api/baremetal/v1/marshalling.gen.js +0 -395
- package/dist/api/baremetal/v1/validation-rules.gen.js +0 -109
- package/dist/api/billing/index.js +0 -2
- package/dist/api/billing/v2alpha1/api.gen.js +0 -80
- package/dist/api/billing/v2alpha1/index.gen.js +0 -4
- package/dist/api/billing/v2alpha1/marshalling.gen.js +0 -53
- package/dist/api/block/index.js +0 -2
- package/dist/api/block/v1alpha1/api.gen.js +0 -245
- package/dist/api/block/v1alpha1/content.gen.js +0 -13
- package/dist/api/block/v1alpha1/index.gen.js +0 -7
- package/dist/api/block/v1alpha1/marshalling.gen.js +0 -175
- package/dist/api/block/v1alpha1/validation-rules.gen.js +0 -42
- package/dist/api/cockpit/index.js +0 -2
- package/dist/api/cockpit/v1beta1/api.gen.js +0 -448
- package/dist/api/cockpit/v1beta1/content.gen.js +0 -7
- package/dist/api/cockpit/v1beta1/index.gen.js +0 -5
- package/dist/api/cockpit/v1beta1/marshalling.gen.js +0 -220
- package/dist/api/container/index.js +0 -2
- package/dist/api/container/v1beta1/api.gen.js +0 -549
- package/dist/api/container/v1beta1/content.gen.js +0 -22
- package/dist/api/container/v1beta1/index.gen.js +0 -5
- package/dist/api/container/v1beta1/marshalling.gen.js +0 -330
- package/dist/api/document_db/index.js +0 -2
- package/dist/api/document_db/v1beta1/api.gen.js +0 -830
- package/dist/api/document_db/v1beta1/content.gen.js +0 -19
- package/dist/api/document_db/v1beta1/index.gen.js +0 -7
- package/dist/api/document_db/v1beta1/marshalling.gen.js +0 -580
- package/dist/api/document_db/v1beta1/validation-rules.gen.js +0 -10
- package/dist/api/domain/index.js +0 -2
- package/dist/api/domain/v2beta1/api.gen.js +0 -875
- package/dist/api/domain/v2beta1/content.gen.js +0 -28
- package/dist/api/domain/v2beta1/index.gen.js +0 -7
- package/dist/api/domain/v2beta1/marshalling.gen.js +0 -958
- package/dist/api/flexibleip/index.js +0 -2
- package/dist/api/flexibleip/v1alpha1/api.gen.js +0 -203
- package/dist/api/flexibleip/v1alpha1/content.gen.js +0 -10
- package/dist/api/flexibleip/v1alpha1/index.gen.js +0 -7
- package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +0 -97
- package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +0 -14
- package/dist/api/function/index.js +0 -2
- package/dist/api/function/v1beta1/api.gen.js +0 -560
- package/dist/api/function/v1beta1/content.gen.js +0 -22
- package/dist/api/function/v1beta1/index.gen.js +0 -5
- package/dist/api/function/v1beta1/marshalling.gen.js +0 -368
- package/dist/api/iam/index.js +0 -2
- package/dist/api/iam/v1alpha1/api.gen.js +0 -799
- package/dist/api/iam/v1alpha1/index.gen.js +0 -6
- package/dist/api/iam/v1alpha1/marshalling.gen.js +0 -373
- package/dist/api/iam/v1alpha1/validation-rules.gen.js +0 -207
- package/dist/api/instance/index.js +0 -2
- package/dist/api/instance/v1/api.gen.js +0 -1003
- package/dist/api/instance/v1/api.utils.js +0 -369
- package/dist/api/instance/v1/content.gen.js +0 -31
- package/dist/api/instance/v1/index.js +0 -2
- package/dist/api/instance/v1/marshalling.gen.js +0 -1206
- package/dist/api/instance/v1/marshalling.utils.js +0 -63
- package/dist/api/iot/index.js +0 -2
- package/dist/api/iot/v1/api.gen.js +0 -581
- package/dist/api/iot/v1/content.gen.js +0 -7
- package/dist/api/iot/v1/index.gen.js +0 -5
- package/dist/api/iot/v1/marshalling.gen.js +0 -388
- package/dist/api/ipfs/index.js +0 -2
- package/dist/api/ipfs/v1alpha1/api.gen.js +0 -197
- package/dist/api/ipfs/v1alpha1/content.gen.js +0 -7
- package/dist/api/ipfs/v1alpha1/index.gen.js +0 -5
- package/dist/api/ipfs/v1alpha1/marshalling.gen.js +0 -121
- package/dist/api/k8s/index.js +0 -2
- package/dist/api/k8s/v1/api.gen.js +0 -454
- package/dist/api/k8s/v1/api.utils.js +0 -13
- package/dist/api/k8s/v1/content.gen.js +0 -13
- package/dist/api/k8s/v1/index.js +0 -4
- package/dist/api/k8s/v1/marshalling.gen.js +0 -333
- package/dist/api/k8s/v1/validation-rules.gen.js +0 -101
- package/dist/api/lb/index.js +0 -2
- package/dist/api/lb/v1/api.gen.js +0 -1669
- package/dist/api/lb/v1/api.utils.js +0 -81
- package/dist/api/lb/v1/content.gen.js +0 -16
- package/dist/api/lb/v1/index.js +0 -2
- package/dist/api/lb/v1/marshalling.gen.js +0 -923
- package/dist/api/marketplace/index.js +0 -4
- package/dist/api/marketplace/v1/api.gen.js +0 -60
- package/dist/api/marketplace/v1/index.gen.js +0 -4
- package/dist/api/marketplace/v1/marshalling.gen.js +0 -92
- package/dist/api/marketplace/v2/api.gen.js +0 -162
- package/dist/api/marketplace/v2/index.gen.js +0 -4
- package/dist/api/marketplace/v2/marshalling.gen.js +0 -94
- package/dist/api/mnq/index.js +0 -2
- package/dist/api/mnq/v1alpha1/api.gen.js +0 -205
- package/dist/api/mnq/v1alpha1/index.gen.js +0 -4
- package/dist/api/mnq/v1alpha1/marshalling.gen.js +0 -121
- package/dist/api/rdb/index.js +0 -2
- package/dist/api/rdb/v1/api.gen.js +0 -972
- package/dist/api/rdb/v1/content.gen.js +0 -22
- package/dist/api/rdb/v1/index.gen.js +0 -7
- package/dist/api/rdb/v1/marshalling.gen.js +0 -636
- package/dist/api/rdb/v1/validation-rules.gen.js +0 -10
- package/dist/api/redis/index.js +0 -2
- package/dist/api/redis/v1/api.gen.js +0 -389
- package/dist/api/redis/v1/content.gen.js +0 -7
- package/dist/api/redis/v1/index.gen.js +0 -5
- package/dist/api/redis/v1/marshalling.gen.js +0 -259
- package/dist/api/registry/index.js +0 -2
- package/dist/api/registry/v1/api.gen.js +0 -252
- package/dist/api/registry/v1/content.gen.js +0 -13
- package/dist/api/registry/v1/index.gen.js +0 -5
- package/dist/api/registry/v1/marshalling.gen.js +0 -106
- package/dist/api/secret/index.js +0 -2
- package/dist/api/secret/v1alpha1/api.gen.js +0 -415
- package/dist/api/secret/v1alpha1/index.gen.js +0 -4
- package/dist/api/secret/v1alpha1/marshalling.gen.js +0 -143
- package/dist/api/tem/index.js +0 -2
- package/dist/api/tem/v1alpha1/api.gen.js +0 -229
- package/dist/api/tem/v1alpha1/content.gen.js +0 -10
- package/dist/api/tem/v1alpha1/index.gen.js +0 -5
- package/dist/api/tem/v1alpha1/marshalling.gen.js +0 -159
- package/dist/api/test/index.js +0 -2
- package/dist/api/test/v1/api.gen.js +0 -152
- package/dist/api/test/v1/content.gen.js +0 -7
- package/dist/api/test/v1/index.gen.js +0 -5
- package/dist/api/test/v1/marshalling.gen.js +0 -79
- package/dist/api/vpc/index.js +0 -4
- package/dist/api/vpc/v1/api.gen.js +0 -110
- package/dist/api/vpc/v1/index.gen.js +0 -4
- package/dist/api/vpc/v1/marshalling.gen.js +0 -44
- package/dist/api/vpc/v2/api.gen.js +0 -276
- package/dist/api/vpc/v2/index.gen.js +0 -4
- package/dist/api/vpc/v2/marshalling.gen.js +0 -135
- package/dist/api/vpcgw/index.js +0 -2
- package/dist/api/vpcgw/v1/api.gen.js +0 -669
- package/dist/api/vpcgw/v1/content.gen.js +0 -10
- package/dist/api/vpcgw/v1/index.gen.js +0 -5
- package/dist/api/vpcgw/v1/marshalling.gen.js +0 -336
- package/dist/api/webhosting/index.js +0 -2
- package/dist/api/webhosting/v1alpha1/api.gen.js +0 -210
- package/dist/api/webhosting/v1alpha1/content.gen.js +0 -7
- package/dist/api/webhosting/v1alpha1/index.gen.js +0 -7
- package/dist/api/webhosting/v1alpha1/marshalling.gen.js +0 -173
- package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +0 -23
- package/dist/helpers/is-browser.js +0 -5
- package/dist/helpers/is-response.js +0 -10
- package/dist/helpers/json.js +0 -11
- package/dist/helpers/marshalling.js +0 -130
- package/dist/index.cjs +0 -24364
- package/dist/index.d.ts +0 -27584
- package/dist/index.js +0 -69
- package/dist/internal/async/interval-retrier.js +0 -105
- package/dist/internal/async/sleep.js +0 -13
- package/dist/internal/interceptors/composer.js +0 -46
- package/dist/internal/interceptors/helpers.js +0 -32
- package/dist/internal/logger/console-logger.js +0 -38
- package/dist/internal/logger/index.js +0 -41
- package/dist/internal/logger/level-resolver.js +0 -13
- package/dist/internal/validations/string-validation.js +0 -38
- package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js +0 -13
- package/dist/scw/api.js +0 -12
- package/dist/scw/auth.js +0 -68
- package/dist/scw/client-ini-factory.js +0 -174
- package/dist/scw/client-ini-profile.js +0 -54
- package/dist/scw/client-settings.js +0 -78
- package/dist/scw/client.js +0 -98
- package/dist/scw/constants.js +0 -4
- package/dist/scw/custom-marshalling.js +0 -131
- package/dist/scw/errors/error-parser.js +0 -107
- package/dist/scw/errors/non-standard/invalid-request-mapper.js +0 -36
- package/dist/scw/errors/non-standard/unknown-resource-mapper.js +0 -27
- package/dist/scw/errors/scw-error.js +0 -66
- package/dist/scw/errors/standard/already-exists-error.js +0 -26
- package/dist/scw/errors/standard/denied-authentication-error.js +0 -52
- package/dist/scw/errors/standard/index.js +0 -13
- package/dist/scw/errors/standard/invalid-arguments-error.js +0 -67
- package/dist/scw/errors/standard/out-of-stock-error.js +0 -22
- package/dist/scw/errors/standard/permissions-denied-error.js +0 -48
- package/dist/scw/errors/standard/precondition-failed-error.js +0 -42
- package/dist/scw/errors/standard/quotas-exceeded-error.js +0 -68
- package/dist/scw/errors/standard/resource-expired-error.js +0 -26
- package/dist/scw/errors/standard/resource-locked-error.js +0 -25
- package/dist/scw/errors/standard/resource-not-found-error.js +0 -25
- package/dist/scw/errors/standard/too-many-requests-error.js +0 -70
- package/dist/scw/errors/standard/transient-state-error.js +0 -26
- package/dist/scw/errors/types.js +0 -23
- package/dist/scw/fetch/build-fetcher.js +0 -72
- package/dist/scw/fetch/http-dumper.js +0 -54
- package/dist/scw/fetch/http-interceptors.js +0 -99
- package/dist/scw/fetch/resource-paginator.js +0 -84
- package/dist/scw/fetch/response-parser.js +0 -72
- package/node_modules/@scaleway/random-name/.npmignore +0 -4
- package/node_modules/@scaleway/random-name/CHANGELOG.md +0 -129
- package/node_modules/@scaleway/random-name/LICENSE.md +0 -21
- package/node_modules/@scaleway/random-name/README.md +0 -26
- package/node_modules/@scaleway/random-name/dist/index.d.ts +0 -3
- package/node_modules/@scaleway/random-name/dist/index.js +0 -13
- package/node_modules/@scaleway/random-name/package.json +0 -23
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { isJSONObject } from '../../../helpers/json.js';
|
|
2
|
-
import { unmarshalMoney } from '../../../scw/custom-marshalling.js';
|
|
3
|
-
import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshalling.js';
|
|
4
|
-
|
|
5
|
-
// This file was automatically generated. DO NOT EDIT.
|
|
6
|
-
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
7
|
-
const unmarshalHostingCpanelUrls = data => {
|
|
8
|
-
if (!isJSONObject(data)) {
|
|
9
|
-
throw new TypeError(`Unmarshalling the type 'HostingCpanelUrls' failed as data isn't a dictionary.`);
|
|
10
|
-
}
|
|
11
|
-
return {
|
|
12
|
-
dashboard: data.dashboard,
|
|
13
|
-
webmail: data.webmail
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
const unmarshalHostingOption = data => {
|
|
17
|
-
if (!isJSONObject(data)) {
|
|
18
|
-
throw new TypeError(`Unmarshalling the type 'HostingOption' failed as data isn't a dictionary.`);
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
id: data.id,
|
|
22
|
-
name: data.name
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
const unmarshalHosting = data => {
|
|
26
|
-
if (!isJSONObject(data)) {
|
|
27
|
-
throw new TypeError(`Unmarshalling the type 'Hosting' failed as data isn't a dictionary.`);
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
cpanelUrls: unmarshalHostingCpanelUrls(data.cpanel_urls),
|
|
31
|
-
createdAt: unmarshalDate(data.created_at),
|
|
32
|
-
dnsStatus: data.dns_status,
|
|
33
|
-
domain: data.domain,
|
|
34
|
-
id: data.id,
|
|
35
|
-
offerEndOfLife: data.offer_end_of_life,
|
|
36
|
-
offerId: data.offer_id,
|
|
37
|
-
offerName: data.offer_name,
|
|
38
|
-
options: unmarshalArrayOfObject(data.options, unmarshalHostingOption),
|
|
39
|
-
organizationId: data.organization_id,
|
|
40
|
-
platformHostname: data.platform_hostname,
|
|
41
|
-
platformNumber: data.platform_number ? data.platform_number : undefined,
|
|
42
|
-
projectId: data.project_id,
|
|
43
|
-
region: data.region,
|
|
44
|
-
status: data.status,
|
|
45
|
-
tags: data.tags,
|
|
46
|
-
updatedAt: unmarshalDate(data.updated_at),
|
|
47
|
-
username: data.username
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
const unmarshalNameserver = data => {
|
|
51
|
-
if (!isJSONObject(data)) {
|
|
52
|
-
throw new TypeError(`Unmarshalling the type 'Nameserver' failed as data isn't a dictionary.`);
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
hostname: data.hostname,
|
|
56
|
-
isDefault: data.is_default,
|
|
57
|
-
status: data.status
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
const unmarshalDnsRecord = data => {
|
|
61
|
-
if (!isJSONObject(data)) {
|
|
62
|
-
throw new TypeError(`Unmarshalling the type 'DnsRecord' failed as data isn't a dictionary.`);
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
name: data.name,
|
|
66
|
-
priority: data.priority ? data.priority : undefined,
|
|
67
|
-
status: data.status,
|
|
68
|
-
ttl: data.ttl,
|
|
69
|
-
type: data.type,
|
|
70
|
-
value: data.value
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
const unmarshalDnsRecords = data => {
|
|
74
|
-
if (!isJSONObject(data)) {
|
|
75
|
-
throw new TypeError(`Unmarshalling the type 'DnsRecords' failed as data isn't a dictionary.`);
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
nameServers: unmarshalArrayOfObject(data.name_servers, unmarshalNameserver),
|
|
79
|
-
records: unmarshalArrayOfObject(data.records, unmarshalDnsRecord),
|
|
80
|
-
status: data.status
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
const unmarshalDediboxHosting = data => {
|
|
84
|
-
if (!isJSONObject(data)) {
|
|
85
|
-
throw new TypeError(`Unmarshalling the type 'DediboxHosting' failed as data isn't a dictionary.`);
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
dediboxId: data.dedibox_id,
|
|
89
|
-
domain: data.domain,
|
|
90
|
-
offerId: data.offer_id,
|
|
91
|
-
type: data.type
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
const unmarshalListDediboxHostingsResponse = data => {
|
|
95
|
-
if (!isJSONObject(data)) {
|
|
96
|
-
throw new TypeError(`Unmarshalling the type 'ListDediboxHostingsResponse' failed as data isn't a dictionary.`);
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
dediboxHostings: unmarshalArrayOfObject(data.dedibox_hostings, unmarshalDediboxHosting),
|
|
100
|
-
totalCount: data.total_count
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
const unmarshalListHostingsResponse = data => {
|
|
104
|
-
if (!isJSONObject(data)) {
|
|
105
|
-
throw new TypeError(`Unmarshalling the type 'ListHostingsResponse' failed as data isn't a dictionary.`);
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
hostings: unmarshalArrayOfObject(data.hostings, unmarshalHosting),
|
|
109
|
-
totalCount: data.total_count
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
const unmarshalOfferProduct = data => {
|
|
113
|
-
if (!isJSONObject(data)) {
|
|
114
|
-
throw new TypeError(`Unmarshalling the type 'OfferProduct' failed as data isn't a dictionary.`);
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
databasesQuota: data.databases_quota,
|
|
118
|
-
emailAccountsQuota: data.email_accounts_quota,
|
|
119
|
-
emailStorageQuota: data.email_storage_quota,
|
|
120
|
-
hostingStorageQuota: data.hosting_storage_quota,
|
|
121
|
-
maxAddonDomains: data.max_addon_domains,
|
|
122
|
-
name: data.name,
|
|
123
|
-
option: data.option,
|
|
124
|
-
ram: data.ram,
|
|
125
|
-
supportIncluded: data.support_included,
|
|
126
|
-
vCpu: data.v_cpu
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
const unmarshalOffer = data => {
|
|
130
|
-
if (!isJSONObject(data)) {
|
|
131
|
-
throw new TypeError(`Unmarshalling the type 'Offer' failed as data isn't a dictionary.`);
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
available: data.available,
|
|
135
|
-
billingOperationPath: data.billing_operation_path,
|
|
136
|
-
endOfLife: data.end_of_life,
|
|
137
|
-
id: data.id,
|
|
138
|
-
price: data.price ? unmarshalMoney(data.price) : undefined,
|
|
139
|
-
product: unmarshalOfferProduct(data.product),
|
|
140
|
-
quotaWarnings: data.quota_warnings
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
const unmarshalListOffersResponse = data => {
|
|
144
|
-
if (!isJSONObject(data)) {
|
|
145
|
-
throw new TypeError(`Unmarshalling the type 'ListOffersResponse' failed as data isn't a dictionary.`);
|
|
146
|
-
}
|
|
147
|
-
return {
|
|
148
|
-
offers: unmarshalArrayOfObject(data.offers, unmarshalOffer)
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
const marshalCreateHostingRequest = (request, defaults) => ({
|
|
152
|
-
domain: request.domain,
|
|
153
|
-
email: request.email,
|
|
154
|
-
offer_id: request.offerId,
|
|
155
|
-
option_ids: request.optionIds,
|
|
156
|
-
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
157
|
-
tags: request.tags
|
|
158
|
-
});
|
|
159
|
-
const marshalDediboxApiMigrateDediboxHostingRequest = (request, defaults) => ({
|
|
160
|
-
domain: request.domain,
|
|
161
|
-
email: request.email,
|
|
162
|
-
organization_id: request.organizationId ?? defaults.defaultOrganizationId,
|
|
163
|
-
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
164
|
-
token: request.token
|
|
165
|
-
});
|
|
166
|
-
const marshalUpdateHostingRequest = (request, defaults) => ({
|
|
167
|
-
email: request.email,
|
|
168
|
-
offer_id: request.offerId,
|
|
169
|
-
option_ids: request.optionIds,
|
|
170
|
-
tags: request.tags
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
export { marshalCreateHostingRequest, marshalDediboxApiMigrateDediboxHostingRequest, marshalUpdateHostingRequest, unmarshalDnsRecords, unmarshalHosting, unmarshalListDediboxHostingsResponse, unmarshalListHostingsResponse, unmarshalListOffersResponse };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// This file was automatically generated. DO NOT EDIT.
|
|
2
|
-
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
3
|
-
|
|
4
|
-
const DediboxApiListDediboxHostingsRequest = {
|
|
5
|
-
page: {
|
|
6
|
-
greaterThan: 0
|
|
7
|
-
},
|
|
8
|
-
pageSize: {
|
|
9
|
-
greaterThan: 0,
|
|
10
|
-
lessThanOrEqual: 100
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
const ListHostingsRequest = {
|
|
14
|
-
page: {
|
|
15
|
-
greaterThan: 0
|
|
16
|
-
},
|
|
17
|
-
pageSize: {
|
|
18
|
-
greaterThan: 0,
|
|
19
|
-
lessThanOrEqual: 100
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export { DediboxApiListDediboxHostingsRequest, ListHostingsRequest };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validates an object is of type Response without using `instanceof`.
|
|
3
|
-
*
|
|
4
|
-
* @remarks Check issue #509 for more context.
|
|
5
|
-
*
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
const isResponse = obj => obj !== null && obj !== undefined && typeof obj === 'object' && 'status' in obj && typeof obj.status === 'number' && 'statusText' in obj && typeof obj.statusText === 'string' && 'headers' in obj && typeof obj.headers === 'object' && 'body' in obj && typeof obj.body !== 'undefined';
|
|
9
|
-
|
|
10
|
-
export { isResponse };
|
package/dist/helpers/json.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validates an unknown object is a JSON Object.
|
|
3
|
-
*
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
const isJSONObject = obj => {
|
|
7
|
-
const objT = typeof obj;
|
|
8
|
-
return obj !== undefined && obj !== null && objT !== 'string' && objT !== 'number' && objT !== 'boolean' && !Array.isArray(obj) && objT === 'object';
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export { isJSONObject };
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the parameter if it's valid as path parameter
|
|
3
|
-
* (string and not empty, or number), else throws an exception.
|
|
4
|
-
*
|
|
5
|
-
* @param name - The parameter name
|
|
6
|
-
* @param param - The parameter value
|
|
7
|
-
* @returns The parameter value
|
|
8
|
-
*
|
|
9
|
-
* @throws TypeError
|
|
10
|
-
* Thrown if the parameter is invalid.
|
|
11
|
-
*
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
function validatePathParam(name, param) {
|
|
15
|
-
if (typeof param === 'string' && param.length > 0) return param;
|
|
16
|
-
if (typeof param === 'number') return param.toString();
|
|
17
|
-
throw new TypeError(`param ${name} cannot be empty in request`);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Resolves the ideal parameter and value amongst an optional list.
|
|
22
|
-
*
|
|
23
|
-
* @param list - The list to be looking into
|
|
24
|
-
* @param isRequired - If at least one "one-of" should be found, false by default
|
|
25
|
-
* @returns The parameter and value
|
|
26
|
-
*
|
|
27
|
-
* @throws TypeError
|
|
28
|
-
* Thrown if isRequired is true, and no value or default value is specified.
|
|
29
|
-
*
|
|
30
|
-
* @internal
|
|
31
|
-
*/
|
|
32
|
-
const resolveOneOf = function (list, isRequired) {
|
|
33
|
-
if (isRequired === void 0) {
|
|
34
|
-
isRequired = false;
|
|
35
|
-
}
|
|
36
|
-
const elt = list.find(obj => obj.value !== undefined) ?? list.find(obj => obj.default !== undefined);
|
|
37
|
-
const value = elt?.value ?? elt?.default;
|
|
38
|
-
if (elt && value !== undefined) {
|
|
39
|
-
return {
|
|
40
|
-
[elt.param]: value
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
if (isRequired) {
|
|
44
|
-
const keyList = list.map(obj => obj.param).join(' or ');
|
|
45
|
-
throw new TypeError(`one of ${keyList} must be indicated in the request`);
|
|
46
|
-
}
|
|
47
|
-
return {};
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Filters defined parameters tuples and converts them to URLSearchParams.
|
|
51
|
-
*
|
|
52
|
-
* @param paramTuples - The key/value pairs
|
|
53
|
-
* @returns URLSearchParams
|
|
54
|
-
*
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
57
|
-
const urlParams = function () {
|
|
58
|
-
const params = new URLSearchParams();
|
|
59
|
-
for (var _len = arguments.length, paramTuples = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
60
|
-
paramTuples[_key] = arguments[_key];
|
|
61
|
-
}
|
|
62
|
-
for (const [key, value] of paramTuples) {
|
|
63
|
-
if (typeof key === 'string' && value != null) {
|
|
64
|
-
if (Array.isArray(value)) {
|
|
65
|
-
for (const innerValue of value) {
|
|
66
|
-
if (innerValue !== null) {
|
|
67
|
-
params.append(key, innerValue instanceof Date ? innerValue.toISOString() : innerValue.toString());
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
params.append(key, value instanceof Date ? value.toISOString() : value.toString());
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return params;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Unmarshals data to Date object.
|
|
80
|
-
*
|
|
81
|
-
* @internal
|
|
82
|
-
*/
|
|
83
|
-
const unmarshalDate = data => {
|
|
84
|
-
if (typeof data !== 'string') {
|
|
85
|
-
return undefined;
|
|
86
|
-
}
|
|
87
|
-
const date = new Date(data);
|
|
88
|
-
if (Number.isNaN(date.getTime())) {
|
|
89
|
-
return undefined;
|
|
90
|
-
}
|
|
91
|
-
return date;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Unmarshals array of object.
|
|
96
|
-
*
|
|
97
|
-
* @internal
|
|
98
|
-
*/
|
|
99
|
-
const unmarshalArrayOfObject = function (data, unmarshaller, emptyFallback) {
|
|
100
|
-
if (emptyFallback === void 0) {
|
|
101
|
-
emptyFallback = true;
|
|
102
|
-
}
|
|
103
|
-
if (!Array.isArray(data)) {
|
|
104
|
-
return emptyFallback ? [] : undefined;
|
|
105
|
-
}
|
|
106
|
-
return data.map(elt => unmarshaller(elt));
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Unmarshals map of object.
|
|
111
|
-
*
|
|
112
|
-
* @internal
|
|
113
|
-
*/
|
|
114
|
-
const unmarshalMapOfObject = function (data, unmarshaller, emptyFallback) {
|
|
115
|
-
if (emptyFallback === void 0) {
|
|
116
|
-
emptyFallback = true;
|
|
117
|
-
}
|
|
118
|
-
if (!data || typeof data !== 'object' || !(data instanceof Object) || Array.isArray(data)) {
|
|
119
|
-
return emptyFallback ? {} : undefined;
|
|
120
|
-
}
|
|
121
|
-
return Object.entries(data).reduce((acc, _ref) => {
|
|
122
|
-
let [key, value] = _ref;
|
|
123
|
-
return {
|
|
124
|
-
...acc,
|
|
125
|
-
[key]: unmarshaller(value)
|
|
126
|
-
};
|
|
127
|
-
}, {});
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export { resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalMapOfObject, urlParams, validatePathParam };
|