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/dist/index.d.ts CHANGED
@@ -209,7 +209,7 @@ declare class ThrowableError extends Error {
209
209
  * Used to match and validate responses based on content type and status code.
210
210
  */
211
211
  interface ResponseDefinition {
212
- /** Zod schema for validating the response body */
212
+ /** Schema for validating the response body */
213
213
  schema: ZodType;
214
214
  /** The content type of this response (e.g., 'application/json') */
215
215
  contentType: ContentType;
@@ -289,7 +289,7 @@ interface RequestPagination<Page> {
289
289
  pageSize?: number;
290
290
  /** JSON path to extract page data from response */
291
291
  pagePath: string[];
292
- /** Zod schema for validating page data */
292
+ /** Schema for validating page data */
293
293
  pageSchema?: ZodType<Page, any, any>;
294
294
  }
295
295
  /**
@@ -301,12 +301,12 @@ interface RequestPagination<Page> {
301
301
  interface RequestCursorPagination<Page> {
302
302
  /** JSON path to extract page data from response */
303
303
  pagePath: string[];
304
- /** Zod schema for validating page data */
304
+ /** Schema for validating page data */
305
305
  pageSchema?: ZodType<Page, any, any>;
306
306
  /** JSON path to extract next cursor from response */
307
307
  cursorPath: string[];
308
- /** Zod schema for validating cursor value */
309
- cursorSchema?: ZodType<string | null | undefined>;
308
+ /** Schema for validating cursor value */
309
+ cursorSchema?: ZodType<any, any, any>;
310
310
  }
311
311
 
312
312
  /**
@@ -403,8 +403,11 @@ declare class Request<PageSchema = unknown[]> {
403
403
  * Handles both cursor-based and limit-offset pagination strategies.
404
404
  *
405
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.
406
409
  */
407
- nextPage(cursor?: string): void;
410
+ nextPage(cursor?: string, offsetIncrement?: number): void;
408
411
  private constructPath;
409
412
  private getOffsetParam;
410
413
  private getCursorParam;
@@ -521,6 +524,7 @@ interface RetryOptions {
521
524
  }
522
525
  interface ValidationOptions {
523
526
  responseValidation?: boolean;
527
+ requestValidation?: boolean;
524
528
  }
525
529
 
526
530
  /**
@@ -699,6 +703,7 @@ declare class BaseService {
699
703
  * @returns Merged configuration with all overrides applied
700
704
  */
701
705
  protected getResolvedConfig(methodConfig?: Partial<SdkConfig>, requestConfig?: Partial<SdkConfig>): SdkConfig;
706
+ protected toBase64(str: string): string;
702
707
  set baseUrl(baseUrl: string);
703
708
  set environment(environment: Environment);
704
709
  set timeoutMs(timeoutMs: number);
@@ -1008,7 +1013,7 @@ declare const createPurchaseV2Request: z.ZodLazy<z.ZodObject<{
1008
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.
1009
1014
  * @property {number} quantity - Number of eSIMs to purchase.
1010
1015
  * @property {string} email - Email address where the purchase confirmation email will be sent (including QR Code & activation steps)
1011
- * @property {string} referenceId - An identifier provided by the partner to link this purchase to their booking or transaction for analytics and debugging purposes.
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.
1012
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.
1013
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.
1014
1019
  * @property {CreatePurchaseV2RequestLanguage} language - Language of the confirmation email sent to the customer.
@@ -1087,6 +1092,31 @@ declare const createPurchaseV2OkResponse: z.ZodLazy<z.ZodObject<{
1087
1092
  */
1088
1093
  type CreatePurchaseV2OkResponse = z.infer<typeof createPurchaseV2OkResponse>;
1089
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
+
1090
1120
  /**
1091
1121
  * Zod schema for the ListPurchasesOkResponse model.
1092
1122
  * Defines the structure and validation rules for this data type.
@@ -1249,19 +1279,6 @@ declare const listPurchasesOkResponse: z.ZodLazy<z.ZodObject<{
1249
1279
  */
1250
1280
  type ListPurchasesOkResponse = z.infer<typeof listPurchasesOkResponse>;
1251
1281
 
1252
- interface ListPurchasesParams {
1253
- purchaseId?: string;
1254
- iccid?: string;
1255
- afterDate?: string;
1256
- beforeDate?: string;
1257
- email?: string;
1258
- referenceId?: string;
1259
- afterCursor?: string;
1260
- limit?: number;
1261
- after?: number;
1262
- before?: number;
1263
- }
1264
-
1265
1282
  /**
1266
1283
  * Zod schema for the CreatePurchaseRequest model.
1267
1284
  * Defines the structure and validation rules for this data type.
@@ -1311,7 +1328,7 @@ declare const createPurchaseRequest: z.ZodLazy<z.ZodObject<{
1311
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.
1312
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.
1313
1330
  * @property {string} email - Email address where the purchase confirmation email will be sent (including QR Code & activation steps)
1314
- * @property {string} referenceId - An identifier provided by the partner to link this purchase to their booking or transaction for analytics and debugging purposes.
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.
1315
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.
1316
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.
1317
1334
  * @property {CreatePurchaseRequestLanguage} language - Language of the confirmation email sent to the customer.
@@ -1449,7 +1466,7 @@ declare const topUpEsimRequest: z.ZodLazy<z.ZodObject<{
1449
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.
1450
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.
1451
1468
  * @property {string} email - Email address where the purchase confirmation email will be sent (excluding QR Code & activation steps).
1452
- * @property {string} referenceId - An identifier provided by the partner to link this purchase to their booking or transaction for analytics and debugging purposes.
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.
1453
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.
1454
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.
1455
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.
@@ -1672,10 +1689,11 @@ declare class PurchasesService extends BaseService {
1672
1689
  setGetPurchaseConsumptionConfig(config: Partial<SdkConfig>): this;
1673
1690
  /**
1674
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.
1675
1693
  * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
1676
1694
  * @returns {Promise<HttpResponse<CreatePurchaseV2OkResponse[]>>} - Successful Response
1677
1695
  */
1678
- createPurchaseV2(body: CreatePurchaseV2Request, requestConfig?: Partial<SdkConfig>): Promise<CreatePurchaseV2OkResponse[]>;
1696
+ createPurchaseV2(body: CreatePurchaseV2Request, params?: CreatePurchaseV2Params, requestConfig?: Partial<SdkConfig>): Promise<CreatePurchaseV2OkResponse[]>;
1679
1697
  /**
1680
1698
  * This endpoint can be used to list all the successful purchases made between a given interval.
1681
1699
  * @param {string} [params.purchaseId] - ID of the purchase
@@ -1694,16 +1712,18 @@ declare class PurchasesService extends BaseService {
1694
1712
  listPurchases(params?: ListPurchasesParams, requestConfig?: Partial<SdkConfig>): Promise<ListPurchasesOkResponse>;
1695
1713
  /**
1696
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.
1697
1716
  * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
1698
1717
  * @returns {Promise<HttpResponse<CreatePurchaseOkResponse>>} - Successful Response
1699
1718
  */
1700
- createPurchase(body: CreatePurchaseRequest, requestConfig?: Partial<SdkConfig>): Promise<CreatePurchaseOkResponse>;
1719
+ createPurchase(body: CreatePurchaseRequest, params?: CreatePurchaseParams, requestConfig?: Partial<SdkConfig>): Promise<CreatePurchaseOkResponse>;
1701
1720
  /**
1702
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.
1703
1723
  * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
1704
1724
  * @returns {Promise<HttpResponse<TopUpEsimOkResponse>>} - Successful Response
1705
1725
  */
1706
- topUpEsim(body: TopUpEsimRequest, requestConfig?: Partial<SdkConfig>): Promise<TopUpEsimOkResponse>;
1726
+ topUpEsim(body: TopUpEsimRequest, params?: TopUpEsimParams, requestConfig?: Partial<SdkConfig>): Promise<TopUpEsimOkResponse>;
1707
1727
  /**
1708
1728
  * This endpoint allows you to modify the validity dates of an existing purchase.
1709
1729
  **Behavior:**
@@ -1713,10 +1733,11 @@ declare class PurchasesService extends BaseService {
1713
1733
 
1714
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.
1715
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.
1716
1737
  * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
1717
1738
  * @returns {Promise<HttpResponse<EditPurchaseOkResponse>>} - Successful Response
1718
1739
  */
1719
- editPurchase(body: EditPurchaseRequest, requestConfig?: Partial<SdkConfig>): Promise<EditPurchaseOkResponse>;
1740
+ editPurchase(body: EditPurchaseRequest, params?: EditPurchaseParams, requestConfig?: Partial<SdkConfig>): Promise<EditPurchaseOkResponse>;
1720
1741
  /**
1721
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.
1722
1743
  * @param {string} purchaseId - ID of the purchase
@@ -2167,6 +2188,9 @@ type GetEsimOkResponse = z.infer<typeof getEsimOkResponse>;
2167
2188
  interface GetEsimParams {
2168
2189
  iccid: string;
2169
2190
  }
2191
+ interface SuspendEsimParams {
2192
+ idempotencyKey?: string;
2193
+ }
2170
2194
 
2171
2195
  /**
2172
2196
  * Zod schema for the GetEsimDeviceOkResponse model.
@@ -2272,6 +2296,24 @@ declare const getEsimHistoryOkResponse: z.ZodLazy<z.ZodObject<{
2272
2296
  */
2273
2297
  type GetEsimHistoryOkResponse = z.infer<typeof getEsimHistoryOkResponse>;
2274
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
+
2275
2317
  /**
2276
2318
  * Service class for ESimService operations.
2277
2319
  * Provides methods to interact with ESimService-related API endpoints.
@@ -2281,6 +2323,7 @@ declare class ESimService extends BaseService {
2281
2323
  protected getEsimConfig?: Partial<SdkConfig>;
2282
2324
  protected getEsimDeviceConfig?: Partial<SdkConfig>;
2283
2325
  protected getEsimHistoryConfig?: Partial<SdkConfig>;
2326
+ protected suspendEsimConfig?: Partial<SdkConfig>;
2284
2327
  /**
2285
2328
  * Sets method-level configuration for getEsim.
2286
2329
  * @param config - Partial configuration to override service-level defaults
@@ -2299,6 +2342,12 @@ declare class ESimService extends BaseService {
2299
2342
  * @returns This service instance for method chaining
2300
2343
  */
2301
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;
2302
2351
  /**
2303
2352
  * Get eSIM
2304
2353
  * @param {string} params.iccid - ID of the eSIM
@@ -2320,6 +2369,14 @@ declare class ESimService extends BaseService {
2320
2369
  * @returns {Promise<HttpResponse<GetEsimHistoryOkResponse>>} - Successful Response
2321
2370
  */
2322
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>;
2323
2380
  }
2324
2381
 
2325
2382
  /**
@@ -2578,19 +2635,11 @@ declare enum GrantType {
2578
2635
  CLIENT_CREDENTIALS = "client_credentials"
2579
2636
  }
2580
2637
 
2581
- declare class BadRequest extends ThrowableError {
2582
- message: string;
2583
- protected response?: unknown;
2584
- constructor(message: string, response?: unknown);
2585
- static from(message: string, response?: unknown): BadRequest;
2586
- throw(): void;
2587
- }
2588
-
2589
- declare class Unauthorized extends ThrowableError {
2638
+ declare class ErrorResponse extends ThrowableError {
2590
2639
  message: string;
2591
2640
  protected response?: unknown;
2592
2641
  constructor(message: string, response?: unknown);
2593
- static from(message: string, response?: unknown): Unauthorized;
2642
+ static from(message: string, response?: unknown): ErrorResponse;
2594
2643
  throw(): void;
2595
2644
  }
2596
2645
 
@@ -2612,4 +2661,4 @@ declare class Celitech {
2612
2661
  set accessToken(accessToken: string);
2613
2662
  }
2614
2663
 
2615
- export { BadRequest, Celitech, CreatePurchaseOkResponse, CreatePurchaseOkResponseProfile, CreatePurchaseOkResponsePurchase, CreatePurchaseRequest, CreatePurchaseRequestLanguage, CreatePurchaseV2OkResponse, CreatePurchaseV2OkResponseProfile, CreatePurchaseV2OkResponsePurchase, CreatePurchaseV2Request, CreatePurchaseV2RequestLanguage, Destinations, DestinationsService, Device, ESimService, EditPurchaseOkResponse, EditPurchaseRequest, Environment, 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, TokenOkResponse, TopUpEsimOkResponse, TopUpEsimOkResponseProfile, TopUpEsimOkResponsePurchase, TopUpEsimRequest, Unauthorized, ValidationOptions };
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 };