celitech-sdk 1.1.87 → 1.1.89

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
@@ -61,15 +61,6 @@ var RequestHandlerChain = class {
61
61
  }
62
62
  };
63
63
 
64
- // src/http/error.ts
65
- var HttpError = class extends Error {
66
- constructor(metadata, error) {
67
- super(error);
68
- this.error = metadata.statusText;
69
- this.metadata = metadata;
70
- }
71
- };
72
-
73
64
  // src/http/hooks/custom-hook.ts
74
65
  var CURRENT_TOKEN = "";
75
66
  var CURRENT_EXPIRY = -1;
@@ -235,7 +226,8 @@ var TransportHookAdapter = class {
235
226
  path: newRequest.path,
236
227
  body: newRequest.body,
237
228
  queryParams: this.hookParamsToTransportParams(newRequest.queryParams, request.queryParams, true),
238
- headers: this.hookParamsToTransportParams(newRequest.headers, request.headers, false)
229
+ headers: this.hookParamsToTransportParams(newRequest.headers, request.headers, false),
230
+ pathParams: this.hookParamsToTransportParams(newRequest.pathParams, request.headers, false)
239
231
  });
240
232
  return newTransportRequest;
241
233
  }
@@ -256,27 +248,34 @@ var TransportHookAdapter = class {
256
248
  request.queryParams.forEach((queryParam, key) => {
257
249
  hookQueryParams.set(key, queryParam.value);
258
250
  });
251
+ const hookPathParams = /* @__PURE__ */ new Map();
252
+ request.pathParams.forEach((pathParam, key) => {
253
+ hookPathParams.set(key, pathParam.value);
254
+ });
259
255
  const hookRequest = {
260
256
  baseUrl: request.baseUrl,
261
257
  method: request.method,
262
258
  path: request.path,
263
259
  headers: hookHeaders,
264
260
  body: request.body,
265
- queryParams: hookQueryParams
261
+ queryParams: hookQueryParams,
262
+ pathParams: hookPathParams
266
263
  };
267
264
  return hookRequest;
268
265
  }
269
266
  hookParamsToTransportParams(hookParams, originalTransportParams, encode) {
270
267
  const transportParams = /* @__PURE__ */ new Map();
271
268
  hookParams.forEach((hookParamValue, hookParamKey) => {
272
- var _a, _b;
269
+ var _a, _b, _c, _d;
273
270
  const requestParam = originalTransportParams.get(hookParamKey);
274
271
  transportParams.set(hookParamKey, {
275
272
  key: hookParamKey,
276
273
  value: hookParamValue,
277
274
  encode: (_a = requestParam == null ? void 0 : requestParam.encode) != null ? _a : false,
278
275
  style: (requestParam == null ? void 0 : requestParam.style) || "none" /* NONE */,
279
- explode: (_b = requestParam == null ? void 0 : requestParam.explode) != null ? _b : false
276
+ explode: (_b = requestParam == null ? void 0 : requestParam.explode) != null ? _b : false,
277
+ isLimit: (_c = requestParam == null ? void 0 : requestParam.isLimit) != null ? _c : false,
278
+ isOffset: (_d = requestParam == null ? void 0 : requestParam.isOffset) != null ? _d : false
280
279
  });
281
280
  });
282
281
  return transportParams;
@@ -299,8 +298,7 @@ var HookHandler = class {
299
298
  if (response.metadata.status < 400) {
300
299
  return await hook.afterResponse(nextRequest, response, hookParams);
301
300
  }
302
- const error = await hook.onError(nextRequest, response, hookParams);
303
- throw new HttpError(error.metadata, error.error);
301
+ throw await hook.onError(nextRequest, response, hookParams);
304
302
  }
305
303
  getHookParams(request) {
306
304
  const hookParams = /* @__PURE__ */ new Map();
@@ -433,6 +431,13 @@ var RequestValidationHandler = class {
433
431
  });
434
432
  return params.toString();
435
433
  }
434
+ if (typeof body === "object" && !Array.isArray(body)) {
435
+ const params = new URLSearchParams();
436
+ for (const [key, value] of Object.entries(body)) {
437
+ params.append(key, value.toString());
438
+ }
439
+ return params.toString();
440
+ }
436
441
  return "";
437
442
  }
438
443
  toFormData(body) {
@@ -451,95 +456,87 @@ var RequestValidationHandler = class {
451
456
  }
452
457
  };
453
458
 
454
- // src/http/transport/request-axios-adapter.ts
455
- var import_axios = __toESM(require("axios"));
456
- var RequestAxiosAdapter = class {
459
+ // src/http/transport/request-fetch-adapter.ts
460
+ var RequestFetchAdapter = class {
457
461
  constructor(request) {
458
462
  this.request = request;
459
- this.config = {
460
- responseType: "arraybuffer"
461
- };
462
- this.setHeaders();
463
- this.setTimeout();
463
+ this.requestInit = {};
464
+ this.setMethod(request.method);
465
+ this.setHeaders(request.getHeaders());
466
+ this.setBody(request.body);
467
+ this.setTimeout(request.config.timeoutMs);
464
468
  }
465
469
  async send() {
466
- const method = this.getMethod();
467
- const { body } = this.request;
468
- let axiosResponse;
469
- try {
470
- if (this.request.method === "POST" || this.request.method === "PUT" || this.request.method === "PATCH") {
471
- axiosResponse = await method(this.request.constructFullUrl(), body, this.config);
472
- } else {
473
- axiosResponse = await method(this.request.constructFullUrl(), this.config);
474
- }
475
- } catch (err) {
476
- if ((0, import_axios.isAxiosError)(err) && err.response) {
477
- axiosResponse = err.response;
478
- } else {
479
- throw err;
480
- }
481
- }
482
- const headerRecord = {};
483
- Object.keys(axiosResponse.headers).forEach((key) => {
484
- headerRecord[key] = axiosResponse.headers[key];
485
- });
470
+ const response = await fetch(this.request.constructFullUrl(), this.requestInit);
486
471
  const metadata = {
487
- status: axiosResponse.status,
488
- statusText: axiosResponse.statusText || "",
489
- headers: headerRecord
472
+ status: response.status,
473
+ statusText: response.statusText || "",
474
+ headers: this.getHeaders(response)
490
475
  };
491
- if (metadata.status >= 400) {
492
- throw new HttpError(metadata);
493
- }
494
476
  return {
495
477
  metadata,
496
- raw: axiosResponse.data.buffer.slice(
497
- axiosResponse.data.byteOffset,
498
- axiosResponse.data.byteOffset + axiosResponse.data.byteLength
499
- )
478
+ raw: await response.clone().arrayBuffer()
500
479
  };
501
480
  }
502
- getMethod() {
503
- if (this.request.method === "POST") {
504
- return import_axios.default.post;
505
- } else if (this.request.method === "GET") {
506
- return import_axios.default.get;
507
- } else if (this.request.method === "PUT") {
508
- return import_axios.default.put;
509
- } else if (this.request.method === "DELETE") {
510
- return import_axios.default.delete;
511
- } else if (this.request.method === "PATCH") {
512
- return import_axios.default.patch;
513
- } else if (this.request.method === "HEAD") {
514
- return import_axios.default.head;
481
+ setMethod(method) {
482
+ if (!method) {
483
+ return;
515
484
  }
516
- throw new Error("invalid method!!!!");
485
+ this.requestInit = {
486
+ ...this.requestInit,
487
+ method
488
+ };
517
489
  }
518
- setHeaders() {
519
- if (!this.request.headers) {
490
+ setBody(body) {
491
+ if (!body) {
520
492
  return;
521
493
  }
522
- const headersRecord = {};
523
- new Headers(this.request.getHeaders()).forEach((value, key) => {
524
- headersRecord[key] = value;
525
- });
526
- this.config = {
527
- ...this.config,
528
- headers: headersRecord
494
+ this.requestInit = {
495
+ ...this.requestInit,
496
+ body
529
497
  };
530
498
  }
531
- setTimeout() {
532
- this.config = {
533
- ...this.config,
534
- timeout: this.request.config.timeout
499
+ setHeaders(headers) {
500
+ if (!headers) {
501
+ return;
502
+ }
503
+ this.requestInit = {
504
+ ...this.requestInit,
505
+ headers
535
506
  };
536
507
  }
508
+ setTimeout(timeoutMs) {
509
+ if (!timeoutMs) {
510
+ return;
511
+ }
512
+ this.requestInit = {
513
+ ...this.requestInit,
514
+ signal: AbortSignal.timeout(timeoutMs)
515
+ };
516
+ }
517
+ getHeaders(response) {
518
+ const headers = {};
519
+ response.headers.forEach((value, key) => {
520
+ headers[key] = value;
521
+ });
522
+ return headers;
523
+ }
537
524
  };
538
525
 
539
526
  // src/http/handlers/terminating-handler.ts
540
527
  var TerminatingHandler = class {
541
528
  async handle(request) {
542
- return new RequestAxiosAdapter(request).send();
529
+ return new RequestFetchAdapter(request).send();
530
+ }
531
+ };
532
+
533
+ // src/http/error.ts
534
+ var HttpError = class extends Error {
535
+ constructor(metadata, raw, error) {
536
+ super(error);
537
+ this.error = metadata.statusText;
538
+ this.metadata = metadata;
539
+ this.raw = raw;
543
540
  }
544
541
  };
545
542
 
@@ -588,12 +585,39 @@ var HttpClient = class {
588
585
  call(request) {
589
586
  return this.requestHandlerChain.callChain(request);
590
587
  }
588
+ async callPaginated(request) {
589
+ const response = await this.call(request);
590
+ if (!response.data) {
591
+ throw new Error("no response data to paginate through");
592
+ }
593
+ return {
594
+ ...response,
595
+ data: this.getPage(request, response.data)
596
+ };
597
+ }
591
598
  setBaseUrl(url) {
592
599
  this.config.baseUrl = url;
593
600
  }
594
601
  setConfig(config) {
595
602
  this.config = config;
596
603
  }
604
+ getPage(request, data) {
605
+ var _a, _b, _c, _d;
606
+ if (!request.pagination) {
607
+ throw new Error("getPage called for request without pagination property");
608
+ }
609
+ let curr = data;
610
+ for (const segment of ((_a = request.pagination) == null ? void 0 : _a.pagePath) || []) {
611
+ curr = curr[segment];
612
+ }
613
+ const page = (_c = (_b = request.pagination) == null ? void 0 : _b.pageSchema) == null ? void 0 : _c.parse(curr);
614
+ if (!page) {
615
+ throw new Error(
616
+ `error getting page data. Curr: ${JSON.stringify(curr)}. PagePath: ${(_d = request.pagination) == null ? void 0 : _d.pagePath}. Data: ${JSON.stringify(data)}`
617
+ );
618
+ }
619
+ return page;
620
+ }
597
621
  };
598
622
 
599
623
  // src/services/base-service.ts
@@ -608,8 +632,8 @@ var BaseService = class {
608
632
  set environment(environment) {
609
633
  this.config.environment = environment;
610
634
  }
611
- set timeout(timeout) {
612
- this.config.timeout = timeout;
635
+ set timeoutMs(timeoutMs) {
636
+ this.config.timeoutMs = timeoutMs;
613
637
  }
614
638
  set clientId(clientId) {
615
639
  this.config.clientId = clientId;
@@ -688,6 +712,7 @@ var Request = class {
688
712
  this.responseContentType = params.responseContentType;
689
713
  this.retry = params.retry;
690
714
  this.validation = params.validation;
715
+ this.pagination = params.pagination;
691
716
  }
692
717
  addHeaderParam(key, param) {
693
718
  if (param.value === void 0) {
@@ -746,16 +771,6 @@ var Request = class {
746
771
  this.path = hookRequest.path;
747
772
  this.body = hookRequest.body;
748
773
  }
749
- toHookRequest() {
750
- return {
751
- baseUrl: this.baseUrl,
752
- method: this.method,
753
- path: this.path,
754
- headers: this.headers,
755
- body: this.body,
756
- queryParams: this.queryParams
757
- };
758
- }
759
774
  constructFullUrl() {
760
775
  const queryString = new QuerySerializer().serialize(this.queryParams);
761
776
  const path = this.constructPath();
@@ -790,9 +805,36 @@ var Request = class {
790
805
  }
791
806
  return new HeaderSerializer().serialize(this.headers);
792
807
  }
808
+ nextPage() {
809
+ if (!this.pagination) {
810
+ return;
811
+ }
812
+ const offsetParam = this.getOffsetParam();
813
+ if (!offsetParam) {
814
+ return;
815
+ }
816
+ offsetParam.value = Number(offsetParam.value) + this.pagination.pageSize;
817
+ }
793
818
  constructPath() {
794
819
  return new PathSerializer().serialize(this.pathPattern, this.pathParams);
795
820
  }
821
+ getOffsetParam() {
822
+ const offsetParam = this.getAllParams().find((param) => param.isOffset);
823
+ return offsetParam;
824
+ }
825
+ getAllParams() {
826
+ const allParams = [];
827
+ this.headers.forEach((val, key) => {
828
+ allParams.push(val);
829
+ });
830
+ this.queryParams.forEach((val, key) => {
831
+ allParams.push(val);
832
+ });
833
+ this.pathParams.forEach((val, key) => {
834
+ allParams.push(val);
835
+ });
836
+ return allParams;
837
+ }
796
838
  };
797
839
 
798
840
  // src/http/transport/request-builder.ts
@@ -880,6 +922,10 @@ var RequestBuilder = class {
880
922
  this.params.responseSchema = responseSchema;
881
923
  return this;
882
924
  }
925
+ setPagination(pagination) {
926
+ this.params.pagination = pagination;
927
+ return this;
928
+ }
883
929
  addBody(body) {
884
930
  if (body !== void 0) {
885
931
  this.params.body = body;
@@ -896,7 +942,9 @@ var RequestBuilder = class {
896
942
  value: param.value,
897
943
  explode: (_a = param.explode) != null ? _a : true,
898
944
  style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
899
- encode: (_c = param.encode) != null ? _c : true
945
+ encode: (_c = param.encode) != null ? _c : true,
946
+ isLimit: !!param.isLimit,
947
+ isOffset: !!param.isOffset
900
948
  });
901
949
  return this;
902
950
  }
@@ -910,7 +958,9 @@ var RequestBuilder = class {
910
958
  value: param.value,
911
959
  explode: (_a = param.explode) != null ? _a : true,
912
960
  style: (_b = param.style) != null ? _b : "form" /* FORM */,
913
- encode: (_c = param.encode) != null ? _c : true
961
+ encode: (_c = param.encode) != null ? _c : true,
962
+ isLimit: !!param.isLimit,
963
+ isOffset: !!param.isOffset
914
964
  });
915
965
  return this;
916
966
  }
@@ -924,7 +974,9 @@ var RequestBuilder = class {
924
974
  value: param.value,
925
975
  explode: (_a = param.explode) != null ? _a : true,
926
976
  style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
927
- encode: (_c = param.encode) != null ? _c : false
977
+ encode: (_c = param.encode) != null ? _c : false,
978
+ isLimit: !!param.isLimit,
979
+ isOffset: !!param.isOffset
928
980
  });
929
981
  return this;
930
982
  }
@@ -994,7 +1046,7 @@ var DestinationsService = class extends BaseService {
994
1046
  * @returns {Promise<HttpResponse<ListDestinationsOkResponse>>} Successful Response
995
1047
  */
996
1048
  async listDestinations(requestConfig) {
997
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/destinations").setRequestSchema(import_zod5.z.any()).setResponseSchema(listDestinationsOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).build();
1049
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/destinations").setRequestSchema(import_zod5.z.any()).setResponseSchema(listDestinationsOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).build();
998
1050
  return this.client.call(request);
999
1051
  }
1000
1052
  };
@@ -1090,7 +1142,7 @@ var PackagesService = class extends BaseService {
1090
1142
  * @returns {Promise<HttpResponse<ListPackagesOkResponse>>} Successful Response
1091
1143
  */
1092
1144
  async listPackages(params, requestConfig) {
1093
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/packages").setRequestSchema(import_zod8.z.any()).setResponseSchema(listPackagesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
1145
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/packages").setRequestSchema(import_zod8.z.any()).setResponseSchema(listPackagesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
1094
1146
  key: "destination",
1095
1147
  value: params == null ? void 0 : params.destination
1096
1148
  }).addQueryParam({
@@ -1406,22 +1458,30 @@ var import_zod15 = require("zod");
1406
1458
  var createPurchaseOkResponseProfile = import_zod15.z.lazy(() => {
1407
1459
  return import_zod15.z.object({
1408
1460
  iccid: import_zod15.z.string().min(18).max(22).optional(),
1409
- activationCode: import_zod15.z.string().min(1e3).max(8e3).optional()
1461
+ activationCode: import_zod15.z.string().min(1e3).max(8e3).optional(),
1462
+ manualActivationCode: import_zod15.z.string().optional()
1410
1463
  });
1411
1464
  });
1412
1465
  var createPurchaseOkResponseProfileResponse = import_zod15.z.lazy(() => {
1413
1466
  return import_zod15.z.object({
1414
1467
  iccid: import_zod15.z.string().min(18).max(22).optional(),
1415
- activationCode: import_zod15.z.string().min(1e3).max(8e3).optional()
1468
+ activationCode: import_zod15.z.string().min(1e3).max(8e3).optional(),
1469
+ manualActivationCode: import_zod15.z.string().optional()
1416
1470
  }).transform((data) => ({
1417
1471
  iccid: data["iccid"],
1418
- activationCode: data["activationCode"]
1472
+ activationCode: data["activationCode"],
1473
+ manualActivationCode: data["manualActivationCode"]
1419
1474
  }));
1420
1475
  });
1421
1476
  var createPurchaseOkResponseProfileRequest = import_zod15.z.lazy(() => {
1422
- return import_zod15.z.object({ iccid: import_zod15.z.string().nullish(), activationCode: import_zod15.z.string().nullish() }).transform((data) => ({
1477
+ return import_zod15.z.object({
1478
+ iccid: import_zod15.z.string().nullish(),
1479
+ activationCode: import_zod15.z.string().nullish(),
1480
+ manualActivationCode: import_zod15.z.string().nullish()
1481
+ }).transform((data) => ({
1423
1482
  iccid: data["iccid"],
1424
- activationCode: data["activationCode"]
1483
+ activationCode: data["activationCode"],
1484
+ manualActivationCode: data["manualActivationCode"]
1425
1485
  }));
1426
1486
  });
1427
1487
 
@@ -1732,7 +1792,7 @@ var PurchasesService = class extends BaseService {
1732
1792
  * @returns {Promise<HttpResponse<ListPurchasesOkResponse>>} Successful Response
1733
1793
  */
1734
1794
  async listPurchases(params, requestConfig) {
1735
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/purchases").setRequestSchema(import_zod24.z.any()).setResponseSchema(listPurchasesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
1795
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases").setRequestSchema(import_zod24.z.any()).setResponseSchema(listPurchasesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
1736
1796
  key: "iccid",
1737
1797
  value: params == null ? void 0 : params.iccid
1738
1798
  }).addQueryParam({
@@ -1764,7 +1824,7 @@ var PurchasesService = class extends BaseService {
1764
1824
  * @returns {Promise<HttpResponse<CreatePurchaseOkResponse>>} Successful Response
1765
1825
  */
1766
1826
  async createPurchase(body, requestConfig) {
1767
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("POST").setPath("/purchases").setRequestSchema(createPurchaseRequestRequest).setResponseSchema(createPurchaseOkResponseResponse).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();
1827
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases").setRequestSchema(createPurchaseRequestRequest).setResponseSchema(createPurchaseOkResponseResponse).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();
1768
1828
  return this.client.call(request);
1769
1829
  }
1770
1830
  /**
@@ -1772,7 +1832,7 @@ var PurchasesService = class extends BaseService {
1772
1832
  * @returns {Promise<HttpResponse<TopUpEsimOkResponse>>} Successful Response
1773
1833
  */
1774
1834
  async topUpEsim(body, requestConfig) {
1775
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("POST").setPath("/purchases/topup").setRequestSchema(topUpEsimRequestRequest).setResponseSchema(topUpEsimOkResponseResponse).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();
1835
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/topup").setRequestSchema(topUpEsimRequestRequest).setResponseSchema(topUpEsimOkResponseResponse).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();
1776
1836
  return this.client.call(request);
1777
1837
  }
1778
1838
  /**
@@ -1780,7 +1840,7 @@ var PurchasesService = class extends BaseService {
1780
1840
  * @returns {Promise<HttpResponse<EditPurchaseOkResponse>>} Successful Response
1781
1841
  */
1782
1842
  async editPurchase(body, requestConfig) {
1783
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("POST").setPath("/purchases/edit").setRequestSchema(editPurchaseRequestRequest).setResponseSchema(editPurchaseOkResponseResponse).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();
1843
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/edit").setRequestSchema(editPurchaseRequestRequest).setResponseSchema(editPurchaseOkResponseResponse).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();
1784
1844
  return this.client.call(request);
1785
1845
  }
1786
1846
  /**
@@ -1789,7 +1849,7 @@ var PurchasesService = class extends BaseService {
1789
1849
  * @returns {Promise<HttpResponse<GetPurchaseConsumptionOkResponse>>} Successful Response
1790
1850
  */
1791
1851
  async getPurchaseConsumption(purchaseId, requestConfig) {
1792
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(import_zod24.z.any()).setResponseSchema(getPurchaseConsumptionOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
1852
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(import_zod24.z.any()).setResponseSchema(getPurchaseConsumptionOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
1793
1853
  key: "purchaseId",
1794
1854
  value: purchaseId
1795
1855
  }).build();
@@ -2056,7 +2116,7 @@ var ESimService = class extends BaseService {
2056
2116
  * @returns {Promise<HttpResponse<GetEsimOkResponse>>} Successful Response
2057
2117
  */
2058
2118
  async getEsim(params, requestConfig) {
2059
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim").setRequestSchema(import_zod34.z.any()).setResponseSchema(getEsimOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
2119
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim").setRequestSchema(import_zod34.z.any()).setResponseSchema(getEsimOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
2060
2120
  key: "iccid",
2061
2121
  value: params == null ? void 0 : params.iccid
2062
2122
  }).build();
@@ -2068,7 +2128,7 @@ var ESimService = class extends BaseService {
2068
2128
  * @returns {Promise<HttpResponse<GetEsimDeviceOkResponse>>} Successful Response
2069
2129
  */
2070
2130
  async getEsimDevice(iccid, requestConfig) {
2071
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(import_zod34.z.any()).setResponseSchema(getEsimDeviceOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2131
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(import_zod34.z.any()).setResponseSchema(getEsimDeviceOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2072
2132
  key: "iccid",
2073
2133
  value: iccid
2074
2134
  }).build();
@@ -2080,7 +2140,7 @@ var ESimService = class extends BaseService {
2080
2140
  * @returns {Promise<HttpResponse<GetEsimHistoryOkResponse>>} Successful Response
2081
2141
  */
2082
2142
  async getEsimHistory(iccid, requestConfig) {
2083
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(import_zod34.z.any()).setResponseSchema(getEsimHistoryOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2143
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(import_zod34.z.any()).setResponseSchema(getEsimHistoryOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2084
2144
  key: "iccid",
2085
2145
  value: iccid
2086
2146
  }).build();
@@ -2092,7 +2152,7 @@ var ESimService = class extends BaseService {
2092
2152
  * @returns {Promise<HttpResponse<GetEsimMacOkResponse>>} Successful Response
2093
2153
  */
2094
2154
  async getEsimMac(iccid, requestConfig) {
2095
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim/{iccid}/mac").setRequestSchema(import_zod34.z.any()).setResponseSchema(getEsimMacOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2155
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/mac").setRequestSchema(import_zod34.z.any()).setResponseSchema(getEsimMacOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2096
2156
  key: "iccid",
2097
2157
  value: iccid
2098
2158
  }).build();
@@ -2126,11 +2186,11 @@ var Celitech = class {
2126
2186
  this.purchases.baseUrl = environment;
2127
2187
  this.eSim.baseUrl = environment;
2128
2188
  }
2129
- set timeout(timeout) {
2130
- this.destinations.timeout = timeout;
2131
- this.packages.timeout = timeout;
2132
- this.purchases.timeout = timeout;
2133
- this.eSim.timeout = timeout;
2189
+ set timeoutMs(timeoutMs) {
2190
+ this.destinations.timeoutMs = timeoutMs;
2191
+ this.packages.timeoutMs = timeoutMs;
2192
+ this.purchases.timeoutMs = timeoutMs;
2193
+ this.eSim.timeoutMs = timeoutMs;
2134
2194
  }
2135
2195
  set clientId(clientId) {
2136
2196
  this.destinations.clientId = clientId;