celitech-sdk 1.1.86 → 1.1.88

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # Celitech TypeScript SDK 1.1.86
1
+ # Celitech TypeScript SDK 1.1.88
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.1.86`
8
+ - SDK version: `1.1.88`
9
9
 
10
10
  ## About the API
11
11
 
@@ -18,6 +18,7 @@ Welcome to the CELITECH API documentation! Useful links: [Homepage](https://www.
18
18
  - [Installation](#installation)
19
19
  - [Environment Variables](#environment-variables)
20
20
  - [Setting a Custom Timeout](#setting-a-custom-timeout)
21
+ - [Sample Usage](#sample-usage)
21
22
  - [Services](#services)
22
23
  - [Models](#models)
23
24
  - [License](#license)
@@ -57,6 +58,25 @@ You can set a custom timeout for the SDK's HTTP requests as follows:
57
58
  const celitech = new Celitech({ timeout: 10000 });
58
59
  ```
59
60
 
61
+ # Sample Usage
62
+
63
+ Below is a comprehensive example demonstrating how to authenticate and call a simple endpoint:
64
+
65
+ ```ts
66
+ import { Celitech } from 'celitech-sdk';
67
+
68
+ (async () => {
69
+ const celitech = new Celitech({
70
+ clientId: 'client-id',
71
+ clientSecret: 'client-secret',
72
+ });
73
+
74
+ const { data } = await celitech.destinations.listDestinations();
75
+
76
+ console.log(data);
77
+ })();
78
+ ```
79
+
60
80
  ## Services
61
81
 
62
82
  The SDK provides various services to interact with the API.
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ declare enum Environment {
4
4
  DEFAULT = "https://api.celitech.net/v1"
5
5
  }
6
6
 
7
- type HttpMethod$1 = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
7
+ type HttpMethod$1 = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
8
8
  interface HttpRequest {
9
9
  baseUrl: string;
10
10
  method: HttpMethod$1;
@@ -13,6 +13,7 @@ interface HttpRequest {
13
13
  body?: BodyInit;
14
14
  abortSignal?: AbortSignal;
15
15
  queryParams: Map<string, unknown>;
16
+ pathParams: Map<string, unknown>;
16
17
  }
17
18
  interface HttpMetadata$1 {
18
19
  status: number;
@@ -24,14 +25,14 @@ interface HttpResponse$1<T> {
24
25
  metadata: HttpMetadata$1;
25
26
  raw: ArrayBuffer;
26
27
  }
27
- interface HttpError {
28
+ interface HttpError$1 {
28
29
  error: string;
29
30
  metadata: HttpMetadata$1;
30
31
  }
31
32
  interface Hook {
32
33
  beforeRequest(request: HttpRequest, params: Map<string, string>): Promise<HttpRequest>;
33
34
  afterResponse(request: HttpRequest, response: HttpResponse$1<any>, params: Map<string, string>): Promise<HttpResponse$1<any>>;
34
- onError(request: HttpRequest, response: HttpResponse$1<any>, params: Map<string, string>): Promise<HttpError>;
35
+ onError(request: HttpRequest, response: HttpResponse$1<any>, params: Map<string, string>): Promise<HttpError$1>;
35
36
  }
36
37
 
37
38
  declare enum SerializationStyle {
@@ -45,7 +46,7 @@ declare enum SerializationStyle {
45
46
  NONE = "none"
46
47
  }
47
48
 
48
- interface CreateRequestParameters<T> {
49
+ interface CreateRequestParameters<FullResponse, Page = unknown[]> {
49
50
  baseUrl: string;
50
51
  method: HttpMethod;
51
52
  body?: any;
@@ -54,12 +55,13 @@ interface CreateRequestParameters<T> {
54
55
  pathParams: Map<string, RequestParameter>;
55
56
  path: string;
56
57
  config: SdkConfig;
57
- responseSchema: ZodType<T, any, any>;
58
+ responseSchema: ZodType<FullResponse, any, any>;
58
59
  requestSchema: ZodType;
59
60
  requestContentType: ContentType;
60
61
  responseContentType: ContentType;
61
62
  validation: ValidationOptions;
62
63
  retry: RetryOptions;
64
+ pagination?: RequestPagination<Page>;
63
65
  }
64
66
  interface RequestParameter {
65
67
  key: string | undefined;
@@ -67,8 +69,15 @@ interface RequestParameter {
67
69
  explode: boolean;
68
70
  encode: boolean;
69
71
  style: SerializationStyle;
72
+ isLimit: boolean;
73
+ isOffset: boolean;
74
+ }
75
+ interface RequestPagination<Page> {
76
+ pageSize: number;
77
+ pagePath: string[];
78
+ pageSchema?: ZodType<Page, any, any>;
70
79
  }
71
- declare class Request<T> {
80
+ declare class Request<T = unknown, PageSchema = unknown[]> {
72
81
  baseUrl: string;
73
82
  headers: Map<string, RequestParameter>;
74
83
  queryParams: Map<string, RequestParameter>;
@@ -83,25 +92,28 @@ declare class Request<T> {
83
92
  responseContentType: ContentType;
84
93
  validation: ValidationOptions;
85
94
  retry: RetryOptions;
95
+ pagination?: RequestPagination<PageSchema>;
86
96
  private readonly pathPattern;
87
- constructor(params: CreateRequestParameters<T>);
97
+ constructor(params: CreateRequestParameters<T, PageSchema>);
88
98
  addHeaderParam(key: string, param: RequestParameter): void;
89
99
  addQueryParam(key: string, param: RequestParameter): void;
90
100
  addPathParam(key: string, param: RequestParameter): void;
91
101
  addBody(body: any): void;
92
102
  updateFromHookRequest(hookRequest: HttpRequest): void;
93
- toHookRequest(): HttpRequest;
94
103
  constructFullUrl(): string;
95
- copy(overrides?: Partial<CreateRequestParameters<T>>): Request<T>;
104
+ copy(overrides?: Partial<CreateRequestParameters<T>>): Request<T, unknown[]>;
96
105
  getHeaders(): HeadersInit | undefined;
106
+ nextPage(): void;
97
107
  private constructPath;
108
+ private getOffsetParam;
109
+ private getAllParams;
98
110
  }
99
111
 
100
- type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
112
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
101
113
  interface SdkConfig {
102
114
  baseUrl?: string;
103
115
  environment?: Environment;
104
- timeout?: number;
116
+ timeoutMs?: number;
105
117
  clientId?: string;
106
118
  clientSecret?: string;
107
119
  retry?: RetryOptions;
@@ -112,7 +124,7 @@ interface HttpMetadata {
112
124
  statusText: string;
113
125
  headers: Record<string, string>;
114
126
  }
115
- interface HttpResponse<T> {
127
+ interface HttpResponse<T = unknown> {
116
128
  data?: T;
117
129
  metadata: HttpMetadata;
118
130
  raw: ArrayBuffer;
@@ -144,7 +156,7 @@ declare class CustomHook implements Hook {
144
156
  getToken(clientId: string, clientSecret: string): Promise<any>;
145
157
  beforeRequest(request: HttpRequest, params: Map<string, string>): Promise<HttpRequest>;
146
158
  afterResponse(request: HttpRequest, response: HttpResponse$1<any>, params: Map<string, string>): Promise<HttpResponse$1<any>>;
147
- onError(request: HttpRequest, response: HttpResponse$1<any>, params: Map<string, string>): Promise<HttpError>;
159
+ onError(request: HttpRequest, response: HttpResponse$1<any>, params: Map<string, string>): Promise<HttpError$1>;
148
160
  }
149
161
 
150
162
  declare class HttpClient {
@@ -152,8 +164,10 @@ declare class HttpClient {
152
164
  private readonly requestHandlerChain;
153
165
  constructor(config: SdkConfig, hook?: CustomHook);
154
166
  call<T>(request: Request<T>): Promise<HttpResponse<T>>;
167
+ callPaginated<FullResponse, Page>(request: Request<FullResponse, Page>): Promise<HttpResponse<Page>>;
155
168
  setBaseUrl(url: string): void;
156
169
  setConfig(config: SdkConfig): void;
170
+ private getPage;
157
171
  }
158
172
 
159
173
  declare class BaseService {
@@ -162,7 +176,7 @@ declare class BaseService {
162
176
  constructor(config: SdkConfig);
163
177
  set baseUrl(baseUrl: string);
164
178
  set environment(environment: Environment);
165
- set timeout(timeout: number);
179
+ set timeoutMs(timeoutMs: number);
166
180
  set clientId(clientId: string);
167
181
  set clientSecret(clientSecret: string);
168
182
  }
@@ -586,12 +600,15 @@ declare const createPurchaseOkResponse: z.ZodLazy<z.ZodObject<{
586
600
  profile: z.ZodOptional<z.ZodLazy<z.ZodObject<{
587
601
  iccid: z.ZodOptional<z.ZodString>;
588
602
  activationCode: z.ZodOptional<z.ZodString>;
603
+ manualActivationCode: z.ZodOptional<z.ZodString>;
589
604
  }, "strip", z.ZodTypeAny, {
590
605
  iccid?: string | undefined;
591
606
  activationCode?: string | undefined;
607
+ manualActivationCode?: string | undefined;
592
608
  }, {
593
609
  iccid?: string | undefined;
594
610
  activationCode?: string | undefined;
611
+ manualActivationCode?: string | undefined;
595
612
  }>>>;
596
613
  }, "strip", z.ZodTypeAny, {
597
614
  purchase?: {
@@ -606,6 +623,7 @@ declare const createPurchaseOkResponse: z.ZodLazy<z.ZodObject<{
606
623
  profile?: {
607
624
  iccid?: string | undefined;
608
625
  activationCode?: string | undefined;
626
+ manualActivationCode?: string | undefined;
609
627
  } | undefined;
610
628
  }, {
611
629
  purchase?: {
@@ -620,6 +638,7 @@ declare const createPurchaseOkResponse: z.ZodLazy<z.ZodObject<{
620
638
  profile?: {
621
639
  iccid?: string | undefined;
622
640
  activationCode?: string | undefined;
641
+ manualActivationCode?: string | undefined;
623
642
  } | undefined;
624
643
  }>>;
625
644
  /**
@@ -1064,18 +1083,22 @@ type CreatePurchaseOkResponsePurchase = z.infer<typeof createPurchaseOkResponseP
1064
1083
  declare const createPurchaseOkResponseProfile: z.ZodLazy<z.ZodObject<{
1065
1084
  iccid: z.ZodOptional<z.ZodString>;
1066
1085
  activationCode: z.ZodOptional<z.ZodString>;
1086
+ manualActivationCode: z.ZodOptional<z.ZodString>;
1067
1087
  }, "strip", z.ZodTypeAny, {
1068
1088
  iccid?: string | undefined;
1069
1089
  activationCode?: string | undefined;
1090
+ manualActivationCode?: string | undefined;
1070
1091
  }, {
1071
1092
  iccid?: string | undefined;
1072
1093
  activationCode?: string | undefined;
1094
+ manualActivationCode?: string | undefined;
1073
1095
  }>>;
1074
1096
  /**
1075
1097
  *
1076
1098
  * @typedef {CreatePurchaseOkResponseProfile} createPurchaseOkResponseProfile
1077
1099
  * @property {string} - ID of the eSIM
1078
1100
  * @property {string} - QR Code of the eSIM as base64
1101
+ * @property {string} - Manual Activation Code of the eSIM
1079
1102
  */
1080
1103
  type CreatePurchaseOkResponseProfile = z.infer<typeof createPurchaseOkResponseProfile>;
1081
1104
 
@@ -1498,6 +1521,13 @@ declare const getEsimMacOkResponseEsim: z.ZodLazy<z.ZodObject<{
1498
1521
  */
1499
1522
  type GetEsimMacOkResponseEsim = z.infer<typeof getEsimMacOkResponseEsim>;
1500
1523
 
1524
+ declare class HttpError extends Error {
1525
+ readonly error: string;
1526
+ readonly metadata: HttpMetadata;
1527
+ readonly raw?: ArrayBuffer;
1528
+ constructor(metadata: HttpMetadata, raw?: ArrayBuffer, error?: string);
1529
+ }
1530
+
1501
1531
  declare class Celitech {
1502
1532
  config: SdkConfig;
1503
1533
  readonly destinations: DestinationsService;
@@ -1507,9 +1537,9 @@ declare class Celitech {
1507
1537
  constructor(config: SdkConfig);
1508
1538
  set baseUrl(baseUrl: string);
1509
1539
  set environment(environment: Environment);
1510
- set timeout(timeout: number);
1540
+ set timeoutMs(timeoutMs: number);
1511
1541
  set clientId(clientId: string);
1512
1542
  set clientSecret(clientSecret: string);
1513
1543
  }
1514
1544
 
1515
- export { Celitech, CreatePurchaseOkResponse, CreatePurchaseOkResponseProfile, CreatePurchaseOkResponsePurchase, CreatePurchaseRequest, Destinations, DestinationsService, Device, ESimService, EditPurchaseOkResponse, EditPurchaseRequest, GetEsimDeviceOkResponse, GetEsimHistoryOkResponse, GetEsimHistoryOkResponseEsim, GetEsimMacOkResponse, GetEsimMacOkResponseEsim, GetEsimOkResponse, GetEsimOkResponseEsim, GetPurchaseConsumptionOkResponse, History, ListDestinationsOkResponse, ListPackagesOkResponse, ListPurchasesOkResponse, Package_, Packages, PackagesService, Purchases, PurchasesEsim, PurchasesService, RequestConfig, RetryOptions, SdkConfig, TopUpEsimOkResponse, TopUpEsimOkResponseProfile, TopUpEsimOkResponsePurchase, TopUpEsimRequest, ValidationOptions };
1545
+ export { Celitech, CreatePurchaseOkResponse, CreatePurchaseOkResponseProfile, CreatePurchaseOkResponsePurchase, CreatePurchaseRequest, Destinations, DestinationsService, Device, ESimService, EditPurchaseOkResponse, EditPurchaseRequest, Environment, GetEsimDeviceOkResponse, GetEsimHistoryOkResponse, GetEsimHistoryOkResponseEsim, GetEsimMacOkResponse, GetEsimMacOkResponseEsim, GetEsimOkResponse, GetEsimOkResponseEsim, GetPurchaseConsumptionOkResponse, History, HttpError, HttpMetadata, HttpMethod, HttpResponse, ListDestinationsOkResponse, ListPackagesOkResponse, ListPurchasesOkResponse, Package_, Packages, PackagesService, Purchases, PurchasesEsim, PurchasesService, RequestConfig, RetryOptions, SdkConfig, TopUpEsimOkResponse, TopUpEsimOkResponseProfile, TopUpEsimOkResponsePurchase, TopUpEsimRequest, ValidationOptions };
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) {
@@ -459,10 +464,19 @@ var RequestFetchAdapter = class {
459
464
  this.setMethod(request.method);
460
465
  this.setHeaders(request.getHeaders());
461
466
  this.setBody(request.body);
462
- this.setTimeout(request.config.timeout);
467
+ this.setTimeout(request.config.timeoutMs);
463
468
  }
464
469
  async send() {
465
- return fetch(this.request.constructFullUrl(), this.requestInit);
470
+ const response = await fetch(this.request.constructFullUrl(), this.requestInit);
471
+ const metadata = {
472
+ status: response.status,
473
+ statusText: response.statusText || "",
474
+ headers: this.getHeaders(response)
475
+ };
476
+ return {
477
+ metadata,
478
+ raw: await response.clone().arrayBuffer()
479
+ };
466
480
  }
467
481
  setMethod(method) {
468
482
  if (!method) {
@@ -491,32 +505,13 @@ var RequestFetchAdapter = class {
491
505
  headers
492
506
  };
493
507
  }
494
- setTimeout(timeout) {
495
- if (!timeout) {
508
+ setTimeout(timeoutMs) {
509
+ if (!timeoutMs) {
496
510
  return;
497
511
  }
498
512
  this.requestInit = {
499
513
  ...this.requestInit,
500
- signal: AbortSignal.timeout(timeout)
501
- };
502
- }
503
- };
504
-
505
- // src/http/handlers/terminating-handler.ts
506
- var TerminatingHandler = class {
507
- async handle(request) {
508
- const response = await new RequestFetchAdapter(request).send();
509
- const metadata = {
510
- status: response.status,
511
- statusText: response.statusText,
512
- headers: this.getHeaders(response)
513
- };
514
- if (metadata.status >= 400) {
515
- throw new HttpError(metadata);
516
- }
517
- return {
518
- metadata,
519
- raw: await response.clone().arrayBuffer()
514
+ signal: AbortSignal.timeout(timeoutMs)
520
515
  };
521
516
  }
522
517
  getHeaders(response) {
@@ -526,8 +521,22 @@ var TerminatingHandler = class {
526
521
  });
527
522
  return headers;
528
523
  }
529
- isErrorResponse(response) {
530
- return response.metadata.status >= 400;
524
+ };
525
+
526
+ // src/http/handlers/terminating-handler.ts
527
+ var TerminatingHandler = class {
528
+ async handle(request) {
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;
531
540
  }
532
541
  };
533
542
 
@@ -576,12 +585,39 @@ var HttpClient = class {
576
585
  call(request) {
577
586
  return this.requestHandlerChain.callChain(request);
578
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
+ }
579
598
  setBaseUrl(url) {
580
599
  this.config.baseUrl = url;
581
600
  }
582
601
  setConfig(config) {
583
602
  this.config = config;
584
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
+ }
585
621
  };
586
622
 
587
623
  // src/services/base-service.ts
@@ -596,8 +632,8 @@ var BaseService = class {
596
632
  set environment(environment) {
597
633
  this.config.environment = environment;
598
634
  }
599
- set timeout(timeout) {
600
- this.config.timeout = timeout;
635
+ set timeoutMs(timeoutMs) {
636
+ this.config.timeoutMs = timeoutMs;
601
637
  }
602
638
  set clientId(clientId) {
603
639
  this.config.clientId = clientId;
@@ -676,6 +712,7 @@ var Request = class {
676
712
  this.responseContentType = params.responseContentType;
677
713
  this.retry = params.retry;
678
714
  this.validation = params.validation;
715
+ this.pagination = params.pagination;
679
716
  }
680
717
  addHeaderParam(key, param) {
681
718
  if (param.value === void 0) {
@@ -734,16 +771,6 @@ var Request = class {
734
771
  this.path = hookRequest.path;
735
772
  this.body = hookRequest.body;
736
773
  }
737
- toHookRequest() {
738
- return {
739
- baseUrl: this.baseUrl,
740
- method: this.method,
741
- path: this.path,
742
- headers: this.headers,
743
- body: this.body,
744
- queryParams: this.queryParams
745
- };
746
- }
747
774
  constructFullUrl() {
748
775
  const queryString = new QuerySerializer().serialize(this.queryParams);
749
776
  const path = this.constructPath();
@@ -778,9 +805,36 @@ var Request = class {
778
805
  }
779
806
  return new HeaderSerializer().serialize(this.headers);
780
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
+ }
781
818
  constructPath() {
782
819
  return new PathSerializer().serialize(this.pathPattern, this.pathParams);
783
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
+ }
784
838
  };
785
839
 
786
840
  // src/http/transport/request-builder.ts
@@ -868,6 +922,10 @@ var RequestBuilder = class {
868
922
  this.params.responseSchema = responseSchema;
869
923
  return this;
870
924
  }
925
+ setPagination(pagination) {
926
+ this.params.pagination = pagination;
927
+ return this;
928
+ }
871
929
  addBody(body) {
872
930
  if (body !== void 0) {
873
931
  this.params.body = body;
@@ -884,7 +942,9 @@ var RequestBuilder = class {
884
942
  value: param.value,
885
943
  explode: (_a = param.explode) != null ? _a : true,
886
944
  style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
887
- encode: (_c = param.encode) != null ? _c : true
945
+ encode: (_c = param.encode) != null ? _c : true,
946
+ isLimit: !!param.isLimit,
947
+ isOffset: !!param.isOffset
888
948
  });
889
949
  return this;
890
950
  }
@@ -898,7 +958,9 @@ var RequestBuilder = class {
898
958
  value: param.value,
899
959
  explode: (_a = param.explode) != null ? _a : true,
900
960
  style: (_b = param.style) != null ? _b : "form" /* FORM */,
901
- encode: (_c = param.encode) != null ? _c : true
961
+ encode: (_c = param.encode) != null ? _c : true,
962
+ isLimit: !!param.isLimit,
963
+ isOffset: !!param.isOffset
902
964
  });
903
965
  return this;
904
966
  }
@@ -912,7 +974,9 @@ var RequestBuilder = class {
912
974
  value: param.value,
913
975
  explode: (_a = param.explode) != null ? _a : true,
914
976
  style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
915
- encode: (_c = param.encode) != null ? _c : false
977
+ encode: (_c = param.encode) != null ? _c : false,
978
+ isLimit: !!param.isLimit,
979
+ isOffset: !!param.isOffset
916
980
  });
917
981
  return this;
918
982
  }
@@ -982,7 +1046,7 @@ var DestinationsService = class extends BaseService {
982
1046
  * @returns {Promise<HttpResponse<ListDestinationsOkResponse>>} Successful Response
983
1047
  */
984
1048
  async listDestinations(requestConfig) {
985
- 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();
986
1050
  return this.client.call(request);
987
1051
  }
988
1052
  };
@@ -1078,7 +1142,7 @@ var PackagesService = class extends BaseService {
1078
1142
  * @returns {Promise<HttpResponse<ListPackagesOkResponse>>} Successful Response
1079
1143
  */
1080
1144
  async listPackages(params, requestConfig) {
1081
- 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({
1082
1146
  key: "destination",
1083
1147
  value: params == null ? void 0 : params.destination
1084
1148
  }).addQueryParam({
@@ -1394,22 +1458,30 @@ var import_zod15 = require("zod");
1394
1458
  var createPurchaseOkResponseProfile = import_zod15.z.lazy(() => {
1395
1459
  return import_zod15.z.object({
1396
1460
  iccid: import_zod15.z.string().min(18).max(22).optional(),
1397
- 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()
1398
1463
  });
1399
1464
  });
1400
1465
  var createPurchaseOkResponseProfileResponse = import_zod15.z.lazy(() => {
1401
1466
  return import_zod15.z.object({
1402
1467
  iccid: import_zod15.z.string().min(18).max(22).optional(),
1403
- 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()
1404
1470
  }).transform((data) => ({
1405
1471
  iccid: data["iccid"],
1406
- activationCode: data["activationCode"]
1472
+ activationCode: data["activationCode"],
1473
+ manualActivationCode: data["manualActivationCode"]
1407
1474
  }));
1408
1475
  });
1409
1476
  var createPurchaseOkResponseProfileRequest = import_zod15.z.lazy(() => {
1410
- 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) => ({
1411
1482
  iccid: data["iccid"],
1412
- activationCode: data["activationCode"]
1483
+ activationCode: data["activationCode"],
1484
+ manualActivationCode: data["manualActivationCode"]
1413
1485
  }));
1414
1486
  });
1415
1487
 
@@ -1720,7 +1792,7 @@ var PurchasesService = class extends BaseService {
1720
1792
  * @returns {Promise<HttpResponse<ListPurchasesOkResponse>>} Successful Response
1721
1793
  */
1722
1794
  async listPurchases(params, requestConfig) {
1723
- 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({
1724
1796
  key: "iccid",
1725
1797
  value: params == null ? void 0 : params.iccid
1726
1798
  }).addQueryParam({
@@ -1752,7 +1824,7 @@ var PurchasesService = class extends BaseService {
1752
1824
  * @returns {Promise<HttpResponse<CreatePurchaseOkResponse>>} Successful Response
1753
1825
  */
1754
1826
  async createPurchase(body, requestConfig) {
1755
- 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();
1756
1828
  return this.client.call(request);
1757
1829
  }
1758
1830
  /**
@@ -1760,7 +1832,7 @@ var PurchasesService = class extends BaseService {
1760
1832
  * @returns {Promise<HttpResponse<TopUpEsimOkResponse>>} Successful Response
1761
1833
  */
1762
1834
  async topUpEsim(body, requestConfig) {
1763
- 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();
1764
1836
  return this.client.call(request);
1765
1837
  }
1766
1838
  /**
@@ -1768,7 +1840,7 @@ var PurchasesService = class extends BaseService {
1768
1840
  * @returns {Promise<HttpResponse<EditPurchaseOkResponse>>} Successful Response
1769
1841
  */
1770
1842
  async editPurchase(body, requestConfig) {
1771
- 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();
1772
1844
  return this.client.call(request);
1773
1845
  }
1774
1846
  /**
@@ -1777,7 +1849,7 @@ var PurchasesService = class extends BaseService {
1777
1849
  * @returns {Promise<HttpResponse<GetPurchaseConsumptionOkResponse>>} Successful Response
1778
1850
  */
1779
1851
  async getPurchaseConsumption(purchaseId, requestConfig) {
1780
- 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({
1781
1853
  key: "purchaseId",
1782
1854
  value: purchaseId
1783
1855
  }).build();
@@ -2044,7 +2116,7 @@ var ESimService = class extends BaseService {
2044
2116
  * @returns {Promise<HttpResponse<GetEsimOkResponse>>} Successful Response
2045
2117
  */
2046
2118
  async getEsim(params, requestConfig) {
2047
- 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({
2048
2120
  key: "iccid",
2049
2121
  value: params == null ? void 0 : params.iccid
2050
2122
  }).build();
@@ -2056,7 +2128,7 @@ var ESimService = class extends BaseService {
2056
2128
  * @returns {Promise<HttpResponse<GetEsimDeviceOkResponse>>} Successful Response
2057
2129
  */
2058
2130
  async getEsimDevice(iccid, requestConfig) {
2059
- 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({
2060
2132
  key: "iccid",
2061
2133
  value: iccid
2062
2134
  }).build();
@@ -2068,7 +2140,7 @@ var ESimService = class extends BaseService {
2068
2140
  * @returns {Promise<HttpResponse<GetEsimHistoryOkResponse>>} Successful Response
2069
2141
  */
2070
2142
  async getEsimHistory(iccid, requestConfig) {
2071
- 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({
2072
2144
  key: "iccid",
2073
2145
  value: iccid
2074
2146
  }).build();
@@ -2080,7 +2152,7 @@ var ESimService = class extends BaseService {
2080
2152
  * @returns {Promise<HttpResponse<GetEsimMacOkResponse>>} Successful Response
2081
2153
  */
2082
2154
  async getEsimMac(iccid, requestConfig) {
2083
- 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({
2084
2156
  key: "iccid",
2085
2157
  value: iccid
2086
2158
  }).build();
@@ -2114,11 +2186,11 @@ var Celitech = class {
2114
2186
  this.purchases.baseUrl = environment;
2115
2187
  this.eSim.baseUrl = environment;
2116
2188
  }
2117
- set timeout(timeout) {
2118
- this.destinations.timeout = timeout;
2119
- this.packages.timeout = timeout;
2120
- this.purchases.timeout = timeout;
2121
- 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;
2122
2194
  }
2123
2195
  set clientId(clientId) {
2124
2196
  this.destinations.clientId = clientId;
package/dist/index.mjs CHANGED
@@ -21,15 +21,6 @@ var RequestHandlerChain = class {
21
21
  }
22
22
  };
23
23
 
24
- // src/http/error.ts
25
- var HttpError = class extends Error {
26
- constructor(metadata, error) {
27
- super(error);
28
- this.error = metadata.statusText;
29
- this.metadata = metadata;
30
- }
31
- };
32
-
33
24
  // src/http/hooks/custom-hook.ts
34
25
  var CURRENT_TOKEN = "";
35
26
  var CURRENT_EXPIRY = -1;
@@ -195,7 +186,8 @@ var TransportHookAdapter = class {
195
186
  path: newRequest.path,
196
187
  body: newRequest.body,
197
188
  queryParams: this.hookParamsToTransportParams(newRequest.queryParams, request.queryParams, true),
198
- headers: this.hookParamsToTransportParams(newRequest.headers, request.headers, false)
189
+ headers: this.hookParamsToTransportParams(newRequest.headers, request.headers, false),
190
+ pathParams: this.hookParamsToTransportParams(newRequest.pathParams, request.headers, false)
199
191
  });
200
192
  return newTransportRequest;
201
193
  }
@@ -216,27 +208,34 @@ var TransportHookAdapter = class {
216
208
  request.queryParams.forEach((queryParam, key) => {
217
209
  hookQueryParams.set(key, queryParam.value);
218
210
  });
211
+ const hookPathParams = /* @__PURE__ */ new Map();
212
+ request.pathParams.forEach((pathParam, key) => {
213
+ hookPathParams.set(key, pathParam.value);
214
+ });
219
215
  const hookRequest = {
220
216
  baseUrl: request.baseUrl,
221
217
  method: request.method,
222
218
  path: request.path,
223
219
  headers: hookHeaders,
224
220
  body: request.body,
225
- queryParams: hookQueryParams
221
+ queryParams: hookQueryParams,
222
+ pathParams: hookPathParams
226
223
  };
227
224
  return hookRequest;
228
225
  }
229
226
  hookParamsToTransportParams(hookParams, originalTransportParams, encode) {
230
227
  const transportParams = /* @__PURE__ */ new Map();
231
228
  hookParams.forEach((hookParamValue, hookParamKey) => {
232
- var _a, _b;
229
+ var _a, _b, _c, _d;
233
230
  const requestParam = originalTransportParams.get(hookParamKey);
234
231
  transportParams.set(hookParamKey, {
235
232
  key: hookParamKey,
236
233
  value: hookParamValue,
237
234
  encode: (_a = requestParam == null ? void 0 : requestParam.encode) != null ? _a : false,
238
235
  style: (requestParam == null ? void 0 : requestParam.style) || "none" /* NONE */,
239
- explode: (_b = requestParam == null ? void 0 : requestParam.explode) != null ? _b : false
236
+ explode: (_b = requestParam == null ? void 0 : requestParam.explode) != null ? _b : false,
237
+ isLimit: (_c = requestParam == null ? void 0 : requestParam.isLimit) != null ? _c : false,
238
+ isOffset: (_d = requestParam == null ? void 0 : requestParam.isOffset) != null ? _d : false
240
239
  });
241
240
  });
242
241
  return transportParams;
@@ -259,8 +258,7 @@ var HookHandler = class {
259
258
  if (response.metadata.status < 400) {
260
259
  return await hook.afterResponse(nextRequest, response, hookParams);
261
260
  }
262
- const error = await hook.onError(nextRequest, response, hookParams);
263
- throw new HttpError(error.metadata, error.error);
261
+ throw await hook.onError(nextRequest, response, hookParams);
264
262
  }
265
263
  getHookParams(request) {
266
264
  const hookParams = /* @__PURE__ */ new Map();
@@ -393,6 +391,13 @@ var RequestValidationHandler = class {
393
391
  });
394
392
  return params.toString();
395
393
  }
394
+ if (typeof body === "object" && !Array.isArray(body)) {
395
+ const params = new URLSearchParams();
396
+ for (const [key, value] of Object.entries(body)) {
397
+ params.append(key, value.toString());
398
+ }
399
+ return params.toString();
400
+ }
396
401
  return "";
397
402
  }
398
403
  toFormData(body) {
@@ -419,10 +424,19 @@ var RequestFetchAdapter = class {
419
424
  this.setMethod(request.method);
420
425
  this.setHeaders(request.getHeaders());
421
426
  this.setBody(request.body);
422
- this.setTimeout(request.config.timeout);
427
+ this.setTimeout(request.config.timeoutMs);
423
428
  }
424
429
  async send() {
425
- return fetch(this.request.constructFullUrl(), this.requestInit);
430
+ const response = await fetch(this.request.constructFullUrl(), this.requestInit);
431
+ const metadata = {
432
+ status: response.status,
433
+ statusText: response.statusText || "",
434
+ headers: this.getHeaders(response)
435
+ };
436
+ return {
437
+ metadata,
438
+ raw: await response.clone().arrayBuffer()
439
+ };
426
440
  }
427
441
  setMethod(method) {
428
442
  if (!method) {
@@ -451,32 +465,13 @@ var RequestFetchAdapter = class {
451
465
  headers
452
466
  };
453
467
  }
454
- setTimeout(timeout) {
455
- if (!timeout) {
468
+ setTimeout(timeoutMs) {
469
+ if (!timeoutMs) {
456
470
  return;
457
471
  }
458
472
  this.requestInit = {
459
473
  ...this.requestInit,
460
- signal: AbortSignal.timeout(timeout)
461
- };
462
- }
463
- };
464
-
465
- // src/http/handlers/terminating-handler.ts
466
- var TerminatingHandler = class {
467
- async handle(request) {
468
- const response = await new RequestFetchAdapter(request).send();
469
- const metadata = {
470
- status: response.status,
471
- statusText: response.statusText,
472
- headers: this.getHeaders(response)
473
- };
474
- if (metadata.status >= 400) {
475
- throw new HttpError(metadata);
476
- }
477
- return {
478
- metadata,
479
- raw: await response.clone().arrayBuffer()
474
+ signal: AbortSignal.timeout(timeoutMs)
480
475
  };
481
476
  }
482
477
  getHeaders(response) {
@@ -486,8 +481,22 @@ var TerminatingHandler = class {
486
481
  });
487
482
  return headers;
488
483
  }
489
- isErrorResponse(response) {
490
- return response.metadata.status >= 400;
484
+ };
485
+
486
+ // src/http/handlers/terminating-handler.ts
487
+ var TerminatingHandler = class {
488
+ async handle(request) {
489
+ return new RequestFetchAdapter(request).send();
490
+ }
491
+ };
492
+
493
+ // src/http/error.ts
494
+ var HttpError = class extends Error {
495
+ constructor(metadata, raw, error) {
496
+ super(error);
497
+ this.error = metadata.statusText;
498
+ this.metadata = metadata;
499
+ this.raw = raw;
491
500
  }
492
501
  };
493
502
 
@@ -536,12 +545,39 @@ var HttpClient = class {
536
545
  call(request) {
537
546
  return this.requestHandlerChain.callChain(request);
538
547
  }
548
+ async callPaginated(request) {
549
+ const response = await this.call(request);
550
+ if (!response.data) {
551
+ throw new Error("no response data to paginate through");
552
+ }
553
+ return {
554
+ ...response,
555
+ data: this.getPage(request, response.data)
556
+ };
557
+ }
539
558
  setBaseUrl(url) {
540
559
  this.config.baseUrl = url;
541
560
  }
542
561
  setConfig(config) {
543
562
  this.config = config;
544
563
  }
564
+ getPage(request, data) {
565
+ var _a, _b, _c, _d;
566
+ if (!request.pagination) {
567
+ throw new Error("getPage called for request without pagination property");
568
+ }
569
+ let curr = data;
570
+ for (const segment of ((_a = request.pagination) == null ? void 0 : _a.pagePath) || []) {
571
+ curr = curr[segment];
572
+ }
573
+ const page = (_c = (_b = request.pagination) == null ? void 0 : _b.pageSchema) == null ? void 0 : _c.parse(curr);
574
+ if (!page) {
575
+ throw new Error(
576
+ `error getting page data. Curr: ${JSON.stringify(curr)}. PagePath: ${(_d = request.pagination) == null ? void 0 : _d.pagePath}. Data: ${JSON.stringify(data)}`
577
+ );
578
+ }
579
+ return page;
580
+ }
545
581
  };
546
582
 
547
583
  // src/services/base-service.ts
@@ -556,8 +592,8 @@ var BaseService = class {
556
592
  set environment(environment) {
557
593
  this.config.environment = environment;
558
594
  }
559
- set timeout(timeout) {
560
- this.config.timeout = timeout;
595
+ set timeoutMs(timeoutMs) {
596
+ this.config.timeoutMs = timeoutMs;
561
597
  }
562
598
  set clientId(clientId) {
563
599
  this.config.clientId = clientId;
@@ -636,6 +672,7 @@ var Request = class {
636
672
  this.responseContentType = params.responseContentType;
637
673
  this.retry = params.retry;
638
674
  this.validation = params.validation;
675
+ this.pagination = params.pagination;
639
676
  }
640
677
  addHeaderParam(key, param) {
641
678
  if (param.value === void 0) {
@@ -694,16 +731,6 @@ var Request = class {
694
731
  this.path = hookRequest.path;
695
732
  this.body = hookRequest.body;
696
733
  }
697
- toHookRequest() {
698
- return {
699
- baseUrl: this.baseUrl,
700
- method: this.method,
701
- path: this.path,
702
- headers: this.headers,
703
- body: this.body,
704
- queryParams: this.queryParams
705
- };
706
- }
707
734
  constructFullUrl() {
708
735
  const queryString = new QuerySerializer().serialize(this.queryParams);
709
736
  const path = this.constructPath();
@@ -738,9 +765,36 @@ var Request = class {
738
765
  }
739
766
  return new HeaderSerializer().serialize(this.headers);
740
767
  }
768
+ nextPage() {
769
+ if (!this.pagination) {
770
+ return;
771
+ }
772
+ const offsetParam = this.getOffsetParam();
773
+ if (!offsetParam) {
774
+ return;
775
+ }
776
+ offsetParam.value = Number(offsetParam.value) + this.pagination.pageSize;
777
+ }
741
778
  constructPath() {
742
779
  return new PathSerializer().serialize(this.pathPattern, this.pathParams);
743
780
  }
781
+ getOffsetParam() {
782
+ const offsetParam = this.getAllParams().find((param) => param.isOffset);
783
+ return offsetParam;
784
+ }
785
+ getAllParams() {
786
+ const allParams = [];
787
+ this.headers.forEach((val, key) => {
788
+ allParams.push(val);
789
+ });
790
+ this.queryParams.forEach((val, key) => {
791
+ allParams.push(val);
792
+ });
793
+ this.pathParams.forEach((val, key) => {
794
+ allParams.push(val);
795
+ });
796
+ return allParams;
797
+ }
744
798
  };
745
799
 
746
800
  // src/http/transport/request-builder.ts
@@ -828,6 +882,10 @@ var RequestBuilder = class {
828
882
  this.params.responseSchema = responseSchema;
829
883
  return this;
830
884
  }
885
+ setPagination(pagination) {
886
+ this.params.pagination = pagination;
887
+ return this;
888
+ }
831
889
  addBody(body) {
832
890
  if (body !== void 0) {
833
891
  this.params.body = body;
@@ -844,7 +902,9 @@ var RequestBuilder = class {
844
902
  value: param.value,
845
903
  explode: (_a = param.explode) != null ? _a : true,
846
904
  style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
847
- encode: (_c = param.encode) != null ? _c : true
905
+ encode: (_c = param.encode) != null ? _c : true,
906
+ isLimit: !!param.isLimit,
907
+ isOffset: !!param.isOffset
848
908
  });
849
909
  return this;
850
910
  }
@@ -858,7 +918,9 @@ var RequestBuilder = class {
858
918
  value: param.value,
859
919
  explode: (_a = param.explode) != null ? _a : true,
860
920
  style: (_b = param.style) != null ? _b : "form" /* FORM */,
861
- encode: (_c = param.encode) != null ? _c : true
921
+ encode: (_c = param.encode) != null ? _c : true,
922
+ isLimit: !!param.isLimit,
923
+ isOffset: !!param.isOffset
862
924
  });
863
925
  return this;
864
926
  }
@@ -872,7 +934,9 @@ var RequestBuilder = class {
872
934
  value: param.value,
873
935
  explode: (_a = param.explode) != null ? _a : true,
874
936
  style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
875
- encode: (_c = param.encode) != null ? _c : false
937
+ encode: (_c = param.encode) != null ? _c : false,
938
+ isLimit: !!param.isLimit,
939
+ isOffset: !!param.isOffset
876
940
  });
877
941
  return this;
878
942
  }
@@ -942,7 +1006,7 @@ var DestinationsService = class extends BaseService {
942
1006
  * @returns {Promise<HttpResponse<ListDestinationsOkResponse>>} Successful Response
943
1007
  */
944
1008
  async listDestinations(requestConfig) {
945
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/destinations").setRequestSchema(z4.any()).setResponseSchema(listDestinationsOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).build();
1009
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/destinations").setRequestSchema(z4.any()).setResponseSchema(listDestinationsOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).build();
946
1010
  return this.client.call(request);
947
1011
  }
948
1012
  };
@@ -1038,7 +1102,7 @@ var PackagesService = class extends BaseService {
1038
1102
  * @returns {Promise<HttpResponse<ListPackagesOkResponse>>} Successful Response
1039
1103
  */
1040
1104
  async listPackages(params, requestConfig) {
1041
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/packages").setRequestSchema(z7.any()).setResponseSchema(listPackagesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
1105
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/packages").setRequestSchema(z7.any()).setResponseSchema(listPackagesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
1042
1106
  key: "destination",
1043
1107
  value: params == null ? void 0 : params.destination
1044
1108
  }).addQueryParam({
@@ -1354,22 +1418,30 @@ import { z as z14 } from "zod";
1354
1418
  var createPurchaseOkResponseProfile = z14.lazy(() => {
1355
1419
  return z14.object({
1356
1420
  iccid: z14.string().min(18).max(22).optional(),
1357
- activationCode: z14.string().min(1e3).max(8e3).optional()
1421
+ activationCode: z14.string().min(1e3).max(8e3).optional(),
1422
+ manualActivationCode: z14.string().optional()
1358
1423
  });
1359
1424
  });
1360
1425
  var createPurchaseOkResponseProfileResponse = z14.lazy(() => {
1361
1426
  return z14.object({
1362
1427
  iccid: z14.string().min(18).max(22).optional(),
1363
- activationCode: z14.string().min(1e3).max(8e3).optional()
1428
+ activationCode: z14.string().min(1e3).max(8e3).optional(),
1429
+ manualActivationCode: z14.string().optional()
1364
1430
  }).transform((data) => ({
1365
1431
  iccid: data["iccid"],
1366
- activationCode: data["activationCode"]
1432
+ activationCode: data["activationCode"],
1433
+ manualActivationCode: data["manualActivationCode"]
1367
1434
  }));
1368
1435
  });
1369
1436
  var createPurchaseOkResponseProfileRequest = z14.lazy(() => {
1370
- return z14.object({ iccid: z14.string().nullish(), activationCode: z14.string().nullish() }).transform((data) => ({
1437
+ return z14.object({
1438
+ iccid: z14.string().nullish(),
1439
+ activationCode: z14.string().nullish(),
1440
+ manualActivationCode: z14.string().nullish()
1441
+ }).transform((data) => ({
1371
1442
  iccid: data["iccid"],
1372
- activationCode: data["activationCode"]
1443
+ activationCode: data["activationCode"],
1444
+ manualActivationCode: data["manualActivationCode"]
1373
1445
  }));
1374
1446
  });
1375
1447
 
@@ -1680,7 +1752,7 @@ var PurchasesService = class extends BaseService {
1680
1752
  * @returns {Promise<HttpResponse<ListPurchasesOkResponse>>} Successful Response
1681
1753
  */
1682
1754
  async listPurchases(params, requestConfig) {
1683
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/purchases").setRequestSchema(z23.any()).setResponseSchema(listPurchasesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
1755
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases").setRequestSchema(z23.any()).setResponseSchema(listPurchasesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
1684
1756
  key: "iccid",
1685
1757
  value: params == null ? void 0 : params.iccid
1686
1758
  }).addQueryParam({
@@ -1712,7 +1784,7 @@ var PurchasesService = class extends BaseService {
1712
1784
  * @returns {Promise<HttpResponse<CreatePurchaseOkResponse>>} Successful Response
1713
1785
  */
1714
1786
  async createPurchase(body, requestConfig) {
1715
- 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();
1787
+ 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();
1716
1788
  return this.client.call(request);
1717
1789
  }
1718
1790
  /**
@@ -1720,7 +1792,7 @@ var PurchasesService = class extends BaseService {
1720
1792
  * @returns {Promise<HttpResponse<TopUpEsimOkResponse>>} Successful Response
1721
1793
  */
1722
1794
  async topUpEsim(body, requestConfig) {
1723
- 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();
1795
+ 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();
1724
1796
  return this.client.call(request);
1725
1797
  }
1726
1798
  /**
@@ -1728,7 +1800,7 @@ var PurchasesService = class extends BaseService {
1728
1800
  * @returns {Promise<HttpResponse<EditPurchaseOkResponse>>} Successful Response
1729
1801
  */
1730
1802
  async editPurchase(body, requestConfig) {
1731
- 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();
1803
+ 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();
1732
1804
  return this.client.call(request);
1733
1805
  }
1734
1806
  /**
@@ -1737,7 +1809,7 @@ var PurchasesService = class extends BaseService {
1737
1809
  * @returns {Promise<HttpResponse<GetPurchaseConsumptionOkResponse>>} Successful Response
1738
1810
  */
1739
1811
  async getPurchaseConsumption(purchaseId, requestConfig) {
1740
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(z23.any()).setResponseSchema(getPurchaseConsumptionOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
1812
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(z23.any()).setResponseSchema(getPurchaseConsumptionOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
1741
1813
  key: "purchaseId",
1742
1814
  value: purchaseId
1743
1815
  }).build();
@@ -2004,7 +2076,7 @@ var ESimService = class extends BaseService {
2004
2076
  * @returns {Promise<HttpResponse<GetEsimOkResponse>>} Successful Response
2005
2077
  */
2006
2078
  async getEsim(params, requestConfig) {
2007
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim").setRequestSchema(z33.any()).setResponseSchema(getEsimOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
2079
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim").setRequestSchema(z33.any()).setResponseSchema(getEsimOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
2008
2080
  key: "iccid",
2009
2081
  value: params == null ? void 0 : params.iccid
2010
2082
  }).build();
@@ -2016,7 +2088,7 @@ var ESimService = class extends BaseService {
2016
2088
  * @returns {Promise<HttpResponse<GetEsimDeviceOkResponse>>} Successful Response
2017
2089
  */
2018
2090
  async getEsimDevice(iccid, requestConfig) {
2019
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(z33.any()).setResponseSchema(getEsimDeviceOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2091
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(z33.any()).setResponseSchema(getEsimDeviceOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2020
2092
  key: "iccid",
2021
2093
  value: iccid
2022
2094
  }).build();
@@ -2028,7 +2100,7 @@ var ESimService = class extends BaseService {
2028
2100
  * @returns {Promise<HttpResponse<GetEsimHistoryOkResponse>>} Successful Response
2029
2101
  */
2030
2102
  async getEsimHistory(iccid, requestConfig) {
2031
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(z33.any()).setResponseSchema(getEsimHistoryOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2103
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(z33.any()).setResponseSchema(getEsimHistoryOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2032
2104
  key: "iccid",
2033
2105
  value: iccid
2034
2106
  }).build();
@@ -2040,7 +2112,7 @@ var ESimService = class extends BaseService {
2040
2112
  * @returns {Promise<HttpResponse<GetEsimMacOkResponse>>} Successful Response
2041
2113
  */
2042
2114
  async getEsimMac(iccid, requestConfig) {
2043
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim/{iccid}/mac").setRequestSchema(z33.any()).setResponseSchema(getEsimMacOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2115
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/mac").setRequestSchema(z33.any()).setResponseSchema(getEsimMacOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2044
2116
  key: "iccid",
2045
2117
  value: iccid
2046
2118
  }).build();
@@ -2074,11 +2146,11 @@ var Celitech = class {
2074
2146
  this.purchases.baseUrl = environment;
2075
2147
  this.eSim.baseUrl = environment;
2076
2148
  }
2077
- set timeout(timeout) {
2078
- this.destinations.timeout = timeout;
2079
- this.packages.timeout = timeout;
2080
- this.purchases.timeout = timeout;
2081
- this.eSim.timeout = timeout;
2149
+ set timeoutMs(timeoutMs) {
2150
+ this.destinations.timeoutMs = timeoutMs;
2151
+ this.packages.timeoutMs = timeoutMs;
2152
+ this.purchases.timeoutMs = timeoutMs;
2153
+ this.eSim.timeoutMs = timeoutMs;
2082
2154
  }
2083
2155
  set clientId(clientId) {
2084
2156
  this.destinations.clientId = clientId;
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "celitech-sdk",
3
- "version": "1.1.86",
3
+ "version": "1.1.88",
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
- "main": "./dist/commonjs/index.js",
7
- "module": "./dist/esm/index.js",
8
- "browser": "./dist/index.umd.js",
9
- "unpkg": "./dist/index.umd.js",
10
- "types": "./dist/commonjs/index.d.ts",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "browser": "./dist/index.js",
9
+ "unpkg": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
11
  "scripts": {
12
+ "test": "tsc --noEmit",
12
13
  "build": "tsup-node src/index.ts --format cjs,esm --dts --clean",
13
14
  "prepublishOnly": "npm run build"
14
15
  },