celitech-sdk 2.0.7 → 2.0.10
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 +48 -15
- package/dist/index.d.mts +2664 -0
- package/dist/index.d.ts +86 -37
- package/dist/index.js +1017 -703
- package/dist/index.mjs +1017 -703
- package/package.json +18 -7
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,2664 @@
|
|
|
1
|
+
import { ZodType, z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Available API environments with their base URLs.
|
|
5
|
+
* Use these constants to configure the SDK for different environments (production, staging, etc.).
|
|
6
|
+
*/
|
|
7
|
+
declare enum Environment {
|
|
8
|
+
/** DEFAULT environment base URL */
|
|
9
|
+
DEFAULT = "https://api.celitech.net/v1"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Standard HTTP methods supported by the SDK.
|
|
14
|
+
*/
|
|
15
|
+
type HttpMethod$1 = 'CONNECT' | 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT' | 'TRACE';
|
|
16
|
+
/**
|
|
17
|
+
* Represents an HTTP request with all its components.
|
|
18
|
+
*/
|
|
19
|
+
interface HttpRequest {
|
|
20
|
+
/** Base URL of the API endpoint */
|
|
21
|
+
baseUrl: string;
|
|
22
|
+
/** HTTP method for the request */
|
|
23
|
+
method: HttpMethod$1;
|
|
24
|
+
/** Request path (relative to base URL) */
|
|
25
|
+
path: string;
|
|
26
|
+
/** Request headers as key-value pairs */
|
|
27
|
+
headers: Map<string, unknown>;
|
|
28
|
+
/** Request body payload (optional) */
|
|
29
|
+
body?: BodyInit;
|
|
30
|
+
/** Signal to abort the request (optional) */
|
|
31
|
+
abortSignal?: AbortSignal;
|
|
32
|
+
/** Query string parameters */
|
|
33
|
+
queryParams: Map<string, unknown>;
|
|
34
|
+
/** Path parameters for URL templating */
|
|
35
|
+
pathParams: Map<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Metadata about an HTTP response.
|
|
39
|
+
*/
|
|
40
|
+
interface HttpMetadata$1 {
|
|
41
|
+
/** HTTP status code */
|
|
42
|
+
status: number;
|
|
43
|
+
/** HTTP status text message */
|
|
44
|
+
statusText: string;
|
|
45
|
+
/** Response headers as key-value pairs */
|
|
46
|
+
headers: Record<string, string>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Represents an HTTP response with typed data.
|
|
50
|
+
* @template T - The type of the response data
|
|
51
|
+
*/
|
|
52
|
+
interface HttpResponse$1<T> {
|
|
53
|
+
/** Parsed response data (optional) */
|
|
54
|
+
data?: T;
|
|
55
|
+
/** Response metadata (status, headers, etc.) */
|
|
56
|
+
metadata: HttpMetadata$1;
|
|
57
|
+
/** Raw response object from the HTTP client */
|
|
58
|
+
raw: ArrayBuffer;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Represents an HTTP error response.
|
|
62
|
+
*/
|
|
63
|
+
interface HttpError$1 {
|
|
64
|
+
/** Error message or description */
|
|
65
|
+
error: string;
|
|
66
|
+
/** Response metadata (status, headers, etc.) */
|
|
67
|
+
metadata: HttpMetadata$1;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Hook interface for intercepting and modifying HTTP requests and responses.
|
|
71
|
+
* Allows custom logic to be executed at different stages of the request lifecycle.
|
|
72
|
+
*/
|
|
73
|
+
interface Hook {
|
|
74
|
+
/**
|
|
75
|
+
* Called before an HTTP request is sent.
|
|
76
|
+
* Allows modification of the request before execution.
|
|
77
|
+
* @param request - The HTTP request to be sent
|
|
78
|
+
* @param params - Additional custom parameters
|
|
79
|
+
* @returns A promise that resolves to the potentially modified request
|
|
80
|
+
*/
|
|
81
|
+
beforeRequest(request: HttpRequest, params: Map<string, string>): Promise<HttpRequest>;
|
|
82
|
+
/**
|
|
83
|
+
* Called after a successful HTTP response is received.
|
|
84
|
+
* Allows processing or modification of the response.
|
|
85
|
+
* @param request - The original HTTP request
|
|
86
|
+
* @param response - The HTTP response received
|
|
87
|
+
* @param params - Additional custom parameters
|
|
88
|
+
* @returns A promise that resolves to the potentially modified response
|
|
89
|
+
*/
|
|
90
|
+
afterResponse(request: HttpRequest, response: HttpResponse$1<any>, params: Map<string, string>): Promise<HttpResponse$1<any>>;
|
|
91
|
+
/**
|
|
92
|
+
* Called when an HTTP request results in an error.
|
|
93
|
+
* Allows custom error handling and transformation.
|
|
94
|
+
* @param request - The original HTTP request
|
|
95
|
+
* @param response - The error response received
|
|
96
|
+
* @param params - Additional custom parameters
|
|
97
|
+
* @returns A promise that resolves to an error object
|
|
98
|
+
*/
|
|
99
|
+
onError(request: HttpRequest, response: HttpResponse$1<any>, params: Map<string, string>): Promise<HttpError$1>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* OpenAPI parameter serialization styles.
|
|
104
|
+
* Defines how parameters should be formatted in the request.
|
|
105
|
+
*/
|
|
106
|
+
declare enum SerializationStyle {
|
|
107
|
+
/** Simple comma-separated values (e.g., "3,4,5") */
|
|
108
|
+
SIMPLE = "simple",
|
|
109
|
+
/** Label prefix with dot notation (e.g., ".3.4.5") */
|
|
110
|
+
LABEL = "label",
|
|
111
|
+
/** Matrix semicolon-prefixed (e.g., ";id=3;id=4") */
|
|
112
|
+
MATRIX = "matrix",
|
|
113
|
+
/** Form-style ampersand-separated (e.g., "id=3&id=4") */
|
|
114
|
+
FORM = "form",
|
|
115
|
+
/** Space-delimited values (e.g., "id=3 4 5") */
|
|
116
|
+
SPACE_DELIMITED = "space_delimited",
|
|
117
|
+
/** Pipe-delimited values (e.g., "id=3|4|5") */
|
|
118
|
+
PIPE_DELIMITED = "pipe_delimited",
|
|
119
|
+
/** Deep object notation (e.g., "id[role]=admin") */
|
|
120
|
+
DEEP_OBJECT = "deep_object",
|
|
121
|
+
/** No specific style applied */
|
|
122
|
+
NONE = "none"
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Represents an OAuth 2.0 access token with its associated metadata.
|
|
127
|
+
* Stores the token, granted scopes, and expiration time.
|
|
128
|
+
*/
|
|
129
|
+
declare class OAuthToken {
|
|
130
|
+
accessToken: string;
|
|
131
|
+
scopes: Set<string>;
|
|
132
|
+
expiresAt: number | null;
|
|
133
|
+
/**
|
|
134
|
+
* Creates a new OAuth token.
|
|
135
|
+
* @param accessToken - The access token string
|
|
136
|
+
* @param scopes - Set of OAuth scopes granted to this token
|
|
137
|
+
* @param expiresAt - Timestamp when the token expires (milliseconds since epoch), or null if no expiration
|
|
138
|
+
*/
|
|
139
|
+
constructor(accessToken: string, scopes: Set<string>, expiresAt: number | null);
|
|
140
|
+
/**
|
|
141
|
+
* Checks if this token has all the required scopes.
|
|
142
|
+
* @param scopes - Set of scopes to check for
|
|
143
|
+
* @returns True if the token has all required scopes, false otherwise
|
|
144
|
+
*/
|
|
145
|
+
hasAllScopes(scopes: Set<string>): boolean;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Manages OAuth 2.0 access tokens for the SDK.
|
|
149
|
+
* Handles token retrieval, caching, and automatic refresh when tokens expire.
|
|
150
|
+
* Implements a singleton pattern to share tokens across the SDK.
|
|
151
|
+
*/
|
|
152
|
+
declare class OAuthTokenManager {
|
|
153
|
+
/** Singleton instance of the token manager */
|
|
154
|
+
private static instance;
|
|
155
|
+
/** Currently cached OAuth token */
|
|
156
|
+
private token?;
|
|
157
|
+
/**
|
|
158
|
+
* Gets a valid access token for the specified scopes.
|
|
159
|
+
* Returns a cached token if available and not expired, otherwise requests a new one.
|
|
160
|
+
* @param scopes - Set of OAuth scopes required for the token
|
|
161
|
+
* @param config - SDK configuration containing client credentials
|
|
162
|
+
* @returns A promise that resolves to a valid OAuth token
|
|
163
|
+
* @throws Error if client credentials are missing or token request fails
|
|
164
|
+
*/
|
|
165
|
+
getToken(scopes: Set<string>, config: SdkConfig): Promise<OAuthToken>;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Error class that can be thrown explicitly via a throw() method.
|
|
170
|
+
* Extends the built-in Error class with a convenience method for throwing.
|
|
171
|
+
*/
|
|
172
|
+
declare class ThrowableError extends Error {
|
|
173
|
+
message: string;
|
|
174
|
+
protected response?: unknown;
|
|
175
|
+
/**
|
|
176
|
+
* Optional metadata about the HTTP response that triggered this error.
|
|
177
|
+
*/
|
|
178
|
+
metadata?: HttpMetadata;
|
|
179
|
+
/**
|
|
180
|
+
* Creates a new throwable error.
|
|
181
|
+
* @param message - The error message
|
|
182
|
+
* @param response - Optional response data associated with the error
|
|
183
|
+
*/
|
|
184
|
+
constructor(message: string, response?: unknown);
|
|
185
|
+
/**
|
|
186
|
+
* Creates an error instance from a response body.
|
|
187
|
+
* Parsing (which can throw) is kept out of the constructor so that constructing
|
|
188
|
+
* an error while handling an error response never throws. The base implementation
|
|
189
|
+
* simply constructs the instance; subclasses may override to populate typed fields.
|
|
190
|
+
*
|
|
191
|
+
* Contract: every subclass constructor must accept `(message, response?)`. The base
|
|
192
|
+
* uses `new this(message, response)`, so a subclass with a different constructor
|
|
193
|
+
* signature must override `from()`.
|
|
194
|
+
* @param message - The error message
|
|
195
|
+
* @param response - Optional response data associated with the error
|
|
196
|
+
* @returns A new error instance
|
|
197
|
+
*/
|
|
198
|
+
static from(message: string, response?: unknown): ThrowableError;
|
|
199
|
+
/**
|
|
200
|
+
* Throws this error instance.
|
|
201
|
+
* Convenience method for explicitly throwing the error.
|
|
202
|
+
* @throws This error instance
|
|
203
|
+
*/
|
|
204
|
+
throw(): void;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Defines an expected response format with schema validation.
|
|
209
|
+
* Used to match and validate responses based on content type and status code.
|
|
210
|
+
*/
|
|
211
|
+
interface ResponseDefinition {
|
|
212
|
+
/** Schema for validating the response body */
|
|
213
|
+
schema: ZodType;
|
|
214
|
+
/** The content type of this response (e.g., 'application/json') */
|
|
215
|
+
contentType: ContentType;
|
|
216
|
+
/** The HTTP status code this definition applies to */
|
|
217
|
+
status: number;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Defines an error response format with custom error class.
|
|
221
|
+
* Used to throw typed errors based on content type and status code.
|
|
222
|
+
*/
|
|
223
|
+
interface ErrorDefinition {
|
|
224
|
+
/** The error class to instantiate, exposing a static `from` factory */
|
|
225
|
+
error: (new (...args: any[]) => ThrowableError) & {
|
|
226
|
+
from(message: string, response?: unknown): ThrowableError;
|
|
227
|
+
};
|
|
228
|
+
/** The content type of this error response */
|
|
229
|
+
contentType: ContentType;
|
|
230
|
+
/** The HTTP status code this error applies to */
|
|
231
|
+
status: number;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Parameters required to create a Request instance.
|
|
235
|
+
* Contains all configuration needed for HTTP execution, validation, and error handling.
|
|
236
|
+
*
|
|
237
|
+
* @template Page - The type of paginated data items
|
|
238
|
+
*/
|
|
239
|
+
interface CreateRequestParameters<Page = unknown[]> {
|
|
240
|
+
baseUrl: string;
|
|
241
|
+
method: HttpMethod;
|
|
242
|
+
body?: any;
|
|
243
|
+
headers: Map<string, RequestParameter>;
|
|
244
|
+
queryParams: Map<string, RequestParameter>;
|
|
245
|
+
pathParams: Map<string, RequestParameter>;
|
|
246
|
+
cookies: Map<string, RequestParameter>;
|
|
247
|
+
path: string;
|
|
248
|
+
config: SdkConfig;
|
|
249
|
+
responses: ResponseDefinition[];
|
|
250
|
+
errors: ErrorDefinition[];
|
|
251
|
+
requestSchema: ZodType;
|
|
252
|
+
requestContentType: ContentType;
|
|
253
|
+
pagination?: RequestPagination<Page> | RequestCursorPagination<Page>;
|
|
254
|
+
filename?: string;
|
|
255
|
+
filenames?: string[];
|
|
256
|
+
scopes?: Set<string>;
|
|
257
|
+
tokenManager: OAuthTokenManager;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Represents a request parameter with serialization metadata.
|
|
261
|
+
* Wraps a value with OpenAPI serialization instructions for proper encoding.
|
|
262
|
+
*/
|
|
263
|
+
interface RequestParameter {
|
|
264
|
+
/** The parameter name (may be undefined for path substitution) */
|
|
265
|
+
key: string | undefined;
|
|
266
|
+
/** The actual parameter value */
|
|
267
|
+
value: unknown;
|
|
268
|
+
/** Whether to explode arrays/objects into multiple parameters */
|
|
269
|
+
explode: boolean;
|
|
270
|
+
/** Whether to URL-encode the value */
|
|
271
|
+
encode: boolean;
|
|
272
|
+
/** The OpenAPI serialization style (e.g., SIMPLE, FORM, MATRIX) */
|
|
273
|
+
style: SerializationStyle;
|
|
274
|
+
/** Whether this parameter is a pagination limit */
|
|
275
|
+
isLimit: boolean;
|
|
276
|
+
/** Whether this parameter is a pagination offset */
|
|
277
|
+
isOffset: boolean;
|
|
278
|
+
/** Whether this parameter is a pagination cursor */
|
|
279
|
+
isCursor: boolean;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Configuration for limit-offset pagination.
|
|
283
|
+
* Used for traditional page-based pagination with size and offset.
|
|
284
|
+
*
|
|
285
|
+
* @template Page - The type of page data
|
|
286
|
+
*/
|
|
287
|
+
interface RequestPagination<Page> {
|
|
288
|
+
/** The number of items per page */
|
|
289
|
+
pageSize?: number;
|
|
290
|
+
/** JSON path to extract page data from response */
|
|
291
|
+
pagePath: string[];
|
|
292
|
+
/** Schema for validating page data */
|
|
293
|
+
pageSchema?: ZodType<Page, any, any>;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Configuration for cursor-based pagination.
|
|
297
|
+
* Used for stateless pagination with cursor tokens.
|
|
298
|
+
*
|
|
299
|
+
* @template Page - The type of page data
|
|
300
|
+
*/
|
|
301
|
+
interface RequestCursorPagination<Page> {
|
|
302
|
+
/** JSON path to extract page data from response */
|
|
303
|
+
pagePath: string[];
|
|
304
|
+
/** Schema for validating page data */
|
|
305
|
+
pageSchema?: ZodType<Page, any, any>;
|
|
306
|
+
/** JSON path to extract next cursor from response */
|
|
307
|
+
cursorPath: string[];
|
|
308
|
+
/** Schema for validating cursor value */
|
|
309
|
+
cursorSchema?: ZodType<any, any, any>;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Represents an HTTP request with all necessary configuration and parameters.
|
|
314
|
+
* Handles path/query/header/cookie serialization, pagination, validation, and retry logic.
|
|
315
|
+
* This is the core request object passed through the handler chain for execution.
|
|
316
|
+
*
|
|
317
|
+
* @template PageSchema - The type of paginated data returned by this request
|
|
318
|
+
*/
|
|
319
|
+
declare class Request<PageSchema = unknown[]> {
|
|
320
|
+
baseUrl: string;
|
|
321
|
+
headers: Map<string, RequestParameter>;
|
|
322
|
+
queryParams: Map<string, RequestParameter>;
|
|
323
|
+
pathParams: Map<string, RequestParameter>;
|
|
324
|
+
cookies: Map<string, RequestParameter>;
|
|
325
|
+
body?: any;
|
|
326
|
+
method: HttpMethod;
|
|
327
|
+
path: string;
|
|
328
|
+
config: SdkConfig;
|
|
329
|
+
responses: ResponseDefinition[];
|
|
330
|
+
errors: ErrorDefinition[];
|
|
331
|
+
requestSchema: ZodType;
|
|
332
|
+
requestContentType: ContentType;
|
|
333
|
+
pagination?: RequestPagination<PageSchema> | RequestCursorPagination<PageSchema>;
|
|
334
|
+
filename?: string;
|
|
335
|
+
filenames?: string[];
|
|
336
|
+
scopes?: Set<string>;
|
|
337
|
+
tokenManager: OAuthTokenManager;
|
|
338
|
+
private readonly pathPattern;
|
|
339
|
+
constructor(params: CreateRequestParameters<PageSchema>);
|
|
340
|
+
/**
|
|
341
|
+
* Adds a header parameter to the request with OpenAPI serialization rules.
|
|
342
|
+
*
|
|
343
|
+
* @param key - The header name
|
|
344
|
+
* @param param - The parameter configuration including value, style, and encoding options
|
|
345
|
+
*/
|
|
346
|
+
addHeaderParam(key: string, param: RequestParameter): void;
|
|
347
|
+
/**
|
|
348
|
+
* Adds a query parameter to the request with OpenAPI serialization rules.
|
|
349
|
+
*
|
|
350
|
+
* @param key - The query parameter name
|
|
351
|
+
* @param param - The parameter configuration including value, style, and encoding options
|
|
352
|
+
*/
|
|
353
|
+
addQueryParam(key: string, param: RequestParameter): void;
|
|
354
|
+
/**
|
|
355
|
+
* Adds a path parameter to the request with OpenAPI serialization rules.
|
|
356
|
+
*
|
|
357
|
+
* @param key - The path parameter name (matches template variable in path pattern)
|
|
358
|
+
* @param param - The parameter configuration including value, style, and encoding options
|
|
359
|
+
*/
|
|
360
|
+
addPathParam(key: string, param: RequestParameter): void;
|
|
361
|
+
/**
|
|
362
|
+
* Sets the request body if the value is defined.
|
|
363
|
+
*
|
|
364
|
+
* @param body - The request body to send
|
|
365
|
+
*/
|
|
366
|
+
addBody(body: any): void;
|
|
367
|
+
/**
|
|
368
|
+
* Updates this request from a modified hook request.
|
|
369
|
+
* Used after hooks modify the request to sync changes back to the internal Request object.
|
|
370
|
+
*
|
|
371
|
+
* @param hookRequest - The modified request from hook processing
|
|
372
|
+
*/
|
|
373
|
+
updateFromHookRequest(hookRequest: HttpRequest): void;
|
|
374
|
+
/**
|
|
375
|
+
* Constructs the complete URL by combining base URL, path with substituted parameters,
|
|
376
|
+
* and serialized query string.
|
|
377
|
+
*
|
|
378
|
+
* @returns The fully constructed URL ready for HTTP execution
|
|
379
|
+
*/
|
|
380
|
+
constructFullUrl(): string;
|
|
381
|
+
/**
|
|
382
|
+
* Creates a copy of this request with optional parameter overrides.
|
|
383
|
+
* Useful for pagination where you need to modify parameters while keeping the rest intact.
|
|
384
|
+
*
|
|
385
|
+
* @param overrides - Optional parameters to override in the copied request
|
|
386
|
+
* @returns A new Request instance with the specified overrides
|
|
387
|
+
*/
|
|
388
|
+
copy(overrides?: Partial<CreateRequestParameters>): Request<unknown[]>;
|
|
389
|
+
/**
|
|
390
|
+
* Serializes headers to a format suitable for HTTP execution.
|
|
391
|
+
*
|
|
392
|
+
* @returns Serialized headers as HeadersInit, or undefined if no headers
|
|
393
|
+
*/
|
|
394
|
+
getHeaders(): HeadersInit | undefined;
|
|
395
|
+
/**
|
|
396
|
+
* Serializes cookies to a format suitable for HTTP execution.
|
|
397
|
+
*
|
|
398
|
+
* @returns Serialized cookies as a record, or undefined if no cookies
|
|
399
|
+
*/
|
|
400
|
+
getCookies(): Record<string, string> | undefined;
|
|
401
|
+
/**
|
|
402
|
+
* Advances pagination parameters to fetch the next page.
|
|
403
|
+
* Handles both cursor-based and limit-offset pagination strategies.
|
|
404
|
+
*
|
|
405
|
+
* @param cursor - The cursor value for cursor-based pagination (optional for limit-offset)
|
|
406
|
+
* @param offsetIncrement - Fallback increment for offset pagination with no declared `pageSize`
|
|
407
|
+
* (stepless offset — gap doc row 200), where the caller only learns the increment after fetching
|
|
408
|
+
* a page (its item count). Ignored whenever `pageSize` is set, which always wins.
|
|
409
|
+
*/
|
|
410
|
+
nextPage(cursor?: string, offsetIncrement?: number): void;
|
|
411
|
+
private constructPath;
|
|
412
|
+
private getOffsetParam;
|
|
413
|
+
private getCursorParam;
|
|
414
|
+
private getAllParams;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Standard HTTP methods supported by the SDK.
|
|
419
|
+
*/
|
|
420
|
+
type HttpMethod = 'CONNECT' | 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT' | 'TRACE';
|
|
421
|
+
/**
|
|
422
|
+
* SDK configuration interface.
|
|
423
|
+
* Contains all settings required to initialize and configure the SDK.
|
|
424
|
+
*/
|
|
425
|
+
interface BaseConfig {
|
|
426
|
+
retry?: RetryOptions;
|
|
427
|
+
validation?: ValidationOptions;
|
|
428
|
+
baseUrl?: string;
|
|
429
|
+
environment?: Environment;
|
|
430
|
+
timeoutMs?: number;
|
|
431
|
+
oAuthBaseUrl?: string;
|
|
432
|
+
}
|
|
433
|
+
interface ClientCredentialAuthConfig extends BaseConfig {
|
|
434
|
+
clientId: string;
|
|
435
|
+
clientSecret: string;
|
|
436
|
+
accessToken?: never;
|
|
437
|
+
}
|
|
438
|
+
interface TokenAuthConfig extends BaseConfig {
|
|
439
|
+
clientSecret?: never;
|
|
440
|
+
clientId?: never;
|
|
441
|
+
accessToken: string;
|
|
442
|
+
}
|
|
443
|
+
type SdkConfig = ClientCredentialAuthConfig | TokenAuthConfig;
|
|
444
|
+
/**
|
|
445
|
+
* Metadata about an HTTP response.
|
|
446
|
+
* Contains status information and headers from the server response.
|
|
447
|
+
*/
|
|
448
|
+
interface HttpMetadata {
|
|
449
|
+
/** HTTP status code (e.g., 200, 404, 500) */
|
|
450
|
+
status: number;
|
|
451
|
+
/** HTTP status text message (e.g., "OK", "Not Found") */
|
|
452
|
+
statusText: string;
|
|
453
|
+
/** Response headers as key-value pairs */
|
|
454
|
+
headers: Record<string, string>;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Standard HTTP response with typed data.
|
|
458
|
+
* @template T - The type of the response data
|
|
459
|
+
*/
|
|
460
|
+
interface HttpResponse<T = unknown> {
|
|
461
|
+
/** Parsed response data (optional) */
|
|
462
|
+
data?: T;
|
|
463
|
+
/** Response metadata (status, headers, etc.) */
|
|
464
|
+
metadata: HttpMetadata;
|
|
465
|
+
/** Raw response object from the HTTP client */
|
|
466
|
+
raw: ArrayBuffer;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* HTTP response for paginated API endpoints.
|
|
470
|
+
* Marker interface extending HttpResponse for type safety with pagination.
|
|
471
|
+
* @template T - The type of a single page of data
|
|
472
|
+
*/
|
|
473
|
+
interface PaginatedHttpResponse<T = unknown> extends HttpResponse<T> {
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* HTTP response for cursor-paginated API endpoints.
|
|
477
|
+
* Includes a cursor for fetching the next page of results.
|
|
478
|
+
* @template T - The type of a single page of data
|
|
479
|
+
*/
|
|
480
|
+
interface CursorPaginatedHttpResponse<T = unknown> extends HttpResponse<T> {
|
|
481
|
+
/** Cursor string for fetching the next page, null if no more pages, undefined if not applicable */
|
|
482
|
+
nextCursor?: string | null;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Supported content types for HTTP requests and responses.
|
|
486
|
+
* Determines how the SDK serializes requests and parses responses.
|
|
487
|
+
*/
|
|
488
|
+
declare enum ContentType {
|
|
489
|
+
/** JSON format (application/json) */
|
|
490
|
+
Json = "json",
|
|
491
|
+
/**
|
|
492
|
+
* @deprecated XML is handled as text. Use {@link ContentType.Text} instead.
|
|
493
|
+
* Kept as an alias for backward compatibility; will be removed in a future major version.
|
|
494
|
+
*/
|
|
495
|
+
Xml = "text",
|
|
496
|
+
/** PDF document (application/pdf) */
|
|
497
|
+
Pdf = "pdf",
|
|
498
|
+
/** Image file (image/*) */
|
|
499
|
+
Image = "image",
|
|
500
|
+
/** Generic file */
|
|
501
|
+
File = "file",
|
|
502
|
+
/** Binary data (application/octet-stream) */
|
|
503
|
+
Binary = "binary",
|
|
504
|
+
/** URL-encoded form data (application/x-www-form-urlencoded) */
|
|
505
|
+
FormUrlEncoded = "form",
|
|
506
|
+
/** Plain text (text/plain) */
|
|
507
|
+
Text = "text",
|
|
508
|
+
/** Multipart form data for file uploads (multipart/form-data) */
|
|
509
|
+
MultipartFormData = "multipartFormData",
|
|
510
|
+
/** Server-sent events stream (text/event-stream) */
|
|
511
|
+
EventStream = "eventStream",
|
|
512
|
+
/** No content (HTTP 204) */
|
|
513
|
+
NoContent = "noContent"
|
|
514
|
+
}
|
|
515
|
+
interface RetryOptions {
|
|
516
|
+
attempts: number;
|
|
517
|
+
delayMs?: number;
|
|
518
|
+
maxDelayMs?: number;
|
|
519
|
+
backoffFactor?: number;
|
|
520
|
+
jitterMs?: number;
|
|
521
|
+
maxRetryAfterDelayMs?: number;
|
|
522
|
+
statusCodesToRetry?: number[];
|
|
523
|
+
httpMethodsToRetry?: HttpMethod[];
|
|
524
|
+
}
|
|
525
|
+
interface ValidationOptions {
|
|
526
|
+
responseValidation?: boolean;
|
|
527
|
+
requestValidation?: boolean;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Error class for HTTP request failures.
|
|
532
|
+
* Captures error details including status, metadata, and the raw response.
|
|
533
|
+
*/
|
|
534
|
+
declare class HttpError extends Error {
|
|
535
|
+
/** Error message or status text */
|
|
536
|
+
readonly error: string;
|
|
537
|
+
/** HTTP response metadata (status, headers, etc.) */
|
|
538
|
+
readonly metadata: HttpMetadata;
|
|
539
|
+
/** Raw response object from the HTTP client */
|
|
540
|
+
readonly raw?: ArrayBuffer;
|
|
541
|
+
/**
|
|
542
|
+
* Creates a new HTTP error.
|
|
543
|
+
* @param metadata - HTTP response metadata
|
|
544
|
+
* @param raw - Raw response object (optional)
|
|
545
|
+
* @param error - Custom error message (optional, defaults to status text)
|
|
546
|
+
*/
|
|
547
|
+
constructor(metadata: HttpMetadata, raw?: ArrayBuffer, error?: string);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Default implementation of the Hook interface that provides pass-through behavior.
|
|
552
|
+
* This hook can be extended to add custom logic for request/response interception.
|
|
553
|
+
*/
|
|
554
|
+
declare class CustomHook implements Hook {
|
|
555
|
+
/**
|
|
556
|
+
* Called before an HTTP request is sent.
|
|
557
|
+
* Default implementation returns the request unchanged.
|
|
558
|
+
* @param request - The HTTP request to be sent
|
|
559
|
+
* @param params - Additional custom parameters
|
|
560
|
+
* @returns A promise that resolves to the unmodified request
|
|
561
|
+
*/
|
|
562
|
+
beforeRequest(request: HttpRequest, params: Map<string, string>): Promise<HttpRequest>;
|
|
563
|
+
/**
|
|
564
|
+
* Called after a successful HTTP response is received.
|
|
565
|
+
* Default implementation returns the response unchanged.
|
|
566
|
+
* @param request - The original HTTP request
|
|
567
|
+
* @param response - The HTTP response received
|
|
568
|
+
* @param params - Additional custom parameters
|
|
569
|
+
* @returns A promise that resolves to the unmodified response
|
|
570
|
+
*/
|
|
571
|
+
afterResponse(request: HttpRequest, response: HttpResponse$1<any>, params: Map<string, string>): Promise<HttpResponse$1<any>>;
|
|
572
|
+
/**
|
|
573
|
+
* Called when an HTTP request results in an error.
|
|
574
|
+
* Default implementation wraps the error response in an HttpError object.
|
|
575
|
+
* @param request - The original HTTP request
|
|
576
|
+
* @param response - The error response received
|
|
577
|
+
* @param params - Additional custom parameters
|
|
578
|
+
* @returns A promise that resolves to an HttpError object
|
|
579
|
+
*/
|
|
580
|
+
onError(request: HttpRequest, response: HttpResponse$1<any>, params: Map<string, string>): Promise<HttpError>;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Core HTTP client for making API requests.
|
|
585
|
+
* Manages request/response handling through a chain of handlers for validation, retry, hooks, and more.
|
|
586
|
+
*/
|
|
587
|
+
declare class HttpClient {
|
|
588
|
+
private config;
|
|
589
|
+
/** Chain of request handlers that process requests in sequence */
|
|
590
|
+
private readonly requestHandlerChain;
|
|
591
|
+
/**
|
|
592
|
+
* Creates a new HTTP client with configured request handlers.
|
|
593
|
+
* @param config - SDK configuration including base URL and authentication
|
|
594
|
+
* @param hook - Optional custom hook for request/response interception
|
|
595
|
+
*/
|
|
596
|
+
constructor(config: SdkConfig, hook?: CustomHook);
|
|
597
|
+
/**
|
|
598
|
+
* Executes a standard HTTP request.
|
|
599
|
+
* @template T - The expected response data type
|
|
600
|
+
* @param request - The HTTP request to execute
|
|
601
|
+
* @returns A promise that resolves to the HTTP response
|
|
602
|
+
*/
|
|
603
|
+
call<T>(request: Request): Promise<HttpResponse<T>>;
|
|
604
|
+
/**
|
|
605
|
+
* Executes a standard HTTP request and returns only the data directly.
|
|
606
|
+
* @template T - The expected response data type
|
|
607
|
+
* @param request - The HTTP request to execute
|
|
608
|
+
* @returns A promise that resolves to the response data
|
|
609
|
+
*/
|
|
610
|
+
callDirect<T>(request: Request): Promise<T>;
|
|
611
|
+
/**
|
|
612
|
+
* Executes a streaming HTTP request that yields responses incrementally.
|
|
613
|
+
* @template T - The expected response data type for each chunk
|
|
614
|
+
* @param request - The HTTP request to execute
|
|
615
|
+
* @returns An async generator that yields HTTP responses
|
|
616
|
+
*/
|
|
617
|
+
stream<T>(request: Request): AsyncGenerator<HttpResponse<T>>;
|
|
618
|
+
/**
|
|
619
|
+
* Executes a paginated HTTP request and extracts the page data from the response.
|
|
620
|
+
* @template FullResponse - The complete response type from the API
|
|
621
|
+
* @template Page - The type of a single page of data
|
|
622
|
+
* @param request - The paginated HTTP request to execute
|
|
623
|
+
* @returns A promise that resolves to the paginated HTTP response
|
|
624
|
+
* @throws Error if the response contains no data to paginate through
|
|
625
|
+
*/
|
|
626
|
+
callPaginated<FullResponse, Page>(request: Request<Page>): Promise<PaginatedHttpResponse<Page>>;
|
|
627
|
+
/**
|
|
628
|
+
* Executes a cursor-paginated HTTP request and extracts both page data and the next cursor.
|
|
629
|
+
* @template FullResponse - The complete response type from the API
|
|
630
|
+
* @template Page - The type of a single page of data
|
|
631
|
+
* @param request - The cursor-paginated HTTP request to execute
|
|
632
|
+
* @returns A promise that resolves to the cursor-paginated HTTP response with next cursor
|
|
633
|
+
* @throws Error if the response contains no data to paginate through
|
|
634
|
+
*/
|
|
635
|
+
callCursorPaginated<FullResponse, Page>(request: Request<Page>): Promise<CursorPaginatedHttpResponse<Page>>;
|
|
636
|
+
/**
|
|
637
|
+
* Updates the base URL for all subsequent requests.
|
|
638
|
+
* @param url - The new base URL to use
|
|
639
|
+
*/
|
|
640
|
+
setBaseUrl(url: string): void;
|
|
641
|
+
/**
|
|
642
|
+
* Updates the SDK configuration.
|
|
643
|
+
* @param config - The new SDK configuration
|
|
644
|
+
*/
|
|
645
|
+
setConfig(config: SdkConfig): void;
|
|
646
|
+
/**
|
|
647
|
+
* Extracts page data from a full API response using the configured pagination path.
|
|
648
|
+
* @template FullResponse - The complete response type from the API
|
|
649
|
+
* @template Page - The type of a single page of data
|
|
650
|
+
* @param request - The request containing pagination configuration
|
|
651
|
+
* @param data - The full response data to extract the page from
|
|
652
|
+
* @returns The extracted and parsed page data
|
|
653
|
+
* @throws Error if pagination is not configured or page extraction fails
|
|
654
|
+
*/
|
|
655
|
+
private getPage;
|
|
656
|
+
/**
|
|
657
|
+
* Extracts the next cursor from a full API response for cursor-based pagination.
|
|
658
|
+
* @template FullResponse - The complete response type from the API
|
|
659
|
+
* @template Page - The type of a single page of data
|
|
660
|
+
* @param request - The request containing cursor pagination configuration
|
|
661
|
+
* @param data - The full response data to extract the cursor from
|
|
662
|
+
* @returns The next cursor string, null if no more pages, or undefined if not cursor pagination
|
|
663
|
+
*/
|
|
664
|
+
private getNextCursor;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Base service class that all API service classes extend.
|
|
669
|
+
* Provides common functionality including HTTP client management and configuration.
|
|
670
|
+
*/
|
|
671
|
+
declare class BaseService {
|
|
672
|
+
config: SdkConfig;
|
|
673
|
+
protected tokenManager: OAuthTokenManager;
|
|
674
|
+
/** The HTTP client instance used to make API requests */
|
|
675
|
+
client: HttpClient;
|
|
676
|
+
/** Service-level configuration overrides */
|
|
677
|
+
protected serviceConfig?: Partial<SdkConfig>;
|
|
678
|
+
constructor(config: SdkConfig, tokenManager: OAuthTokenManager);
|
|
679
|
+
/**
|
|
680
|
+
* Sets service-level configuration that applies to all methods in this service.
|
|
681
|
+
* @param config - Partial configuration to override SDK-level defaults
|
|
682
|
+
* @returns This service instance for method chaining
|
|
683
|
+
*/
|
|
684
|
+
setConfig(config: Partial<SdkConfig>): this;
|
|
685
|
+
/**
|
|
686
|
+
* Recursively merges two objects. Plain nested objects are merged key-by-key so a
|
|
687
|
+
* partial override (e.g. `{ retry: { attempts: 5 } }`) only overwrites the specified
|
|
688
|
+
* keys instead of replacing the whole nested object. Arrays and non-plain values are
|
|
689
|
+
* replaced wholesale.
|
|
690
|
+
*
|
|
691
|
+
* Override keys with the value `undefined` are skipped so the base value is preserved,
|
|
692
|
+
* matching the common JS merge idiom (e.g. lodash.merge). To explicitly clear a key,
|
|
693
|
+
* assign `null` or omit the key from the override entirely.
|
|
694
|
+
*/
|
|
695
|
+
private static deepMerge;
|
|
696
|
+
private static isPlainObject;
|
|
697
|
+
/**
|
|
698
|
+
* Resolves configuration from the hierarchy: requestConfig > methodConfig > serviceConfig > sdkConfig
|
|
699
|
+
* Deep-merges all config levels so partial nested overrides (e.g. `{ retry: { attempts: 5 } }`)
|
|
700
|
+
* preserve unoverridden sibling keys from the SDK default.
|
|
701
|
+
* @param methodConfig - Method-level configuration override
|
|
702
|
+
* @param requestConfig - Request-level configuration override
|
|
703
|
+
* @returns Merged configuration with all overrides applied
|
|
704
|
+
*/
|
|
705
|
+
protected getResolvedConfig(methodConfig?: Partial<SdkConfig>, requestConfig?: Partial<SdkConfig>): SdkConfig;
|
|
706
|
+
protected toBase64(str: string): string;
|
|
707
|
+
set baseUrl(baseUrl: string);
|
|
708
|
+
set environment(environment: Environment);
|
|
709
|
+
set timeoutMs(timeoutMs: number);
|
|
710
|
+
set clientId(clientId: string);
|
|
711
|
+
set clientSecret(clientSecret: string);
|
|
712
|
+
set oAuthBaseUrl(oAuthBaseUrl: string);
|
|
713
|
+
set accessToken(accessToken: string);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Zod schema for the ListDestinationsOkResponse model.
|
|
718
|
+
* Defines the structure and validation rules for this data type.
|
|
719
|
+
* This is the shape used in application code - what developers interact with.
|
|
720
|
+
*/
|
|
721
|
+
declare const listDestinationsOkResponse: z.ZodLazy<z.ZodObject<{
|
|
722
|
+
destinations: z.ZodArray<z.ZodLazy<z.ZodObject<{
|
|
723
|
+
name: z.ZodString;
|
|
724
|
+
destination: z.ZodString;
|
|
725
|
+
destinationIso2: z.ZodString;
|
|
726
|
+
supportedCountries: z.ZodArray<z.ZodString, "many">;
|
|
727
|
+
}, "strip", z.ZodTypeAny, {
|
|
728
|
+
name: string;
|
|
729
|
+
destination: string;
|
|
730
|
+
destinationIso2: string;
|
|
731
|
+
supportedCountries: string[];
|
|
732
|
+
}, {
|
|
733
|
+
name: string;
|
|
734
|
+
destination: string;
|
|
735
|
+
destinationIso2: string;
|
|
736
|
+
supportedCountries: string[];
|
|
737
|
+
}>>, "many">;
|
|
738
|
+
}, "strip", z.ZodTypeAny, {
|
|
739
|
+
destinations: {
|
|
740
|
+
name: string;
|
|
741
|
+
destination: string;
|
|
742
|
+
destinationIso2: string;
|
|
743
|
+
supportedCountries: string[];
|
|
744
|
+
}[];
|
|
745
|
+
}, {
|
|
746
|
+
destinations: {
|
|
747
|
+
name: string;
|
|
748
|
+
destination: string;
|
|
749
|
+
destinationIso2: string;
|
|
750
|
+
supportedCountries: string[];
|
|
751
|
+
}[];
|
|
752
|
+
}>>;
|
|
753
|
+
/**
|
|
754
|
+
* @typedef {ListDestinationsOkResponse} listDestinationsOkResponse
|
|
755
|
+
* @property {Destinations[]} destinations
|
|
756
|
+
*/
|
|
757
|
+
type ListDestinationsOkResponse = z.infer<typeof listDestinationsOkResponse>;
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Service class for DestinationsService operations.
|
|
761
|
+
* Provides methods to interact with DestinationsService-related API endpoints.
|
|
762
|
+
* All methods return promises and handle request/response serialization automatically.
|
|
763
|
+
*/
|
|
764
|
+
declare class DestinationsService extends BaseService {
|
|
765
|
+
protected listDestinationsConfig?: Partial<SdkConfig>;
|
|
766
|
+
/**
|
|
767
|
+
* Sets method-level configuration for listDestinations.
|
|
768
|
+
* @param config - Partial configuration to override service-level defaults
|
|
769
|
+
* @returns This service instance for method chaining
|
|
770
|
+
*/
|
|
771
|
+
setListDestinationsConfig(config: Partial<SdkConfig>): this;
|
|
772
|
+
/**
|
|
773
|
+
* List Destinations
|
|
774
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
775
|
+
* @returns {Promise<HttpResponse<ListDestinationsOkResponse>>} - Successful Response
|
|
776
|
+
*/
|
|
777
|
+
listDestinations(requestConfig?: Partial<SdkConfig>): Promise<ListDestinationsOkResponse>;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Zod schema for the Destinations model.
|
|
782
|
+
* Defines the structure and validation rules for this data type.
|
|
783
|
+
* This is the shape used in application code - what developers interact with.
|
|
784
|
+
*/
|
|
785
|
+
declare const destinations: z.ZodLazy<z.ZodObject<{
|
|
786
|
+
name: z.ZodString;
|
|
787
|
+
destination: z.ZodString;
|
|
788
|
+
destinationIso2: z.ZodString;
|
|
789
|
+
supportedCountries: z.ZodArray<z.ZodString, "many">;
|
|
790
|
+
}, "strip", z.ZodTypeAny, {
|
|
791
|
+
name: string;
|
|
792
|
+
destination: string;
|
|
793
|
+
destinationIso2: string;
|
|
794
|
+
supportedCountries: string[];
|
|
795
|
+
}, {
|
|
796
|
+
name: string;
|
|
797
|
+
destination: string;
|
|
798
|
+
destinationIso2: string;
|
|
799
|
+
supportedCountries: string[];
|
|
800
|
+
}>>;
|
|
801
|
+
/**
|
|
802
|
+
* @typedef {Destinations} destinations
|
|
803
|
+
* @property {string} name - Name of the destination
|
|
804
|
+
* @property {string} destination - ISO3 representation of the destination
|
|
805
|
+
* @property {string} destinationIso2 - ISO2 representation of the destination
|
|
806
|
+
* @property {string[]} supportedCountries - This array indicates the geographical area covered by a specific destination. If the destination represents a single country, the array will include that country. However, if the destination represents a broader regional scope, the array will be populated with the names of the countries belonging to that region.
|
|
807
|
+
*/
|
|
808
|
+
type Destinations = z.infer<typeof destinations>;
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Zod schema for the ListPackagesOkResponse model.
|
|
812
|
+
* Defines the structure and validation rules for this data type.
|
|
813
|
+
* This is the shape used in application code - what developers interact with.
|
|
814
|
+
*/
|
|
815
|
+
declare const listPackagesOkResponse: z.ZodLazy<z.ZodObject<{
|
|
816
|
+
packages: z.ZodArray<z.ZodLazy<z.ZodObject<{
|
|
817
|
+
id: z.ZodString;
|
|
818
|
+
destination: z.ZodString;
|
|
819
|
+
destinationIso2: z.ZodString;
|
|
820
|
+
dataLimitInBytes: z.ZodNumber;
|
|
821
|
+
dataLimitInGb: z.ZodNumber;
|
|
822
|
+
minDays: z.ZodNumber;
|
|
823
|
+
maxDays: z.ZodNumber;
|
|
824
|
+
priceInCents: z.ZodNumber;
|
|
825
|
+
}, "strip", z.ZodTypeAny, {
|
|
826
|
+
destination: string;
|
|
827
|
+
destinationIso2: string;
|
|
828
|
+
id: string;
|
|
829
|
+
dataLimitInBytes: number;
|
|
830
|
+
dataLimitInGb: number;
|
|
831
|
+
minDays: number;
|
|
832
|
+
maxDays: number;
|
|
833
|
+
priceInCents: number;
|
|
834
|
+
}, {
|
|
835
|
+
destination: string;
|
|
836
|
+
destinationIso2: string;
|
|
837
|
+
id: string;
|
|
838
|
+
dataLimitInBytes: number;
|
|
839
|
+
dataLimitInGb: number;
|
|
840
|
+
minDays: number;
|
|
841
|
+
maxDays: number;
|
|
842
|
+
priceInCents: number;
|
|
843
|
+
}>>, "many">;
|
|
844
|
+
afterCursor: z.ZodNullable<z.ZodString>;
|
|
845
|
+
}, "strip", z.ZodTypeAny, {
|
|
846
|
+
packages: {
|
|
847
|
+
destination: string;
|
|
848
|
+
destinationIso2: string;
|
|
849
|
+
id: string;
|
|
850
|
+
dataLimitInBytes: number;
|
|
851
|
+
dataLimitInGb: number;
|
|
852
|
+
minDays: number;
|
|
853
|
+
maxDays: number;
|
|
854
|
+
priceInCents: number;
|
|
855
|
+
}[];
|
|
856
|
+
afterCursor: string | null;
|
|
857
|
+
}, {
|
|
858
|
+
packages: {
|
|
859
|
+
destination: string;
|
|
860
|
+
destinationIso2: string;
|
|
861
|
+
id: string;
|
|
862
|
+
dataLimitInBytes: number;
|
|
863
|
+
dataLimitInGb: number;
|
|
864
|
+
minDays: number;
|
|
865
|
+
maxDays: number;
|
|
866
|
+
priceInCents: number;
|
|
867
|
+
}[];
|
|
868
|
+
afterCursor: string | null;
|
|
869
|
+
}>>;
|
|
870
|
+
/**
|
|
871
|
+
* @typedef {ListPackagesOkResponse} listPackagesOkResponse
|
|
872
|
+
* @property {Packages[]} packages
|
|
873
|
+
* @property {string} afterCursor - The cursor value representing the end of the current page of results. Use this cursor value as the "afterCursor" parameter in your next request to retrieve the subsequent page of results. It ensures that you continue fetching data from where you left off, facilitating smooth pagination
|
|
874
|
+
*/
|
|
875
|
+
type ListPackagesOkResponse = z.infer<typeof listPackagesOkResponse>;
|
|
876
|
+
|
|
877
|
+
interface ListPackagesParams {
|
|
878
|
+
destination?: string;
|
|
879
|
+
dataLimitInGb?: number;
|
|
880
|
+
startDate?: string;
|
|
881
|
+
endDate?: string;
|
|
882
|
+
afterCursor?: string;
|
|
883
|
+
limit?: number;
|
|
884
|
+
startTime?: number;
|
|
885
|
+
endTime?: number;
|
|
886
|
+
includeUnlimited?: boolean;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* Service class for PackagesService operations.
|
|
891
|
+
* Provides methods to interact with PackagesService-related API endpoints.
|
|
892
|
+
* All methods return promises and handle request/response serialization automatically.
|
|
893
|
+
*/
|
|
894
|
+
declare class PackagesService extends BaseService {
|
|
895
|
+
protected listPackagesConfig?: Partial<SdkConfig>;
|
|
896
|
+
/**
|
|
897
|
+
* Sets method-level configuration for listPackages.
|
|
898
|
+
* @param config - Partial configuration to override service-level defaults
|
|
899
|
+
* @returns This service instance for method chaining
|
|
900
|
+
*/
|
|
901
|
+
setListPackagesConfig(config: Partial<SdkConfig>): this;
|
|
902
|
+
/**
|
|
903
|
+
* List Packages
|
|
904
|
+
* @param {string} [params.destination] - ISO representation of the package's destination. Supports both ISO2 (e.g., 'FR') and ISO3 (e.g., 'FRA') country codes.
|
|
905
|
+
* @param {number} [params.dataLimitInGb] - Filter packages by data limit in GB. When provided, only packages with this exact data limit are returned. Use `-1` together with `includeUnlimited=true` to return only unlimited packages. A value of `0` is ignored.
|
|
906
|
+
* @param {string} [params.startDate] - Start date of the package's validity in the format 'yyyy-MM-dd'. This date can be set to the current day or any day within the next 12 months.
|
|
907
|
+
* @param {string} [params.endDate] - End date of the package's validity in the format 'yyyy-MM-dd'. End date can be maximum 90 days after Start date.
|
|
908
|
+
* @param {string} [params.afterCursor] - To get the next batch of results, use this parameter. It tells the API where to start fetching data after the last item you received. It helps you avoid repeats and efficiently browse through large sets of data.
|
|
909
|
+
* @param {number} [params.limit] - Maximum number of packages to be returned in the response. The value must be greater than 0 and less than or equal to 160. If not provided, the default value is 20
|
|
910
|
+
* @param {number} [params.startTime] - Epoch value representing the start time of the package's validity. This timestamp can be set to the current time or any time within the next 12 months
|
|
911
|
+
* @param {number} [params.endTime] - Epoch value representing the end time of the package's validity. End time can be maximum 90 days after Start time
|
|
912
|
+
* @param {boolean} [params.includeUnlimited] - Whether to include unlimited (date-based) packages in the results. Unlimited packages are excluded by default; set this to `true` to include them. An unlimited package has `dataLimitInGB` and `dataLimitInBytes` equal to `-1`, and is offered for 3 to 30 days with `minDays` equal to `maxDays`.
|
|
913
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
914
|
+
* @returns {Promise<HttpResponse<ListPackagesOkResponse>>} - Successful Response
|
|
915
|
+
*/
|
|
916
|
+
listPackages(params?: ListPackagesParams, requestConfig?: Partial<SdkConfig>): Promise<ListPackagesOkResponse>;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* Zod schema for the Packages model.
|
|
921
|
+
* Defines the structure and validation rules for this data type.
|
|
922
|
+
* This is the shape used in application code - what developers interact with.
|
|
923
|
+
*/
|
|
924
|
+
declare const packages: z.ZodLazy<z.ZodObject<{
|
|
925
|
+
id: z.ZodString;
|
|
926
|
+
destination: z.ZodString;
|
|
927
|
+
destinationIso2: z.ZodString;
|
|
928
|
+
dataLimitInBytes: z.ZodNumber;
|
|
929
|
+
dataLimitInGb: z.ZodNumber;
|
|
930
|
+
minDays: z.ZodNumber;
|
|
931
|
+
maxDays: z.ZodNumber;
|
|
932
|
+
priceInCents: z.ZodNumber;
|
|
933
|
+
}, "strip", z.ZodTypeAny, {
|
|
934
|
+
destination: string;
|
|
935
|
+
destinationIso2: string;
|
|
936
|
+
id: string;
|
|
937
|
+
dataLimitInBytes: number;
|
|
938
|
+
dataLimitInGb: number;
|
|
939
|
+
minDays: number;
|
|
940
|
+
maxDays: number;
|
|
941
|
+
priceInCents: number;
|
|
942
|
+
}, {
|
|
943
|
+
destination: string;
|
|
944
|
+
destinationIso2: string;
|
|
945
|
+
id: string;
|
|
946
|
+
dataLimitInBytes: number;
|
|
947
|
+
dataLimitInGb: number;
|
|
948
|
+
minDays: number;
|
|
949
|
+
maxDays: number;
|
|
950
|
+
priceInCents: number;
|
|
951
|
+
}>>;
|
|
952
|
+
/**
|
|
953
|
+
* @typedef {Packages} packages
|
|
954
|
+
* @property {string} id - ID of the package
|
|
955
|
+
* @property {string} destination - ISO3 representation of the package's destination.
|
|
956
|
+
* @property {string} destinationIso2 - ISO2 representation of the package's destination.
|
|
957
|
+
* @property {number} dataLimitInBytes - Size of the package in Bytes. A value of `-1` indicates an unlimited package.
|
|
958
|
+
* @property {number} dataLimitInGb - Size of the package in GB. A value of `-1` indicates an unlimited (date-based) package.
|
|
959
|
+
* @property {number} minDays - Min number of days for the package
|
|
960
|
+
* @property {number} maxDays - Max number of days for the package
|
|
961
|
+
* @property {number} priceInCents - Price of the package in cents
|
|
962
|
+
*/
|
|
963
|
+
type Packages = z.infer<typeof packages>;
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* Zod schema for the CreatePurchaseV2Request model.
|
|
967
|
+
* Defines the structure and validation rules for this data type.
|
|
968
|
+
* This is the shape used in application code - what developers interact with.
|
|
969
|
+
*/
|
|
970
|
+
declare const createPurchaseV2Request: z.ZodLazy<z.ZodObject<{
|
|
971
|
+
destination: z.ZodString;
|
|
972
|
+
dataLimitInGb: z.ZodNumber;
|
|
973
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
974
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
975
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
976
|
+
quantity: z.ZodNumber;
|
|
977
|
+
email: z.ZodOptional<z.ZodString>;
|
|
978
|
+
referenceId: z.ZodOptional<z.ZodString>;
|
|
979
|
+
networkBrand: z.ZodOptional<z.ZodString>;
|
|
980
|
+
emailBrand: z.ZodOptional<z.ZodString>;
|
|
981
|
+
language: z.ZodOptional<z.ZodString>;
|
|
982
|
+
}, "strip", z.ZodTypeAny, {
|
|
983
|
+
destination: string;
|
|
984
|
+
dataLimitInGb: number;
|
|
985
|
+
quantity: number;
|
|
986
|
+
startDate?: string | undefined;
|
|
987
|
+
endDate?: string | undefined;
|
|
988
|
+
duration?: number | undefined;
|
|
989
|
+
email?: string | undefined;
|
|
990
|
+
referenceId?: string | undefined;
|
|
991
|
+
networkBrand?: string | undefined;
|
|
992
|
+
emailBrand?: string | undefined;
|
|
993
|
+
language?: string | undefined;
|
|
994
|
+
}, {
|
|
995
|
+
destination: string;
|
|
996
|
+
dataLimitInGb: number;
|
|
997
|
+
quantity: number;
|
|
998
|
+
startDate?: string | undefined;
|
|
999
|
+
endDate?: string | undefined;
|
|
1000
|
+
duration?: number | undefined;
|
|
1001
|
+
email?: string | undefined;
|
|
1002
|
+
referenceId?: string | undefined;
|
|
1003
|
+
networkBrand?: string | undefined;
|
|
1004
|
+
emailBrand?: string | undefined;
|
|
1005
|
+
language?: string | undefined;
|
|
1006
|
+
}>>;
|
|
1007
|
+
/**
|
|
1008
|
+
* @typedef {CreatePurchaseV2Request} createPurchaseV2Request
|
|
1009
|
+
* @property {string} destination - ISO representation of the package's destination. Supports both ISO2 (e.g., 'FR') and ISO3 (e.g., 'FRA') country codes.
|
|
1010
|
+
* @property {number} dataLimitInGb - Size of the package in GB. The available options are 0.5, 1, 2, 3, 5, 8, 20, 50GB. Use `-1` to purchase an unlimited (date-based) package — provide `startDate`/`endDate` spanning 3 to 30 days (`duration` is not supported for unlimited packages).
|
|
1011
|
+
* @property {string} startDate - Start date of the package's validity in the format 'yyyy-MM-dd'. This date can be set to the current day or any day within the next 12 months.
|
|
1012
|
+
* @property {string} endDate - End date of the package's validity in the format 'yyyy-MM-dd'. End date can be maximum 90 days after Start date.
|
|
1013
|
+
* @property {number} duration - Duration of the package in days. Available values are 1, 2, 7, 14, 30, or 90. Either provide startDate/endDate or duration. Not supported for unlimited packages (`dataLimitInGB` = -1), which are date-based — provide startDate/endDate instead.
|
|
1014
|
+
* @property {number} quantity - Number of eSIMs to purchase.
|
|
1015
|
+
* @property {string} email - Email address where the purchase confirmation email will be sent (including QR Code & activation steps)
|
|
1016
|
+
* @property {string} referenceId - An identifier provided by the partner to link this purchase to their booking or transaction for analytics and debugging purposes. Letters, digits, `-`, `_`, `.`, `@` and `+` are allowed (so an email address works), up to 255 characters.
|
|
1017
|
+
* @property {string} networkBrand - Customize the network brand of the issued eSIM. The `networkBrand` parameter cannot exceed 15 characters in length and must contain only letters, numbers, dots (.), ampersands (&), and spaces. This feature is available to platforms with Diamond tier only.
|
|
1018
|
+
* @property {string} emailBrand - Customize the email subject brand. The `emailBrand` parameter cannot exceed 25 characters in length and must contain only letters, numbers, and spaces. This feature is available to platforms with Diamond tier only.
|
|
1019
|
+
* @property {CreatePurchaseV2RequestLanguage} language - Language of the confirmation email sent to the customer.
|
|
1020
|
+
*/
|
|
1021
|
+
type CreatePurchaseV2Request = z.infer<typeof createPurchaseV2Request>;
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* Zod schema for the CreatePurchaseV2OkResponse model.
|
|
1025
|
+
* Defines the structure and validation rules for this data type.
|
|
1026
|
+
* This is the shape used in application code - what developers interact with.
|
|
1027
|
+
*/
|
|
1028
|
+
declare const createPurchaseV2OkResponse: z.ZodLazy<z.ZodObject<{
|
|
1029
|
+
purchase: z.ZodLazy<z.ZodObject<{
|
|
1030
|
+
id: z.ZodString;
|
|
1031
|
+
packageId: z.ZodString;
|
|
1032
|
+
createdDate: z.ZodString;
|
|
1033
|
+
}, "strip", z.ZodTypeAny, {
|
|
1034
|
+
id: string;
|
|
1035
|
+
packageId: string;
|
|
1036
|
+
createdDate: string;
|
|
1037
|
+
}, {
|
|
1038
|
+
id: string;
|
|
1039
|
+
packageId: string;
|
|
1040
|
+
createdDate: string;
|
|
1041
|
+
}>>;
|
|
1042
|
+
profile: z.ZodLazy<z.ZodObject<{
|
|
1043
|
+
iccid: z.ZodString;
|
|
1044
|
+
activationCode: z.ZodString;
|
|
1045
|
+
manualActivationCode: z.ZodString;
|
|
1046
|
+
iosActivationLink: z.ZodString;
|
|
1047
|
+
androidActivationLink: z.ZodString;
|
|
1048
|
+
}, "strip", z.ZodTypeAny, {
|
|
1049
|
+
iccid: string;
|
|
1050
|
+
activationCode: string;
|
|
1051
|
+
manualActivationCode: string;
|
|
1052
|
+
iosActivationLink: string;
|
|
1053
|
+
androidActivationLink: string;
|
|
1054
|
+
}, {
|
|
1055
|
+
iccid: string;
|
|
1056
|
+
activationCode: string;
|
|
1057
|
+
manualActivationCode: string;
|
|
1058
|
+
iosActivationLink: string;
|
|
1059
|
+
androidActivationLink: string;
|
|
1060
|
+
}>>;
|
|
1061
|
+
}, "strip", z.ZodTypeAny, {
|
|
1062
|
+
purchase: {
|
|
1063
|
+
id: string;
|
|
1064
|
+
packageId: string;
|
|
1065
|
+
createdDate: string;
|
|
1066
|
+
};
|
|
1067
|
+
profile: {
|
|
1068
|
+
iccid: string;
|
|
1069
|
+
activationCode: string;
|
|
1070
|
+
manualActivationCode: string;
|
|
1071
|
+
iosActivationLink: string;
|
|
1072
|
+
androidActivationLink: string;
|
|
1073
|
+
};
|
|
1074
|
+
}, {
|
|
1075
|
+
purchase: {
|
|
1076
|
+
id: string;
|
|
1077
|
+
packageId: string;
|
|
1078
|
+
createdDate: string;
|
|
1079
|
+
};
|
|
1080
|
+
profile: {
|
|
1081
|
+
iccid: string;
|
|
1082
|
+
activationCode: string;
|
|
1083
|
+
manualActivationCode: string;
|
|
1084
|
+
iosActivationLink: string;
|
|
1085
|
+
androidActivationLink: string;
|
|
1086
|
+
};
|
|
1087
|
+
}>>;
|
|
1088
|
+
/**
|
|
1089
|
+
* @typedef {CreatePurchaseV2OkResponse} createPurchaseV2OkResponse
|
|
1090
|
+
* @property {CreatePurchaseV2OkResponsePurchase} purchase
|
|
1091
|
+
* @property {CreatePurchaseV2OkResponseProfile} profile
|
|
1092
|
+
*/
|
|
1093
|
+
type CreatePurchaseV2OkResponse = z.infer<typeof createPurchaseV2OkResponse>;
|
|
1094
|
+
|
|
1095
|
+
interface CreatePurchaseV2Params {
|
|
1096
|
+
idempotencyKey?: string;
|
|
1097
|
+
}
|
|
1098
|
+
interface ListPurchasesParams {
|
|
1099
|
+
purchaseId?: string;
|
|
1100
|
+
iccid?: string;
|
|
1101
|
+
afterDate?: string;
|
|
1102
|
+
beforeDate?: string;
|
|
1103
|
+
email?: string;
|
|
1104
|
+
referenceId?: string;
|
|
1105
|
+
afterCursor?: string;
|
|
1106
|
+
limit?: number;
|
|
1107
|
+
after?: number;
|
|
1108
|
+
before?: number;
|
|
1109
|
+
}
|
|
1110
|
+
interface CreatePurchaseParams {
|
|
1111
|
+
idempotencyKey?: string;
|
|
1112
|
+
}
|
|
1113
|
+
interface TopUpEsimParams {
|
|
1114
|
+
idempotencyKey?: string;
|
|
1115
|
+
}
|
|
1116
|
+
interface EditPurchaseParams {
|
|
1117
|
+
idempotencyKey?: string;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
/**
|
|
1121
|
+
* Zod schema for the ListPurchasesOkResponse model.
|
|
1122
|
+
* Defines the structure and validation rules for this data type.
|
|
1123
|
+
* This is the shape used in application code - what developers interact with.
|
|
1124
|
+
*/
|
|
1125
|
+
declare const listPurchasesOkResponse: z.ZodLazy<z.ZodObject<{
|
|
1126
|
+
purchases: z.ZodArray<z.ZodLazy<z.ZodObject<{
|
|
1127
|
+
id: z.ZodString;
|
|
1128
|
+
startDate: z.ZodNullable<z.ZodString>;
|
|
1129
|
+
endDate: z.ZodNullable<z.ZodString>;
|
|
1130
|
+
duration: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
1131
|
+
createdDate: z.ZodString;
|
|
1132
|
+
startTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
1133
|
+
endTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
1134
|
+
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
1135
|
+
package: z.ZodLazy<z.ZodObject<{
|
|
1136
|
+
id: z.ZodString;
|
|
1137
|
+
dataLimitInBytes: z.ZodNumber;
|
|
1138
|
+
dataLimitInGb: z.ZodNumber;
|
|
1139
|
+
destination: z.ZodString;
|
|
1140
|
+
destinationIso2: z.ZodString;
|
|
1141
|
+
destinationName: z.ZodString;
|
|
1142
|
+
priceInCents: z.ZodNumber;
|
|
1143
|
+
}, "strip", z.ZodTypeAny, {
|
|
1144
|
+
destination: string;
|
|
1145
|
+
destinationIso2: string;
|
|
1146
|
+
id: string;
|
|
1147
|
+
dataLimitInBytes: number;
|
|
1148
|
+
dataLimitInGb: number;
|
|
1149
|
+
priceInCents: number;
|
|
1150
|
+
destinationName: string;
|
|
1151
|
+
}, {
|
|
1152
|
+
destination: string;
|
|
1153
|
+
destinationIso2: string;
|
|
1154
|
+
id: string;
|
|
1155
|
+
dataLimitInBytes: number;
|
|
1156
|
+
dataLimitInGb: number;
|
|
1157
|
+
priceInCents: number;
|
|
1158
|
+
destinationName: string;
|
|
1159
|
+
}>>;
|
|
1160
|
+
esim: z.ZodLazy<z.ZodObject<{
|
|
1161
|
+
iccid: z.ZodString;
|
|
1162
|
+
}, "strip", z.ZodTypeAny, {
|
|
1163
|
+
iccid: string;
|
|
1164
|
+
}, {
|
|
1165
|
+
iccid: string;
|
|
1166
|
+
}>>;
|
|
1167
|
+
source: z.ZodString;
|
|
1168
|
+
purchaseType: z.ZodString;
|
|
1169
|
+
referenceId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1170
|
+
}, "strip", z.ZodTypeAny, {
|
|
1171
|
+
id: string;
|
|
1172
|
+
startDate: string | null;
|
|
1173
|
+
endDate: string | null;
|
|
1174
|
+
createdDate: string;
|
|
1175
|
+
package: {
|
|
1176
|
+
destination: string;
|
|
1177
|
+
destinationIso2: string;
|
|
1178
|
+
id: string;
|
|
1179
|
+
dataLimitInBytes: number;
|
|
1180
|
+
dataLimitInGb: number;
|
|
1181
|
+
priceInCents: number;
|
|
1182
|
+
destinationName: string;
|
|
1183
|
+
};
|
|
1184
|
+
esim: {
|
|
1185
|
+
iccid: string;
|
|
1186
|
+
};
|
|
1187
|
+
source: string;
|
|
1188
|
+
purchaseType: string;
|
|
1189
|
+
duration?: number | null | undefined;
|
|
1190
|
+
startTime?: number | null | undefined;
|
|
1191
|
+
endTime?: number | null | undefined;
|
|
1192
|
+
createdAt?: number | undefined;
|
|
1193
|
+
referenceId?: string | null | undefined;
|
|
1194
|
+
}, {
|
|
1195
|
+
id: string;
|
|
1196
|
+
startDate: string | null;
|
|
1197
|
+
endDate: string | null;
|
|
1198
|
+
createdDate: string;
|
|
1199
|
+
package: {
|
|
1200
|
+
destination: string;
|
|
1201
|
+
destinationIso2: string;
|
|
1202
|
+
id: string;
|
|
1203
|
+
dataLimitInBytes: number;
|
|
1204
|
+
dataLimitInGb: number;
|
|
1205
|
+
priceInCents: number;
|
|
1206
|
+
destinationName: string;
|
|
1207
|
+
};
|
|
1208
|
+
esim: {
|
|
1209
|
+
iccid: string;
|
|
1210
|
+
};
|
|
1211
|
+
source: string;
|
|
1212
|
+
purchaseType: string;
|
|
1213
|
+
duration?: number | null | undefined;
|
|
1214
|
+
startTime?: number | null | undefined;
|
|
1215
|
+
endTime?: number | null | undefined;
|
|
1216
|
+
createdAt?: number | undefined;
|
|
1217
|
+
referenceId?: string | null | undefined;
|
|
1218
|
+
}>>, "many">;
|
|
1219
|
+
afterCursor: z.ZodNullable<z.ZodString>;
|
|
1220
|
+
}, "strip", z.ZodTypeAny, {
|
|
1221
|
+
afterCursor: string | null;
|
|
1222
|
+
purchases: {
|
|
1223
|
+
id: string;
|
|
1224
|
+
startDate: string | null;
|
|
1225
|
+
endDate: string | null;
|
|
1226
|
+
createdDate: string;
|
|
1227
|
+
package: {
|
|
1228
|
+
destination: string;
|
|
1229
|
+
destinationIso2: string;
|
|
1230
|
+
id: string;
|
|
1231
|
+
dataLimitInBytes: number;
|
|
1232
|
+
dataLimitInGb: number;
|
|
1233
|
+
priceInCents: number;
|
|
1234
|
+
destinationName: string;
|
|
1235
|
+
};
|
|
1236
|
+
esim: {
|
|
1237
|
+
iccid: string;
|
|
1238
|
+
};
|
|
1239
|
+
source: string;
|
|
1240
|
+
purchaseType: string;
|
|
1241
|
+
duration?: number | null | undefined;
|
|
1242
|
+
startTime?: number | null | undefined;
|
|
1243
|
+
endTime?: number | null | undefined;
|
|
1244
|
+
createdAt?: number | undefined;
|
|
1245
|
+
referenceId?: string | null | undefined;
|
|
1246
|
+
}[];
|
|
1247
|
+
}, {
|
|
1248
|
+
afterCursor: string | null;
|
|
1249
|
+
purchases: {
|
|
1250
|
+
id: string;
|
|
1251
|
+
startDate: string | null;
|
|
1252
|
+
endDate: string | null;
|
|
1253
|
+
createdDate: string;
|
|
1254
|
+
package: {
|
|
1255
|
+
destination: string;
|
|
1256
|
+
destinationIso2: string;
|
|
1257
|
+
id: string;
|
|
1258
|
+
dataLimitInBytes: number;
|
|
1259
|
+
dataLimitInGb: number;
|
|
1260
|
+
priceInCents: number;
|
|
1261
|
+
destinationName: string;
|
|
1262
|
+
};
|
|
1263
|
+
esim: {
|
|
1264
|
+
iccid: string;
|
|
1265
|
+
};
|
|
1266
|
+
source: string;
|
|
1267
|
+
purchaseType: string;
|
|
1268
|
+
duration?: number | null | undefined;
|
|
1269
|
+
startTime?: number | null | undefined;
|
|
1270
|
+
endTime?: number | null | undefined;
|
|
1271
|
+
createdAt?: number | undefined;
|
|
1272
|
+
referenceId?: string | null | undefined;
|
|
1273
|
+
}[];
|
|
1274
|
+
}>>;
|
|
1275
|
+
/**
|
|
1276
|
+
* @typedef {ListPurchasesOkResponse} listPurchasesOkResponse
|
|
1277
|
+
* @property {Purchases[]} purchases
|
|
1278
|
+
* @property {string} afterCursor - The cursor value representing the end of the current page of results. Use this cursor value as the "afterCursor" parameter in your next request to retrieve the subsequent page of results. It ensures that you continue fetching data from where you left off, facilitating smooth pagination.
|
|
1279
|
+
*/
|
|
1280
|
+
type ListPurchasesOkResponse = z.infer<typeof listPurchasesOkResponse>;
|
|
1281
|
+
|
|
1282
|
+
/**
|
|
1283
|
+
* Zod schema for the CreatePurchaseRequest model.
|
|
1284
|
+
* Defines the structure and validation rules for this data type.
|
|
1285
|
+
* This is the shape used in application code - what developers interact with.
|
|
1286
|
+
*/
|
|
1287
|
+
declare const createPurchaseRequest: z.ZodLazy<z.ZodObject<{
|
|
1288
|
+
destination: z.ZodString;
|
|
1289
|
+
dataLimitInGb: z.ZodNumber;
|
|
1290
|
+
startDate: z.ZodString;
|
|
1291
|
+
endDate: z.ZodString;
|
|
1292
|
+
email: z.ZodOptional<z.ZodString>;
|
|
1293
|
+
referenceId: z.ZodOptional<z.ZodString>;
|
|
1294
|
+
networkBrand: z.ZodOptional<z.ZodString>;
|
|
1295
|
+
emailBrand: z.ZodOptional<z.ZodString>;
|
|
1296
|
+
language: z.ZodOptional<z.ZodString>;
|
|
1297
|
+
startTime: z.ZodOptional<z.ZodNumber>;
|
|
1298
|
+
endTime: z.ZodOptional<z.ZodNumber>;
|
|
1299
|
+
}, "strip", z.ZodTypeAny, {
|
|
1300
|
+
destination: string;
|
|
1301
|
+
dataLimitInGb: number;
|
|
1302
|
+
startDate: string;
|
|
1303
|
+
endDate: string;
|
|
1304
|
+
email?: string | undefined;
|
|
1305
|
+
referenceId?: string | undefined;
|
|
1306
|
+
networkBrand?: string | undefined;
|
|
1307
|
+
emailBrand?: string | undefined;
|
|
1308
|
+
language?: string | undefined;
|
|
1309
|
+
startTime?: number | undefined;
|
|
1310
|
+
endTime?: number | undefined;
|
|
1311
|
+
}, {
|
|
1312
|
+
destination: string;
|
|
1313
|
+
dataLimitInGb: number;
|
|
1314
|
+
startDate: string;
|
|
1315
|
+
endDate: string;
|
|
1316
|
+
email?: string | undefined;
|
|
1317
|
+
referenceId?: string | undefined;
|
|
1318
|
+
networkBrand?: string | undefined;
|
|
1319
|
+
emailBrand?: string | undefined;
|
|
1320
|
+
language?: string | undefined;
|
|
1321
|
+
startTime?: number | undefined;
|
|
1322
|
+
endTime?: number | undefined;
|
|
1323
|
+
}>>;
|
|
1324
|
+
/**
|
|
1325
|
+
* @typedef {CreatePurchaseRequest} createPurchaseRequest
|
|
1326
|
+
* @property {string} destination - ISO representation of the package's destination. Supports both ISO2 (e.g., 'FR') and ISO3 (e.g., 'FRA') country codes.
|
|
1327
|
+
* @property {number} dataLimitInGb - Size of the package in GB. The available options are 0.5, 1, 2, 3, 5, 8, 20, 50GB. Use `-1` to purchase an unlimited (date-based) package — provide `startDate`/`endDate` spanning 3 to 30 days.
|
|
1328
|
+
* @property {string} startDate - Start date of the package's validity in the format 'yyyy-MM-dd'. This date can be set to the current day or any day within the next 12 months.
|
|
1329
|
+
* @property {string} endDate - End date of the package's validity in the format 'yyyy-MM-dd'. End date can be maximum 90 days after Start date.
|
|
1330
|
+
* @property {string} email - Email address where the purchase confirmation email will be sent (including QR Code & activation steps)
|
|
1331
|
+
* @property {string} referenceId - An identifier provided by the partner to link this purchase to their booking or transaction for analytics and debugging purposes. Letters, digits, `-`, `_`, `.`, `@` and `+` are allowed (so an email address works), up to 255 characters.
|
|
1332
|
+
* @property {string} networkBrand - Customize the network brand of the issued eSIM. The `networkBrand` parameter cannot exceed 15 characters in length and must contain only letters, numbers, dots (.), ampersands (&), and spaces. This feature is available to platforms with Diamond tier only.
|
|
1333
|
+
* @property {string} emailBrand - Customize the email subject brand. The `emailBrand` parameter cannot exceed 25 characters in length and must contain only letters, numbers, and spaces. This feature is available to platforms with Diamond tier only.
|
|
1334
|
+
* @property {CreatePurchaseRequestLanguage} language - Language of the confirmation email sent to the customer.
|
|
1335
|
+
* @property {number} startTime - Epoch value representing the start time of the package's validity. This timestamp can be set to the current time or any time within the next 12 months.
|
|
1336
|
+
* @property {number} endTime - Epoch value representing the end time of the package's validity. End time can be maximum 90 days after Start time.
|
|
1337
|
+
*/
|
|
1338
|
+
type CreatePurchaseRequest = z.infer<typeof createPurchaseRequest>;
|
|
1339
|
+
|
|
1340
|
+
/**
|
|
1341
|
+
* Zod schema for the CreatePurchaseOkResponse model.
|
|
1342
|
+
* Defines the structure and validation rules for this data type.
|
|
1343
|
+
* This is the shape used in application code - what developers interact with.
|
|
1344
|
+
*/
|
|
1345
|
+
declare const createPurchaseOkResponse: z.ZodLazy<z.ZodObject<{
|
|
1346
|
+
purchase: z.ZodLazy<z.ZodObject<{
|
|
1347
|
+
id: z.ZodString;
|
|
1348
|
+
packageId: z.ZodString;
|
|
1349
|
+
startDate: z.ZodNullable<z.ZodString>;
|
|
1350
|
+
endDate: z.ZodNullable<z.ZodString>;
|
|
1351
|
+
createdDate: z.ZodString;
|
|
1352
|
+
startTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
1353
|
+
endTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
1354
|
+
}, "strip", z.ZodTypeAny, {
|
|
1355
|
+
id: string;
|
|
1356
|
+
startDate: string | null;
|
|
1357
|
+
endDate: string | null;
|
|
1358
|
+
packageId: string;
|
|
1359
|
+
createdDate: string;
|
|
1360
|
+
startTime?: number | null | undefined;
|
|
1361
|
+
endTime?: number | null | undefined;
|
|
1362
|
+
}, {
|
|
1363
|
+
id: string;
|
|
1364
|
+
startDate: string | null;
|
|
1365
|
+
endDate: string | null;
|
|
1366
|
+
packageId: string;
|
|
1367
|
+
createdDate: string;
|
|
1368
|
+
startTime?: number | null | undefined;
|
|
1369
|
+
endTime?: number | null | undefined;
|
|
1370
|
+
}>>;
|
|
1371
|
+
profile: z.ZodLazy<z.ZodObject<{
|
|
1372
|
+
iccid: z.ZodString;
|
|
1373
|
+
activationCode: z.ZodString;
|
|
1374
|
+
manualActivationCode: z.ZodString;
|
|
1375
|
+
}, "strip", z.ZodTypeAny, {
|
|
1376
|
+
iccid: string;
|
|
1377
|
+
activationCode: string;
|
|
1378
|
+
manualActivationCode: string;
|
|
1379
|
+
}, {
|
|
1380
|
+
iccid: string;
|
|
1381
|
+
activationCode: string;
|
|
1382
|
+
manualActivationCode: string;
|
|
1383
|
+
}>>;
|
|
1384
|
+
}, "strip", z.ZodTypeAny, {
|
|
1385
|
+
purchase: {
|
|
1386
|
+
id: string;
|
|
1387
|
+
startDate: string | null;
|
|
1388
|
+
endDate: string | null;
|
|
1389
|
+
packageId: string;
|
|
1390
|
+
createdDate: string;
|
|
1391
|
+
startTime?: number | null | undefined;
|
|
1392
|
+
endTime?: number | null | undefined;
|
|
1393
|
+
};
|
|
1394
|
+
profile: {
|
|
1395
|
+
iccid: string;
|
|
1396
|
+
activationCode: string;
|
|
1397
|
+
manualActivationCode: string;
|
|
1398
|
+
};
|
|
1399
|
+
}, {
|
|
1400
|
+
purchase: {
|
|
1401
|
+
id: string;
|
|
1402
|
+
startDate: string | null;
|
|
1403
|
+
endDate: string | null;
|
|
1404
|
+
packageId: string;
|
|
1405
|
+
createdDate: string;
|
|
1406
|
+
startTime?: number | null | undefined;
|
|
1407
|
+
endTime?: number | null | undefined;
|
|
1408
|
+
};
|
|
1409
|
+
profile: {
|
|
1410
|
+
iccid: string;
|
|
1411
|
+
activationCode: string;
|
|
1412
|
+
manualActivationCode: string;
|
|
1413
|
+
};
|
|
1414
|
+
}>>;
|
|
1415
|
+
/**
|
|
1416
|
+
* @typedef {CreatePurchaseOkResponse} createPurchaseOkResponse
|
|
1417
|
+
* @property {CreatePurchaseOkResponsePurchase} purchase
|
|
1418
|
+
* @property {CreatePurchaseOkResponseProfile} profile
|
|
1419
|
+
*/
|
|
1420
|
+
type CreatePurchaseOkResponse = z.infer<typeof createPurchaseOkResponse>;
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* Zod schema for the TopUpEsimRequest model.
|
|
1424
|
+
* Defines the structure and validation rules for this data type.
|
|
1425
|
+
* This is the shape used in application code - what developers interact with.
|
|
1426
|
+
*/
|
|
1427
|
+
declare const topUpEsimRequest: z.ZodLazy<z.ZodObject<{
|
|
1428
|
+
iccid: z.ZodString;
|
|
1429
|
+
dataLimitInGb: z.ZodNumber;
|
|
1430
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
1431
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
1432
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
1433
|
+
email: z.ZodOptional<z.ZodString>;
|
|
1434
|
+
referenceId: z.ZodOptional<z.ZodString>;
|
|
1435
|
+
emailBrand: z.ZodOptional<z.ZodString>;
|
|
1436
|
+
startTime: z.ZodOptional<z.ZodNumber>;
|
|
1437
|
+
endTime: z.ZodOptional<z.ZodNumber>;
|
|
1438
|
+
}, "strip", z.ZodTypeAny, {
|
|
1439
|
+
dataLimitInGb: number;
|
|
1440
|
+
iccid: string;
|
|
1441
|
+
startDate?: string | undefined;
|
|
1442
|
+
endDate?: string | undefined;
|
|
1443
|
+
duration?: number | undefined;
|
|
1444
|
+
email?: string | undefined;
|
|
1445
|
+
referenceId?: string | undefined;
|
|
1446
|
+
emailBrand?: string | undefined;
|
|
1447
|
+
startTime?: number | undefined;
|
|
1448
|
+
endTime?: number | undefined;
|
|
1449
|
+
}, {
|
|
1450
|
+
dataLimitInGb: number;
|
|
1451
|
+
iccid: string;
|
|
1452
|
+
startDate?: string | undefined;
|
|
1453
|
+
endDate?: string | undefined;
|
|
1454
|
+
duration?: number | undefined;
|
|
1455
|
+
email?: string | undefined;
|
|
1456
|
+
referenceId?: string | undefined;
|
|
1457
|
+
emailBrand?: string | undefined;
|
|
1458
|
+
startTime?: number | undefined;
|
|
1459
|
+
endTime?: number | undefined;
|
|
1460
|
+
}>>;
|
|
1461
|
+
/**
|
|
1462
|
+
* @typedef {TopUpEsimRequest} topUpEsimRequest
|
|
1463
|
+
* @property {string} iccid - ID of the eSIM
|
|
1464
|
+
* @property {number} dataLimitInGb - Size of the package in GB. The available options are 0.5, 1, 2, 3, 5, 8, 20, 50GB. Use `-1` to top up with an unlimited (date-based) package — provide `startDate`/`endDate` spanning 3 to 30 days (`duration` is not supported for unlimited packages).
|
|
1465
|
+
* @property {string} startDate - Start date of the package's validity in the format 'yyyy-MM-dd'. This date can be set to the current day or any day within the next 12 months.
|
|
1466
|
+
* @property {string} endDate - End date of the package's validity in the format 'yyyy-MM-dd'. End date can be maximum 90 days after Start date.
|
|
1467
|
+
* @property {number} duration - Duration of the package in days. Available values are 1, 2, 7, 14, 30, or 90. Either provide startDate/endDate or duration. Not supported for unlimited packages (`dataLimitInGB` = -1), which are date-based — provide startDate/endDate instead.
|
|
1468
|
+
* @property {string} email - Email address where the purchase confirmation email will be sent (excluding QR Code & activation steps).
|
|
1469
|
+
* @property {string} referenceId - An identifier provided by the partner to link this purchase to their booking or transaction for analytics and debugging purposes. Letters, digits, `-`, `_`, `.`, `@` and `+` are allowed (so an email address works), up to 255 characters.
|
|
1470
|
+
* @property {string} emailBrand - Customize the email subject brand. The `emailBrand` parameter cannot exceed 25 characters in length and must contain only letters, numbers, and spaces. This feature is available to platforms with Diamond tier only.
|
|
1471
|
+
* @property {number} startTime - Epoch value representing the start time of the package's validity. This timestamp can be set to the current time or any time within the next 12 months.
|
|
1472
|
+
* @property {number} endTime - Epoch value representing the end time of the package's validity. End time can be maximum 90 days after Start time.
|
|
1473
|
+
*/
|
|
1474
|
+
type TopUpEsimRequest = z.infer<typeof topUpEsimRequest>;
|
|
1475
|
+
|
|
1476
|
+
/**
|
|
1477
|
+
* Zod schema for the TopUpEsimOkResponse model.
|
|
1478
|
+
* Defines the structure and validation rules for this data type.
|
|
1479
|
+
* This is the shape used in application code - what developers interact with.
|
|
1480
|
+
*/
|
|
1481
|
+
declare const topUpEsimOkResponse: z.ZodLazy<z.ZodObject<{
|
|
1482
|
+
purchase: z.ZodLazy<z.ZodObject<{
|
|
1483
|
+
id: z.ZodString;
|
|
1484
|
+
packageId: z.ZodString;
|
|
1485
|
+
startDate: z.ZodNullable<z.ZodString>;
|
|
1486
|
+
endDate: z.ZodNullable<z.ZodString>;
|
|
1487
|
+
createdDate: z.ZodString;
|
|
1488
|
+
startTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
1489
|
+
endTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
1490
|
+
}, "strip", z.ZodTypeAny, {
|
|
1491
|
+
id: string;
|
|
1492
|
+
startDate: string | null;
|
|
1493
|
+
endDate: string | null;
|
|
1494
|
+
packageId: string;
|
|
1495
|
+
createdDate: string;
|
|
1496
|
+
startTime?: number | null | undefined;
|
|
1497
|
+
endTime?: number | null | undefined;
|
|
1498
|
+
}, {
|
|
1499
|
+
id: string;
|
|
1500
|
+
startDate: string | null;
|
|
1501
|
+
endDate: string | null;
|
|
1502
|
+
packageId: string;
|
|
1503
|
+
createdDate: string;
|
|
1504
|
+
startTime?: number | null | undefined;
|
|
1505
|
+
endTime?: number | null | undefined;
|
|
1506
|
+
}>>;
|
|
1507
|
+
profile: z.ZodLazy<z.ZodObject<{
|
|
1508
|
+
iccid: z.ZodString;
|
|
1509
|
+
}, "strip", z.ZodTypeAny, {
|
|
1510
|
+
iccid: string;
|
|
1511
|
+
}, {
|
|
1512
|
+
iccid: string;
|
|
1513
|
+
}>>;
|
|
1514
|
+
}, "strip", z.ZodTypeAny, {
|
|
1515
|
+
purchase: {
|
|
1516
|
+
id: string;
|
|
1517
|
+
startDate: string | null;
|
|
1518
|
+
endDate: string | null;
|
|
1519
|
+
packageId: string;
|
|
1520
|
+
createdDate: string;
|
|
1521
|
+
startTime?: number | null | undefined;
|
|
1522
|
+
endTime?: number | null | undefined;
|
|
1523
|
+
};
|
|
1524
|
+
profile: {
|
|
1525
|
+
iccid: string;
|
|
1526
|
+
};
|
|
1527
|
+
}, {
|
|
1528
|
+
purchase: {
|
|
1529
|
+
id: string;
|
|
1530
|
+
startDate: string | null;
|
|
1531
|
+
endDate: string | null;
|
|
1532
|
+
packageId: string;
|
|
1533
|
+
createdDate: string;
|
|
1534
|
+
startTime?: number | null | undefined;
|
|
1535
|
+
endTime?: number | null | undefined;
|
|
1536
|
+
};
|
|
1537
|
+
profile: {
|
|
1538
|
+
iccid: string;
|
|
1539
|
+
};
|
|
1540
|
+
}>>;
|
|
1541
|
+
/**
|
|
1542
|
+
* @typedef {TopUpEsimOkResponse} topUpEsimOkResponse
|
|
1543
|
+
* @property {TopUpEsimOkResponsePurchase} purchase
|
|
1544
|
+
* @property {TopUpEsimOkResponseProfile} profile
|
|
1545
|
+
*/
|
|
1546
|
+
type TopUpEsimOkResponse = z.infer<typeof topUpEsimOkResponse>;
|
|
1547
|
+
|
|
1548
|
+
/**
|
|
1549
|
+
* Zod schema for the EditPurchaseRequest model.
|
|
1550
|
+
* Defines the structure and validation rules for this data type.
|
|
1551
|
+
* This is the shape used in application code - what developers interact with.
|
|
1552
|
+
*/
|
|
1553
|
+
declare const editPurchaseRequest: z.ZodLazy<z.ZodObject<{
|
|
1554
|
+
purchaseId: z.ZodString;
|
|
1555
|
+
startDate: z.ZodString;
|
|
1556
|
+
endDate: z.ZodString;
|
|
1557
|
+
startTime: z.ZodOptional<z.ZodNumber>;
|
|
1558
|
+
endTime: z.ZodOptional<z.ZodNumber>;
|
|
1559
|
+
}, "strip", z.ZodTypeAny, {
|
|
1560
|
+
startDate: string;
|
|
1561
|
+
endDate: string;
|
|
1562
|
+
purchaseId: string;
|
|
1563
|
+
startTime?: number | undefined;
|
|
1564
|
+
endTime?: number | undefined;
|
|
1565
|
+
}, {
|
|
1566
|
+
startDate: string;
|
|
1567
|
+
endDate: string;
|
|
1568
|
+
purchaseId: string;
|
|
1569
|
+
startTime?: number | undefined;
|
|
1570
|
+
endTime?: number | undefined;
|
|
1571
|
+
}>>;
|
|
1572
|
+
/**
|
|
1573
|
+
* @typedef {EditPurchaseRequest} editPurchaseRequest
|
|
1574
|
+
* @property {string} purchaseId - ID of the purchase
|
|
1575
|
+
* @property {string} startDate - Start date of the package's validity in the format 'yyyy-MM-dd'. This date can be set to the current day or any day within the next 12 months.
|
|
1576
|
+
* @property {string} endDate - End date of the package's validity in the format 'yyyy-MM-dd'. End date can be maximum 90 days after Start date.
|
|
1577
|
+
* @property {number} startTime - Epoch value representing the start time of the package's validity. This timestamp can be set to the current time or any time within the next 12 months.
|
|
1578
|
+
* @property {number} endTime - Epoch value representing the end time of the package's validity. End time can be maximum 90 days after Start time.
|
|
1579
|
+
*/
|
|
1580
|
+
type EditPurchaseRequest = z.infer<typeof editPurchaseRequest>;
|
|
1581
|
+
|
|
1582
|
+
/**
|
|
1583
|
+
* Zod schema for the EditPurchaseOkResponse model.
|
|
1584
|
+
* Defines the structure and validation rules for this data type.
|
|
1585
|
+
* This is the shape used in application code - what developers interact with.
|
|
1586
|
+
*/
|
|
1587
|
+
declare const editPurchaseOkResponse: z.ZodLazy<z.ZodObject<{
|
|
1588
|
+
purchaseId: z.ZodString;
|
|
1589
|
+
newStartDate: z.ZodNullable<z.ZodString>;
|
|
1590
|
+
newEndDate: z.ZodNullable<z.ZodString>;
|
|
1591
|
+
newStartTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
1592
|
+
newEndTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
1593
|
+
}, "strip", z.ZodTypeAny, {
|
|
1594
|
+
purchaseId: string;
|
|
1595
|
+
newStartDate: string | null;
|
|
1596
|
+
newEndDate: string | null;
|
|
1597
|
+
newStartTime?: number | null | undefined;
|
|
1598
|
+
newEndTime?: number | null | undefined;
|
|
1599
|
+
}, {
|
|
1600
|
+
purchaseId: string;
|
|
1601
|
+
newStartDate: string | null;
|
|
1602
|
+
newEndDate: string | null;
|
|
1603
|
+
newStartTime?: number | null | undefined;
|
|
1604
|
+
newEndTime?: number | null | undefined;
|
|
1605
|
+
}>>;
|
|
1606
|
+
/**
|
|
1607
|
+
* @typedef {EditPurchaseOkResponse} editPurchaseOkResponse
|
|
1608
|
+
* @property {string} purchaseId - ID of the purchase
|
|
1609
|
+
* @property {string} newStartDate - Start date of the package's validity in the format 'yyyy-MM-ddThh:mm:ssZZ'
|
|
1610
|
+
* @property {string} newEndDate - End date of the package's validity in the format 'yyyy-MM-ddThh:mm:ssZZ'
|
|
1611
|
+
* @property {number} newStartTime - Epoch value representing the new start time of the package's validity
|
|
1612
|
+
* @property {number} newEndTime - Epoch value representing the new end time of the package's validity
|
|
1613
|
+
*/
|
|
1614
|
+
type EditPurchaseOkResponse = z.infer<typeof editPurchaseOkResponse>;
|
|
1615
|
+
|
|
1616
|
+
/**
|
|
1617
|
+
* Zod schema for the GetPurchaseConsumptionOkResponse model.
|
|
1618
|
+
* Defines the structure and validation rules for this data type.
|
|
1619
|
+
* This is the shape used in application code - what developers interact with.
|
|
1620
|
+
*/
|
|
1621
|
+
declare const getPurchaseConsumptionOkResponse: z.ZodLazy<z.ZodObject<{
|
|
1622
|
+
dataUsageRemainingInBytes: z.ZodNumber;
|
|
1623
|
+
dataUsageRemainingInGb: z.ZodNumber;
|
|
1624
|
+
status: z.ZodString;
|
|
1625
|
+
}, "strip", z.ZodTypeAny, {
|
|
1626
|
+
status: string;
|
|
1627
|
+
dataUsageRemainingInBytes: number;
|
|
1628
|
+
dataUsageRemainingInGb: number;
|
|
1629
|
+
}, {
|
|
1630
|
+
status: string;
|
|
1631
|
+
dataUsageRemainingInBytes: number;
|
|
1632
|
+
dataUsageRemainingInGb: number;
|
|
1633
|
+
}>>;
|
|
1634
|
+
/**
|
|
1635
|
+
* @typedef {GetPurchaseConsumptionOkResponse} getPurchaseConsumptionOkResponse
|
|
1636
|
+
* @property {number} dataUsageRemainingInBytes - Remaining balance of the package in bytes. Returns `-1` for unlimited packages.
|
|
1637
|
+
* @property {number} dataUsageRemainingInGb - Remaining balance of the package in GB. Returns `-1` for unlimited packages.
|
|
1638
|
+
* @property {string} status - Status of the connectivity, possible values are 'ACTIVE' or 'NOT_ACTIVE'
|
|
1639
|
+
*/
|
|
1640
|
+
type GetPurchaseConsumptionOkResponse = z.infer<typeof getPurchaseConsumptionOkResponse>;
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* Service class for PurchasesService operations.
|
|
1644
|
+
* Provides methods to interact with PurchasesService-related API endpoints.
|
|
1645
|
+
* All methods return promises and handle request/response serialization automatically.
|
|
1646
|
+
*/
|
|
1647
|
+
declare class PurchasesService extends BaseService {
|
|
1648
|
+
protected createPurchaseV2Config?: Partial<SdkConfig>;
|
|
1649
|
+
protected listPurchasesConfig?: Partial<SdkConfig>;
|
|
1650
|
+
protected createPurchaseConfig?: Partial<SdkConfig>;
|
|
1651
|
+
protected topUpEsimConfig?: Partial<SdkConfig>;
|
|
1652
|
+
protected editPurchaseConfig?: Partial<SdkConfig>;
|
|
1653
|
+
protected getPurchaseConsumptionConfig?: Partial<SdkConfig>;
|
|
1654
|
+
/**
|
|
1655
|
+
* Sets method-level configuration for createPurchaseV2.
|
|
1656
|
+
* @param config - Partial configuration to override service-level defaults
|
|
1657
|
+
* @returns This service instance for method chaining
|
|
1658
|
+
*/
|
|
1659
|
+
setCreatePurchaseV2Config(config: Partial<SdkConfig>): this;
|
|
1660
|
+
/**
|
|
1661
|
+
* Sets method-level configuration for listPurchases.
|
|
1662
|
+
* @param config - Partial configuration to override service-level defaults
|
|
1663
|
+
* @returns This service instance for method chaining
|
|
1664
|
+
*/
|
|
1665
|
+
setListPurchasesConfig(config: Partial<SdkConfig>): this;
|
|
1666
|
+
/**
|
|
1667
|
+
* Sets method-level configuration for createPurchase.
|
|
1668
|
+
* @param config - Partial configuration to override service-level defaults
|
|
1669
|
+
* @returns This service instance for method chaining
|
|
1670
|
+
*/
|
|
1671
|
+
setCreatePurchaseConfig(config: Partial<SdkConfig>): this;
|
|
1672
|
+
/**
|
|
1673
|
+
* Sets method-level configuration for topUpEsim.
|
|
1674
|
+
* @param config - Partial configuration to override service-level defaults
|
|
1675
|
+
* @returns This service instance for method chaining
|
|
1676
|
+
*/
|
|
1677
|
+
setTopUpEsimConfig(config: Partial<SdkConfig>): this;
|
|
1678
|
+
/**
|
|
1679
|
+
* Sets method-level configuration for editPurchase.
|
|
1680
|
+
* @param config - Partial configuration to override service-level defaults
|
|
1681
|
+
* @returns This service instance for method chaining
|
|
1682
|
+
*/
|
|
1683
|
+
setEditPurchaseConfig(config: Partial<SdkConfig>): this;
|
|
1684
|
+
/**
|
|
1685
|
+
* Sets method-level configuration for getPurchaseConsumption.
|
|
1686
|
+
* @param config - Partial configuration to override service-level defaults
|
|
1687
|
+
* @returns This service instance for method chaining
|
|
1688
|
+
*/
|
|
1689
|
+
setGetPurchaseConsumptionConfig(config: Partial<SdkConfig>): this;
|
|
1690
|
+
/**
|
|
1691
|
+
* This endpoint is used to purchase a new eSIM by providing the package details.
|
|
1692
|
+
* @param {string} [params.idempotencyKey] - Optional. A unique value (for example a UUID) that makes this request safe to retry. If a request with the same `Idempotency-Key` and the same body succeeds, repeating it returns the original response instead of performing the action again, and the response includes the header `Idempotent-Replayed: true`. Keys are scoped to your credentials and remembered for 3 days. Only successful (2xx) responses are remembered, so a request that failed can be retried with the same key. Reusing a key with a different request returns `422`; sending it while the original request is still being processed returns `409`. If the idempotency store is temporarily unavailable, the request is not processed and returns `503`; retry it. Must be 1 to 255 printable ASCII characters, without spaces.
|
|
1693
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
1694
|
+
* @returns {Promise<HttpResponse<CreatePurchaseV2OkResponse[]>>} - Successful Response
|
|
1695
|
+
*/
|
|
1696
|
+
createPurchaseV2(body: CreatePurchaseV2Request, params?: CreatePurchaseV2Params, requestConfig?: Partial<SdkConfig>): Promise<CreatePurchaseV2OkResponse[]>;
|
|
1697
|
+
/**
|
|
1698
|
+
* This endpoint can be used to list all the successful purchases made between a given interval.
|
|
1699
|
+
* @param {string} [params.purchaseId] - ID of the purchase
|
|
1700
|
+
* @param {string} [params.iccid] - ID of the eSIM
|
|
1701
|
+
* @param {string} [params.afterDate] - Start date of the interval for filtering purchases in the format 'yyyy-MM-dd'
|
|
1702
|
+
* @param {string} [params.beforeDate] - End date of the interval for filtering purchases in the format 'yyyy-MM-dd'
|
|
1703
|
+
* @param {string} [params.email] - Email associated to the purchase.
|
|
1704
|
+
* @param {string} [params.referenceId] - The referenceId that was provided by the partner during the purchase or topup flow.
|
|
1705
|
+
* @param {string} [params.afterCursor] - To get the next batch of results, use this parameter. It tells the API where to start fetching data after the last item you received. It helps you avoid repeats and efficiently browse through large sets of data.
|
|
1706
|
+
* @param {number} [params.limit] - Maximum number of purchases to be returned in the response. The value must be greater than 0 and less than or equal to 100. If not provided, the default value is 20
|
|
1707
|
+
* @param {number} [params.after] - Epoch value representing the start of the time interval for filtering purchases
|
|
1708
|
+
* @param {number} [params.before] - Epoch value representing the end of the time interval for filtering purchases
|
|
1709
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
1710
|
+
* @returns {Promise<HttpResponse<ListPurchasesOkResponse>>} - Successful Response
|
|
1711
|
+
*/
|
|
1712
|
+
listPurchases(params?: ListPurchasesParams, requestConfig?: Partial<SdkConfig>): Promise<ListPurchasesOkResponse>;
|
|
1713
|
+
/**
|
|
1714
|
+
* This endpoint is used to purchase a new eSIM by providing the package details.
|
|
1715
|
+
* @param {string} [params.idempotencyKey] - Optional. A unique value (for example a UUID) that makes this request safe to retry. If a request with the same `Idempotency-Key` and the same body succeeds, repeating it returns the original response instead of performing the action again, and the response includes the header `Idempotent-Replayed: true`. Keys are scoped to your credentials and remembered for 3 days. Only successful (2xx) responses are remembered, so a request that failed can be retried with the same key. Reusing a key with a different request returns `422`; sending it while the original request is still being processed returns `409`. If the idempotency store is temporarily unavailable, the request is not processed and returns `503`; retry it. Must be 1 to 255 printable ASCII characters, without spaces.
|
|
1716
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
1717
|
+
* @returns {Promise<HttpResponse<CreatePurchaseOkResponse>>} - Successful Response
|
|
1718
|
+
*/
|
|
1719
|
+
createPurchase(body: CreatePurchaseRequest, params?: CreatePurchaseParams, requestConfig?: Partial<SdkConfig>): Promise<CreatePurchaseOkResponse>;
|
|
1720
|
+
/**
|
|
1721
|
+
* This endpoint is used to top-up an existing eSIM with the previously associated destination by providing its ICCID and package details. To determine if an eSIM can be topped up, use the Get eSIM endpoint, which returns the `isTopUpAllowed` flag.
|
|
1722
|
+
* @param {string} [params.idempotencyKey] - Optional. A unique value (for example a UUID) that makes this request safe to retry. If a request with the same `Idempotency-Key` and the same body succeeds, repeating it returns the original response instead of performing the action again, and the response includes the header `Idempotent-Replayed: true`. Keys are scoped to your credentials and remembered for 3 days. Only successful (2xx) responses are remembered, so a request that failed can be retried with the same key. Reusing a key with a different request returns `422`; sending it while the original request is still being processed returns `409`. If the idempotency store is temporarily unavailable, the request is not processed and returns `503`; retry it. Must be 1 to 255 printable ASCII characters, without spaces.
|
|
1723
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
1724
|
+
* @returns {Promise<HttpResponse<TopUpEsimOkResponse>>} - Successful Response
|
|
1725
|
+
*/
|
|
1726
|
+
topUpEsim(body: TopUpEsimRequest, params?: TopUpEsimParams, requestConfig?: Partial<SdkConfig>): Promise<TopUpEsimOkResponse>;
|
|
1727
|
+
/**
|
|
1728
|
+
* This endpoint allows you to modify the validity dates of an existing purchase.
|
|
1729
|
+
**Behavior:**
|
|
1730
|
+
- If the purchase has **not yet been activated**, both the start and end dates can be updated.
|
|
1731
|
+
- If the purchase is **already active**, only the **end date** can be updated, while the **start date must remain unchanged** (and should be passed as originally set).
|
|
1732
|
+
- Updates must comply with the same pricing structure; the modification cannot alter the package size or change its duration category.
|
|
1733
|
+
|
|
1734
|
+
The end date can be extended or shortened as long as it adheres to the same pricing category and does not exceed the allowed duration limits.
|
|
1735
|
+
|
|
1736
|
+
* @param {string} [params.idempotencyKey] - Optional. A unique value (for example a UUID) that makes this request safe to retry. If a request with the same `Idempotency-Key` and the same body succeeds, repeating it returns the original response instead of performing the action again, and the response includes the header `Idempotent-Replayed: true`. Keys are scoped to your credentials and remembered for 3 days. Only successful (2xx) responses are remembered, so a request that failed can be retried with the same key. Reusing a key with a different request returns `422`; sending it while the original request is still being processed returns `409`. If the idempotency store is temporarily unavailable, the request is not processed and returns `503`; retry it. Must be 1 to 255 printable ASCII characters, without spaces.
|
|
1737
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
1738
|
+
* @returns {Promise<HttpResponse<EditPurchaseOkResponse>>} - Successful Response
|
|
1739
|
+
*/
|
|
1740
|
+
editPurchase(body: EditPurchaseRequest, params?: EditPurchaseParams, requestConfig?: Partial<SdkConfig>): Promise<EditPurchaseOkResponse>;
|
|
1741
|
+
/**
|
|
1742
|
+
* This endpoint can be called for consumption notifications (e.g. every 1 hour or when the user clicks a button). It returns the data balance (consumption) of purchased packages.
|
|
1743
|
+
* @param {string} purchaseId - ID of the purchase
|
|
1744
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
1745
|
+
* @returns {Promise<HttpResponse<GetPurchaseConsumptionOkResponse>>} - Successful Response
|
|
1746
|
+
*/
|
|
1747
|
+
getPurchaseConsumption(purchaseId: string, requestConfig?: Partial<SdkConfig>): Promise<GetPurchaseConsumptionOkResponse>;
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
/**
|
|
1751
|
+
* Zod schema for the CreatePurchaseV2OkResponsePurchase model.
|
|
1752
|
+
* Defines the structure and validation rules for this data type.
|
|
1753
|
+
* This is the shape used in application code - what developers interact with.
|
|
1754
|
+
*/
|
|
1755
|
+
declare const createPurchaseV2OkResponsePurchase: z.ZodLazy<z.ZodObject<{
|
|
1756
|
+
id: z.ZodString;
|
|
1757
|
+
packageId: z.ZodString;
|
|
1758
|
+
createdDate: z.ZodString;
|
|
1759
|
+
}, "strip", z.ZodTypeAny, {
|
|
1760
|
+
id: string;
|
|
1761
|
+
packageId: string;
|
|
1762
|
+
createdDate: string;
|
|
1763
|
+
}, {
|
|
1764
|
+
id: string;
|
|
1765
|
+
packageId: string;
|
|
1766
|
+
createdDate: string;
|
|
1767
|
+
}>>;
|
|
1768
|
+
/**
|
|
1769
|
+
* @typedef {CreatePurchaseV2OkResponsePurchase} createPurchaseV2OkResponsePurchase
|
|
1770
|
+
* @property {string} id - ID of the purchase
|
|
1771
|
+
* @property {string} packageId - ID of the package
|
|
1772
|
+
* @property {string} createdDate - Creation date of the purchase in the format 'yyyy-MM-ddThh:mm:ssZZ'
|
|
1773
|
+
*/
|
|
1774
|
+
type CreatePurchaseV2OkResponsePurchase = z.infer<typeof createPurchaseV2OkResponsePurchase>;
|
|
1775
|
+
|
|
1776
|
+
/**
|
|
1777
|
+
* Zod schema for the CreatePurchaseV2OkResponseProfile model.
|
|
1778
|
+
* Defines the structure and validation rules for this data type.
|
|
1779
|
+
* This is the shape used in application code - what developers interact with.
|
|
1780
|
+
*/
|
|
1781
|
+
declare const createPurchaseV2OkResponseProfile: z.ZodLazy<z.ZodObject<{
|
|
1782
|
+
iccid: z.ZodString;
|
|
1783
|
+
activationCode: z.ZodString;
|
|
1784
|
+
manualActivationCode: z.ZodString;
|
|
1785
|
+
iosActivationLink: z.ZodString;
|
|
1786
|
+
androidActivationLink: z.ZodString;
|
|
1787
|
+
}, "strip", z.ZodTypeAny, {
|
|
1788
|
+
iccid: string;
|
|
1789
|
+
activationCode: string;
|
|
1790
|
+
manualActivationCode: string;
|
|
1791
|
+
iosActivationLink: string;
|
|
1792
|
+
androidActivationLink: string;
|
|
1793
|
+
}, {
|
|
1794
|
+
iccid: string;
|
|
1795
|
+
activationCode: string;
|
|
1796
|
+
manualActivationCode: string;
|
|
1797
|
+
iosActivationLink: string;
|
|
1798
|
+
androidActivationLink: string;
|
|
1799
|
+
}>>;
|
|
1800
|
+
/**
|
|
1801
|
+
* @typedef {CreatePurchaseV2OkResponseProfile} createPurchaseV2OkResponseProfile
|
|
1802
|
+
* @property {string} iccid - ID of the eSIM
|
|
1803
|
+
* @property {string} activationCode - QR Code of the eSIM as base64
|
|
1804
|
+
* @property {string} manualActivationCode - Manual Activation Code of the eSIM
|
|
1805
|
+
* @property {string} iosActivationLink - iOS Activation Link of the eSIM
|
|
1806
|
+
* @property {string} androidActivationLink - Android Activation Link of the eSIM
|
|
1807
|
+
*/
|
|
1808
|
+
type CreatePurchaseV2OkResponseProfile = z.infer<typeof createPurchaseV2OkResponseProfile>;
|
|
1809
|
+
|
|
1810
|
+
declare enum CreatePurchaseV2RequestLanguage {
|
|
1811
|
+
EN = "en",
|
|
1812
|
+
ES = "es",
|
|
1813
|
+
FR = "fr",
|
|
1814
|
+
DE = "de",
|
|
1815
|
+
PT_BR = "pt-br"
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
/**
|
|
1819
|
+
* Zod schema for the Purchases model.
|
|
1820
|
+
* Defines the structure and validation rules for this data type.
|
|
1821
|
+
* This is the shape used in application code - what developers interact with.
|
|
1822
|
+
*/
|
|
1823
|
+
declare const purchases: z.ZodLazy<z.ZodObject<{
|
|
1824
|
+
id: z.ZodString;
|
|
1825
|
+
startDate: z.ZodNullable<z.ZodString>;
|
|
1826
|
+
endDate: z.ZodNullable<z.ZodString>;
|
|
1827
|
+
duration: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
1828
|
+
createdDate: z.ZodString;
|
|
1829
|
+
startTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
1830
|
+
endTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
1831
|
+
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
1832
|
+
package: z.ZodLazy<z.ZodObject<{
|
|
1833
|
+
id: z.ZodString;
|
|
1834
|
+
dataLimitInBytes: z.ZodNumber;
|
|
1835
|
+
dataLimitInGb: z.ZodNumber;
|
|
1836
|
+
destination: z.ZodString;
|
|
1837
|
+
destinationIso2: z.ZodString;
|
|
1838
|
+
destinationName: z.ZodString;
|
|
1839
|
+
priceInCents: z.ZodNumber;
|
|
1840
|
+
}, "strip", z.ZodTypeAny, {
|
|
1841
|
+
destination: string;
|
|
1842
|
+
destinationIso2: string;
|
|
1843
|
+
id: string;
|
|
1844
|
+
dataLimitInBytes: number;
|
|
1845
|
+
dataLimitInGb: number;
|
|
1846
|
+
priceInCents: number;
|
|
1847
|
+
destinationName: string;
|
|
1848
|
+
}, {
|
|
1849
|
+
destination: string;
|
|
1850
|
+
destinationIso2: string;
|
|
1851
|
+
id: string;
|
|
1852
|
+
dataLimitInBytes: number;
|
|
1853
|
+
dataLimitInGb: number;
|
|
1854
|
+
priceInCents: number;
|
|
1855
|
+
destinationName: string;
|
|
1856
|
+
}>>;
|
|
1857
|
+
esim: z.ZodLazy<z.ZodObject<{
|
|
1858
|
+
iccid: z.ZodString;
|
|
1859
|
+
}, "strip", z.ZodTypeAny, {
|
|
1860
|
+
iccid: string;
|
|
1861
|
+
}, {
|
|
1862
|
+
iccid: string;
|
|
1863
|
+
}>>;
|
|
1864
|
+
source: z.ZodString;
|
|
1865
|
+
purchaseType: z.ZodString;
|
|
1866
|
+
referenceId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1867
|
+
}, "strip", z.ZodTypeAny, {
|
|
1868
|
+
id: string;
|
|
1869
|
+
startDate: string | null;
|
|
1870
|
+
endDate: string | null;
|
|
1871
|
+
createdDate: string;
|
|
1872
|
+
package: {
|
|
1873
|
+
destination: string;
|
|
1874
|
+
destinationIso2: string;
|
|
1875
|
+
id: string;
|
|
1876
|
+
dataLimitInBytes: number;
|
|
1877
|
+
dataLimitInGb: number;
|
|
1878
|
+
priceInCents: number;
|
|
1879
|
+
destinationName: string;
|
|
1880
|
+
};
|
|
1881
|
+
esim: {
|
|
1882
|
+
iccid: string;
|
|
1883
|
+
};
|
|
1884
|
+
source: string;
|
|
1885
|
+
purchaseType: string;
|
|
1886
|
+
duration?: number | null | undefined;
|
|
1887
|
+
startTime?: number | null | undefined;
|
|
1888
|
+
endTime?: number | null | undefined;
|
|
1889
|
+
createdAt?: number | undefined;
|
|
1890
|
+
referenceId?: string | null | undefined;
|
|
1891
|
+
}, {
|
|
1892
|
+
id: string;
|
|
1893
|
+
startDate: string | null;
|
|
1894
|
+
endDate: string | null;
|
|
1895
|
+
createdDate: string;
|
|
1896
|
+
package: {
|
|
1897
|
+
destination: string;
|
|
1898
|
+
destinationIso2: string;
|
|
1899
|
+
id: string;
|
|
1900
|
+
dataLimitInBytes: number;
|
|
1901
|
+
dataLimitInGb: number;
|
|
1902
|
+
priceInCents: number;
|
|
1903
|
+
destinationName: string;
|
|
1904
|
+
};
|
|
1905
|
+
esim: {
|
|
1906
|
+
iccid: string;
|
|
1907
|
+
};
|
|
1908
|
+
source: string;
|
|
1909
|
+
purchaseType: string;
|
|
1910
|
+
duration?: number | null | undefined;
|
|
1911
|
+
startTime?: number | null | undefined;
|
|
1912
|
+
endTime?: number | null | undefined;
|
|
1913
|
+
createdAt?: number | undefined;
|
|
1914
|
+
referenceId?: string | null | undefined;
|
|
1915
|
+
}>>;
|
|
1916
|
+
/**
|
|
1917
|
+
* @typedef {Purchases} purchases
|
|
1918
|
+
* @property {string} id - ID of the purchase
|
|
1919
|
+
* @property {string} startDate - Start date of the package's validity in the format 'yyyy-MM-ddThh:mm:ssZZ'
|
|
1920
|
+
* @property {string} endDate - End date of the package's validity in the format 'yyyy-MM-ddThh:mm:ssZZ'
|
|
1921
|
+
* @property {number} duration - Duration of the package in days. Possible values are 1, 2, 7, 14, 30, or 90. `null` for unlimited (date-based) packages.
|
|
1922
|
+
* @property {string} createdDate - Creation date of the purchase in the format 'yyyy-MM-ddThh:mm:ssZZ'
|
|
1923
|
+
* @property {number} startTime - Epoch value representing the start time of the package's validity
|
|
1924
|
+
* @property {number} endTime - Epoch value representing the end time of the package's validity
|
|
1925
|
+
* @property {number} createdAt - Epoch value representing the date of creation of the purchase
|
|
1926
|
+
* @property {Package_} package
|
|
1927
|
+
* @property {PurchasesEsim} esim
|
|
1928
|
+
* @property {string} source - The `source` indicates whether the purchase was made from the API, dashboard, landing-page, promo-page or iframe. For purchases made before September 8, 2023, the value will be displayed as 'Not available'.
|
|
1929
|
+
* @property {string} purchaseType - The `purchaseType` indicates whether this is the initial purchase that creates the eSIM (First Purchase) or a subsequent top-up on an existing eSIM (Top-up Purchase).
|
|
1930
|
+
* @property {string} referenceId - The `referenceId` that was provided by the partner during the purchase or top-up flow. This identifier can be used for analytics and debugging purposes.
|
|
1931
|
+
*/
|
|
1932
|
+
type Purchases = z.infer<typeof purchases>;
|
|
1933
|
+
|
|
1934
|
+
/**
|
|
1935
|
+
* Zod schema for the Package_ model.
|
|
1936
|
+
* Defines the structure and validation rules for this data type.
|
|
1937
|
+
* This is the shape used in application code - what developers interact with.
|
|
1938
|
+
*/
|
|
1939
|
+
declare const package_: z.ZodLazy<z.ZodObject<{
|
|
1940
|
+
id: z.ZodString;
|
|
1941
|
+
dataLimitInBytes: z.ZodNumber;
|
|
1942
|
+
dataLimitInGb: z.ZodNumber;
|
|
1943
|
+
destination: z.ZodString;
|
|
1944
|
+
destinationIso2: z.ZodString;
|
|
1945
|
+
destinationName: z.ZodString;
|
|
1946
|
+
priceInCents: z.ZodNumber;
|
|
1947
|
+
}, "strip", z.ZodTypeAny, {
|
|
1948
|
+
destination: string;
|
|
1949
|
+
destinationIso2: string;
|
|
1950
|
+
id: string;
|
|
1951
|
+
dataLimitInBytes: number;
|
|
1952
|
+
dataLimitInGb: number;
|
|
1953
|
+
priceInCents: number;
|
|
1954
|
+
destinationName: string;
|
|
1955
|
+
}, {
|
|
1956
|
+
destination: string;
|
|
1957
|
+
destinationIso2: string;
|
|
1958
|
+
id: string;
|
|
1959
|
+
dataLimitInBytes: number;
|
|
1960
|
+
dataLimitInGb: number;
|
|
1961
|
+
priceInCents: number;
|
|
1962
|
+
destinationName: string;
|
|
1963
|
+
}>>;
|
|
1964
|
+
/**
|
|
1965
|
+
* @typedef {Package_} package_
|
|
1966
|
+
* @property {string} id - ID of the package
|
|
1967
|
+
* @property {number} dataLimitInBytes - Size of the package in Bytes. A value of `-1` indicates an unlimited package.
|
|
1968
|
+
* @property {number} dataLimitInGb - Size of the package in GB. A value of `-1` indicates an unlimited (date-based) package.
|
|
1969
|
+
* @property {string} destination - ISO3 representation of the package's destination.
|
|
1970
|
+
* @property {string} destinationIso2 - ISO2 representation of the package's destination.
|
|
1971
|
+
* @property {string} destinationName - Name of the package's destination
|
|
1972
|
+
* @property {number} priceInCents - Price of the package in cents
|
|
1973
|
+
*/
|
|
1974
|
+
type Package_ = z.infer<typeof package_>;
|
|
1975
|
+
|
|
1976
|
+
/**
|
|
1977
|
+
* Zod schema for the PurchasesEsim model.
|
|
1978
|
+
* Defines the structure and validation rules for this data type.
|
|
1979
|
+
* This is the shape used in application code - what developers interact with.
|
|
1980
|
+
*/
|
|
1981
|
+
declare const purchasesEsim: z.ZodLazy<z.ZodObject<{
|
|
1982
|
+
iccid: z.ZodString;
|
|
1983
|
+
}, "strip", z.ZodTypeAny, {
|
|
1984
|
+
iccid: string;
|
|
1985
|
+
}, {
|
|
1986
|
+
iccid: string;
|
|
1987
|
+
}>>;
|
|
1988
|
+
/**
|
|
1989
|
+
* @typedef {PurchasesEsim} purchasesEsim
|
|
1990
|
+
* @property {string} iccid - ID of the eSIM
|
|
1991
|
+
*/
|
|
1992
|
+
type PurchasesEsim = z.infer<typeof purchasesEsim>;
|
|
1993
|
+
|
|
1994
|
+
/**
|
|
1995
|
+
* Zod schema for the CreatePurchaseOkResponsePurchase model.
|
|
1996
|
+
* Defines the structure and validation rules for this data type.
|
|
1997
|
+
* This is the shape used in application code - what developers interact with.
|
|
1998
|
+
*/
|
|
1999
|
+
declare const createPurchaseOkResponsePurchase: z.ZodLazy<z.ZodObject<{
|
|
2000
|
+
id: z.ZodString;
|
|
2001
|
+
packageId: z.ZodString;
|
|
2002
|
+
startDate: z.ZodNullable<z.ZodString>;
|
|
2003
|
+
endDate: z.ZodNullable<z.ZodString>;
|
|
2004
|
+
createdDate: z.ZodString;
|
|
2005
|
+
startTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
2006
|
+
endTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
2007
|
+
}, "strip", z.ZodTypeAny, {
|
|
2008
|
+
id: string;
|
|
2009
|
+
startDate: string | null;
|
|
2010
|
+
endDate: string | null;
|
|
2011
|
+
packageId: string;
|
|
2012
|
+
createdDate: string;
|
|
2013
|
+
startTime?: number | null | undefined;
|
|
2014
|
+
endTime?: number | null | undefined;
|
|
2015
|
+
}, {
|
|
2016
|
+
id: string;
|
|
2017
|
+
startDate: string | null;
|
|
2018
|
+
endDate: string | null;
|
|
2019
|
+
packageId: string;
|
|
2020
|
+
createdDate: string;
|
|
2021
|
+
startTime?: number | null | undefined;
|
|
2022
|
+
endTime?: number | null | undefined;
|
|
2023
|
+
}>>;
|
|
2024
|
+
/**
|
|
2025
|
+
* @typedef {CreatePurchaseOkResponsePurchase} createPurchaseOkResponsePurchase
|
|
2026
|
+
* @property {string} id - ID of the purchase
|
|
2027
|
+
* @property {string} packageId - ID of the package
|
|
2028
|
+
* @property {string} startDate - Start date of the package's validity in the format 'yyyy-MM-ddThh:mm:ssZZ'
|
|
2029
|
+
* @property {string} endDate - End date of the package's validity in the format 'yyyy-MM-ddThh:mm:ssZZ'
|
|
2030
|
+
* @property {string} createdDate - Creation date of the purchase in the format 'yyyy-MM-ddThh:mm:ssZZ'
|
|
2031
|
+
* @property {number} startTime - Epoch value representing the start time of the package's validity
|
|
2032
|
+
* @property {number} endTime - Epoch value representing the end time of the package's validity
|
|
2033
|
+
*/
|
|
2034
|
+
type CreatePurchaseOkResponsePurchase = z.infer<typeof createPurchaseOkResponsePurchase>;
|
|
2035
|
+
|
|
2036
|
+
/**
|
|
2037
|
+
* Zod schema for the CreatePurchaseOkResponseProfile model.
|
|
2038
|
+
* Defines the structure and validation rules for this data type.
|
|
2039
|
+
* This is the shape used in application code - what developers interact with.
|
|
2040
|
+
*/
|
|
2041
|
+
declare const createPurchaseOkResponseProfile: z.ZodLazy<z.ZodObject<{
|
|
2042
|
+
iccid: z.ZodString;
|
|
2043
|
+
activationCode: z.ZodString;
|
|
2044
|
+
manualActivationCode: z.ZodString;
|
|
2045
|
+
}, "strip", z.ZodTypeAny, {
|
|
2046
|
+
iccid: string;
|
|
2047
|
+
activationCode: string;
|
|
2048
|
+
manualActivationCode: string;
|
|
2049
|
+
}, {
|
|
2050
|
+
iccid: string;
|
|
2051
|
+
activationCode: string;
|
|
2052
|
+
manualActivationCode: string;
|
|
2053
|
+
}>>;
|
|
2054
|
+
/**
|
|
2055
|
+
* @typedef {CreatePurchaseOkResponseProfile} createPurchaseOkResponseProfile
|
|
2056
|
+
* @property {string} iccid - ID of the eSIM
|
|
2057
|
+
* @property {string} activationCode - QR Code of the eSIM as base64
|
|
2058
|
+
* @property {string} manualActivationCode - Manual Activation Code of the eSIM
|
|
2059
|
+
*/
|
|
2060
|
+
type CreatePurchaseOkResponseProfile = z.infer<typeof createPurchaseOkResponseProfile>;
|
|
2061
|
+
|
|
2062
|
+
declare enum CreatePurchaseRequestLanguage {
|
|
2063
|
+
EN = "en",
|
|
2064
|
+
ES = "es",
|
|
2065
|
+
FR = "fr",
|
|
2066
|
+
DE = "de",
|
|
2067
|
+
PT_BR = "pt-br"
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
/**
|
|
2071
|
+
* Zod schema for the TopUpEsimOkResponsePurchase model.
|
|
2072
|
+
* Defines the structure and validation rules for this data type.
|
|
2073
|
+
* This is the shape used in application code - what developers interact with.
|
|
2074
|
+
*/
|
|
2075
|
+
declare const topUpEsimOkResponsePurchase: z.ZodLazy<z.ZodObject<{
|
|
2076
|
+
id: z.ZodString;
|
|
2077
|
+
packageId: z.ZodString;
|
|
2078
|
+
startDate: z.ZodNullable<z.ZodString>;
|
|
2079
|
+
endDate: z.ZodNullable<z.ZodString>;
|
|
2080
|
+
createdDate: z.ZodString;
|
|
2081
|
+
startTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
2082
|
+
endTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
2083
|
+
}, "strip", z.ZodTypeAny, {
|
|
2084
|
+
id: string;
|
|
2085
|
+
startDate: string | null;
|
|
2086
|
+
endDate: string | null;
|
|
2087
|
+
packageId: string;
|
|
2088
|
+
createdDate: string;
|
|
2089
|
+
startTime?: number | null | undefined;
|
|
2090
|
+
endTime?: number | null | undefined;
|
|
2091
|
+
}, {
|
|
2092
|
+
id: string;
|
|
2093
|
+
startDate: string | null;
|
|
2094
|
+
endDate: string | null;
|
|
2095
|
+
packageId: string;
|
|
2096
|
+
createdDate: string;
|
|
2097
|
+
startTime?: number | null | undefined;
|
|
2098
|
+
endTime?: number | null | undefined;
|
|
2099
|
+
}>>;
|
|
2100
|
+
/**
|
|
2101
|
+
* @typedef {TopUpEsimOkResponsePurchase} topUpEsimOkResponsePurchase
|
|
2102
|
+
* @property {string} id - ID of the purchase
|
|
2103
|
+
* @property {string} packageId - ID of the package
|
|
2104
|
+
* @property {string} startDate - Start date of the package's validity in the format 'yyyy-MM-ddThh:mm:ssZZ'
|
|
2105
|
+
* @property {string} endDate - End date of the package's validity in the format 'yyyy-MM-ddThh:mm:ssZZ'
|
|
2106
|
+
* @property {string} createdDate - Creation date of the purchase in the format 'yyyy-MM-ddThh:mm:ssZZ'
|
|
2107
|
+
* @property {number} startTime - Epoch value representing the start time of the package's validity
|
|
2108
|
+
* @property {number} endTime - Epoch value representing the end time of the package's validity
|
|
2109
|
+
*/
|
|
2110
|
+
type TopUpEsimOkResponsePurchase = z.infer<typeof topUpEsimOkResponsePurchase>;
|
|
2111
|
+
|
|
2112
|
+
/**
|
|
2113
|
+
* Zod schema for the TopUpEsimOkResponseProfile model.
|
|
2114
|
+
* Defines the structure and validation rules for this data type.
|
|
2115
|
+
* This is the shape used in application code - what developers interact with.
|
|
2116
|
+
*/
|
|
2117
|
+
declare const topUpEsimOkResponseProfile: z.ZodLazy<z.ZodObject<{
|
|
2118
|
+
iccid: z.ZodString;
|
|
2119
|
+
}, "strip", z.ZodTypeAny, {
|
|
2120
|
+
iccid: string;
|
|
2121
|
+
}, {
|
|
2122
|
+
iccid: string;
|
|
2123
|
+
}>>;
|
|
2124
|
+
/**
|
|
2125
|
+
* @typedef {TopUpEsimOkResponseProfile} topUpEsimOkResponseProfile
|
|
2126
|
+
* @property {string} iccid - ID of the eSIM
|
|
2127
|
+
*/
|
|
2128
|
+
type TopUpEsimOkResponseProfile = z.infer<typeof topUpEsimOkResponseProfile>;
|
|
2129
|
+
|
|
2130
|
+
/**
|
|
2131
|
+
* Zod schema for the GetEsimOkResponse model.
|
|
2132
|
+
* Defines the structure and validation rules for this data type.
|
|
2133
|
+
* This is the shape used in application code - what developers interact with.
|
|
2134
|
+
*/
|
|
2135
|
+
declare const getEsimOkResponse: z.ZodLazy<z.ZodObject<{
|
|
2136
|
+
esim: z.ZodLazy<z.ZodObject<{
|
|
2137
|
+
iccid: z.ZodString;
|
|
2138
|
+
smdpAddress: z.ZodString;
|
|
2139
|
+
activationCode: z.ZodString;
|
|
2140
|
+
manualActivationCode: z.ZodString;
|
|
2141
|
+
status: z.ZodString;
|
|
2142
|
+
connectivityStatus: z.ZodString;
|
|
2143
|
+
isTopUpAllowed: z.ZodBoolean;
|
|
2144
|
+
}, "strip", z.ZodTypeAny, {
|
|
2145
|
+
status: string;
|
|
2146
|
+
iccid: string;
|
|
2147
|
+
activationCode: string;
|
|
2148
|
+
manualActivationCode: string;
|
|
2149
|
+
smdpAddress: string;
|
|
2150
|
+
connectivityStatus: string;
|
|
2151
|
+
isTopUpAllowed: boolean;
|
|
2152
|
+
}, {
|
|
2153
|
+
status: string;
|
|
2154
|
+
iccid: string;
|
|
2155
|
+
activationCode: string;
|
|
2156
|
+
manualActivationCode: string;
|
|
2157
|
+
smdpAddress: string;
|
|
2158
|
+
connectivityStatus: string;
|
|
2159
|
+
isTopUpAllowed: boolean;
|
|
2160
|
+
}>>;
|
|
2161
|
+
}, "strip", z.ZodTypeAny, {
|
|
2162
|
+
esim: {
|
|
2163
|
+
status: string;
|
|
2164
|
+
iccid: string;
|
|
2165
|
+
activationCode: string;
|
|
2166
|
+
manualActivationCode: string;
|
|
2167
|
+
smdpAddress: string;
|
|
2168
|
+
connectivityStatus: string;
|
|
2169
|
+
isTopUpAllowed: boolean;
|
|
2170
|
+
};
|
|
2171
|
+
}, {
|
|
2172
|
+
esim: {
|
|
2173
|
+
status: string;
|
|
2174
|
+
iccid: string;
|
|
2175
|
+
activationCode: string;
|
|
2176
|
+
manualActivationCode: string;
|
|
2177
|
+
smdpAddress: string;
|
|
2178
|
+
connectivityStatus: string;
|
|
2179
|
+
isTopUpAllowed: boolean;
|
|
2180
|
+
};
|
|
2181
|
+
}>>;
|
|
2182
|
+
/**
|
|
2183
|
+
* @typedef {GetEsimOkResponse} getEsimOkResponse
|
|
2184
|
+
* @property {GetEsimOkResponseEsim} esim
|
|
2185
|
+
*/
|
|
2186
|
+
type GetEsimOkResponse = z.infer<typeof getEsimOkResponse>;
|
|
2187
|
+
|
|
2188
|
+
interface GetEsimParams {
|
|
2189
|
+
iccid: string;
|
|
2190
|
+
}
|
|
2191
|
+
interface SuspendEsimParams {
|
|
2192
|
+
idempotencyKey?: string;
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
/**
|
|
2196
|
+
* Zod schema for the GetEsimDeviceOkResponse model.
|
|
2197
|
+
* Defines the structure and validation rules for this data type.
|
|
2198
|
+
* This is the shape used in application code - what developers interact with.
|
|
2199
|
+
*/
|
|
2200
|
+
declare const getEsimDeviceOkResponse: z.ZodLazy<z.ZodObject<{
|
|
2201
|
+
device: z.ZodLazy<z.ZodObject<{
|
|
2202
|
+
oem: z.ZodString;
|
|
2203
|
+
hardwareName: z.ZodString;
|
|
2204
|
+
hardwareModel: z.ZodString;
|
|
2205
|
+
eid: z.ZodString;
|
|
2206
|
+
}, "strip", z.ZodTypeAny, {
|
|
2207
|
+
oem: string;
|
|
2208
|
+
hardwareName: string;
|
|
2209
|
+
hardwareModel: string;
|
|
2210
|
+
eid: string;
|
|
2211
|
+
}, {
|
|
2212
|
+
oem: string;
|
|
2213
|
+
hardwareName: string;
|
|
2214
|
+
hardwareModel: string;
|
|
2215
|
+
eid: string;
|
|
2216
|
+
}>>;
|
|
2217
|
+
}, "strip", z.ZodTypeAny, {
|
|
2218
|
+
device: {
|
|
2219
|
+
oem: string;
|
|
2220
|
+
hardwareName: string;
|
|
2221
|
+
hardwareModel: string;
|
|
2222
|
+
eid: string;
|
|
2223
|
+
};
|
|
2224
|
+
}, {
|
|
2225
|
+
device: {
|
|
2226
|
+
oem: string;
|
|
2227
|
+
hardwareName: string;
|
|
2228
|
+
hardwareModel: string;
|
|
2229
|
+
eid: string;
|
|
2230
|
+
};
|
|
2231
|
+
}>>;
|
|
2232
|
+
/**
|
|
2233
|
+
* @typedef {GetEsimDeviceOkResponse} getEsimDeviceOkResponse
|
|
2234
|
+
* @property {Device} device
|
|
2235
|
+
*/
|
|
2236
|
+
type GetEsimDeviceOkResponse = z.infer<typeof getEsimDeviceOkResponse>;
|
|
2237
|
+
|
|
2238
|
+
/**
|
|
2239
|
+
* Zod schema for the GetEsimHistoryOkResponse model.
|
|
2240
|
+
* Defines the structure and validation rules for this data type.
|
|
2241
|
+
* This is the shape used in application code - what developers interact with.
|
|
2242
|
+
*/
|
|
2243
|
+
declare const getEsimHistoryOkResponse: z.ZodLazy<z.ZodObject<{
|
|
2244
|
+
esim: z.ZodLazy<z.ZodObject<{
|
|
2245
|
+
iccid: z.ZodString;
|
|
2246
|
+
history: z.ZodArray<z.ZodLazy<z.ZodObject<{
|
|
2247
|
+
status: z.ZodString;
|
|
2248
|
+
statusDate: z.ZodString;
|
|
2249
|
+
date: z.ZodOptional<z.ZodNumber>;
|
|
2250
|
+
}, "strip", z.ZodTypeAny, {
|
|
2251
|
+
status: string;
|
|
2252
|
+
statusDate: string;
|
|
2253
|
+
date?: number | undefined;
|
|
2254
|
+
}, {
|
|
2255
|
+
status: string;
|
|
2256
|
+
statusDate: string;
|
|
2257
|
+
date?: number | undefined;
|
|
2258
|
+
}>>, "many">;
|
|
2259
|
+
}, "strip", z.ZodTypeAny, {
|
|
2260
|
+
iccid: string;
|
|
2261
|
+
history: {
|
|
2262
|
+
status: string;
|
|
2263
|
+
statusDate: string;
|
|
2264
|
+
date?: number | undefined;
|
|
2265
|
+
}[];
|
|
2266
|
+
}, {
|
|
2267
|
+
iccid: string;
|
|
2268
|
+
history: {
|
|
2269
|
+
status: string;
|
|
2270
|
+
statusDate: string;
|
|
2271
|
+
date?: number | undefined;
|
|
2272
|
+
}[];
|
|
2273
|
+
}>>;
|
|
2274
|
+
}, "strip", z.ZodTypeAny, {
|
|
2275
|
+
esim: {
|
|
2276
|
+
iccid: string;
|
|
2277
|
+
history: {
|
|
2278
|
+
status: string;
|
|
2279
|
+
statusDate: string;
|
|
2280
|
+
date?: number | undefined;
|
|
2281
|
+
}[];
|
|
2282
|
+
};
|
|
2283
|
+
}, {
|
|
2284
|
+
esim: {
|
|
2285
|
+
iccid: string;
|
|
2286
|
+
history: {
|
|
2287
|
+
status: string;
|
|
2288
|
+
statusDate: string;
|
|
2289
|
+
date?: number | undefined;
|
|
2290
|
+
}[];
|
|
2291
|
+
};
|
|
2292
|
+
}>>;
|
|
2293
|
+
/**
|
|
2294
|
+
* @typedef {GetEsimHistoryOkResponse} getEsimHistoryOkResponse
|
|
2295
|
+
* @property {GetEsimHistoryOkResponseEsim} esim
|
|
2296
|
+
*/
|
|
2297
|
+
type GetEsimHistoryOkResponse = z.infer<typeof getEsimHistoryOkResponse>;
|
|
2298
|
+
|
|
2299
|
+
/**
|
|
2300
|
+
* Zod schema for the SuspendEsimOkResponse model.
|
|
2301
|
+
* Defines the structure and validation rules for this data type.
|
|
2302
|
+
* This is the shape used in application code - what developers interact with.
|
|
2303
|
+
*/
|
|
2304
|
+
declare const suspendEsimOkResponse: z.ZodLazy<z.ZodObject<{
|
|
2305
|
+
message: z.ZodString;
|
|
2306
|
+
}, "strip", z.ZodTypeAny, {
|
|
2307
|
+
message: string;
|
|
2308
|
+
}, {
|
|
2309
|
+
message: string;
|
|
2310
|
+
}>>;
|
|
2311
|
+
/**
|
|
2312
|
+
* @typedef {SuspendEsimOkResponse} suspendEsimOkResponse
|
|
2313
|
+
* @property {string} message - Confirmation message
|
|
2314
|
+
*/
|
|
2315
|
+
type SuspendEsimOkResponse = z.infer<typeof suspendEsimOkResponse>;
|
|
2316
|
+
|
|
2317
|
+
/**
|
|
2318
|
+
* Service class for ESimService operations.
|
|
2319
|
+
* Provides methods to interact with ESimService-related API endpoints.
|
|
2320
|
+
* All methods return promises and handle request/response serialization automatically.
|
|
2321
|
+
*/
|
|
2322
|
+
declare class ESimService extends BaseService {
|
|
2323
|
+
protected getEsimConfig?: Partial<SdkConfig>;
|
|
2324
|
+
protected getEsimDeviceConfig?: Partial<SdkConfig>;
|
|
2325
|
+
protected getEsimHistoryConfig?: Partial<SdkConfig>;
|
|
2326
|
+
protected suspendEsimConfig?: Partial<SdkConfig>;
|
|
2327
|
+
/**
|
|
2328
|
+
* Sets method-level configuration for getEsim.
|
|
2329
|
+
* @param config - Partial configuration to override service-level defaults
|
|
2330
|
+
* @returns This service instance for method chaining
|
|
2331
|
+
*/
|
|
2332
|
+
setGetEsimConfig(config: Partial<SdkConfig>): this;
|
|
2333
|
+
/**
|
|
2334
|
+
* Sets method-level configuration for getEsimDevice.
|
|
2335
|
+
* @param config - Partial configuration to override service-level defaults
|
|
2336
|
+
* @returns This service instance for method chaining
|
|
2337
|
+
*/
|
|
2338
|
+
setGetEsimDeviceConfig(config: Partial<SdkConfig>): this;
|
|
2339
|
+
/**
|
|
2340
|
+
* Sets method-level configuration for getEsimHistory.
|
|
2341
|
+
* @param config - Partial configuration to override service-level defaults
|
|
2342
|
+
* @returns This service instance for method chaining
|
|
2343
|
+
*/
|
|
2344
|
+
setGetEsimHistoryConfig(config: Partial<SdkConfig>): this;
|
|
2345
|
+
/**
|
|
2346
|
+
* Sets method-level configuration for suspendEsim.
|
|
2347
|
+
* @param config - Partial configuration to override service-level defaults
|
|
2348
|
+
* @returns This service instance for method chaining
|
|
2349
|
+
*/
|
|
2350
|
+
setSuspendEsimConfig(config: Partial<SdkConfig>): this;
|
|
2351
|
+
/**
|
|
2352
|
+
* Get eSIM
|
|
2353
|
+
* @param {string} params.iccid - ID of the eSIM
|
|
2354
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
2355
|
+
* @returns {Promise<HttpResponse<GetEsimOkResponse>>} - Successful Response
|
|
2356
|
+
*/
|
|
2357
|
+
getEsim(params: GetEsimParams, requestConfig?: Partial<SdkConfig>): Promise<GetEsimOkResponse>;
|
|
2358
|
+
/**
|
|
2359
|
+
* Get eSIM Device
|
|
2360
|
+
* @param {string} iccid - ID of the eSIM
|
|
2361
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
2362
|
+
* @returns {Promise<HttpResponse<GetEsimDeviceOkResponse>>} - Successful Response
|
|
2363
|
+
*/
|
|
2364
|
+
getEsimDevice(iccid: string, requestConfig?: Partial<SdkConfig>): Promise<GetEsimDeviceOkResponse>;
|
|
2365
|
+
/**
|
|
2366
|
+
* Get eSIM History
|
|
2367
|
+
* @param {string} iccid - ID of the eSIM
|
|
2368
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
2369
|
+
* @returns {Promise<HttpResponse<GetEsimHistoryOkResponse>>} - Successful Response
|
|
2370
|
+
*/
|
|
2371
|
+
getEsimHistory(iccid: string, requestConfig?: Partial<SdkConfig>): Promise<GetEsimHistoryOkResponse>;
|
|
2372
|
+
/**
|
|
2373
|
+
* Suspends an eSIM to prevent abuse. All of the eSIM's packages are terminated and its connectivity is switched off. The eSIM is not refunded: the charge stays.
|
|
2374
|
+
* @param {string} iccid - ID of the eSIM
|
|
2375
|
+
* @param {string} [params.idempotencyKey] - Optional. A unique value (for example a UUID) that makes this request safe to retry. If a request with the same `Idempotency-Key` and the same body succeeds, repeating it returns the original response instead of performing the action again, and the response includes the header `Idempotent-Replayed: true`. Keys are scoped to your credentials and remembered for 3 days. Only successful (2xx) responses are remembered, so a request that failed can be retried with the same key. Reusing a key with a different request returns `422`; sending it while the original request is still being processed returns `409`. If the idempotency store is temporarily unavailable, the request is not processed and returns `503`; retry it. Must be 1 to 255 printable ASCII characters, without spaces.
|
|
2376
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
2377
|
+
* @returns {Promise<HttpResponse<SuspendEsimOkResponse>>} - Successful Response
|
|
2378
|
+
*/
|
|
2379
|
+
suspendEsim(iccid: string, params?: SuspendEsimParams, requestConfig?: Partial<SdkConfig>): Promise<SuspendEsimOkResponse>;
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
/**
|
|
2383
|
+
* Zod schema for the GetEsimOkResponseEsim model.
|
|
2384
|
+
* Defines the structure and validation rules for this data type.
|
|
2385
|
+
* This is the shape used in application code - what developers interact with.
|
|
2386
|
+
*/
|
|
2387
|
+
declare const getEsimOkResponseEsim: z.ZodLazy<z.ZodObject<{
|
|
2388
|
+
iccid: z.ZodString;
|
|
2389
|
+
smdpAddress: z.ZodString;
|
|
2390
|
+
activationCode: z.ZodString;
|
|
2391
|
+
manualActivationCode: z.ZodString;
|
|
2392
|
+
status: z.ZodString;
|
|
2393
|
+
connectivityStatus: z.ZodString;
|
|
2394
|
+
isTopUpAllowed: z.ZodBoolean;
|
|
2395
|
+
}, "strip", z.ZodTypeAny, {
|
|
2396
|
+
status: string;
|
|
2397
|
+
iccid: string;
|
|
2398
|
+
activationCode: string;
|
|
2399
|
+
manualActivationCode: string;
|
|
2400
|
+
smdpAddress: string;
|
|
2401
|
+
connectivityStatus: string;
|
|
2402
|
+
isTopUpAllowed: boolean;
|
|
2403
|
+
}, {
|
|
2404
|
+
status: string;
|
|
2405
|
+
iccid: string;
|
|
2406
|
+
activationCode: string;
|
|
2407
|
+
manualActivationCode: string;
|
|
2408
|
+
smdpAddress: string;
|
|
2409
|
+
connectivityStatus: string;
|
|
2410
|
+
isTopUpAllowed: boolean;
|
|
2411
|
+
}>>;
|
|
2412
|
+
/**
|
|
2413
|
+
* @typedef {GetEsimOkResponseEsim} getEsimOkResponseEsim
|
|
2414
|
+
* @property {string} iccid - ID of the eSIM
|
|
2415
|
+
* @property {string} smdpAddress - SM-DP+ Address
|
|
2416
|
+
* @property {string} activationCode - QR Code of the eSIM as base64
|
|
2417
|
+
* @property {string} manualActivationCode - The manual activation code
|
|
2418
|
+
* @property {string} status - Status of the eSIM, possible values are 'RELEASED', 'DOWNLOADED', 'INSTALLED', 'ENABLED', 'DELETED', or 'ERROR'
|
|
2419
|
+
* @property {string} connectivityStatus - Status of the eSIM connectivity, possible values are 'ACTIVE' or 'NOT_ACTIVE'
|
|
2420
|
+
* @property {boolean} isTopUpAllowed - Indicates whether the eSIM is currently eligible for a top-up. This flag should be checked before attempting a top-up request.
|
|
2421
|
+
*/
|
|
2422
|
+
type GetEsimOkResponseEsim = z.infer<typeof getEsimOkResponseEsim>;
|
|
2423
|
+
|
|
2424
|
+
/**
|
|
2425
|
+
* Zod schema for the Device model.
|
|
2426
|
+
* Defines the structure and validation rules for this data type.
|
|
2427
|
+
* This is the shape used in application code - what developers interact with.
|
|
2428
|
+
*/
|
|
2429
|
+
declare const device: z.ZodLazy<z.ZodObject<{
|
|
2430
|
+
oem: z.ZodString;
|
|
2431
|
+
hardwareName: z.ZodString;
|
|
2432
|
+
hardwareModel: z.ZodString;
|
|
2433
|
+
eid: z.ZodString;
|
|
2434
|
+
}, "strip", z.ZodTypeAny, {
|
|
2435
|
+
oem: string;
|
|
2436
|
+
hardwareName: string;
|
|
2437
|
+
hardwareModel: string;
|
|
2438
|
+
eid: string;
|
|
2439
|
+
}, {
|
|
2440
|
+
oem: string;
|
|
2441
|
+
hardwareName: string;
|
|
2442
|
+
hardwareModel: string;
|
|
2443
|
+
eid: string;
|
|
2444
|
+
}>>;
|
|
2445
|
+
/**
|
|
2446
|
+
* @typedef {Device} device
|
|
2447
|
+
* @property {string} oem - Name of the OEM
|
|
2448
|
+
* @property {string} hardwareName - Name of the Device
|
|
2449
|
+
* @property {string} hardwareModel - Model of the Device
|
|
2450
|
+
* @property {string} eid - Serial Number of the eSIM
|
|
2451
|
+
*/
|
|
2452
|
+
type Device = z.infer<typeof device>;
|
|
2453
|
+
|
|
2454
|
+
/**
|
|
2455
|
+
* Zod schema for the GetEsimHistoryOkResponseEsim model.
|
|
2456
|
+
* Defines the structure and validation rules for this data type.
|
|
2457
|
+
* This is the shape used in application code - what developers interact with.
|
|
2458
|
+
*/
|
|
2459
|
+
declare const getEsimHistoryOkResponseEsim: z.ZodLazy<z.ZodObject<{
|
|
2460
|
+
iccid: z.ZodString;
|
|
2461
|
+
history: z.ZodArray<z.ZodLazy<z.ZodObject<{
|
|
2462
|
+
status: z.ZodString;
|
|
2463
|
+
statusDate: z.ZodString;
|
|
2464
|
+
date: z.ZodOptional<z.ZodNumber>;
|
|
2465
|
+
}, "strip", z.ZodTypeAny, {
|
|
2466
|
+
status: string;
|
|
2467
|
+
statusDate: string;
|
|
2468
|
+
date?: number | undefined;
|
|
2469
|
+
}, {
|
|
2470
|
+
status: string;
|
|
2471
|
+
statusDate: string;
|
|
2472
|
+
date?: number | undefined;
|
|
2473
|
+
}>>, "many">;
|
|
2474
|
+
}, "strip", z.ZodTypeAny, {
|
|
2475
|
+
iccid: string;
|
|
2476
|
+
history: {
|
|
2477
|
+
status: string;
|
|
2478
|
+
statusDate: string;
|
|
2479
|
+
date?: number | undefined;
|
|
2480
|
+
}[];
|
|
2481
|
+
}, {
|
|
2482
|
+
iccid: string;
|
|
2483
|
+
history: {
|
|
2484
|
+
status: string;
|
|
2485
|
+
statusDate: string;
|
|
2486
|
+
date?: number | undefined;
|
|
2487
|
+
}[];
|
|
2488
|
+
}>>;
|
|
2489
|
+
/**
|
|
2490
|
+
* @typedef {GetEsimHistoryOkResponseEsim} getEsimHistoryOkResponseEsim
|
|
2491
|
+
* @property {string} iccid - ID of the eSIM
|
|
2492
|
+
* @property {History[]} history
|
|
2493
|
+
*/
|
|
2494
|
+
type GetEsimHistoryOkResponseEsim = z.infer<typeof getEsimHistoryOkResponseEsim>;
|
|
2495
|
+
|
|
2496
|
+
/**
|
|
2497
|
+
* Zod schema for the History model.
|
|
2498
|
+
* Defines the structure and validation rules for this data type.
|
|
2499
|
+
* This is the shape used in application code - what developers interact with.
|
|
2500
|
+
*/
|
|
2501
|
+
declare const history: z.ZodLazy<z.ZodObject<{
|
|
2502
|
+
status: z.ZodString;
|
|
2503
|
+
statusDate: z.ZodString;
|
|
2504
|
+
date: z.ZodOptional<z.ZodNumber>;
|
|
2505
|
+
}, "strip", z.ZodTypeAny, {
|
|
2506
|
+
status: string;
|
|
2507
|
+
statusDate: string;
|
|
2508
|
+
date?: number | undefined;
|
|
2509
|
+
}, {
|
|
2510
|
+
status: string;
|
|
2511
|
+
statusDate: string;
|
|
2512
|
+
date?: number | undefined;
|
|
2513
|
+
}>>;
|
|
2514
|
+
/**
|
|
2515
|
+
* @typedef {History} history
|
|
2516
|
+
* @property {string} status - The status of the eSIM at a given time, possible values are 'RELEASED', 'DOWNLOADED', 'INSTALLED', 'ENABLED', 'DELETED', or 'ERROR'
|
|
2517
|
+
* @property {string} statusDate - The date when the eSIM status changed in the format 'yyyy-MM-ddThh:mm:ssZZ'
|
|
2518
|
+
* @property {number} date - Epoch value representing the date when the eSIM status changed
|
|
2519
|
+
*/
|
|
2520
|
+
type History = z.infer<typeof history>;
|
|
2521
|
+
|
|
2522
|
+
/**
|
|
2523
|
+
* Zod schema for the TokenOkResponse model.
|
|
2524
|
+
* Defines the structure and validation rules for this data type.
|
|
2525
|
+
* This is the shape used in application code - what developers interact with.
|
|
2526
|
+
*/
|
|
2527
|
+
declare const tokenOkResponse: z.ZodLazy<z.ZodObject<{
|
|
2528
|
+
token: z.ZodString;
|
|
2529
|
+
}, "strip", z.ZodTypeAny, {
|
|
2530
|
+
token: string;
|
|
2531
|
+
}, {
|
|
2532
|
+
token: string;
|
|
2533
|
+
}>>;
|
|
2534
|
+
/**
|
|
2535
|
+
* @typedef {TokenOkResponse} tokenOkResponse
|
|
2536
|
+
* @property {string} token - The generated token
|
|
2537
|
+
*/
|
|
2538
|
+
type TokenOkResponse = z.infer<typeof tokenOkResponse>;
|
|
2539
|
+
|
|
2540
|
+
/**
|
|
2541
|
+
* Service class for IFrameService operations.
|
|
2542
|
+
* Provides methods to interact with IFrameService-related API endpoints.
|
|
2543
|
+
* All methods return promises and handle request/response serialization automatically.
|
|
2544
|
+
*/
|
|
2545
|
+
declare class IFrameService extends BaseService {
|
|
2546
|
+
protected tokenConfig?: Partial<SdkConfig>;
|
|
2547
|
+
/**
|
|
2548
|
+
* Sets method-level configuration for token.
|
|
2549
|
+
* @param config - Partial configuration to override service-level defaults
|
|
2550
|
+
* @returns This service instance for method chaining
|
|
2551
|
+
*/
|
|
2552
|
+
setTokenConfig(config: Partial<SdkConfig>): this;
|
|
2553
|
+
/**
|
|
2554
|
+
* Generate a new token to be used in the iFrame
|
|
2555
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
2556
|
+
* @returns {Promise<HttpResponse<TokenOkResponse>>} - Successful Response
|
|
2557
|
+
*/
|
|
2558
|
+
token(requestConfig?: Partial<SdkConfig>): Promise<TokenOkResponse>;
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
/**
|
|
2562
|
+
* Zod schema for the OAuthTokenRequest model.
|
|
2563
|
+
* Defines the structure and validation rules for this data type.
|
|
2564
|
+
* This is the shape used in application code - what developers interact with.
|
|
2565
|
+
*/
|
|
2566
|
+
declare const oAuthTokenRequest: z.ZodLazy<z.ZodObject<{
|
|
2567
|
+
grantType: z.ZodString;
|
|
2568
|
+
clientId: z.ZodString;
|
|
2569
|
+
clientSecret: z.ZodString;
|
|
2570
|
+
scope: z.ZodString;
|
|
2571
|
+
}, "strip", z.ZodTypeAny, {
|
|
2572
|
+
clientId: string;
|
|
2573
|
+
clientSecret: string;
|
|
2574
|
+
grantType: string;
|
|
2575
|
+
scope: string;
|
|
2576
|
+
}, {
|
|
2577
|
+
clientId: string;
|
|
2578
|
+
clientSecret: string;
|
|
2579
|
+
grantType: string;
|
|
2580
|
+
scope: string;
|
|
2581
|
+
}>>;
|
|
2582
|
+
/**
|
|
2583
|
+
* @typedef {OAuthTokenRequest} oAuthTokenRequest
|
|
2584
|
+
* @property {GrantType} grantType
|
|
2585
|
+
* @property {string} clientId
|
|
2586
|
+
* @property {string} clientSecret
|
|
2587
|
+
* @property {string} scope
|
|
2588
|
+
*/
|
|
2589
|
+
type OAuthTokenRequest = z.infer<typeof oAuthTokenRequest>;
|
|
2590
|
+
|
|
2591
|
+
/**
|
|
2592
|
+
* Zod schema for the OAuthTokenResponse model.
|
|
2593
|
+
* Defines the structure and validation rules for this data type.
|
|
2594
|
+
* This is the shape used in application code - what developers interact with.
|
|
2595
|
+
*/
|
|
2596
|
+
declare const oAuthTokenResponse: z.ZodLazy<z.ZodObject<{
|
|
2597
|
+
accessToken: z.ZodOptional<z.ZodString>;
|
|
2598
|
+
expiresIn: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
2599
|
+
}, "strip", z.ZodTypeAny, {
|
|
2600
|
+
accessToken?: string | undefined;
|
|
2601
|
+
expiresIn?: number | null | undefined;
|
|
2602
|
+
}, {
|
|
2603
|
+
accessToken?: string | undefined;
|
|
2604
|
+
expiresIn?: number | null | undefined;
|
|
2605
|
+
}>>;
|
|
2606
|
+
/**
|
|
2607
|
+
* @typedef {OAuthTokenResponse} oAuthTokenResponse
|
|
2608
|
+
* @property {string} accessToken
|
|
2609
|
+
* @property {number} expiresIn
|
|
2610
|
+
*/
|
|
2611
|
+
type OAuthTokenResponse = z.infer<typeof oAuthTokenResponse>;
|
|
2612
|
+
|
|
2613
|
+
/**
|
|
2614
|
+
* Service class for OAuthService operations.
|
|
2615
|
+
* Provides methods to interact with OAuthService-related API endpoints.
|
|
2616
|
+
* All methods return promises and handle request/response serialization automatically.
|
|
2617
|
+
*/
|
|
2618
|
+
declare class OAuthService extends BaseService {
|
|
2619
|
+
protected getAccessTokenConfig?: Partial<SdkConfig>;
|
|
2620
|
+
/**
|
|
2621
|
+
* Sets method-level configuration for getAccessToken.
|
|
2622
|
+
* @param config - Partial configuration to override service-level defaults
|
|
2623
|
+
* @returns This service instance for method chaining
|
|
2624
|
+
*/
|
|
2625
|
+
setGetAccessTokenConfig(config: Partial<SdkConfig>): this;
|
|
2626
|
+
/**
|
|
2627
|
+
*
|
|
2628
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
2629
|
+
* @returns {Promise<HttpResponse<OAuthTokenResponse>>} - OAuth token
|
|
2630
|
+
*/
|
|
2631
|
+
getAccessToken(body: OAuthTokenRequest, requestConfig?: Partial<SdkConfig>): Promise<OAuthTokenResponse>;
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
declare enum GrantType {
|
|
2635
|
+
CLIENT_CREDENTIALS = "client_credentials"
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
declare class ErrorResponse extends ThrowableError {
|
|
2639
|
+
message: string;
|
|
2640
|
+
protected response?: unknown;
|
|
2641
|
+
constructor(message: string, response?: unknown);
|
|
2642
|
+
static from(message: string, response?: unknown): ErrorResponse;
|
|
2643
|
+
throw(): void;
|
|
2644
|
+
}
|
|
2645
|
+
|
|
2646
|
+
declare class Celitech {
|
|
2647
|
+
config: SdkConfig;
|
|
2648
|
+
readonly destinations: DestinationsService;
|
|
2649
|
+
readonly packages: PackagesService;
|
|
2650
|
+
readonly purchases: PurchasesService;
|
|
2651
|
+
readonly eSim: ESimService;
|
|
2652
|
+
readonly iFrame: IFrameService;
|
|
2653
|
+
protected tokenManager: OAuthTokenManager;
|
|
2654
|
+
constructor(config: SdkConfig);
|
|
2655
|
+
set baseUrl(baseUrl: string);
|
|
2656
|
+
set environment(environment: Environment);
|
|
2657
|
+
set timeoutMs(timeoutMs: number);
|
|
2658
|
+
set clientId(clientId: string);
|
|
2659
|
+
set clientSecret(clientSecret: string);
|
|
2660
|
+
set oAuthBaseUrl(oAuthBaseUrl: string);
|
|
2661
|
+
set accessToken(accessToken: string);
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
export { Celitech, CreatePurchaseOkResponse, CreatePurchaseOkResponseProfile, CreatePurchaseOkResponsePurchase, CreatePurchaseRequest, CreatePurchaseRequestLanguage, CreatePurchaseV2OkResponse, CreatePurchaseV2OkResponseProfile, CreatePurchaseV2OkResponsePurchase, CreatePurchaseV2Request, CreatePurchaseV2RequestLanguage, Destinations, DestinationsService, Device, ESimService, EditPurchaseOkResponse, EditPurchaseRequest, Environment, ErrorResponse, GetEsimDeviceOkResponse, GetEsimHistoryOkResponse, GetEsimHistoryOkResponseEsim, GetEsimOkResponse, GetEsimOkResponseEsim, GetPurchaseConsumptionOkResponse, GrantType, History, HttpError, HttpMetadata, HttpMethod, HttpResponse, IFrameService, ListDestinationsOkResponse, ListPackagesOkResponse, ListPurchasesOkResponse, OAuthService, OAuthTokenRequest, OAuthTokenResponse, Package_, Packages, PackagesService, Purchases, PurchasesEsim, PurchasesService, RetryOptions, SdkConfig, SuspendEsimOkResponse, TokenOkResponse, TopUpEsimOkResponse, TopUpEsimOkResponseProfile, TopUpEsimOkResponsePurchase, TopUpEsimRequest, ValidationOptions };
|