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/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # Celitech TypeScript SDK 1.1.87
1
+ # Celitech TypeScript SDK 1.1.89
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.87`
8
+ - SDK version: `1.1.89`
9
9
 
10
10
  ## About the API
11
11
 
package/dist/index.d.ts CHANGED
@@ -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
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;
@@ -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 };