celitech-sdk 1.3.6 → 1.3.8
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +10 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +27 -29
- package/dist/index.mjs +27 -29
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
# Celitech TypeScript SDK 1.3.
|
1
|
+
# Celitech TypeScript SDK 1.3.8
|
2
2
|
|
3
3
|
Welcome to the Celitech SDK documentation. This guide will help you get started with integrating and using the Celitech SDK in your project.
|
4
4
|
|
5
5
|
## Versions
|
6
6
|
|
7
7
|
- API version: `1.1.0`
|
8
|
-
- SDK version: `1.3.
|
8
|
+
- SDK version: `1.3.8`
|
9
9
|
|
10
10
|
## About the API
|
11
11
|
|
@@ -48,13 +48,15 @@ The Celitech API uses OAuth for authentication.
|
|
48
48
|
You need to provide the OAuth parameters when initializing the SDK.
|
49
49
|
|
50
50
|
```ts
|
51
|
-
|
51
|
+
const sdk = new Celitech({ clientSecret: 'CLIENT_SECRET', clientId: 'CLIENT_ID' });
|
52
52
|
```
|
53
53
|
|
54
54
|
If you need to set or update the OAuth parameters after the SDK initialization, you can use:
|
55
55
|
|
56
56
|
```ts
|
57
|
-
|
57
|
+
const sdk = new Celitech();
|
58
|
+
sdk.clientId = 'CLIENT_ID';
|
59
|
+
sdk.clientSecret = 'CLIENT_SECRET';
|
58
60
|
```
|
59
61
|
|
60
62
|
## Environment Variables
|
@@ -86,7 +88,10 @@ Below is a comprehensive example demonstrating how to authenticate and call a si
|
|
86
88
|
import { Celitech } from 'celitech-sdk';
|
87
89
|
|
88
90
|
(async () => {
|
89
|
-
const celitech = new Celitech({
|
91
|
+
const celitech = new Celitech({
|
92
|
+
clientSecret: 'CLIENT_SECRET',
|
93
|
+
clientId: 'CLIENT_ID',
|
94
|
+
});
|
90
95
|
|
91
96
|
const { data } = await celitech.destinations.listDestinations();
|
92
97
|
|
package/dist/index.d.ts
CHANGED
@@ -75,7 +75,7 @@ interface CreateRequestParameters<FullResponse, Page = unknown[]> {
|
|
75
75
|
validation: ValidationOptions;
|
76
76
|
retry: RetryOptions;
|
77
77
|
pagination?: RequestPagination<Page>;
|
78
|
-
scopes
|
78
|
+
scopes?: Set<string>;
|
79
79
|
tokenManager: OAuthTokenManager;
|
80
80
|
}
|
81
81
|
interface RequestParameter {
|
@@ -108,7 +108,7 @@ declare class Request<T = unknown, PageSchema = unknown[]> {
|
|
108
108
|
validation: ValidationOptions;
|
109
109
|
retry: RetryOptions;
|
110
110
|
pagination?: RequestPagination<PageSchema>;
|
111
|
-
scopes
|
111
|
+
scopes?: Set<string>;
|
112
112
|
tokenManager: OAuthTokenManager;
|
113
113
|
private readonly pathPattern;
|
114
114
|
constructor(params: CreateRequestParameters<T, PageSchema>);
|
package/dist/index.js
CHANGED
@@ -360,7 +360,7 @@ var RequestValidationHandler = class {
|
|
360
360
|
} else if (request.requestContentType === "xml" /* Xml */ || request.requestContentType === "binary" /* Binary */ || request.requestContentType === "text" /* Text */) {
|
361
361
|
request.body = request.body;
|
362
362
|
} else if (request.requestContentType === "form" /* FormUrlEncoded */) {
|
363
|
-
request.body = this.toFormUrlEncoded(request
|
363
|
+
request.body = this.toFormUrlEncoded(request);
|
364
364
|
} else if (request.requestContentType === "multipartFormData" /* MultipartFormData */) {
|
365
365
|
request.body = this.toFormData(request.body);
|
366
366
|
} else {
|
@@ -368,27 +368,29 @@ var RequestValidationHandler = class {
|
|
368
368
|
}
|
369
369
|
return await this.next.handle(request);
|
370
370
|
}
|
371
|
-
toFormUrlEncoded(
|
372
|
-
|
371
|
+
toFormUrlEncoded(request) {
|
372
|
+
var _a;
|
373
|
+
if (request.body === void 0) {
|
373
374
|
return "";
|
374
375
|
}
|
375
|
-
if (typeof body === "string") {
|
376
|
-
return body;
|
376
|
+
if (typeof request.body === "string") {
|
377
|
+
return request.body;
|
377
378
|
}
|
378
|
-
if (body instanceof URLSearchParams) {
|
379
|
-
return body.toString();
|
379
|
+
if (request.body instanceof URLSearchParams) {
|
380
|
+
return request.body.toString();
|
380
381
|
}
|
381
|
-
|
382
|
+
const validatedBody = (_a = request.requestSchema) == null ? void 0 : _a.parse(request.body);
|
383
|
+
if (validatedBody instanceof FormData) {
|
382
384
|
const params = new URLSearchParams();
|
383
|
-
|
385
|
+
validatedBody.forEach((value, key) => {
|
384
386
|
params.append(key, value.toString());
|
385
387
|
});
|
386
388
|
return params.toString();
|
387
389
|
}
|
388
|
-
if (typeof
|
390
|
+
if (typeof validatedBody === "object" && !Array.isArray(validatedBody)) {
|
389
391
|
const params = new URLSearchParams();
|
390
|
-
for (const [key, value] of Object.entries(
|
391
|
-
params.append(key, value
|
392
|
+
for (const [key, value] of Object.entries(validatedBody)) {
|
393
|
+
params.append(key, `${value}`);
|
392
394
|
}
|
393
395
|
return params.toString();
|
394
396
|
}
|
@@ -751,7 +753,7 @@ var Request = class {
|
|
751
753
|
return `${this.baseUrl}${path}${queryString}`;
|
752
754
|
}
|
753
755
|
copy(overrides) {
|
754
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n
|
756
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
755
757
|
const createRequestParams = {
|
756
758
|
baseUrl: (_a = overrides == null ? void 0 : overrides.baseUrl) != null ? _a : this.baseUrl,
|
757
759
|
method: (_b = overrides == null ? void 0 : overrides.method) != null ? _b : this.method,
|
@@ -767,7 +769,7 @@ var Request = class {
|
|
767
769
|
responseContentType: (_l = overrides == null ? void 0 : overrides.responseContentType) != null ? _l : this.responseContentType,
|
768
770
|
retry: (_m = overrides == null ? void 0 : overrides.retry) != null ? _m : this.retry,
|
769
771
|
validation: (_n = overrides == null ? void 0 : overrides.validation) != null ? _n : this.validation,
|
770
|
-
scopes:
|
772
|
+
scopes: overrides == null ? void 0 : overrides.scopes,
|
771
773
|
tokenManager: this.tokenManager
|
772
774
|
};
|
773
775
|
return new Request({
|
@@ -835,7 +837,6 @@ var RequestBuilder = class {
|
|
835
837
|
pathParams: /* @__PURE__ */ new Map(),
|
836
838
|
queryParams: /* @__PURE__ */ new Map(),
|
837
839
|
headers: /* @__PURE__ */ new Map(),
|
838
|
-
scopes: /* @__PURE__ */ new Set(),
|
839
840
|
tokenManager: new OAuthTokenManager()
|
840
841
|
};
|
841
842
|
}
|
@@ -1062,9 +1063,6 @@ var OAuthToken = class {
|
|
1062
1063
|
}
|
1063
1064
|
};
|
1064
1065
|
var OAuthTokenManager = class {
|
1065
|
-
constructor() {
|
1066
|
-
this.token = new OAuthToken("", /* @__PURE__ */ new Set(), null);
|
1067
|
-
}
|
1068
1066
|
async getToken(scopes, config) {
|
1069
1067
|
var _a, _b, _c, _d, _e;
|
1070
1068
|
if ((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) {
|
@@ -1164,7 +1162,7 @@ var DestinationsService = class extends BaseService {
|
|
1164
1162
|
* @returns {Promise<HttpResponse<ListDestinationsOkResponse>>} Successful Response
|
1165
1163
|
*/
|
1166
1164
|
async listDestinations(requestConfig) {
|
1167
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/destinations").setRequestSchema(import_zod7.z.any()).setResponseSchema(listDestinationsOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).build();
|
1165
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/destinations").setRequestSchema(import_zod7.z.any()).setResponseSchema(listDestinationsOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).build();
|
1168
1166
|
return this.client.call(request);
|
1169
1167
|
}
|
1170
1168
|
};
|
@@ -1260,7 +1258,7 @@ var PackagesService = class extends BaseService {
|
|
1260
1258
|
* @returns {Promise<HttpResponse<ListPackagesOkResponse>>} Successful Response
|
1261
1259
|
*/
|
1262
1260
|
async listPackages(params, requestConfig) {
|
1263
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/packages").setRequestSchema(import_zod10.z.any()).setResponseSchema(listPackagesOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
1261
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/packages").setRequestSchema(import_zod10.z.any()).setResponseSchema(listPackagesOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
1264
1262
|
key: "destination",
|
1265
1263
|
value: params == null ? void 0 : params.destination
|
1266
1264
|
}).addQueryParam({
|
@@ -1910,7 +1908,7 @@ var PurchasesService = class extends BaseService {
|
|
1910
1908
|
* @returns {Promise<HttpResponse<ListPurchasesOkResponse>>} Successful Response
|
1911
1909
|
*/
|
1912
1910
|
async listPurchases(params, requestConfig) {
|
1913
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases").setRequestSchema(import_zod26.z.any()).setResponseSchema(listPurchasesOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
1911
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases").setRequestSchema(import_zod26.z.any()).setResponseSchema(listPurchasesOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
1914
1912
|
key: "iccid",
|
1915
1913
|
value: params == null ? void 0 : params.iccid
|
1916
1914
|
}).addQueryParam({
|
@@ -1942,7 +1940,7 @@ var PurchasesService = class extends BaseService {
|
|
1942
1940
|
* @returns {Promise<HttpResponse<CreatePurchaseOkResponse>>} Successful Response
|
1943
1941
|
*/
|
1944
1942
|
async createPurchase(body, requestConfig) {
|
1945
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases").setRequestSchema(createPurchaseRequestRequest).setResponseSchema(createPurchaseOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1943
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases").setRequestSchema(createPurchaseRequestRequest).setResponseSchema(createPurchaseOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1946
1944
|
return this.client.call(request);
|
1947
1945
|
}
|
1948
1946
|
/**
|
@@ -1950,7 +1948,7 @@ var PurchasesService = class extends BaseService {
|
|
1950
1948
|
* @returns {Promise<HttpResponse<TopUpEsimOkResponse>>} Successful Response
|
1951
1949
|
*/
|
1952
1950
|
async topUpEsim(body, requestConfig) {
|
1953
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/topup").setRequestSchema(topUpEsimRequestRequest).setResponseSchema(topUpEsimOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1951
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/topup").setRequestSchema(topUpEsimRequestRequest).setResponseSchema(topUpEsimOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1954
1952
|
return this.client.call(request);
|
1955
1953
|
}
|
1956
1954
|
/**
|
@@ -1958,7 +1956,7 @@ var PurchasesService = class extends BaseService {
|
|
1958
1956
|
* @returns {Promise<HttpResponse<EditPurchaseOkResponse>>} Successful Response
|
1959
1957
|
*/
|
1960
1958
|
async editPurchase(body, requestConfig) {
|
1961
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/edit").setRequestSchema(editPurchaseRequestRequest).setResponseSchema(editPurchaseOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1959
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/edit").setRequestSchema(editPurchaseRequestRequest).setResponseSchema(editPurchaseOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1962
1960
|
return this.client.call(request);
|
1963
1961
|
}
|
1964
1962
|
/**
|
@@ -1967,7 +1965,7 @@ var PurchasesService = class extends BaseService {
|
|
1967
1965
|
* @returns {Promise<HttpResponse<GetPurchaseConsumptionOkResponse>>} Successful Response
|
1968
1966
|
*/
|
1969
1967
|
async getPurchaseConsumption(purchaseId, requestConfig) {
|
1970
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(import_zod26.z.any()).setResponseSchema(getPurchaseConsumptionOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
1968
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(import_zod26.z.any()).setResponseSchema(getPurchaseConsumptionOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
1971
1969
|
key: "purchaseId",
|
1972
1970
|
value: purchaseId
|
1973
1971
|
}).build();
|
@@ -2234,7 +2232,7 @@ var ESimService = class extends BaseService {
|
|
2234
2232
|
* @returns {Promise<HttpResponse<GetEsimOkResponse>>} Successful Response
|
2235
2233
|
*/
|
2236
2234
|
async getEsim(params, requestConfig) {
|
2237
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim").setRequestSchema(import_zod36.z.any()).setResponseSchema(getEsimOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
2235
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim").setRequestSchema(import_zod36.z.any()).setResponseSchema(getEsimOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
2238
2236
|
key: "iccid",
|
2239
2237
|
value: params == null ? void 0 : params.iccid
|
2240
2238
|
}).build();
|
@@ -2246,7 +2244,7 @@ var ESimService = class extends BaseService {
|
|
2246
2244
|
* @returns {Promise<HttpResponse<GetEsimDeviceOkResponse>>} Successful Response
|
2247
2245
|
*/
|
2248
2246
|
async getEsimDevice(iccid, requestConfig) {
|
2249
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(import_zod36.z.any()).setResponseSchema(getEsimDeviceOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2247
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(import_zod36.z.any()).setResponseSchema(getEsimDeviceOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2250
2248
|
key: "iccid",
|
2251
2249
|
value: iccid
|
2252
2250
|
}).build();
|
@@ -2258,7 +2256,7 @@ var ESimService = class extends BaseService {
|
|
2258
2256
|
* @returns {Promise<HttpResponse<GetEsimHistoryOkResponse>>} Successful Response
|
2259
2257
|
*/
|
2260
2258
|
async getEsimHistory(iccid, requestConfig) {
|
2261
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(import_zod36.z.any()).setResponseSchema(getEsimHistoryOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2259
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(import_zod36.z.any()).setResponseSchema(getEsimHistoryOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2262
2260
|
key: "iccid",
|
2263
2261
|
value: iccid
|
2264
2262
|
}).build();
|
@@ -2270,7 +2268,7 @@ var ESimService = class extends BaseService {
|
|
2270
2268
|
* @returns {Promise<HttpResponse<GetEsimMacOkResponse>>} Successful Response
|
2271
2269
|
*/
|
2272
2270
|
async getEsimMac(iccid, requestConfig) {
|
2273
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/mac").setRequestSchema(import_zod36.z.any()).setResponseSchema(getEsimMacOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2271
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/mac").setRequestSchema(import_zod36.z.any()).setResponseSchema(getEsimMacOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2274
2272
|
key: "iccid",
|
2275
2273
|
value: iccid
|
2276
2274
|
}).build();
|
package/dist/index.mjs
CHANGED
@@ -318,7 +318,7 @@ var RequestValidationHandler = class {
|
|
318
318
|
} else if (request.requestContentType === "xml" /* Xml */ || request.requestContentType === "binary" /* Binary */ || request.requestContentType === "text" /* Text */) {
|
319
319
|
request.body = request.body;
|
320
320
|
} else if (request.requestContentType === "form" /* FormUrlEncoded */) {
|
321
|
-
request.body = this.toFormUrlEncoded(request
|
321
|
+
request.body = this.toFormUrlEncoded(request);
|
322
322
|
} else if (request.requestContentType === "multipartFormData" /* MultipartFormData */) {
|
323
323
|
request.body = this.toFormData(request.body);
|
324
324
|
} else {
|
@@ -326,27 +326,29 @@ var RequestValidationHandler = class {
|
|
326
326
|
}
|
327
327
|
return await this.next.handle(request);
|
328
328
|
}
|
329
|
-
toFormUrlEncoded(
|
330
|
-
|
329
|
+
toFormUrlEncoded(request) {
|
330
|
+
var _a;
|
331
|
+
if (request.body === void 0) {
|
331
332
|
return "";
|
332
333
|
}
|
333
|
-
if (typeof body === "string") {
|
334
|
-
return body;
|
334
|
+
if (typeof request.body === "string") {
|
335
|
+
return request.body;
|
335
336
|
}
|
336
|
-
if (body instanceof URLSearchParams) {
|
337
|
-
return body.toString();
|
337
|
+
if (request.body instanceof URLSearchParams) {
|
338
|
+
return request.body.toString();
|
338
339
|
}
|
339
|
-
|
340
|
+
const validatedBody = (_a = request.requestSchema) == null ? void 0 : _a.parse(request.body);
|
341
|
+
if (validatedBody instanceof FormData) {
|
340
342
|
const params = new URLSearchParams();
|
341
|
-
|
343
|
+
validatedBody.forEach((value, key) => {
|
342
344
|
params.append(key, value.toString());
|
343
345
|
});
|
344
346
|
return params.toString();
|
345
347
|
}
|
346
|
-
if (typeof
|
348
|
+
if (typeof validatedBody === "object" && !Array.isArray(validatedBody)) {
|
347
349
|
const params = new URLSearchParams();
|
348
|
-
for (const [key, value] of Object.entries(
|
349
|
-
params.append(key, value
|
350
|
+
for (const [key, value] of Object.entries(validatedBody)) {
|
351
|
+
params.append(key, `${value}`);
|
350
352
|
}
|
351
353
|
return params.toString();
|
352
354
|
}
|
@@ -709,7 +711,7 @@ var Request = class {
|
|
709
711
|
return `${this.baseUrl}${path}${queryString}`;
|
710
712
|
}
|
711
713
|
copy(overrides) {
|
712
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n
|
714
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
713
715
|
const createRequestParams = {
|
714
716
|
baseUrl: (_a = overrides == null ? void 0 : overrides.baseUrl) != null ? _a : this.baseUrl,
|
715
717
|
method: (_b = overrides == null ? void 0 : overrides.method) != null ? _b : this.method,
|
@@ -725,7 +727,7 @@ var Request = class {
|
|
725
727
|
responseContentType: (_l = overrides == null ? void 0 : overrides.responseContentType) != null ? _l : this.responseContentType,
|
726
728
|
retry: (_m = overrides == null ? void 0 : overrides.retry) != null ? _m : this.retry,
|
727
729
|
validation: (_n = overrides == null ? void 0 : overrides.validation) != null ? _n : this.validation,
|
728
|
-
scopes:
|
730
|
+
scopes: overrides == null ? void 0 : overrides.scopes,
|
729
731
|
tokenManager: this.tokenManager
|
730
732
|
};
|
731
733
|
return new Request({
|
@@ -793,7 +795,6 @@ var RequestBuilder = class {
|
|
793
795
|
pathParams: /* @__PURE__ */ new Map(),
|
794
796
|
queryParams: /* @__PURE__ */ new Map(),
|
795
797
|
headers: /* @__PURE__ */ new Map(),
|
796
|
-
scopes: /* @__PURE__ */ new Set(),
|
797
798
|
tokenManager: new OAuthTokenManager()
|
798
799
|
};
|
799
800
|
}
|
@@ -1020,9 +1021,6 @@ var OAuthToken = class {
|
|
1020
1021
|
}
|
1021
1022
|
};
|
1022
1023
|
var OAuthTokenManager = class {
|
1023
|
-
constructor() {
|
1024
|
-
this.token = new OAuthToken("", /* @__PURE__ */ new Set(), null);
|
1025
|
-
}
|
1026
1024
|
async getToken(scopes, config) {
|
1027
1025
|
var _a, _b, _c, _d, _e;
|
1028
1026
|
if ((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) {
|
@@ -1122,7 +1120,7 @@ var DestinationsService = class extends BaseService {
|
|
1122
1120
|
* @returns {Promise<HttpResponse<ListDestinationsOkResponse>>} Successful Response
|
1123
1121
|
*/
|
1124
1122
|
async listDestinations(requestConfig) {
|
1125
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/destinations").setRequestSchema(z6.any()).setResponseSchema(listDestinationsOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).build();
|
1123
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/destinations").setRequestSchema(z6.any()).setResponseSchema(listDestinationsOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).build();
|
1126
1124
|
return this.client.call(request);
|
1127
1125
|
}
|
1128
1126
|
};
|
@@ -1218,7 +1216,7 @@ var PackagesService = class extends BaseService {
|
|
1218
1216
|
* @returns {Promise<HttpResponse<ListPackagesOkResponse>>} Successful Response
|
1219
1217
|
*/
|
1220
1218
|
async listPackages(params, requestConfig) {
|
1221
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/packages").setRequestSchema(z9.any()).setResponseSchema(listPackagesOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
1219
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/packages").setRequestSchema(z9.any()).setResponseSchema(listPackagesOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
1222
1220
|
key: "destination",
|
1223
1221
|
value: params == null ? void 0 : params.destination
|
1224
1222
|
}).addQueryParam({
|
@@ -1868,7 +1866,7 @@ var PurchasesService = class extends BaseService {
|
|
1868
1866
|
* @returns {Promise<HttpResponse<ListPurchasesOkResponse>>} Successful Response
|
1869
1867
|
*/
|
1870
1868
|
async listPurchases(params, requestConfig) {
|
1871
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases").setRequestSchema(z25.any()).setResponseSchema(listPurchasesOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
1869
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases").setRequestSchema(z25.any()).setResponseSchema(listPurchasesOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
1872
1870
|
key: "iccid",
|
1873
1871
|
value: params == null ? void 0 : params.iccid
|
1874
1872
|
}).addQueryParam({
|
@@ -1900,7 +1898,7 @@ var PurchasesService = class extends BaseService {
|
|
1900
1898
|
* @returns {Promise<HttpResponse<CreatePurchaseOkResponse>>} Successful Response
|
1901
1899
|
*/
|
1902
1900
|
async createPurchase(body, requestConfig) {
|
1903
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases").setRequestSchema(createPurchaseRequestRequest).setResponseSchema(createPurchaseOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1901
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases").setRequestSchema(createPurchaseRequestRequest).setResponseSchema(createPurchaseOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1904
1902
|
return this.client.call(request);
|
1905
1903
|
}
|
1906
1904
|
/**
|
@@ -1908,7 +1906,7 @@ var PurchasesService = class extends BaseService {
|
|
1908
1906
|
* @returns {Promise<HttpResponse<TopUpEsimOkResponse>>} Successful Response
|
1909
1907
|
*/
|
1910
1908
|
async topUpEsim(body, requestConfig) {
|
1911
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/topup").setRequestSchema(topUpEsimRequestRequest).setResponseSchema(topUpEsimOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1909
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/topup").setRequestSchema(topUpEsimRequestRequest).setResponseSchema(topUpEsimOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1912
1910
|
return this.client.call(request);
|
1913
1911
|
}
|
1914
1912
|
/**
|
@@ -1916,7 +1914,7 @@ var PurchasesService = class extends BaseService {
|
|
1916
1914
|
* @returns {Promise<HttpResponse<EditPurchaseOkResponse>>} Successful Response
|
1917
1915
|
*/
|
1918
1916
|
async editPurchase(body, requestConfig) {
|
1919
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/edit").setRequestSchema(editPurchaseRequestRequest).setResponseSchema(editPurchaseOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1917
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/edit").setRequestSchema(editPurchaseRequestRequest).setResponseSchema(editPurchaseOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1920
1918
|
return this.client.call(request);
|
1921
1919
|
}
|
1922
1920
|
/**
|
@@ -1925,7 +1923,7 @@ var PurchasesService = class extends BaseService {
|
|
1925
1923
|
* @returns {Promise<HttpResponse<GetPurchaseConsumptionOkResponse>>} Successful Response
|
1926
1924
|
*/
|
1927
1925
|
async getPurchaseConsumption(purchaseId, requestConfig) {
|
1928
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(z25.any()).setResponseSchema(getPurchaseConsumptionOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
1926
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(z25.any()).setResponseSchema(getPurchaseConsumptionOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
1929
1927
|
key: "purchaseId",
|
1930
1928
|
value: purchaseId
|
1931
1929
|
}).build();
|
@@ -2192,7 +2190,7 @@ var ESimService = class extends BaseService {
|
|
2192
2190
|
* @returns {Promise<HttpResponse<GetEsimOkResponse>>} Successful Response
|
2193
2191
|
*/
|
2194
2192
|
async getEsim(params, requestConfig) {
|
2195
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim").setRequestSchema(z35.any()).setResponseSchema(getEsimOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
2193
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim").setRequestSchema(z35.any()).setResponseSchema(getEsimOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
2196
2194
|
key: "iccid",
|
2197
2195
|
value: params == null ? void 0 : params.iccid
|
2198
2196
|
}).build();
|
@@ -2204,7 +2202,7 @@ var ESimService = class extends BaseService {
|
|
2204
2202
|
* @returns {Promise<HttpResponse<GetEsimDeviceOkResponse>>} Successful Response
|
2205
2203
|
*/
|
2206
2204
|
async getEsimDevice(iccid, requestConfig) {
|
2207
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(z35.any()).setResponseSchema(getEsimDeviceOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2205
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(z35.any()).setResponseSchema(getEsimDeviceOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2208
2206
|
key: "iccid",
|
2209
2207
|
value: iccid
|
2210
2208
|
}).build();
|
@@ -2216,7 +2214,7 @@ var ESimService = class extends BaseService {
|
|
2216
2214
|
* @returns {Promise<HttpResponse<GetEsimHistoryOkResponse>>} Successful Response
|
2217
2215
|
*/
|
2218
2216
|
async getEsimHistory(iccid, requestConfig) {
|
2219
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(z35.any()).setResponseSchema(getEsimHistoryOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2217
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(z35.any()).setResponseSchema(getEsimHistoryOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2220
2218
|
key: "iccid",
|
2221
2219
|
value: iccid
|
2222
2220
|
}).build();
|
@@ -2228,7 +2226,7 @@ var ESimService = class extends BaseService {
|
|
2228
2226
|
* @returns {Promise<HttpResponse<GetEsimMacOkResponse>>} Successful Response
|
2229
2227
|
*/
|
2230
2228
|
async getEsimMac(iccid, requestConfig) {
|
2231
|
-
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/mac").setRequestSchema(z35.any()).setResponseSchema(getEsimMacOkResponseResponse).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2229
|
+
const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/mac").setRequestSchema(z35.any()).setResponseSchema(getEsimMacOkResponseResponse).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2232
2230
|
key: "iccid",
|
2233
2231
|
value: iccid
|
2234
2232
|
}).build();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "celitech-sdk",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.8",
|
4
4
|
"description": "Welcome to the CELITECH API documentation! Useful links: [Homepage](https://www.celitech.com) | [Support email](mailto:support@celitech.com) | [Blog](https://www.celitech.com/blog/) ",
|
5
5
|
"source": "./src/index.ts",
|
6
6
|
"main": "./dist/index.js",
|