celitech-sdk 1.3.59 → 1.3.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -230,7 +230,7 @@ var TransportHookAdapter = class {
230
230
  hookParamsToTransportParams(hookParams, originalTransportParams, encode) {
231
231
  const transportParams = /* @__PURE__ */ new Map();
232
232
  hookParams.forEach((hookParamValue, hookParamKey) => {
233
- var _a, _b, _c, _d;
233
+ var _a, _b, _c, _d, _e;
234
234
  const requestParam = originalTransportParams.get(hookParamKey);
235
235
  transportParams.set(hookParamKey, {
236
236
  key: hookParamKey,
@@ -239,7 +239,8 @@ var TransportHookAdapter = class {
239
239
  style: (requestParam == null ? void 0 : requestParam.style) || "none" /* NONE */,
240
240
  explode: (_b = requestParam == null ? void 0 : requestParam.explode) != null ? _b : false,
241
241
  isLimit: (_c = requestParam == null ? void 0 : requestParam.isLimit) != null ? _c : false,
242
- isOffset: (_d = requestParam == null ? void 0 : requestParam.isOffset) != null ? _d : false
242
+ isOffset: (_d = requestParam == null ? void 0 : requestParam.isOffset) != null ? _d : false,
243
+ isCursor: (_e = requestParam == null ? void 0 : requestParam.isCursor) != null ? _e : false
243
244
  });
244
245
  });
245
246
  return transportParams;
@@ -258,19 +259,28 @@ function getContentTypeDefinition(contentType) {
258
259
  if (ct === "text/event-stream") {
259
260
  return "eventStream" /* EventStream */;
260
261
  }
262
+ if (ct === "application/json" || ct === "text/json" || ct.includes("+json")) {
263
+ return "json" /* Json */;
264
+ }
265
+ if (ct === "application/javascript") {
266
+ return "text" /* Text */;
267
+ }
261
268
  if (ct.startsWith("text/")) {
262
269
  return "text" /* Text */;
263
270
  }
271
+ if (ct === "image/svg+xml") {
272
+ return "text" /* Text */;
273
+ }
264
274
  if (ct.startsWith("image/")) {
265
275
  return "image" /* Image */;
266
276
  }
267
277
  if (ct === "application/octet-stream" || ct === "application/pdf") {
268
278
  return "binary" /* Binary */;
269
279
  }
270
- if (ct === "application/json") {
271
- return "json" /* Json */;
280
+ if (ct === "*/*") {
281
+ return "binary" /* Binary */;
272
282
  }
273
- return "json" /* Json */;
283
+ return "binary" /* Binary */;
274
284
  }
275
285
 
276
286
  // src/http/handlers/hook-handler.ts
@@ -290,6 +300,7 @@ var HookHandler = class {
290
300
  if (response.metadata.status < 400) {
291
301
  return await hook.afterResponse(nextRequest, response, hookParams);
292
302
  }
303
+ const arrayBuffer = response.raw;
293
304
  const rawContentType = ((_a = response.metadata.headers["content-type"]) == null ? void 0 : _a.toLocaleLowerCase()) || "";
294
305
  const contentType = getContentTypeDefinition(rawContentType);
295
306
  const statusCode = response.metadata.status;
@@ -297,14 +308,14 @@ var HookHandler = class {
297
308
  return error2.contentType === contentType && error2.status === statusCode;
298
309
  });
299
310
  if (error) {
300
- const decodedBody2 = new TextDecoder().decode(response.raw);
311
+ const decodedBody2 = new TextDecoder().decode(arrayBuffer);
301
312
  const json = JSON.parse(decodedBody2);
302
313
  new error.error((json == null ? void 0 : json.message) || "", json).throw();
303
314
  }
304
- const decodedBody = new TextDecoder().decode(response.raw);
315
+ const decodedBody = new TextDecoder().decode(arrayBuffer);
305
316
  throw new HttpError(
306
317
  response.metadata,
307
- response.raw,
318
+ arrayBuffer,
308
319
  `Unexpected response body for error status.
309
320
  StatusCode: ${response.metadata.status}
310
321
  Body: ${decodedBody}`
@@ -373,7 +384,8 @@ var ResponseValidationHandler = class {
373
384
  }
374
385
  }
375
386
  splitByDataChunks(response) {
376
- if (!response.metadata.headers["content-type"].includes("text/event-stream")) {
387
+ var _a;
388
+ if (!((_a = response.metadata.headers["content-type"]) == null ? void 0 : _a.includes("text/event-stream"))) {
377
389
  return [response];
378
390
  }
379
391
  const text = new TextDecoder().decode(response.raw);
@@ -799,7 +811,7 @@ var RetryHandler = class {
799
811
  throw new Error("Error retrying request.");
800
812
  }
801
813
  shouldRetry(error) {
802
- return error instanceof HttpError && (error.metadata.status >= 500 || error.metadata.status === 408);
814
+ return error instanceof HttpError && (error.metadata.status >= 500 || error.metadata.status === 408 || error.metadata.status === 429);
803
815
  }
804
816
  delay(delayMs) {
805
817
  if (!delayMs) {
@@ -811,6 +823,11 @@ var RetryHandler = class {
811
823
  }
812
824
  };
813
825
 
826
+ // src/http/transport/types.ts
827
+ function isRequestCursorPagination(pagination) {
828
+ return !!pagination && "cursorPath" in pagination;
829
+ }
830
+
814
831
  // src/http/handlers/oauth-handler.ts
815
832
  var OAuthHandler = class {
816
833
  async handle(request) {
@@ -851,7 +868,8 @@ var OAuthHandler = class {
851
868
  encode: false,
852
869
  style: "simple" /* SIMPLE */,
853
870
  isLimit: false,
854
- isOffset: false
871
+ isOffset: false,
872
+ isCursor: false
855
873
  });
856
874
  }
857
875
  };
@@ -879,9 +897,23 @@ var HttpClient = class {
879
897
  if (!response.data) {
880
898
  throw new Error("no response data to paginate through");
881
899
  }
900
+ const page = this.getPage(request, response.data);
882
901
  return {
883
902
  ...response,
884
- data: this.getPage(request, response.data)
903
+ data: page
904
+ };
905
+ }
906
+ async callCursorPaginated(request) {
907
+ const response = await this.call(request);
908
+ if (!response.data) {
909
+ throw new Error("no response data to paginate through");
910
+ }
911
+ const page = this.getPage(request, response.data);
912
+ const nextCursor = this.getNextCursor(request, response.data);
913
+ return {
914
+ ...response,
915
+ data: page,
916
+ nextCursor
885
917
  };
886
918
  }
887
919
  setBaseUrl(url) {
@@ -891,22 +923,36 @@ var HttpClient = class {
891
923
  this.config = config;
892
924
  }
893
925
  getPage(request, data) {
894
- var _a, _b, _c, _d;
926
+ var _a;
895
927
  if (!request.pagination) {
896
928
  throw new Error("getPage called for request without pagination property");
897
929
  }
898
930
  let curr = data;
899
- for (const segment of ((_a = request.pagination) == null ? void 0 : _a.pagePath) || []) {
931
+ for (const segment of request.pagination.pagePath || []) {
900
932
  curr = curr[segment];
901
933
  }
902
- const page = (_c = (_b = request.pagination) == null ? void 0 : _b.pageSchema) == null ? void 0 : _c.parse(curr);
934
+ const page = (_a = request.pagination.pageSchema) == null ? void 0 : _a.parse(curr);
903
935
  if (!page) {
904
936
  throw new Error(
905
- `error getting page data. Curr: ${JSON.stringify(curr)}. PagePath: ${(_d = request.pagination) == null ? void 0 : _d.pagePath}. Data: ${JSON.stringify(data)}`
937
+ `error getting page data. Curr: ${JSON.stringify(curr)}. PagePath: ${request.pagination.pagePath}. Data: ${JSON.stringify(data)}`
906
938
  );
907
939
  }
908
940
  return page;
909
941
  }
942
+ getNextCursor(request, data) {
943
+ var _a, _b;
944
+ if (!isRequestCursorPagination(request.pagination)) {
945
+ return void 0;
946
+ }
947
+ let curr = data;
948
+ for (const segment of request.pagination.cursorPath) {
949
+ if (curr === null || curr === void 0) {
950
+ return null;
951
+ }
952
+ curr = curr[segment];
953
+ }
954
+ return (_b = (_a = request.pagination.cursorSchema) == null ? void 0 : _a.parse(curr)) != null ? _b : null;
955
+ }
910
956
  };
911
957
 
912
958
  // src/services/base-service.ts
@@ -961,6 +1007,9 @@ var QuerySerializer = class extends Serializer {
961
1007
  }
962
1008
  const query = [];
963
1009
  queryParams.forEach((param) => {
1010
+ if (param.value === void 0) {
1011
+ return;
1012
+ }
964
1013
  return query.push(`${this.serializeValue(param)}`);
965
1014
  });
966
1015
  return query.length ? `?${query.join("&")}` : "";
@@ -1110,15 +1159,24 @@ var Request = class {
1110
1159
  }
1111
1160
  return new HeaderSerializer().serialize(this.headers);
1112
1161
  }
1113
- nextPage() {
1162
+ nextPage(cursor) {
1114
1163
  if (!this.pagination) {
1115
1164
  return;
1116
1165
  }
1117
- const offsetParam = this.getOffsetParam();
1118
- if (!offsetParam) {
1166
+ if (isRequestCursorPagination(this.pagination)) {
1167
+ const cursorParam = this.getCursorParam();
1168
+ if (cursorParam && cursor !== void 0) {
1169
+ cursorParam.value = cursor;
1170
+ }
1119
1171
  return;
1120
1172
  }
1121
- offsetParam.value = Number(offsetParam.value) + this.pagination.pageSize;
1173
+ const offsetParam = this.getOffsetParam();
1174
+ if (offsetParam) {
1175
+ if (this.pagination.pageSize === void 0) {
1176
+ throw new Error("pageSize is required for limit-offset pagination");
1177
+ }
1178
+ offsetParam.value = Number(offsetParam.value) + this.pagination.pageSize;
1179
+ }
1122
1180
  }
1123
1181
  constructPath() {
1124
1182
  return new PathSerializer().serialize(this.pathPattern, this.pathParams);
@@ -1127,6 +1185,10 @@ var Request = class {
1127
1185
  const offsetParam = this.getAllParams().find((param) => param.isOffset);
1128
1186
  return offsetParam;
1129
1187
  }
1188
+ getCursorParam() {
1189
+ const cursorParam = this.getAllParams().find((param) => param.isCursor);
1190
+ return cursorParam;
1191
+ }
1130
1192
  getAllParams() {
1131
1193
  const allParams = [];
1132
1194
  this.headers.forEach((val, _) => {
@@ -1242,6 +1304,10 @@ var RequestBuilder = class {
1242
1304
  this.params.pagination = pagination;
1243
1305
  return this;
1244
1306
  }
1307
+ setCursorPagination(pagination) {
1308
+ this.params.pagination = pagination;
1309
+ return this;
1310
+ }
1245
1311
  setScopes(scopes) {
1246
1312
  this.params.scopes = new Set(scopes);
1247
1313
  return this;
@@ -1261,7 +1327,8 @@ var RequestBuilder = class {
1261
1327
  style: "simple" /* SIMPLE */,
1262
1328
  encode: true,
1263
1329
  isLimit: false,
1264
- isOffset: false
1330
+ isOffset: false,
1331
+ isCursor: false
1265
1332
  });
1266
1333
  return this;
1267
1334
  }
@@ -1276,7 +1343,8 @@ var RequestBuilder = class {
1276
1343
  style: "simple" /* SIMPLE */,
1277
1344
  encode: true,
1278
1345
  isLimit: false,
1279
- isOffset: false
1346
+ isOffset: false,
1347
+ isCursor: false
1280
1348
  });
1281
1349
  return this;
1282
1350
  }
@@ -1291,7 +1359,8 @@ var RequestBuilder = class {
1291
1359
  style: "simple" /* SIMPLE */,
1292
1360
  encode: true,
1293
1361
  isLimit: false,
1294
- isOffset: false
1362
+ isOffset: false,
1363
+ isCursor: false
1295
1364
  });
1296
1365
  return this;
1297
1366
  }
@@ -1321,13 +1390,14 @@ var RequestBuilder = class {
1321
1390
  style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
1322
1391
  encode: (_c = param.encode) != null ? _c : true,
1323
1392
  isLimit: !!param.isLimit,
1324
- isOffset: !!param.isOffset
1393
+ isOffset: !!param.isOffset,
1394
+ isCursor: !!param.isCursor
1325
1395
  });
1326
1396
  return this;
1327
1397
  }
1328
1398
  addQueryParam(param) {
1329
1399
  var _a, _b, _c;
1330
- if (param.value === void 0 || param.key === void 0) {
1400
+ if (param.key === void 0) {
1331
1401
  return this;
1332
1402
  }
1333
1403
  this.params.queryParams.set(param.key, {
@@ -1337,7 +1407,8 @@ var RequestBuilder = class {
1337
1407
  style: (_b = param.style) != null ? _b : "form" /* FORM */,
1338
1408
  encode: (_c = param.encode) != null ? _c : true,
1339
1409
  isLimit: !!param.isLimit,
1340
- isOffset: !!param.isOffset
1410
+ isOffset: !!param.isOffset,
1411
+ isCursor: !!param.isCursor
1341
1412
  });
1342
1413
  return this;
1343
1414
  }
@@ -1353,7 +1424,8 @@ var RequestBuilder = class {
1353
1424
  style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
1354
1425
  encode: (_c = param.encode) != null ? _c : false,
1355
1426
  isLimit: !!param.isLimit,
1356
- isOffset: !!param.isOffset
1427
+ isOffset: !!param.isOffset,
1428
+ isCursor: !!param.isCursor
1357
1429
  });
1358
1430
  return this;
1359
1431
  }
@@ -1437,8 +1509,8 @@ var getAccessTokenOkResponseRequest = import_zod5.z.lazy(() => {
1437
1509
  var OAuthService = class extends BaseService {
1438
1510
  /**
1439
1511
  * This endpoint was added by liblab
1440
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
1441
- * @returns {Promise<HttpResponse<GetAccessTokenOkResponse>>} Successful Response
1512
+ * @param {RequestConfig} [requestConfig] - The request configuration for retry and validation.
1513
+ * @returns {Promise<HttpResponse<GetAccessTokenOkResponse>>} - Successful Response
1442
1514
  */
1443
1515
  async getAccessToken(body, requestConfig) {
1444
1516
  const request = new RequestBuilder().setBaseUrl((requestConfig == null ? void 0 : requestConfig.baseUrl) || this.config.baseUrl || this.config.environment || "https://api.celitech.net/v1" /* DEFAULT */).setConfig(this.config).setMethod("POST").setPath("/oauth2/token").setRequestSchema(getAccessTokenRequestRequest).setTokenManager(this.tokenManager).setRequestContentType("form" /* FormUrlEncoded */).addResponse({
@@ -1637,8 +1709,8 @@ var Unauthorized = class extends ThrowableError {
1637
1709
  var DestinationsService = class extends BaseService {
1638
1710
  /**
1639
1711
  * List Destinations
1640
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
1641
- * @returns {Promise<HttpResponse<ListDestinationsOkResponse>>} Successful Response
1712
+ * @param {RequestConfig} [requestConfig] - The request configuration for retry and validation.
1713
+ * @returns {Promise<HttpResponse<ListDestinationsOkResponse>>} - Successful Response
1642
1714
  */
1643
1715
  async listDestinations(requestConfig) {
1644
1716
  const request = new RequestBuilder().setBaseUrl((requestConfig == null ? void 0 : requestConfig.baseUrl) || this.config.baseUrl || this.config.environment || "https://api.celitech.net/v1" /* DEFAULT */).setConfig(this.config).setMethod("GET").setPath("/destinations").setRequestSchema(import_zod10.z.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
@@ -1753,9 +1825,8 @@ var PackagesService = class extends BaseService {
1753
1825
  * @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
1754
1826
  * @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
1755
1827
  * @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
1756
- * @param {number} [params.duration] - Duration in seconds for the package's validity. If this parameter is present, it will override the startTime and endTime parameters. The maximum duration for a package's validity period is 90 days
1757
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
1758
- * @returns {Promise<HttpResponse<ListPackagesOkResponse>>} Successful Response
1828
+ * @param {RequestConfig} [requestConfig] - The request configuration for retry and validation.
1829
+ * @returns {Promise<HttpResponse<ListPackagesOkResponse>>} - Successful Response
1759
1830
  */
1760
1831
  async listPackages(params, requestConfig) {
1761
1832
  const request = new RequestBuilder().setBaseUrl((requestConfig == null ? void 0 : requestConfig.baseUrl) || this.config.baseUrl || this.config.environment || "https://api.celitech.net/v1" /* DEFAULT */).setConfig(this.config).setMethod("GET").setPath("/packages").setRequestSchema(import_zod13.z.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
@@ -1791,9 +1862,6 @@ var PackagesService = class extends BaseService {
1791
1862
  }).addQueryParam({
1792
1863
  key: "endTime",
1793
1864
  value: params == null ? void 0 : params.endTime
1794
- }).addQueryParam({
1795
- key: "duration",
1796
- value: params == null ? void 0 : params.duration
1797
1865
  }).build();
1798
1866
  return this.client.call(request);
1799
1867
  }
@@ -1808,8 +1876,9 @@ var createPurchaseV2Request = import_zod14.z.lazy(() => {
1808
1876
  return import_zod14.z.object({
1809
1877
  destination: import_zod14.z.string(),
1810
1878
  dataLimitInGb: import_zod14.z.number(),
1811
- startDate: import_zod14.z.string(),
1812
- endDate: import_zod14.z.string(),
1879
+ startDate: import_zod14.z.string().optional(),
1880
+ endDate: import_zod14.z.string().optional(),
1881
+ duration: import_zod14.z.number().optional(),
1813
1882
  quantity: import_zod14.z.number().gte(1).lte(5),
1814
1883
  email: import_zod14.z.string().optional(),
1815
1884
  referenceId: import_zod14.z.string().optional(),
@@ -1821,8 +1890,9 @@ var createPurchaseV2RequestResponse = import_zod14.z.lazy(() => {
1821
1890
  return import_zod14.z.object({
1822
1891
  destination: import_zod14.z.string(),
1823
1892
  dataLimitInGB: import_zod14.z.number(),
1824
- startDate: import_zod14.z.string(),
1825
- endDate: import_zod14.z.string(),
1893
+ startDate: import_zod14.z.string().optional(),
1894
+ endDate: import_zod14.z.string().optional(),
1895
+ duration: import_zod14.z.number().optional(),
1826
1896
  quantity: import_zod14.z.number().gte(1).lte(5),
1827
1897
  email: import_zod14.z.string().optional(),
1828
1898
  referenceId: import_zod14.z.string().optional(),
@@ -1833,6 +1903,7 @@ var createPurchaseV2RequestResponse = import_zod14.z.lazy(() => {
1833
1903
  dataLimitInGb: data["dataLimitInGB"],
1834
1904
  startDate: data["startDate"],
1835
1905
  endDate: data["endDate"],
1906
+ duration: data["duration"],
1836
1907
  quantity: data["quantity"],
1837
1908
  email: data["email"],
1838
1909
  referenceId: data["referenceId"],
@@ -1844,8 +1915,9 @@ var createPurchaseV2RequestRequest = import_zod14.z.lazy(() => {
1844
1915
  return import_zod14.z.object({
1845
1916
  destination: import_zod14.z.string(),
1846
1917
  dataLimitInGb: import_zod14.z.number(),
1847
- startDate: import_zod14.z.string(),
1848
- endDate: import_zod14.z.string(),
1918
+ startDate: import_zod14.z.string().optional(),
1919
+ endDate: import_zod14.z.string().optional(),
1920
+ duration: import_zod14.z.number().optional(),
1849
1921
  quantity: import_zod14.z.number().gte(1).lte(5),
1850
1922
  email: import_zod14.z.string().optional(),
1851
1923
  referenceId: import_zod14.z.string().optional(),
@@ -1856,6 +1928,7 @@ var createPurchaseV2RequestRequest = import_zod14.z.lazy(() => {
1856
1928
  dataLimitInGB: data["dataLimitInGb"],
1857
1929
  startDate: data["startDate"],
1858
1930
  endDate: data["endDate"],
1931
+ duration: data["duration"],
1859
1932
  quantity: data["quantity"],
1860
1933
  email: data["email"],
1861
1934
  referenceId: data["referenceId"],
@@ -2038,6 +2111,7 @@ var purchases = import_zod20.z.lazy(() => {
2038
2111
  id: import_zod20.z.string(),
2039
2112
  startDate: import_zod20.z.string().nullable(),
2040
2113
  endDate: import_zod20.z.string().nullable(),
2114
+ duration: import_zod20.z.number().optional().nullable(),
2041
2115
  createdDate: import_zod20.z.string(),
2042
2116
  startTime: import_zod20.z.number().optional().nullable(),
2043
2117
  endTime: import_zod20.z.number().optional().nullable(),
@@ -2054,6 +2128,7 @@ var purchasesResponse = import_zod20.z.lazy(() => {
2054
2128
  id: import_zod20.z.string(),
2055
2129
  startDate: import_zod20.z.string().nullable(),
2056
2130
  endDate: import_zod20.z.string().nullable(),
2131
+ duration: import_zod20.z.number().optional().nullable(),
2057
2132
  createdDate: import_zod20.z.string(),
2058
2133
  startTime: import_zod20.z.number().optional().nullable(),
2059
2134
  endTime: import_zod20.z.number().optional().nullable(),
@@ -2067,6 +2142,7 @@ var purchasesResponse = import_zod20.z.lazy(() => {
2067
2142
  id: data["id"],
2068
2143
  startDate: data["startDate"],
2069
2144
  endDate: data["endDate"],
2145
+ duration: data["duration"],
2070
2146
  createdDate: data["createdDate"],
2071
2147
  startTime: data["startTime"],
2072
2148
  endTime: data["endTime"],
@@ -2083,6 +2159,7 @@ var purchasesRequest = import_zod20.z.lazy(() => {
2083
2159
  id: import_zod20.z.string(),
2084
2160
  startDate: import_zod20.z.string().nullable(),
2085
2161
  endDate: import_zod20.z.string().nullable(),
2162
+ duration: import_zod20.z.number().optional().nullable(),
2086
2163
  createdDate: import_zod20.z.string(),
2087
2164
  startTime: import_zod20.z.number().optional().nullable(),
2088
2165
  endTime: import_zod20.z.number().optional().nullable(),
@@ -2096,6 +2173,7 @@ var purchasesRequest = import_zod20.z.lazy(() => {
2096
2173
  id: data["id"],
2097
2174
  startDate: data["startDate"],
2098
2175
  endDate: data["endDate"],
2176
+ duration: data["duration"],
2099
2177
  createdDate: data["createdDate"],
2100
2178
  startTime: data["startTime"],
2101
2179
  endTime: data["endTime"],
@@ -2320,8 +2398,9 @@ var topUpEsimRequest = import_zod26.z.lazy(() => {
2320
2398
  return import_zod26.z.object({
2321
2399
  iccid: import_zod26.z.string().min(18).max(22),
2322
2400
  dataLimitInGb: import_zod26.z.number(),
2323
- startDate: import_zod26.z.string(),
2324
- endDate: import_zod26.z.string(),
2401
+ startDate: import_zod26.z.string().optional(),
2402
+ endDate: import_zod26.z.string().optional(),
2403
+ duration: import_zod26.z.number().optional(),
2325
2404
  email: import_zod26.z.string().optional(),
2326
2405
  referenceId: import_zod26.z.string().optional(),
2327
2406
  emailBrand: import_zod26.z.string().optional(),
@@ -2333,8 +2412,9 @@ var topUpEsimRequestResponse = import_zod26.z.lazy(() => {
2333
2412
  return import_zod26.z.object({
2334
2413
  iccid: import_zod26.z.string().min(18).max(22),
2335
2414
  dataLimitInGB: import_zod26.z.number(),
2336
- startDate: import_zod26.z.string(),
2337
- endDate: import_zod26.z.string(),
2415
+ startDate: import_zod26.z.string().optional(),
2416
+ endDate: import_zod26.z.string().optional(),
2417
+ duration: import_zod26.z.number().optional(),
2338
2418
  email: import_zod26.z.string().optional(),
2339
2419
  referenceId: import_zod26.z.string().optional(),
2340
2420
  emailBrand: import_zod26.z.string().optional(),
@@ -2345,6 +2425,7 @@ var topUpEsimRequestResponse = import_zod26.z.lazy(() => {
2345
2425
  dataLimitInGb: data["dataLimitInGB"],
2346
2426
  startDate: data["startDate"],
2347
2427
  endDate: data["endDate"],
2428
+ duration: data["duration"],
2348
2429
  email: data["email"],
2349
2430
  referenceId: data["referenceId"],
2350
2431
  emailBrand: data["emailBrand"],
@@ -2356,8 +2437,9 @@ var topUpEsimRequestRequest = import_zod26.z.lazy(() => {
2356
2437
  return import_zod26.z.object({
2357
2438
  iccid: import_zod26.z.string().min(18).max(22),
2358
2439
  dataLimitInGb: import_zod26.z.number(),
2359
- startDate: import_zod26.z.string(),
2360
- endDate: import_zod26.z.string(),
2440
+ startDate: import_zod26.z.string().optional(),
2441
+ endDate: import_zod26.z.string().optional(),
2442
+ duration: import_zod26.z.number().optional(),
2361
2443
  email: import_zod26.z.string().optional(),
2362
2444
  referenceId: import_zod26.z.string().optional(),
2363
2445
  emailBrand: import_zod26.z.string().optional(),
@@ -2368,6 +2450,7 @@ var topUpEsimRequestRequest = import_zod26.z.lazy(() => {
2368
2450
  dataLimitInGB: data["dataLimitInGb"],
2369
2451
  startDate: data["startDate"],
2370
2452
  endDate: data["endDate"],
2453
+ duration: data["duration"],
2371
2454
  email: data["email"],
2372
2455
  referenceId: data["referenceId"],
2373
2456
  emailBrand: data["emailBrand"],
@@ -2594,8 +2677,8 @@ var getPurchaseConsumptionOkResponseRequest = import_zod32.z.lazy(() => {
2594
2677
  var PurchasesService = class extends BaseService {
2595
2678
  /**
2596
2679
  * This endpoint is used to purchase a new eSIM by providing the package details.
2597
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2598
- * @returns {Promise<HttpResponse<CreatePurchaseV2OkResponse[]>>} Successful Response
2680
+ * @param {RequestConfig} [requestConfig] - The request configuration for retry and validation.
2681
+ * @returns {Promise<HttpResponse<CreatePurchaseV2OkResponse[]>>} - Successful Response
2599
2682
  */
2600
2683
  async createPurchaseV2(body, requestConfig) {
2601
2684
  const request = new RequestBuilder().setBaseUrl((requestConfig == null ? void 0 : requestConfig.baseUrl) || this.config.baseUrl || this.config.environment || "https://api.celitech.net/v1" /* DEFAULT */).setConfig(this.config).setMethod("POST").setPath("/purchases/v2").setRequestSchema(createPurchaseV2RequestRequest).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
@@ -2615,6 +2698,7 @@ var PurchasesService = class extends BaseService {
2615
2698
  }
2616
2699
  /**
2617
2700
  * This endpoint can be used to list all the successful purchases made between a given interval.
2701
+ * @param {string} [params.purchaseId] - ID of the purchase
2618
2702
  * @param {string} [params.iccid] - ID of the eSIM
2619
2703
  * @param {string} [params.afterDate] - Start date of the interval for filtering purchases in the format 'yyyy-MM-dd'
2620
2704
  * @param {string} [params.beforeDate] - End date of the interval for filtering purchases in the format 'yyyy-MM-dd'
@@ -2624,8 +2708,8 @@ var PurchasesService = class extends BaseService {
2624
2708
  * @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
2625
2709
  * @param {number} [params.after] - Epoch value representing the start of the time interval for filtering purchases
2626
2710
  * @param {number} [params.before] - Epoch value representing the end of the time interval for filtering purchases
2627
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2628
- * @returns {Promise<HttpResponse<ListPurchasesOkResponse>>} Successful Response
2711
+ * @param {RequestConfig} [requestConfig] - The request configuration for retry and validation.
2712
+ * @returns {Promise<HttpResponse<ListPurchasesOkResponse>>} - Successful Response
2629
2713
  */
2630
2714
  async listPurchases(params, requestConfig) {
2631
2715
  const request = new RequestBuilder().setBaseUrl((requestConfig == null ? void 0 : requestConfig.baseUrl) || this.config.baseUrl || this.config.environment || "https://api.celitech.net/v1" /* DEFAULT */).setConfig(this.config).setMethod("GET").setPath("/purchases").setRequestSchema(import_zod33.z.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
@@ -2641,6 +2725,9 @@ var PurchasesService = class extends BaseService {
2641
2725
  contentType: "json" /* Json */,
2642
2726
  status: 401
2643
2727
  }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
2728
+ key: "purchaseId",
2729
+ value: params == null ? void 0 : params.purchaseId
2730
+ }).addQueryParam({
2644
2731
  key: "iccid",
2645
2732
  value: params == null ? void 0 : params.iccid
2646
2733
  }).addQueryParam({
@@ -2672,8 +2759,8 @@ var PurchasesService = class extends BaseService {
2672
2759
  }
2673
2760
  /**
2674
2761
  * This endpoint is used to purchase a new eSIM by providing the package details.
2675
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2676
- * @returns {Promise<HttpResponse<CreatePurchaseOkResponse>>} Successful Response
2762
+ * @param {RequestConfig} [requestConfig] - The request configuration for retry and validation.
2763
+ * @returns {Promise<HttpResponse<CreatePurchaseOkResponse>>} - Successful Response
2677
2764
  */
2678
2765
  async createPurchase(body, requestConfig) {
2679
2766
  const request = new RequestBuilder().setBaseUrl((requestConfig == null ? void 0 : requestConfig.baseUrl) || this.config.baseUrl || this.config.environment || "https://api.celitech.net/v1" /* DEFAULT */).setConfig(this.config).setMethod("POST").setPath("/purchases").setRequestSchema(createPurchaseRequestRequest).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
@@ -2692,9 +2779,9 @@ var PurchasesService = class extends BaseService {
2692
2779
  return this.client.call(request);
2693
2780
  }
2694
2781
  /**
2695
- * 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 Status endpoint, which returns the `isTopUpAllowed` flag.
2696
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2697
- * @returns {Promise<HttpResponse<TopUpEsimOkResponse>>} Successful Response
2782
+ * 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.
2783
+ * @param {RequestConfig} [requestConfig] - The request configuration for retry and validation.
2784
+ * @returns {Promise<HttpResponse<TopUpEsimOkResponse>>} - Successful Response
2698
2785
  */
2699
2786
  async topUpEsim(body, requestConfig) {
2700
2787
  const request = new RequestBuilder().setBaseUrl((requestConfig == null ? void 0 : requestConfig.baseUrl) || this.config.baseUrl || this.config.environment || "https://api.celitech.net/v1" /* DEFAULT */).setConfig(this.config).setMethod("POST").setPath("/purchases/topup").setRequestSchema(topUpEsimRequestRequest).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
@@ -2721,8 +2808,8 @@ var PurchasesService = class extends BaseService {
2721
2808
 
2722
2809
  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.
2723
2810
 
2724
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2725
- * @returns {Promise<HttpResponse<EditPurchaseOkResponse>>} Successful Response
2811
+ * @param {RequestConfig} [requestConfig] - The request configuration for retry and validation.
2812
+ * @returns {Promise<HttpResponse<EditPurchaseOkResponse>>} - Successful Response
2726
2813
  */
2727
2814
  async editPurchase(body, requestConfig) {
2728
2815
  const request = new RequestBuilder().setBaseUrl((requestConfig == null ? void 0 : requestConfig.baseUrl) || this.config.baseUrl || this.config.environment || "https://api.celitech.net/v1" /* DEFAULT */).setConfig(this.config).setMethod("POST").setPath("/purchases/edit").setRequestSchema(editPurchaseRequestRequest).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
@@ -2743,8 +2830,8 @@ var PurchasesService = class extends BaseService {
2743
2830
  /**
2744
2831
  * 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.
2745
2832
  * @param {string} purchaseId - ID of the purchase
2746
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2747
- * @returns {Promise<HttpResponse<GetPurchaseConsumptionOkResponse>>} Successful Response
2833
+ * @param {RequestConfig} [requestConfig] - The request configuration for retry and validation.
2834
+ * @returns {Promise<HttpResponse<GetPurchaseConsumptionOkResponse>>} - Successful Response
2748
2835
  */
2749
2836
  async getPurchaseConsumption(purchaseId, requestConfig) {
2750
2837
  const request = new RequestBuilder().setBaseUrl((requestConfig == null ? void 0 : requestConfig.baseUrl) || this.config.baseUrl || this.config.environment || "https://api.celitech.net/v1" /* DEFAULT */).setConfig(this.config).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(import_zod33.z.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
@@ -2782,6 +2869,7 @@ var getEsimOkResponseEsim = import_zod34.z.lazy(() => {
2782
2869
  activationCode: import_zod34.z.string().min(1e3).max(8e3),
2783
2870
  manualActivationCode: import_zod34.z.string(),
2784
2871
  status: import_zod34.z.string(),
2872
+ connectivityStatus: import_zod34.z.string(),
2785
2873
  isTopUpAllowed: import_zod34.z.boolean()
2786
2874
  });
2787
2875
  });
@@ -2792,6 +2880,7 @@ var getEsimOkResponseEsimResponse = import_zod34.z.lazy(() => {
2792
2880
  activationCode: import_zod34.z.string().min(1e3).max(8e3),
2793
2881
  manualActivationCode: import_zod34.z.string(),
2794
2882
  status: import_zod34.z.string(),
2883
+ connectivityStatus: import_zod34.z.string(),
2795
2884
  isTopUpAllowed: import_zod34.z.boolean()
2796
2885
  }).transform((data) => ({
2797
2886
  iccid: data["iccid"],
@@ -2799,6 +2888,7 @@ var getEsimOkResponseEsimResponse = import_zod34.z.lazy(() => {
2799
2888
  activationCode: data["activationCode"],
2800
2889
  manualActivationCode: data["manualActivationCode"],
2801
2890
  status: data["status"],
2891
+ connectivityStatus: data["connectivityStatus"],
2802
2892
  isTopUpAllowed: data["isTopUpAllowed"]
2803
2893
  }));
2804
2894
  });
@@ -2809,6 +2899,7 @@ var getEsimOkResponseEsimRequest = import_zod34.z.lazy(() => {
2809
2899
  activationCode: import_zod34.z.string().min(1e3).max(8e3),
2810
2900
  manualActivationCode: import_zod34.z.string(),
2811
2901
  status: import_zod34.z.string(),
2902
+ connectivityStatus: import_zod34.z.string(),
2812
2903
  isTopUpAllowed: import_zod34.z.boolean()
2813
2904
  }).transform((data) => ({
2814
2905
  iccid: data["iccid"],
@@ -2816,6 +2907,7 @@ var getEsimOkResponseEsimRequest = import_zod34.z.lazy(() => {
2816
2907
  activationCode: data["activationCode"],
2817
2908
  manualActivationCode: data["manualActivationCode"],
2818
2909
  status: data["status"],
2910
+ connectivityStatus: data["connectivityStatus"],
2819
2911
  isTopUpAllowed: data["isTopUpAllowed"]
2820
2912
  }));
2821
2913
  });
@@ -2991,9 +3083,9 @@ var getEsimHistoryOkResponseRequest = import_zod40.z.lazy(() => {
2991
3083
  var ESimService = class extends BaseService {
2992
3084
  /**
2993
3085
  * Get eSIM
2994
- * @param {string} iccid - ID of the eSIM
2995
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2996
- * @returns {Promise<HttpResponse<GetEsimOkResponse>>} Successful Response
3086
+ * @param {string} params.iccid - ID of the eSIM
3087
+ * @param {RequestConfig} [requestConfig] - The request configuration for retry and validation.
3088
+ * @returns {Promise<HttpResponse<GetEsimOkResponse>>} - Successful Response
2997
3089
  */
2998
3090
  async getEsim(params, requestConfig) {
2999
3091
  const request = new RequestBuilder().setBaseUrl((requestConfig == null ? void 0 : requestConfig.baseUrl) || this.config.baseUrl || this.config.environment || "https://api.celitech.net/v1" /* DEFAULT */).setConfig(this.config).setMethod("GET").setPath("/esim").setRequestSchema(import_zod41.z.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
@@ -3017,8 +3109,8 @@ var ESimService = class extends BaseService {
3017
3109
  /**
3018
3110
  * Get eSIM Device
3019
3111
  * @param {string} iccid - ID of the eSIM
3020
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
3021
- * @returns {Promise<HttpResponse<GetEsimDeviceOkResponse>>} Successful Response
3112
+ * @param {RequestConfig} [requestConfig] - The request configuration for retry and validation.
3113
+ * @returns {Promise<HttpResponse<GetEsimDeviceOkResponse>>} - Successful Response
3022
3114
  */
3023
3115
  async getEsimDevice(iccid, requestConfig) {
3024
3116
  const request = new RequestBuilder().setBaseUrl((requestConfig == null ? void 0 : requestConfig.baseUrl) || this.config.baseUrl || this.config.environment || "https://api.celitech.net/v1" /* DEFAULT */).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(import_zod41.z.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
@@ -3042,8 +3134,8 @@ var ESimService = class extends BaseService {
3042
3134
  /**
3043
3135
  * Get eSIM History
3044
3136
  * @param {string} iccid - ID of the eSIM
3045
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
3046
- * @returns {Promise<HttpResponse<GetEsimHistoryOkResponse>>} Successful Response
3137
+ * @param {RequestConfig} [requestConfig] - The request configuration for retry and validation.
3138
+ * @returns {Promise<HttpResponse<GetEsimHistoryOkResponse>>} - Successful Response
3047
3139
  */
3048
3140
  async getEsimHistory(iccid, requestConfig) {
3049
3141
  const request = new RequestBuilder().setBaseUrl((requestConfig == null ? void 0 : requestConfig.baseUrl) || this.config.baseUrl || this.config.environment || "https://api.celitech.net/v1" /* DEFAULT */).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(import_zod41.z.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
@@ -3095,8 +3187,8 @@ var tokenOkResponseRequest = import_zod42.z.lazy(() => {
3095
3187
  var IFrameService = class extends BaseService {
3096
3188
  /**
3097
3189
  * Generate a new token to be used in the iFrame
3098
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
3099
- * @returns {Promise<HttpResponse<TokenOkResponse>>} Successful Response
3190
+ * @param {RequestConfig} [requestConfig] - The request configuration for retry and validation.
3191
+ * @returns {Promise<HttpResponse<TokenOkResponse>>} - Successful Response
3100
3192
  */
3101
3193
  async token(requestConfig) {
3102
3194
  const request = new RequestBuilder().setBaseUrl((requestConfig == null ? void 0 : requestConfig.baseUrl) || this.config.baseUrl || this.config.environment || "https://api.celitech.net/v1" /* DEFAULT */).setConfig(this.config).setMethod("POST").setPath("/iframe/token").setRequestSchema(import_zod43.z.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({