celitech-sdk 1.3.34 → 1.3.42

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.mjs CHANGED
@@ -202,12 +202,39 @@ var TransportHookAdapter = class {
202
202
  }
203
203
  };
204
204
 
205
+ // src/http/utils/content-type.ts
206
+ function getContentTypeDefinition(contentType) {
207
+ if (contentType.startsWith("application/") && contentType.includes("xml")) {
208
+ return "xml" /* Xml */;
209
+ }
210
+ if (contentType.toLowerCase() === "application/x-www-form-urlencoded") {
211
+ return "form" /* FormUrlEncoded */;
212
+ }
213
+ if (contentType.toLowerCase() === "text/event-stream") {
214
+ return "eventStream" /* EventStream */;
215
+ }
216
+ if (contentType.toLowerCase().startsWith("text/")) {
217
+ return "text" /* Text */;
218
+ }
219
+ if (contentType.toLowerCase().startsWith("image/")) {
220
+ return "image" /* Image */;
221
+ }
222
+ if (contentType.toLowerCase() === "application/octet-stream") {
223
+ return "binary" /* Binary */;
224
+ }
225
+ if (contentType.toLowerCase() === "application/json") {
226
+ return "json" /* Json */;
227
+ }
228
+ return "json" /* Json */;
229
+ }
230
+
205
231
  // src/http/handlers/hook-handler.ts
206
232
  var HookHandler = class {
207
233
  constructor(hook) {
208
234
  this.hook = hook;
209
235
  }
210
236
  async handle(request) {
237
+ var _a;
211
238
  if (!this.next) {
212
239
  throw new Error("No next handler set in hook handler.");
213
240
  }
@@ -218,7 +245,25 @@ var HookHandler = class {
218
245
  if (response.metadata.status < 400) {
219
246
  return await hook.afterResponse(nextRequest, response, hookParams);
220
247
  }
221
- throw await hook.onError(nextRequest, response, hookParams);
248
+ const rawContentType = ((_a = response.metadata.headers["content-type"]) == null ? void 0 : _a.toLocaleLowerCase()) || "";
249
+ const contentType = getContentTypeDefinition(rawContentType);
250
+ const statusCode = response.metadata.status;
251
+ const error = request.errors.find((error2) => {
252
+ return error2.contentType === contentType && error2.status === statusCode;
253
+ });
254
+ if (error == null ? void 0 : error.error) {
255
+ const decodedBody2 = new TextDecoder().decode(response.raw);
256
+ const json = JSON.parse(decodedBody2);
257
+ throw new error.error((json == null ? void 0 : json.message) || "", json);
258
+ }
259
+ const decodedBody = new TextDecoder().decode(response.raw);
260
+ throw new HttpError(
261
+ response.metadata,
262
+ response.raw,
263
+ `Unexpected response body for error status.
264
+ StatusCode: ${response.metadata.status}
265
+ Body: ${decodedBody}`
266
+ );
222
267
  }
223
268
  async *stream(request) {
224
269
  if (!this.next) {
@@ -253,7 +298,7 @@ var ResponseMatcher = class {
253
298
  getResponseDefinition(response) {
254
299
  var _a;
255
300
  const rawContentType = ((_a = response.metadata.headers["content-type"]) == null ? void 0 : _a.toLocaleLowerCase()) || "";
256
- const contentType = this.getContentTypeDefinition(rawContentType);
301
+ const contentType = getContentTypeDefinition(rawContentType);
257
302
  const statusCode = response.metadata.status;
258
303
  if (!this.responses.length) {
259
304
  return;
@@ -265,30 +310,6 @@ var ResponseMatcher = class {
265
310
  return response2.contentType === contentType && response2.status === statusCode;
266
311
  });
267
312
  }
268
- getContentTypeDefinition(contentType) {
269
- if (contentType.startsWith("application/") && contentType.includes("xml")) {
270
- return "xml" /* Xml */;
271
- }
272
- if (contentType.toLowerCase() === "application/x-www-form-urlencoded") {
273
- return "form" /* FormUrlEncoded */;
274
- }
275
- if (contentType.toLowerCase() === "text/event-stream") {
276
- return "eventStream" /* EventStream */;
277
- }
278
- if (contentType.toLowerCase().startsWith("text/")) {
279
- return "text" /* Text */;
280
- }
281
- if (contentType.toLowerCase().startsWith("image/")) {
282
- return "image" /* Image */;
283
- }
284
- if (contentType.toLowerCase() === "application/octet-stream") {
285
- return "binary" /* Binary */;
286
- }
287
- if (contentType.toLowerCase() === "application/json") {
288
- return "json" /* Json */;
289
- }
290
- return "json" /* Json */;
291
- }
292
313
  };
293
314
 
294
315
  // src/http/handlers/response-validation-handler.ts
@@ -428,6 +449,29 @@ var ResponseValidationHandler = class {
428
449
  }
429
450
  };
430
451
 
452
+ // src/http/handlers/request-validation-handler.ts
453
+ import { ZodError } from "zod";
454
+
455
+ // src/http/errors/validation-error.ts
456
+ var ValidationError = class extends Error {
457
+ constructor(zodError, object) {
458
+ let actual;
459
+ try {
460
+ actual = JSON.stringify(object, void 0, 2);
461
+ } catch (err) {
462
+ actual = object;
463
+ }
464
+ const error = [
465
+ `ValidationError:`,
466
+ ...zodError.issues.map((issue) => ` Property: ${issue.path.join(".")}. Message: ${issue.message}`),
467
+ " Validated:",
468
+ ...actual.split("\n").map((line) => ` ${line}`)
469
+ ].join("\n");
470
+ super(error);
471
+ this.error = error;
472
+ }
473
+ };
474
+
431
475
  // src/http/handlers/request-validation-handler.ts
432
476
  var RequestValidationHandler = class {
433
477
  async handle(request) {
@@ -447,8 +491,16 @@ var RequestValidationHandler = class {
447
491
  validateRequest(request) {
448
492
  var _a, _b;
449
493
  if (request.requestContentType === "json" /* Json */) {
450
- request.body = JSON.stringify((_a = request.requestSchema) == null ? void 0 : _a.parse(request.body));
451
- } else if (request.requestContentType === "xml" /* Xml */ || request.requestContentType === "binary" /* Binary */ || request.requestContentType === "text" /* Text */) {
494
+ try {
495
+ const parsedBody = (_a = request.requestSchema) == null ? void 0 : _a.parse(request.body);
496
+ request.body = JSON.stringify(parsedBody);
497
+ } catch (error) {
498
+ if (error instanceof ZodError) {
499
+ throw new ValidationError(error, request.body);
500
+ }
501
+ throw error;
502
+ }
503
+ } else if (request.requestContentType === "xml" /* Xml */ || request.requestContentType === "text" /* Text */ || request.requestContentType === "image" /* Image */ || request.requestContentType === "binary" /* Binary */) {
452
504
  request.body = request.body;
453
505
  } else if (request.requestContentType === "form" /* FormUrlEncoded */) {
454
506
  request.body = this.toFormUrlEncoded(request);
@@ -473,14 +525,18 @@ var RequestValidationHandler = class {
473
525
  if (validatedBody instanceof FormData) {
474
526
  const params = new URLSearchParams();
475
527
  validatedBody.forEach((value, key) => {
476
- params.append(key, value.toString());
528
+ if (value != null) {
529
+ params.append(key, value.toString());
530
+ }
477
531
  });
478
532
  return params.toString();
479
533
  }
480
534
  if (typeof validatedBody === "object" && !Array.isArray(validatedBody)) {
481
535
  const params = new URLSearchParams();
482
536
  for (const [key, value] of Object.entries(validatedBody)) {
483
- params.append(key, `${value}`);
537
+ if (value != null) {
538
+ params.append(key, `${value}`);
539
+ }
484
540
  }
485
541
  return params.toString();
486
542
  }
@@ -705,32 +761,39 @@ var OAuthHandler = class {
705
761
  if (!this.next) {
706
762
  throw new Error(`No next handler set in OAuthHandler`);
707
763
  }
708
- await this.addToken(request);
764
+ if (!!request.config.accessToken) {
765
+ this.addAccessTokenHeader(request, request.config.accessToken);
766
+ return this.next.handle(request);
767
+ }
768
+ await this.manageToken(request);
709
769
  return this.next.handle(request);
710
770
  }
711
771
  async *stream(request) {
712
772
  if (!this.next) {
713
773
  throw new Error(`No next handler set in OAuthHandler`);
714
774
  }
715
- await this.addToken(request);
775
+ await this.manageToken(request);
716
776
  yield* this.next.stream(request);
717
777
  }
718
- async addToken(request) {
778
+ async manageToken(request) {
719
779
  if (!request.scopes) {
720
780
  return;
721
781
  }
722
782
  const token = await request.tokenManager.getToken(request.scopes, request.config);
723
783
  if (token.accessToken) {
724
- request.addHeaderParam("Authorization", {
725
- key: "Authorization",
726
- value: `Bearer ${token.accessToken}`,
727
- explode: false,
728
- encode: false,
729
- style: "simple" /* SIMPLE */,
730
- isLimit: false,
731
- isOffset: false
732
- });
733
- }
784
+ this.addAccessTokenHeader(request, token.accessToken);
785
+ }
786
+ }
787
+ addAccessTokenHeader(request, token) {
788
+ request.addHeaderParam("Authorization", {
789
+ key: "Authorization",
790
+ value: `Bearer ${token}`,
791
+ explode: false,
792
+ encode: false,
793
+ style: "simple" /* SIMPLE */,
794
+ isLimit: false,
795
+ isOffset: false
796
+ });
734
797
  }
735
798
  };
736
799
 
@@ -812,6 +875,9 @@ var BaseService = class {
812
875
  set oAuthBaseUrl(oAuthBaseUrl) {
813
876
  this.config.oAuthBaseUrl = oAuthBaseUrl;
814
877
  }
878
+ set accessToken(accessToken) {
879
+ this.config.accessToken = accessToken;
880
+ }
815
881
  };
816
882
 
817
883
  // src/http/transport/request-builder.ts
@@ -878,6 +944,7 @@ var Request = class {
878
944
  this.headers = params.headers;
879
945
  this.queryParams = params.queryParams;
880
946
  this.responses = params.responses;
947
+ this.errors = params.errors;
881
948
  this.requestSchema = params.requestSchema;
882
949
  this.requestContentType = params.requestContentType;
883
950
  this.retry = params.retry;
@@ -950,21 +1017,22 @@ var Request = class {
950
1017
  return `${baseUrl}${path}${queryString}`;
951
1018
  }
952
1019
  copy(overrides) {
953
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
1020
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
954
1021
  const createRequestParams = {
955
1022
  baseUrl: (_a = overrides == null ? void 0 : overrides.baseUrl) != null ? _a : this.baseUrl,
956
- method: (_b = overrides == null ? void 0 : overrides.method) != null ? _b : this.method,
957
- path: (_c = overrides == null ? void 0 : overrides.path) != null ? _c : this.path,
958
- body: (_d = overrides == null ? void 0 : overrides.body) != null ? _d : this.body,
959
- config: (_e = overrides == null ? void 0 : overrides.config) != null ? _e : this.config,
960
- pathParams: (_f = overrides == null ? void 0 : overrides.pathParams) != null ? _f : this.pathParams,
961
- queryParams: (_g = overrides == null ? void 0 : overrides.queryParams) != null ? _g : this.queryParams,
962
- headers: (_h = overrides == null ? void 0 : overrides.headers) != null ? _h : this.headers,
963
- responses: (_i = overrides == null ? void 0 : overrides.responses) != null ? _i : this.responses,
964
- requestSchema: (_j = overrides == null ? void 0 : overrides.requestSchema) != null ? _j : this.requestSchema,
965
- requestContentType: (_k = overrides == null ? void 0 : overrides.requestContentType) != null ? _k : this.requestContentType,
966
- retry: (_l = overrides == null ? void 0 : overrides.retry) != null ? _l : this.retry,
967
- validation: (_m = overrides == null ? void 0 : overrides.validation) != null ? _m : this.validation,
1023
+ errors: (_b = overrides == null ? void 0 : overrides.errors) != null ? _b : this.errors,
1024
+ method: (_c = overrides == null ? void 0 : overrides.method) != null ? _c : this.method,
1025
+ path: (_d = overrides == null ? void 0 : overrides.path) != null ? _d : this.path,
1026
+ body: (_e = overrides == null ? void 0 : overrides.body) != null ? _e : this.body,
1027
+ config: (_f = overrides == null ? void 0 : overrides.config) != null ? _f : this.config,
1028
+ pathParams: (_g = overrides == null ? void 0 : overrides.pathParams) != null ? _g : this.pathParams,
1029
+ queryParams: (_h = overrides == null ? void 0 : overrides.queryParams) != null ? _h : this.queryParams,
1030
+ headers: (_i = overrides == null ? void 0 : overrides.headers) != null ? _i : this.headers,
1031
+ responses: (_j = overrides == null ? void 0 : overrides.responses) != null ? _j : this.responses,
1032
+ requestSchema: (_k = overrides == null ? void 0 : overrides.requestSchema) != null ? _k : this.requestSchema,
1033
+ requestContentType: (_l = overrides == null ? void 0 : overrides.requestContentType) != null ? _l : this.requestContentType,
1034
+ retry: (_m = overrides == null ? void 0 : overrides.retry) != null ? _m : this.retry,
1035
+ validation: (_n = overrides == null ? void 0 : overrides.validation) != null ? _n : this.validation,
968
1036
  scopes: overrides == null ? void 0 : overrides.scopes,
969
1037
  tokenManager: this.tokenManager
970
1038
  };
@@ -1011,6 +1079,12 @@ var Request = class {
1011
1079
  }
1012
1080
  };
1013
1081
 
1082
+ // src/http/environment.ts
1083
+ var Environment = /* @__PURE__ */ ((Environment2) => {
1084
+ Environment2["DEFAULT"] = "https://api.celitech.net/v1";
1085
+ return Environment2;
1086
+ })(Environment || {});
1087
+
1014
1088
  // src/http/transport/request-builder.ts
1015
1089
  var RequestBuilder = class {
1016
1090
  constructor() {
@@ -1020,6 +1094,7 @@ var RequestBuilder = class {
1020
1094
  path: "",
1021
1095
  config: { clientId: "", clientSecret: "" },
1022
1096
  responses: [],
1097
+ errors: [],
1023
1098
  requestSchema: z.any(),
1024
1099
  requestContentType: "json" /* Json */,
1025
1100
  retry: {
@@ -1062,9 +1137,9 @@ var RequestBuilder = class {
1062
1137
  }
1063
1138
  return this;
1064
1139
  }
1065
- setBaseUrl(sdkConfig) {
1066
- if ((sdkConfig == null ? void 0 : sdkConfig.baseUrl) !== void 0) {
1067
- this.params.baseUrl = sdkConfig.baseUrl;
1140
+ setBaseUrl(baseUrl) {
1141
+ if (baseUrl) {
1142
+ this.params.baseUrl = baseUrl;
1068
1143
  }
1069
1144
  return this;
1070
1145
  }
@@ -1100,10 +1175,59 @@ var RequestBuilder = class {
1100
1175
  this.params.tokenManager = tokenManager;
1101
1176
  return this;
1102
1177
  }
1178
+ addAccessTokenAuth(accessToken, prefix) {
1179
+ if (accessToken === void 0) {
1180
+ return this;
1181
+ }
1182
+ this.params.headers.set("Authorization", {
1183
+ key: "Authorization",
1184
+ value: `${prefix != null ? prefix : "BEARER"} ${accessToken}`,
1185
+ explode: false,
1186
+ style: "simple" /* SIMPLE */,
1187
+ encode: true,
1188
+ isLimit: false,
1189
+ isOffset: false
1190
+ });
1191
+ return this;
1192
+ }
1193
+ addBasicAuth(username, password) {
1194
+ if (username === void 0 || password === void 0) {
1195
+ return this;
1196
+ }
1197
+ this.params.headers.set("Authorization", {
1198
+ key: "Authorization",
1199
+ value: `Basic ${this.toBase64(`${username}:${password}`)}`,
1200
+ explode: false,
1201
+ style: "simple" /* SIMPLE */,
1202
+ encode: true,
1203
+ isLimit: false,
1204
+ isOffset: false
1205
+ });
1206
+ return this;
1207
+ }
1208
+ addApiKeyAuth(apiKey, keyName) {
1209
+ if (apiKey === void 0) {
1210
+ return this;
1211
+ }
1212
+ this.params.headers.set(keyName != null ? keyName : "X-API-KEY", {
1213
+ key: keyName != null ? keyName : "X-API-KEY",
1214
+ value: apiKey,
1215
+ explode: false,
1216
+ style: "simple" /* SIMPLE */,
1217
+ encode: true,
1218
+ isLimit: false,
1219
+ isOffset: false
1220
+ });
1221
+ return this;
1222
+ }
1103
1223
  addResponse(response) {
1104
1224
  this.params.responses.push(response);
1105
1225
  return this;
1106
1226
  }
1227
+ addError(error) {
1228
+ this.params.errors.push(error);
1229
+ return this;
1230
+ }
1107
1231
  addBody(body) {
1108
1232
  if (body !== void 0) {
1109
1233
  this.params.body = body;
@@ -1161,6 +1285,13 @@ var RequestBuilder = class {
1161
1285
  build() {
1162
1286
  return new Request(this.params);
1163
1287
  }
1288
+ toBase64(str) {
1289
+ if (typeof window === "undefined") {
1290
+ return Buffer.from(str, "utf-8").toString("base64");
1291
+ } else {
1292
+ return btoa(unescape(encodeURIComponent(str)));
1293
+ }
1294
+ }
1164
1295
  };
1165
1296
 
1166
1297
  // src/services/o-auth/models/get-access-token-request.ts
@@ -1184,7 +1315,11 @@ var getAccessTokenRequestResponse = z2.lazy(() => {
1184
1315
  }));
1185
1316
  });
1186
1317
  var getAccessTokenRequestRequest = z2.lazy(() => {
1187
- return z2.object({ grantType: z2.string().nullish(), clientId: z2.string().nullish(), clientSecret: z2.string().nullish() }).transform((data) => ({
1318
+ return z2.object({
1319
+ grantType: z2.string().optional(),
1320
+ clientId: z2.string().optional(),
1321
+ clientSecret: z2.string().optional()
1322
+ }).transform((data) => ({
1188
1323
  grant_type: data["grantType"],
1189
1324
  client_id: data["clientId"],
1190
1325
  client_secret: data["clientSecret"]
@@ -1212,21 +1347,26 @@ var getAccessTokenOkResponseResponse = z3.lazy(() => {
1212
1347
  }));
1213
1348
  });
1214
1349
  var getAccessTokenOkResponseRequest = z3.lazy(() => {
1215
- return z3.object({ accessToken: z3.string().nullish(), tokenType: z3.string().nullish(), expiresIn: z3.number().nullish() }).transform((data) => ({
1350
+ return z3.object({
1351
+ accessToken: z3.string().optional(),
1352
+ tokenType: z3.string().optional(),
1353
+ expiresIn: z3.number().optional()
1354
+ }).transform((data) => ({
1216
1355
  access_token: data["accessToken"],
1217
1356
  token_type: data["tokenType"],
1218
1357
  expires_in: data["expiresIn"]
1219
1358
  }));
1220
1359
  });
1221
1360
 
1222
- // src/services/o-auth/o-auth.ts
1361
+ // src/services/o-auth/o-auth-service.ts
1223
1362
  var OAuthService = class extends BaseService {
1224
1363
  /**
1225
1364
  * This endpoint was added by liblab
1365
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
1226
1366
  * @returns {Promise<HttpResponse<GetAccessTokenOkResponse>>} Successful Response
1227
1367
  */
1228
1368
  async getAccessToken(body, requestConfig) {
1229
- const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/oauth2/token").setRequestSchema(getAccessTokenRequestRequest).setTokenManager(this.tokenManager).setRequestContentType("form" /* FormUrlEncoded */).addResponse({
1369
+ 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({
1230
1370
  schema: getAccessTokenOkResponseResponse,
1231
1371
  contentType: "json" /* Json */,
1232
1372
  status: 200
@@ -1267,7 +1407,7 @@ var OAuthTokenManager = class {
1267
1407
  const oAuth = new OAuthService(
1268
1408
  {
1269
1409
  ...config,
1270
- baseUrl: config.oAuthBaseUrl || "https://auth.celitech.net"
1410
+ baseUrl: config.oAuthBaseUrl || config.baseUrl || config.environment || "https://auth.celitech.net"
1271
1411
  },
1272
1412
  this
1273
1413
  );
@@ -1293,8 +1433,8 @@ var OAuthTokenManager = class {
1293
1433
  }
1294
1434
  };
1295
1435
 
1296
- // src/services/destinations/destinations.ts
1297
- import { z as z6 } from "zod";
1436
+ // src/services/destinations/destinations-service.ts
1437
+ import { z as z8 } from "zod";
1298
1438
 
1299
1439
  // src/services/destinations/models/list-destinations-ok-response.ts
1300
1440
  import { z as z5 } from "zod";
@@ -1321,9 +1461,9 @@ var destinationsResponse = z4.lazy(() => {
1321
1461
  });
1322
1462
  var destinationsRequest = z4.lazy(() => {
1323
1463
  return z4.object({
1324
- name: z4.string().nullish(),
1325
- destination: z4.string().nullish(),
1326
- supportedCountries: z4.array(z4.string()).nullish()
1464
+ name: z4.string().optional(),
1465
+ destination: z4.string().optional(),
1466
+ supportedCountries: z4.array(z4.string()).optional()
1327
1467
  }).transform((data) => ({
1328
1468
  name: data["name"],
1329
1469
  destination: data["destination"],
@@ -1345,53 +1485,98 @@ var listDestinationsOkResponseResponse = z5.lazy(() => {
1345
1485
  }));
1346
1486
  });
1347
1487
  var listDestinationsOkResponseRequest = z5.lazy(() => {
1348
- return z5.object({ destinations: z5.array(destinationsRequest).nullish() }).transform((data) => ({
1488
+ return z5.object({
1489
+ destinations: z5.array(destinationsRequest).optional()
1490
+ }).transform((data) => ({
1349
1491
  destinations: data["destinations"]
1350
1492
  }));
1351
1493
  });
1352
1494
 
1353
- // src/services/destinations/destinations.ts
1495
+ // src/services/destinations/models/__.ts
1496
+ import { z as z6 } from "zod";
1497
+ var _response = z6.lazy(() => {
1498
+ return z6.object({
1499
+ message: z6.string().optional()
1500
+ }).transform((data) => ({
1501
+ message: data["message"]
1502
+ }));
1503
+ });
1504
+ var __ = class extends Error {
1505
+ constructor(message, response) {
1506
+ super(message);
1507
+ const parsedResponse = _response.parse(response);
1508
+ this.message = parsedResponse.message || "";
1509
+ }
1510
+ };
1511
+
1512
+ // src/services/destinations/models/_1.ts
1513
+ import { z as z7 } from "zod";
1514
+ var _1Response = z7.lazy(() => {
1515
+ return z7.object({
1516
+ message: z7.string().optional()
1517
+ }).transform((data) => ({
1518
+ message: data["message"]
1519
+ }));
1520
+ });
1521
+ var _1 = class extends Error {
1522
+ constructor(message, response) {
1523
+ super(message);
1524
+ const parsedResponse = _1Response.parse(response);
1525
+ this.message = parsedResponse.message || "";
1526
+ }
1527
+ };
1528
+
1529
+ // src/services/destinations/destinations-service.ts
1354
1530
  var DestinationsService = class extends BaseService {
1355
1531
  /**
1356
1532
  * List Destinations
1533
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
1357
1534
  * @returns {Promise<HttpResponse<ListDestinationsOkResponse>>} Successful Response
1358
1535
  */
1359
1536
  async listDestinations(requestConfig) {
1360
- const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/destinations").setRequestSchema(z6.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
1537
+ 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(z8.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
1361
1538
  schema: listDestinationsOkResponseResponse,
1362
1539
  contentType: "json" /* Json */,
1363
1540
  status: 200
1541
+ }).addError({
1542
+ error: __,
1543
+ contentType: "json" /* Json */,
1544
+ status: 400
1545
+ }).addError({
1546
+ error: _1,
1547
+ contentType: "json" /* Json */,
1548
+ status: 401
1364
1549
  }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).build();
1365
1550
  return this.client.call(request);
1366
1551
  }
1367
1552
  };
1368
1553
 
1369
- // src/services/packages/packages.ts
1370
- import { z as z9 } from "zod";
1554
+ // src/services/packages/packages-service.ts
1555
+ import { z as z13 } from "zod";
1371
1556
 
1372
1557
  // src/services/packages/models/list-packages-ok-response.ts
1373
- import { z as z8 } from "zod";
1558
+ import { z as z10 } from "zod";
1374
1559
 
1375
1560
  // src/services/packages/models/packages.ts
1376
- import { z as z7 } from "zod";
1377
- var packages = z7.lazy(() => {
1378
- return z7.object({
1379
- id: z7.string().optional(),
1380
- destination: z7.string().optional(),
1381
- dataLimitInBytes: z7.number().optional(),
1382
- minDays: z7.number().optional(),
1383
- maxDays: z7.number().optional(),
1384
- priceInCents: z7.number().optional()
1561
+ import { z as z9 } from "zod";
1562
+ var packages = z9.lazy(() => {
1563
+ return z9.object({
1564
+ id: z9.string().optional(),
1565
+ destination: z9.string().optional(),
1566
+ dataLimitInBytes: z9.number().optional(),
1567
+ minDays: z9.number().optional(),
1568
+ maxDays: z9.number().optional(),
1569
+ priceInCents: z9.number().optional()
1385
1570
  });
1386
1571
  });
1387
- var packagesResponse = z7.lazy(() => {
1388
- return z7.object({
1389
- id: z7.string().optional(),
1390
- destination: z7.string().optional(),
1391
- dataLimitInBytes: z7.number().optional(),
1392
- minDays: z7.number().optional(),
1393
- maxDays: z7.number().optional(),
1394
- priceInCents: z7.number().optional()
1572
+ var packagesResponse = z9.lazy(() => {
1573
+ return z9.object({
1574
+ id: z9.string().optional(),
1575
+ destination: z9.string().optional(),
1576
+ dataLimitInBytes: z9.number().optional(),
1577
+ minDays: z9.number().optional(),
1578
+ maxDays: z9.number().optional(),
1579
+ priceInCents: z9.number().optional()
1395
1580
  }).transform((data) => ({
1396
1581
  id: data["id"],
1397
1582
  destination: data["destination"],
@@ -1401,14 +1586,14 @@ var packagesResponse = z7.lazy(() => {
1401
1586
  priceInCents: data["priceInCents"]
1402
1587
  }));
1403
1588
  });
1404
- var packagesRequest = z7.lazy(() => {
1405
- return z7.object({
1406
- id: z7.string().nullish(),
1407
- destination: z7.string().nullish(),
1408
- dataLimitInBytes: z7.number().nullish(),
1409
- minDays: z7.number().nullish(),
1410
- maxDays: z7.number().nullish(),
1411
- priceInCents: z7.number().nullish()
1589
+ var packagesRequest = z9.lazy(() => {
1590
+ return z9.object({
1591
+ id: z9.string().optional(),
1592
+ destination: z9.string().optional(),
1593
+ dataLimitInBytes: z9.number().optional(),
1594
+ minDays: z9.number().optional(),
1595
+ maxDays: z9.number().optional(),
1596
+ priceInCents: z9.number().optional()
1412
1597
  }).transform((data) => ({
1413
1598
  id: data["id"],
1414
1599
  destination: data["destination"],
@@ -1420,47 +1605,93 @@ var packagesRequest = z7.lazy(() => {
1420
1605
  });
1421
1606
 
1422
1607
  // src/services/packages/models/list-packages-ok-response.ts
1423
- var listPackagesOkResponse = z8.lazy(() => {
1424
- return z8.object({
1425
- packages: z8.array(packages).optional(),
1426
- afterCursor: z8.string().optional().nullable()
1608
+ var listPackagesOkResponse = z10.lazy(() => {
1609
+ return z10.object({
1610
+ packages: z10.array(packages).optional(),
1611
+ afterCursor: z10.string().optional().nullable()
1427
1612
  });
1428
1613
  });
1429
- var listPackagesOkResponseResponse = z8.lazy(() => {
1430
- return z8.object({
1431
- packages: z8.array(packagesResponse).optional(),
1432
- afterCursor: z8.string().optional().nullable()
1614
+ var listPackagesOkResponseResponse = z10.lazy(() => {
1615
+ return z10.object({
1616
+ packages: z10.array(packagesResponse).optional(),
1617
+ afterCursor: z10.string().optional().nullable()
1433
1618
  }).transform((data) => ({
1434
1619
  packages: data["packages"],
1435
1620
  afterCursor: data["afterCursor"]
1436
1621
  }));
1437
1622
  });
1438
- var listPackagesOkResponseRequest = z8.lazy(() => {
1439
- return z8.object({ packages: z8.array(packagesRequest).nullish(), afterCursor: z8.string().nullish() }).transform((data) => ({
1623
+ var listPackagesOkResponseRequest = z10.lazy(() => {
1624
+ return z10.object({
1625
+ packages: z10.array(packagesRequest).optional(),
1626
+ afterCursor: z10.string().optional().nullable()
1627
+ }).transform((data) => ({
1440
1628
  packages: data["packages"],
1441
1629
  afterCursor: data["afterCursor"]
1442
1630
  }));
1443
1631
  });
1444
1632
 
1445
- // src/services/packages/packages.ts
1633
+ // src/services/packages/models/_2.ts
1634
+ import { z as z11 } from "zod";
1635
+ var _2Response = z11.lazy(() => {
1636
+ return z11.object({
1637
+ message: z11.string().optional()
1638
+ }).transform((data) => ({
1639
+ message: data["message"]
1640
+ }));
1641
+ });
1642
+ var _2 = class extends Error {
1643
+ constructor(message, response) {
1644
+ super(message);
1645
+ const parsedResponse = _2Response.parse(response);
1646
+ this.message = parsedResponse.message || "";
1647
+ }
1648
+ };
1649
+
1650
+ // src/services/packages/models/_3.ts
1651
+ import { z as z12 } from "zod";
1652
+ var _3Response = z12.lazy(() => {
1653
+ return z12.object({
1654
+ message: z12.string().optional()
1655
+ }).transform((data) => ({
1656
+ message: data["message"]
1657
+ }));
1658
+ });
1659
+ var _3 = class extends Error {
1660
+ constructor(message, response) {
1661
+ super(message);
1662
+ const parsedResponse = _3Response.parse(response);
1663
+ this.message = parsedResponse.message || "";
1664
+ }
1665
+ };
1666
+
1667
+ // src/services/packages/packages-service.ts
1446
1668
  var PackagesService = class extends BaseService {
1447
1669
  /**
1448
1670
  * List Packages
1449
- * @param {string} [destination] - ISO representation of the package's destination.
1450
- * @param {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.
1451
- * @param {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.
1452
- * @param {string} [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.
1453
- * @param {number} [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
1454
- * @param {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
- * @param {number} [endTime] - Epoch value representing the end time of the package's validity. End time can be maximum 90 days after Start time
1456
- * @param {number} [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
1671
+ * @param {string} [params.destination] - ISO representation of the package's destination.
1672
+ * @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.
1673
+ * @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.
1674
+ * @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.
1675
+ * @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
1676
+ * @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
1677
+ * @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
1678
+ * @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
1679
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
1457
1680
  * @returns {Promise<HttpResponse<ListPackagesOkResponse>>} Successful Response
1458
1681
  */
1459
1682
  async listPackages(params, requestConfig) {
1460
- const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/packages").setRequestSchema(z9.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
1683
+ 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(z13.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
1461
1684
  schema: listPackagesOkResponseResponse,
1462
1685
  contentType: "json" /* Json */,
1463
1686
  status: 200
1687
+ }).addError({
1688
+ error: _2,
1689
+ contentType: "json" /* Json */,
1690
+ status: 400
1691
+ }).addError({
1692
+ error: _3,
1693
+ contentType: "json" /* Json */,
1694
+ status: 401
1464
1695
  }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
1465
1696
  key: "destination",
1466
1697
  value: params == null ? void 0 : params.destination
@@ -1490,298 +1721,111 @@ var PackagesService = class extends BaseService {
1490
1721
  }
1491
1722
  };
1492
1723
 
1493
- // src/services/purchases/purchases.ts
1494
- import { z as z25 } from "zod";
1495
-
1496
- // src/services/purchases/models/list-purchases-ok-response.ts
1497
- import { z as z13 } from "zod";
1498
-
1499
- // src/services/purchases/models/purchases.ts
1500
- import { z as z12 } from "zod";
1501
-
1502
- // src/services/purchases/models/package_.ts
1503
- import { z as z10 } from "zod";
1504
- var package_ = z10.lazy(() => {
1505
- return z10.object({
1506
- id: z10.string().optional(),
1507
- dataLimitInBytes: z10.number().optional(),
1508
- destination: z10.string().optional(),
1509
- destinationName: z10.string().optional(),
1510
- priceInCents: z10.number().optional()
1511
- });
1512
- });
1513
- var packageResponse = z10.lazy(() => {
1514
- return z10.object({
1515
- id: z10.string().optional(),
1516
- dataLimitInBytes: z10.number().optional(),
1517
- destination: z10.string().optional(),
1518
- destinationName: z10.string().optional(),
1519
- priceInCents: z10.number().optional()
1520
- }).transform((data) => ({
1521
- id: data["id"],
1522
- dataLimitInBytes: data["dataLimitInBytes"],
1523
- destination: data["destination"],
1524
- destinationName: data["destinationName"],
1525
- priceInCents: data["priceInCents"]
1526
- }));
1527
- });
1528
- var packageRequest = z10.lazy(() => {
1529
- return z10.object({
1530
- id: z10.string().nullish(),
1531
- dataLimitInBytes: z10.number().nullish(),
1532
- destination: z10.string().nullish(),
1533
- destinationName: z10.string().nullish(),
1534
- priceInCents: z10.number().nullish()
1535
- }).transform((data) => ({
1536
- id: data["id"],
1537
- dataLimitInBytes: data["dataLimitInBytes"],
1538
- destination: data["destination"],
1539
- destinationName: data["destinationName"],
1540
- priceInCents: data["priceInCents"]
1541
- }));
1542
- });
1543
-
1544
- // src/services/purchases/models/purchases-esim.ts
1545
- import { z as z11 } from "zod";
1546
- var purchasesEsim = z11.lazy(() => {
1547
- return z11.object({
1548
- iccid: z11.string().min(18).max(22).optional()
1549
- });
1550
- });
1551
- var purchasesEsimResponse = z11.lazy(() => {
1552
- return z11.object({
1553
- iccid: z11.string().min(18).max(22).optional()
1554
- }).transform((data) => ({
1555
- iccid: data["iccid"]
1556
- }));
1557
- });
1558
- var purchasesEsimRequest = z11.lazy(() => {
1559
- return z11.object({ iccid: z11.string().nullish() }).transform((data) => ({
1560
- iccid: data["iccid"]
1561
- }));
1562
- });
1563
-
1564
- // src/services/purchases/models/purchases.ts
1565
- var purchases = z12.lazy(() => {
1566
- return z12.object({
1567
- id: z12.string().optional(),
1568
- startDate: z12.string().optional(),
1569
- endDate: z12.string().optional(),
1570
- createdDate: z12.string().optional(),
1571
- startTime: z12.number().optional(),
1572
- endTime: z12.number().optional(),
1573
- createdAt: z12.number().optional(),
1574
- package: package_.optional(),
1575
- esim: purchasesEsim.optional(),
1576
- source: z12.string().optional(),
1577
- referenceId: z12.string().optional()
1578
- });
1579
- });
1580
- var purchasesResponse = z12.lazy(() => {
1581
- return z12.object({
1582
- id: z12.string().optional(),
1583
- startDate: z12.string().optional(),
1584
- endDate: z12.string().optional(),
1585
- createdDate: z12.string().optional(),
1586
- startTime: z12.number().optional(),
1587
- endTime: z12.number().optional(),
1588
- createdAt: z12.number().optional(),
1589
- package: packageResponse.optional(),
1590
- esim: purchasesEsimResponse.optional(),
1591
- source: z12.string().optional(),
1592
- referenceId: z12.string().optional()
1593
- }).transform((data) => ({
1594
- id: data["id"],
1595
- startDate: data["startDate"],
1596
- endDate: data["endDate"],
1597
- createdDate: data["createdDate"],
1598
- startTime: data["startTime"],
1599
- endTime: data["endTime"],
1600
- createdAt: data["createdAt"],
1601
- package: data["package"],
1602
- esim: data["esim"],
1603
- source: data["source"],
1604
- referenceId: data["referenceId"]
1605
- }));
1606
- });
1607
- var purchasesRequest = z12.lazy(() => {
1608
- return z12.object({
1609
- id: z12.string().nullish(),
1610
- startDate: z12.string().nullish(),
1611
- endDate: z12.string().nullish(),
1612
- createdDate: z12.string().nullish(),
1613
- startTime: z12.number().nullish(),
1614
- endTime: z12.number().nullish(),
1615
- createdAt: z12.number().nullish(),
1616
- package: packageRequest.nullish(),
1617
- esim: purchasesEsimRequest.nullish(),
1618
- source: z12.string().nullish(),
1619
- referenceId: z12.string().nullish()
1620
- }).transform((data) => ({
1621
- id: data["id"],
1622
- startDate: data["startDate"],
1623
- endDate: data["endDate"],
1624
- createdDate: data["createdDate"],
1625
- startTime: data["startTime"],
1626
- endTime: data["endTime"],
1627
- createdAt: data["createdAt"],
1628
- package: data["package"],
1629
- esim: data["esim"],
1630
- source: data["source"],
1631
- referenceId: data["referenceId"]
1632
- }));
1633
- });
1634
-
1635
- // src/services/purchases/models/list-purchases-ok-response.ts
1636
- var listPurchasesOkResponse = z13.lazy(() => {
1637
- return z13.object({
1638
- purchases: z13.array(purchases).optional(),
1639
- afterCursor: z13.string().optional().nullable()
1640
- });
1641
- });
1642
- var listPurchasesOkResponseResponse = z13.lazy(() => {
1643
- return z13.object({
1644
- purchases: z13.array(purchasesResponse).optional(),
1645
- afterCursor: z13.string().optional().nullable()
1646
- }).transform((data) => ({
1647
- purchases: data["purchases"],
1648
- afterCursor: data["afterCursor"]
1649
- }));
1650
- });
1651
- var listPurchasesOkResponseRequest = z13.lazy(() => {
1652
- return z13.object({ purchases: z13.array(purchasesRequest).nullish(), afterCursor: z13.string().nullish() }).transform((data) => ({
1653
- purchases: data["purchases"],
1654
- afterCursor: data["afterCursor"]
1655
- }));
1656
- });
1724
+ // src/services/purchases/purchases-service.ts
1725
+ import { z as z45 } from "zod";
1657
1726
 
1658
- // src/services/purchases/models/create-purchase-request.ts
1727
+ // src/services/purchases/models/create-purchase-v2-request.ts
1659
1728
  import { z as z14 } from "zod";
1660
- var createPurchaseRequest = z14.lazy(() => {
1729
+ var createPurchaseV2Request = z14.lazy(() => {
1661
1730
  return z14.object({
1662
1731
  destination: z14.string(),
1663
1732
  dataLimitInGb: z14.number(),
1664
1733
  startDate: z14.string(),
1665
1734
  endDate: z14.string(),
1735
+ quantity: z14.number().gte(1).lte(5),
1666
1736
  email: z14.string().optional(),
1667
1737
  referenceId: z14.string().optional(),
1668
- networkBrand: z14.string().optional(),
1669
- startTime: z14.number().optional(),
1670
- endTime: z14.number().optional()
1738
+ networkBrand: z14.string().optional()
1671
1739
  });
1672
1740
  });
1673
- var createPurchaseRequestResponse = z14.lazy(() => {
1741
+ var createPurchaseV2RequestResponse = z14.lazy(() => {
1674
1742
  return z14.object({
1675
1743
  destination: z14.string(),
1676
1744
  dataLimitInGB: z14.number(),
1677
1745
  startDate: z14.string(),
1678
1746
  endDate: z14.string(),
1747
+ quantity: z14.number().gte(1).lte(5),
1679
1748
  email: z14.string().optional(),
1680
1749
  referenceId: z14.string().optional(),
1681
- networkBrand: z14.string().optional(),
1682
- startTime: z14.number().optional(),
1683
- endTime: z14.number().optional()
1750
+ networkBrand: z14.string().optional()
1684
1751
  }).transform((data) => ({
1685
1752
  destination: data["destination"],
1686
1753
  dataLimitInGb: data["dataLimitInGB"],
1687
1754
  startDate: data["startDate"],
1688
1755
  endDate: data["endDate"],
1756
+ quantity: data["quantity"],
1689
1757
  email: data["email"],
1690
1758
  referenceId: data["referenceId"],
1691
- networkBrand: data["networkBrand"],
1692
- startTime: data["startTime"],
1693
- endTime: data["endTime"]
1759
+ networkBrand: data["networkBrand"]
1694
1760
  }));
1695
1761
  });
1696
- var createPurchaseRequestRequest = z14.lazy(() => {
1762
+ var createPurchaseV2RequestRequest = z14.lazy(() => {
1697
1763
  return z14.object({
1698
- destination: z14.string().nullish(),
1699
- dataLimitInGb: z14.number().nullish(),
1700
- startDate: z14.string().nullish(),
1701
- endDate: z14.string().nullish(),
1702
- email: z14.string().nullish(),
1703
- referenceId: z14.string().nullish(),
1704
- networkBrand: z14.string().nullish(),
1705
- startTime: z14.number().nullish(),
1706
- endTime: z14.number().nullish()
1764
+ destination: z14.string(),
1765
+ dataLimitInGb: z14.number(),
1766
+ startDate: z14.string(),
1767
+ endDate: z14.string(),
1768
+ quantity: z14.number().gte(1).lte(5),
1769
+ email: z14.string().optional(),
1770
+ referenceId: z14.string().optional(),
1771
+ networkBrand: z14.string().optional()
1707
1772
  }).transform((data) => ({
1708
1773
  destination: data["destination"],
1709
1774
  dataLimitInGB: data["dataLimitInGb"],
1710
1775
  startDate: data["startDate"],
1711
1776
  endDate: data["endDate"],
1777
+ quantity: data["quantity"],
1712
1778
  email: data["email"],
1713
1779
  referenceId: data["referenceId"],
1714
- networkBrand: data["networkBrand"],
1715
- startTime: data["startTime"],
1716
- endTime: data["endTime"]
1780
+ networkBrand: data["networkBrand"]
1717
1781
  }));
1718
1782
  });
1719
1783
 
1720
- // src/services/purchases/models/create-purchase-ok-response.ts
1784
+ // src/services/purchases/models/create-purchase-v2-ok-response.ts
1721
1785
  import { z as z17 } from "zod";
1722
1786
 
1723
- // src/services/purchases/models/create-purchase-ok-response-purchase.ts
1787
+ // src/services/purchases/models/create-purchase-v2-ok-response-purchase.ts
1724
1788
  import { z as z15 } from "zod";
1725
- var createPurchaseOkResponsePurchase = z15.lazy(() => {
1789
+ var createPurchaseV2OkResponsePurchase = z15.lazy(() => {
1726
1790
  return z15.object({
1727
1791
  id: z15.string().optional(),
1728
1792
  packageId: z15.string().optional(),
1729
- startDate: z15.string().optional(),
1730
- endDate: z15.string().optional(),
1731
- createdDate: z15.string().optional(),
1732
- startTime: z15.number().optional(),
1733
- endTime: z15.number().optional()
1793
+ createdDate: z15.string().optional()
1734
1794
  });
1735
1795
  });
1736
- var createPurchaseOkResponsePurchaseResponse = z15.lazy(() => {
1796
+ var createPurchaseV2OkResponsePurchaseResponse = z15.lazy(() => {
1737
1797
  return z15.object({
1738
1798
  id: z15.string().optional(),
1739
1799
  packageId: z15.string().optional(),
1740
- startDate: z15.string().optional(),
1741
- endDate: z15.string().optional(),
1742
- createdDate: z15.string().optional(),
1743
- startTime: z15.number().optional(),
1744
- endTime: z15.number().optional()
1800
+ createdDate: z15.string().optional()
1745
1801
  }).transform((data) => ({
1746
1802
  id: data["id"],
1747
1803
  packageId: data["packageId"],
1748
- startDate: data["startDate"],
1749
- endDate: data["endDate"],
1750
- createdDate: data["createdDate"],
1751
- startTime: data["startTime"],
1752
- endTime: data["endTime"]
1804
+ createdDate: data["createdDate"]
1753
1805
  }));
1754
1806
  });
1755
- var createPurchaseOkResponsePurchaseRequest = z15.lazy(() => {
1807
+ var createPurchaseV2OkResponsePurchaseRequest = z15.lazy(() => {
1756
1808
  return z15.object({
1757
- id: z15.string().nullish(),
1758
- packageId: z15.string().nullish(),
1759
- startDate: z15.string().nullish(),
1760
- endDate: z15.string().nullish(),
1761
- createdDate: z15.string().nullish(),
1762
- startTime: z15.number().nullish(),
1763
- endTime: z15.number().nullish()
1809
+ id: z15.string().optional(),
1810
+ packageId: z15.string().optional(),
1811
+ createdDate: z15.string().optional()
1764
1812
  }).transform((data) => ({
1765
1813
  id: data["id"],
1766
1814
  packageId: data["packageId"],
1767
- startDate: data["startDate"],
1768
- endDate: data["endDate"],
1769
- createdDate: data["createdDate"],
1770
- startTime: data["startTime"],
1771
- endTime: data["endTime"]
1815
+ createdDate: data["createdDate"]
1772
1816
  }));
1773
1817
  });
1774
1818
 
1775
- // src/services/purchases/models/create-purchase-ok-response-profile.ts
1819
+ // src/services/purchases/models/create-purchase-v2-ok-response-profile.ts
1776
1820
  import { z as z16 } from "zod";
1777
- var createPurchaseOkResponseProfile = z16.lazy(() => {
1821
+ var createPurchaseV2OkResponseProfile = z16.lazy(() => {
1778
1822
  return z16.object({
1779
1823
  iccid: z16.string().min(18).max(22).optional(),
1780
1824
  activationCode: z16.string().min(1e3).max(8e3).optional(),
1781
1825
  manualActivationCode: z16.string().optional()
1782
1826
  });
1783
1827
  });
1784
- var createPurchaseOkResponseProfileResponse = z16.lazy(() => {
1828
+ var createPurchaseV2OkResponseProfileResponse = z16.lazy(() => {
1785
1829
  return z16.object({
1786
1830
  iccid: z16.string().min(18).max(22).optional(),
1787
1831
  activationCode: z16.string().min(1e3).max(8e3).optional(),
@@ -1792,11 +1836,11 @@ var createPurchaseOkResponseProfileResponse = z16.lazy(() => {
1792
1836
  manualActivationCode: data["manualActivationCode"]
1793
1837
  }));
1794
1838
  });
1795
- var createPurchaseOkResponseProfileRequest = z16.lazy(() => {
1839
+ var createPurchaseV2OkResponseProfileRequest = z16.lazy(() => {
1796
1840
  return z16.object({
1797
- iccid: z16.string().nullish(),
1798
- activationCode: z16.string().nullish(),
1799
- manualActivationCode: z16.string().nullish()
1841
+ iccid: z16.string().min(18).max(22).optional(),
1842
+ activationCode: z16.string().min(1e3).max(8e3).optional(),
1843
+ manualActivationCode: z16.string().optional()
1800
1844
  }).transform((data) => ({
1801
1845
  iccid: data["iccid"],
1802
1846
  activationCode: data["activationCode"],
@@ -1804,15 +1848,425 @@ var createPurchaseOkResponseProfileRequest = z16.lazy(() => {
1804
1848
  }));
1805
1849
  });
1806
1850
 
1807
- // src/services/purchases/models/create-purchase-ok-response.ts
1808
- var createPurchaseOkResponse = z17.lazy(() => {
1851
+ // src/services/purchases/models/create-purchase-v2-ok-response.ts
1852
+ var createPurchaseV2OkResponse = z17.lazy(() => {
1809
1853
  return z17.object({
1854
+ purchase: createPurchaseV2OkResponsePurchase.optional(),
1855
+ profile: createPurchaseV2OkResponseProfile.optional()
1856
+ });
1857
+ });
1858
+ var createPurchaseV2OkResponseResponse = z17.lazy(() => {
1859
+ return z17.object({
1860
+ purchase: createPurchaseV2OkResponsePurchaseResponse.optional(),
1861
+ profile: createPurchaseV2OkResponseProfileResponse.optional()
1862
+ }).transform((data) => ({
1863
+ purchase: data["purchase"],
1864
+ profile: data["profile"]
1865
+ }));
1866
+ });
1867
+ var createPurchaseV2OkResponseRequest = z17.lazy(() => {
1868
+ return z17.object({
1869
+ purchase: createPurchaseV2OkResponsePurchaseRequest.optional(),
1870
+ profile: createPurchaseV2OkResponseProfileRequest.optional()
1871
+ }).transform((data) => ({
1872
+ purchase: data["purchase"],
1873
+ profile: data["profile"]
1874
+ }));
1875
+ });
1876
+
1877
+ // src/services/purchases/models/_4.ts
1878
+ import { z as z18 } from "zod";
1879
+ var _4Response = z18.lazy(() => {
1880
+ return z18.object({
1881
+ message: z18.string().optional()
1882
+ }).transform((data) => ({
1883
+ message: data["message"]
1884
+ }));
1885
+ });
1886
+ var _4 = class extends Error {
1887
+ constructor(message, response) {
1888
+ super(message);
1889
+ const parsedResponse = _4Response.parse(response);
1890
+ this.message = parsedResponse.message || "";
1891
+ }
1892
+ };
1893
+
1894
+ // src/services/purchases/models/_5.ts
1895
+ import { z as z19 } from "zod";
1896
+ var _5Response = z19.lazy(() => {
1897
+ return z19.object({
1898
+ message: z19.string().optional()
1899
+ }).transform((data) => ({
1900
+ message: data["message"]
1901
+ }));
1902
+ });
1903
+ var _5 = class extends Error {
1904
+ constructor(message, response) {
1905
+ super(message);
1906
+ const parsedResponse = _5Response.parse(response);
1907
+ this.message = parsedResponse.message || "";
1908
+ }
1909
+ };
1910
+
1911
+ // src/services/purchases/models/list-purchases-ok-response.ts
1912
+ import { z as z23 } from "zod";
1913
+
1914
+ // src/services/purchases/models/purchases.ts
1915
+ import { z as z22 } from "zod";
1916
+
1917
+ // src/services/purchases/models/package_.ts
1918
+ import { z as z20 } from "zod";
1919
+ var package_ = z20.lazy(() => {
1920
+ return z20.object({
1921
+ id: z20.string().optional(),
1922
+ dataLimitInBytes: z20.number().optional(),
1923
+ destination: z20.string().optional(),
1924
+ destinationName: z20.string().optional(),
1925
+ priceInCents: z20.number().optional()
1926
+ });
1927
+ });
1928
+ var packageResponse = z20.lazy(() => {
1929
+ return z20.object({
1930
+ id: z20.string().optional(),
1931
+ dataLimitInBytes: z20.number().optional(),
1932
+ destination: z20.string().optional(),
1933
+ destinationName: z20.string().optional(),
1934
+ priceInCents: z20.number().optional()
1935
+ }).transform((data) => ({
1936
+ id: data["id"],
1937
+ dataLimitInBytes: data["dataLimitInBytes"],
1938
+ destination: data["destination"],
1939
+ destinationName: data["destinationName"],
1940
+ priceInCents: data["priceInCents"]
1941
+ }));
1942
+ });
1943
+ var packageRequest = z20.lazy(() => {
1944
+ return z20.object({
1945
+ id: z20.string().optional(),
1946
+ dataLimitInBytes: z20.number().optional(),
1947
+ destination: z20.string().optional(),
1948
+ destinationName: z20.string().optional(),
1949
+ priceInCents: z20.number().optional()
1950
+ }).transform((data) => ({
1951
+ id: data["id"],
1952
+ dataLimitInBytes: data["dataLimitInBytes"],
1953
+ destination: data["destination"],
1954
+ destinationName: data["destinationName"],
1955
+ priceInCents: data["priceInCents"]
1956
+ }));
1957
+ });
1958
+
1959
+ // src/services/purchases/models/purchases-esim.ts
1960
+ import { z as z21 } from "zod";
1961
+ var purchasesEsim = z21.lazy(() => {
1962
+ return z21.object({
1963
+ iccid: z21.string().min(18).max(22).optional()
1964
+ });
1965
+ });
1966
+ var purchasesEsimResponse = z21.lazy(() => {
1967
+ return z21.object({
1968
+ iccid: z21.string().min(18).max(22).optional()
1969
+ }).transform((data) => ({
1970
+ iccid: data["iccid"]
1971
+ }));
1972
+ });
1973
+ var purchasesEsimRequest = z21.lazy(() => {
1974
+ return z21.object({
1975
+ iccid: z21.string().min(18).max(22).optional()
1976
+ }).transform((data) => ({
1977
+ iccid: data["iccid"]
1978
+ }));
1979
+ });
1980
+
1981
+ // src/services/purchases/models/purchases.ts
1982
+ var purchases = z22.lazy(() => {
1983
+ return z22.object({
1984
+ id: z22.string().optional(),
1985
+ startDate: z22.string().optional(),
1986
+ endDate: z22.string().optional(),
1987
+ createdDate: z22.string().optional(),
1988
+ startTime: z22.number().optional(),
1989
+ endTime: z22.number().optional(),
1990
+ createdAt: z22.number().optional(),
1991
+ package: package_.optional(),
1992
+ esim: purchasesEsim.optional(),
1993
+ source: z22.string().optional(),
1994
+ referenceId: z22.string().optional()
1995
+ });
1996
+ });
1997
+ var purchasesResponse = z22.lazy(() => {
1998
+ return z22.object({
1999
+ id: z22.string().optional(),
2000
+ startDate: z22.string().optional(),
2001
+ endDate: z22.string().optional(),
2002
+ createdDate: z22.string().optional(),
2003
+ startTime: z22.number().optional(),
2004
+ endTime: z22.number().optional(),
2005
+ createdAt: z22.number().optional(),
2006
+ package: packageResponse.optional(),
2007
+ esim: purchasesEsimResponse.optional(),
2008
+ source: z22.string().optional(),
2009
+ referenceId: z22.string().optional()
2010
+ }).transform((data) => ({
2011
+ id: data["id"],
2012
+ startDate: data["startDate"],
2013
+ endDate: data["endDate"],
2014
+ createdDate: data["createdDate"],
2015
+ startTime: data["startTime"],
2016
+ endTime: data["endTime"],
2017
+ createdAt: data["createdAt"],
2018
+ package: data["package"],
2019
+ esim: data["esim"],
2020
+ source: data["source"],
2021
+ referenceId: data["referenceId"]
2022
+ }));
2023
+ });
2024
+ var purchasesRequest = z22.lazy(() => {
2025
+ return z22.object({
2026
+ id: z22.string().optional(),
2027
+ startDate: z22.string().optional(),
2028
+ endDate: z22.string().optional(),
2029
+ createdDate: z22.string().optional(),
2030
+ startTime: z22.number().optional(),
2031
+ endTime: z22.number().optional(),
2032
+ createdAt: z22.number().optional(),
2033
+ package: packageRequest.optional(),
2034
+ esim: purchasesEsimRequest.optional(),
2035
+ source: z22.string().optional(),
2036
+ referenceId: z22.string().optional()
2037
+ }).transform((data) => ({
2038
+ id: data["id"],
2039
+ startDate: data["startDate"],
2040
+ endDate: data["endDate"],
2041
+ createdDate: data["createdDate"],
2042
+ startTime: data["startTime"],
2043
+ endTime: data["endTime"],
2044
+ createdAt: data["createdAt"],
2045
+ package: data["package"],
2046
+ esim: data["esim"],
2047
+ source: data["source"],
2048
+ referenceId: data["referenceId"]
2049
+ }));
2050
+ });
2051
+
2052
+ // src/services/purchases/models/list-purchases-ok-response.ts
2053
+ var listPurchasesOkResponse = z23.lazy(() => {
2054
+ return z23.object({
2055
+ purchases: z23.array(purchases).optional(),
2056
+ afterCursor: z23.string().optional().nullable()
2057
+ });
2058
+ });
2059
+ var listPurchasesOkResponseResponse = z23.lazy(() => {
2060
+ return z23.object({
2061
+ purchases: z23.array(purchasesResponse).optional(),
2062
+ afterCursor: z23.string().optional().nullable()
2063
+ }).transform((data) => ({
2064
+ purchases: data["purchases"],
2065
+ afterCursor: data["afterCursor"]
2066
+ }));
2067
+ });
2068
+ var listPurchasesOkResponseRequest = z23.lazy(() => {
2069
+ return z23.object({
2070
+ purchases: z23.array(purchasesRequest).optional(),
2071
+ afterCursor: z23.string().optional().nullable()
2072
+ }).transform((data) => ({
2073
+ purchases: data["purchases"],
2074
+ afterCursor: data["afterCursor"]
2075
+ }));
2076
+ });
2077
+
2078
+ // src/services/purchases/models/_6.ts
2079
+ import { z as z24 } from "zod";
2080
+ var _6Response = z24.lazy(() => {
2081
+ return z24.object({
2082
+ message: z24.string().optional()
2083
+ }).transform((data) => ({
2084
+ message: data["message"]
2085
+ }));
2086
+ });
2087
+ var _6 = class extends Error {
2088
+ constructor(message, response) {
2089
+ super(message);
2090
+ const parsedResponse = _6Response.parse(response);
2091
+ this.message = parsedResponse.message || "";
2092
+ }
2093
+ };
2094
+
2095
+ // src/services/purchases/models/_7.ts
2096
+ import { z as z25 } from "zod";
2097
+ var _7Response = z25.lazy(() => {
2098
+ return z25.object({
2099
+ message: z25.string().optional()
2100
+ }).transform((data) => ({
2101
+ message: data["message"]
2102
+ }));
2103
+ });
2104
+ var _7 = class extends Error {
2105
+ constructor(message, response) {
2106
+ super(message);
2107
+ const parsedResponse = _7Response.parse(response);
2108
+ this.message = parsedResponse.message || "";
2109
+ }
2110
+ };
2111
+
2112
+ // src/services/purchases/models/create-purchase-request.ts
2113
+ import { z as z26 } from "zod";
2114
+ var createPurchaseRequest = z26.lazy(() => {
2115
+ return z26.object({
2116
+ destination: z26.string(),
2117
+ dataLimitInGb: z26.number(),
2118
+ startDate: z26.string(),
2119
+ endDate: z26.string(),
2120
+ email: z26.string().optional(),
2121
+ referenceId: z26.string().optional(),
2122
+ networkBrand: z26.string().optional(),
2123
+ startTime: z26.number().optional(),
2124
+ endTime: z26.number().optional()
2125
+ });
2126
+ });
2127
+ var createPurchaseRequestResponse = z26.lazy(() => {
2128
+ return z26.object({
2129
+ destination: z26.string(),
2130
+ dataLimitInGB: z26.number(),
2131
+ startDate: z26.string(),
2132
+ endDate: z26.string(),
2133
+ email: z26.string().optional(),
2134
+ referenceId: z26.string().optional(),
2135
+ networkBrand: z26.string().optional(),
2136
+ startTime: z26.number().optional(),
2137
+ endTime: z26.number().optional()
2138
+ }).transform((data) => ({
2139
+ destination: data["destination"],
2140
+ dataLimitInGb: data["dataLimitInGB"],
2141
+ startDate: data["startDate"],
2142
+ endDate: data["endDate"],
2143
+ email: data["email"],
2144
+ referenceId: data["referenceId"],
2145
+ networkBrand: data["networkBrand"],
2146
+ startTime: data["startTime"],
2147
+ endTime: data["endTime"]
2148
+ }));
2149
+ });
2150
+ var createPurchaseRequestRequest = z26.lazy(() => {
2151
+ return z26.object({
2152
+ destination: z26.string(),
2153
+ dataLimitInGb: z26.number(),
2154
+ startDate: z26.string(),
2155
+ endDate: z26.string(),
2156
+ email: z26.string().optional(),
2157
+ referenceId: z26.string().optional(),
2158
+ networkBrand: z26.string().optional(),
2159
+ startTime: z26.number().optional(),
2160
+ endTime: z26.number().optional()
2161
+ }).transform((data) => ({
2162
+ destination: data["destination"],
2163
+ dataLimitInGB: data["dataLimitInGb"],
2164
+ startDate: data["startDate"],
2165
+ endDate: data["endDate"],
2166
+ email: data["email"],
2167
+ referenceId: data["referenceId"],
2168
+ networkBrand: data["networkBrand"],
2169
+ startTime: data["startTime"],
2170
+ endTime: data["endTime"]
2171
+ }));
2172
+ });
2173
+
2174
+ // src/services/purchases/models/create-purchase-ok-response.ts
2175
+ import { z as z29 } from "zod";
2176
+
2177
+ // src/services/purchases/models/create-purchase-ok-response-purchase.ts
2178
+ import { z as z27 } from "zod";
2179
+ var createPurchaseOkResponsePurchase = z27.lazy(() => {
2180
+ return z27.object({
2181
+ id: z27.string().optional(),
2182
+ packageId: z27.string().optional(),
2183
+ startDate: z27.string().optional(),
2184
+ endDate: z27.string().optional(),
2185
+ createdDate: z27.string().optional(),
2186
+ startTime: z27.number().optional(),
2187
+ endTime: z27.number().optional()
2188
+ });
2189
+ });
2190
+ var createPurchaseOkResponsePurchaseResponse = z27.lazy(() => {
2191
+ return z27.object({
2192
+ id: z27.string().optional(),
2193
+ packageId: z27.string().optional(),
2194
+ startDate: z27.string().optional(),
2195
+ endDate: z27.string().optional(),
2196
+ createdDate: z27.string().optional(),
2197
+ startTime: z27.number().optional(),
2198
+ endTime: z27.number().optional()
2199
+ }).transform((data) => ({
2200
+ id: data["id"],
2201
+ packageId: data["packageId"],
2202
+ startDate: data["startDate"],
2203
+ endDate: data["endDate"],
2204
+ createdDate: data["createdDate"],
2205
+ startTime: data["startTime"],
2206
+ endTime: data["endTime"]
2207
+ }));
2208
+ });
2209
+ var createPurchaseOkResponsePurchaseRequest = z27.lazy(() => {
2210
+ return z27.object({
2211
+ id: z27.string().optional(),
2212
+ packageId: z27.string().optional(),
2213
+ startDate: z27.string().optional(),
2214
+ endDate: z27.string().optional(),
2215
+ createdDate: z27.string().optional(),
2216
+ startTime: z27.number().optional(),
2217
+ endTime: z27.number().optional()
2218
+ }).transform((data) => ({
2219
+ id: data["id"],
2220
+ packageId: data["packageId"],
2221
+ startDate: data["startDate"],
2222
+ endDate: data["endDate"],
2223
+ createdDate: data["createdDate"],
2224
+ startTime: data["startTime"],
2225
+ endTime: data["endTime"]
2226
+ }));
2227
+ });
2228
+
2229
+ // src/services/purchases/models/create-purchase-ok-response-profile.ts
2230
+ import { z as z28 } from "zod";
2231
+ var createPurchaseOkResponseProfile = z28.lazy(() => {
2232
+ return z28.object({
2233
+ iccid: z28.string().min(18).max(22).optional(),
2234
+ activationCode: z28.string().min(1e3).max(8e3).optional(),
2235
+ manualActivationCode: z28.string().optional()
2236
+ });
2237
+ });
2238
+ var createPurchaseOkResponseProfileResponse = z28.lazy(() => {
2239
+ return z28.object({
2240
+ iccid: z28.string().min(18).max(22).optional(),
2241
+ activationCode: z28.string().min(1e3).max(8e3).optional(),
2242
+ manualActivationCode: z28.string().optional()
2243
+ }).transform((data) => ({
2244
+ iccid: data["iccid"],
2245
+ activationCode: data["activationCode"],
2246
+ manualActivationCode: data["manualActivationCode"]
2247
+ }));
2248
+ });
2249
+ var createPurchaseOkResponseProfileRequest = z28.lazy(() => {
2250
+ return z28.object({
2251
+ iccid: z28.string().min(18).max(22).optional(),
2252
+ activationCode: z28.string().min(1e3).max(8e3).optional(),
2253
+ manualActivationCode: z28.string().optional()
2254
+ }).transform((data) => ({
2255
+ iccid: data["iccid"],
2256
+ activationCode: data["activationCode"],
2257
+ manualActivationCode: data["manualActivationCode"]
2258
+ }));
2259
+ });
2260
+
2261
+ // src/services/purchases/models/create-purchase-ok-response.ts
2262
+ var createPurchaseOkResponse = z29.lazy(() => {
2263
+ return z29.object({
1810
2264
  purchase: createPurchaseOkResponsePurchase.optional(),
1811
2265
  profile: createPurchaseOkResponseProfile.optional()
1812
2266
  });
1813
2267
  });
1814
- var createPurchaseOkResponseResponse = z17.lazy(() => {
1815
- return z17.object({
2268
+ var createPurchaseOkResponseResponse = z29.lazy(() => {
2269
+ return z29.object({
1816
2270
  purchase: createPurchaseOkResponsePurchaseResponse.optional(),
1817
2271
  profile: createPurchaseOkResponseProfileResponse.optional()
1818
2272
  }).transform((data) => ({
@@ -1820,40 +2274,74 @@ var createPurchaseOkResponseResponse = z17.lazy(() => {
1820
2274
  profile: data["profile"]
1821
2275
  }));
1822
2276
  });
1823
- var createPurchaseOkResponseRequest = z17.lazy(() => {
1824
- return z17.object({
1825
- purchase: createPurchaseOkResponsePurchaseRequest.nullish(),
1826
- profile: createPurchaseOkResponseProfileRequest.nullish()
2277
+ var createPurchaseOkResponseRequest = z29.lazy(() => {
2278
+ return z29.object({
2279
+ purchase: createPurchaseOkResponsePurchaseRequest.optional(),
2280
+ profile: createPurchaseOkResponseProfileRequest.optional()
1827
2281
  }).transform((data) => ({
1828
2282
  purchase: data["purchase"],
1829
2283
  profile: data["profile"]
1830
2284
  }));
1831
2285
  });
1832
2286
 
2287
+ // src/services/purchases/models/_8.ts
2288
+ import { z as z30 } from "zod";
2289
+ var _8Response = z30.lazy(() => {
2290
+ return z30.object({
2291
+ message: z30.string().optional()
2292
+ }).transform((data) => ({
2293
+ message: data["message"]
2294
+ }));
2295
+ });
2296
+ var _8 = class extends Error {
2297
+ constructor(message, response) {
2298
+ super(message);
2299
+ const parsedResponse = _8Response.parse(response);
2300
+ this.message = parsedResponse.message || "";
2301
+ }
2302
+ };
2303
+
2304
+ // src/services/purchases/models/_9.ts
2305
+ import { z as z31 } from "zod";
2306
+ var _9Response = z31.lazy(() => {
2307
+ return z31.object({
2308
+ message: z31.string().optional()
2309
+ }).transform((data) => ({
2310
+ message: data["message"]
2311
+ }));
2312
+ });
2313
+ var _9 = class extends Error {
2314
+ constructor(message, response) {
2315
+ super(message);
2316
+ const parsedResponse = _9Response.parse(response);
2317
+ this.message = parsedResponse.message || "";
2318
+ }
2319
+ };
2320
+
1833
2321
  // src/services/purchases/models/top-up-esim-request.ts
1834
- import { z as z18 } from "zod";
1835
- var topUpEsimRequest = z18.lazy(() => {
1836
- return z18.object({
1837
- iccid: z18.string().min(18).max(22),
1838
- dataLimitInGb: z18.number(),
1839
- startDate: z18.string(),
1840
- endDate: z18.string(),
1841
- email: z18.string().optional(),
1842
- referenceId: z18.string().optional(),
1843
- startTime: z18.number().optional(),
1844
- endTime: z18.number().optional()
2322
+ import { z as z32 } from "zod";
2323
+ var topUpEsimRequest = z32.lazy(() => {
2324
+ return z32.object({
2325
+ iccid: z32.string().min(18).max(22),
2326
+ dataLimitInGb: z32.number(),
2327
+ startDate: z32.string(),
2328
+ endDate: z32.string(),
2329
+ email: z32.string().optional(),
2330
+ referenceId: z32.string().optional(),
2331
+ startTime: z32.number().optional(),
2332
+ endTime: z32.number().optional()
1845
2333
  });
1846
2334
  });
1847
- var topUpEsimRequestResponse = z18.lazy(() => {
1848
- return z18.object({
1849
- iccid: z18.string().min(18).max(22),
1850
- dataLimitInGB: z18.number(),
1851
- startDate: z18.string(),
1852
- endDate: z18.string(),
1853
- email: z18.string().optional(),
1854
- referenceId: z18.string().optional(),
1855
- startTime: z18.number().optional(),
1856
- endTime: z18.number().optional()
2335
+ var topUpEsimRequestResponse = z32.lazy(() => {
2336
+ return z32.object({
2337
+ iccid: z32.string().min(18).max(22),
2338
+ dataLimitInGB: z32.number(),
2339
+ startDate: z32.string(),
2340
+ endDate: z32.string(),
2341
+ email: z32.string().optional(),
2342
+ referenceId: z32.string().optional(),
2343
+ startTime: z32.number().optional(),
2344
+ endTime: z32.number().optional()
1857
2345
  }).transform((data) => ({
1858
2346
  iccid: data["iccid"],
1859
2347
  dataLimitInGb: data["dataLimitInGB"],
@@ -1865,16 +2353,16 @@ var topUpEsimRequestResponse = z18.lazy(() => {
1865
2353
  endTime: data["endTime"]
1866
2354
  }));
1867
2355
  });
1868
- var topUpEsimRequestRequest = z18.lazy(() => {
1869
- return z18.object({
1870
- iccid: z18.string().nullish(),
1871
- dataLimitInGb: z18.number().nullish(),
1872
- startDate: z18.string().nullish(),
1873
- endDate: z18.string().nullish(),
1874
- email: z18.string().nullish(),
1875
- referenceId: z18.string().nullish(),
1876
- startTime: z18.number().nullish(),
1877
- endTime: z18.number().nullish()
2356
+ var topUpEsimRequestRequest = z32.lazy(() => {
2357
+ return z32.object({
2358
+ iccid: z32.string().min(18).max(22),
2359
+ dataLimitInGb: z32.number(),
2360
+ startDate: z32.string(),
2361
+ endDate: z32.string(),
2362
+ email: z32.string().optional(),
2363
+ referenceId: z32.string().optional(),
2364
+ startTime: z32.number().optional(),
2365
+ endTime: z32.number().optional()
1878
2366
  }).transform((data) => ({
1879
2367
  iccid: data["iccid"],
1880
2368
  dataLimitInGB: data["dataLimitInGb"],
@@ -1888,30 +2376,30 @@ var topUpEsimRequestRequest = z18.lazy(() => {
1888
2376
  });
1889
2377
 
1890
2378
  // src/services/purchases/models/top-up-esim-ok-response.ts
1891
- import { z as z21 } from "zod";
2379
+ import { z as z35 } from "zod";
1892
2380
 
1893
2381
  // src/services/purchases/models/top-up-esim-ok-response-purchase.ts
1894
- import { z as z19 } from "zod";
1895
- var topUpEsimOkResponsePurchase = z19.lazy(() => {
1896
- return z19.object({
1897
- id: z19.string().optional(),
1898
- packageId: z19.string().optional(),
1899
- startDate: z19.string().optional(),
1900
- endDate: z19.string().optional(),
1901
- createdDate: z19.string().optional(),
1902
- startTime: z19.number().optional(),
1903
- endTime: z19.number().optional()
2382
+ import { z as z33 } from "zod";
2383
+ var topUpEsimOkResponsePurchase = z33.lazy(() => {
2384
+ return z33.object({
2385
+ id: z33.string().optional(),
2386
+ packageId: z33.string().optional(),
2387
+ startDate: z33.string().optional(),
2388
+ endDate: z33.string().optional(),
2389
+ createdDate: z33.string().optional(),
2390
+ startTime: z33.number().optional(),
2391
+ endTime: z33.number().optional()
1904
2392
  });
1905
2393
  });
1906
- var topUpEsimOkResponsePurchaseResponse = z19.lazy(() => {
1907
- return z19.object({
1908
- id: z19.string().optional(),
1909
- packageId: z19.string().optional(),
1910
- startDate: z19.string().optional(),
1911
- endDate: z19.string().optional(),
1912
- createdDate: z19.string().optional(),
1913
- startTime: z19.number().optional(),
1914
- endTime: z19.number().optional()
2394
+ var topUpEsimOkResponsePurchaseResponse = z33.lazy(() => {
2395
+ return z33.object({
2396
+ id: z33.string().optional(),
2397
+ packageId: z33.string().optional(),
2398
+ startDate: z33.string().optional(),
2399
+ endDate: z33.string().optional(),
2400
+ createdDate: z33.string().optional(),
2401
+ startTime: z33.number().optional(),
2402
+ endTime: z33.number().optional()
1915
2403
  }).transform((data) => ({
1916
2404
  id: data["id"],
1917
2405
  packageId: data["packageId"],
@@ -1922,15 +2410,15 @@ var topUpEsimOkResponsePurchaseResponse = z19.lazy(() => {
1922
2410
  endTime: data["endTime"]
1923
2411
  }));
1924
2412
  });
1925
- var topUpEsimOkResponsePurchaseRequest = z19.lazy(() => {
1926
- return z19.object({
1927
- id: z19.string().nullish(),
1928
- packageId: z19.string().nullish(),
1929
- startDate: z19.string().nullish(),
1930
- endDate: z19.string().nullish(),
1931
- createdDate: z19.string().nullish(),
1932
- startTime: z19.number().nullish(),
1933
- endTime: z19.number().nullish()
2413
+ var topUpEsimOkResponsePurchaseRequest = z33.lazy(() => {
2414
+ return z33.object({
2415
+ id: z33.string().optional(),
2416
+ packageId: z33.string().optional(),
2417
+ startDate: z33.string().optional(),
2418
+ endDate: z33.string().optional(),
2419
+ createdDate: z33.string().optional(),
2420
+ startTime: z33.number().optional(),
2421
+ endTime: z33.number().optional()
1934
2422
  }).transform((data) => ({
1935
2423
  id: data["id"],
1936
2424
  packageId: data["packageId"],
@@ -1943,34 +2431,36 @@ var topUpEsimOkResponsePurchaseRequest = z19.lazy(() => {
1943
2431
  });
1944
2432
 
1945
2433
  // src/services/purchases/models/top-up-esim-ok-response-profile.ts
1946
- import { z as z20 } from "zod";
1947
- var topUpEsimOkResponseProfile = z20.lazy(() => {
1948
- return z20.object({
1949
- iccid: z20.string().min(18).max(22).optional()
2434
+ import { z as z34 } from "zod";
2435
+ var topUpEsimOkResponseProfile = z34.lazy(() => {
2436
+ return z34.object({
2437
+ iccid: z34.string().min(18).max(22).optional()
1950
2438
  });
1951
2439
  });
1952
- var topUpEsimOkResponseProfileResponse = z20.lazy(() => {
1953
- return z20.object({
1954
- iccid: z20.string().min(18).max(22).optional()
2440
+ var topUpEsimOkResponseProfileResponse = z34.lazy(() => {
2441
+ return z34.object({
2442
+ iccid: z34.string().min(18).max(22).optional()
1955
2443
  }).transform((data) => ({
1956
2444
  iccid: data["iccid"]
1957
2445
  }));
1958
2446
  });
1959
- var topUpEsimOkResponseProfileRequest = z20.lazy(() => {
1960
- return z20.object({ iccid: z20.string().nullish() }).transform((data) => ({
2447
+ var topUpEsimOkResponseProfileRequest = z34.lazy(() => {
2448
+ return z34.object({
2449
+ iccid: z34.string().min(18).max(22).optional()
2450
+ }).transform((data) => ({
1961
2451
  iccid: data["iccid"]
1962
2452
  }));
1963
2453
  });
1964
2454
 
1965
2455
  // src/services/purchases/models/top-up-esim-ok-response.ts
1966
- var topUpEsimOkResponse = z21.lazy(() => {
1967
- return z21.object({
2456
+ var topUpEsimOkResponse = z35.lazy(() => {
2457
+ return z35.object({
1968
2458
  purchase: topUpEsimOkResponsePurchase.optional(),
1969
2459
  profile: topUpEsimOkResponseProfile.optional()
1970
2460
  });
1971
2461
  });
1972
- var topUpEsimOkResponseResponse = z21.lazy(() => {
1973
- return z21.object({
2462
+ var topUpEsimOkResponseResponse = z35.lazy(() => {
2463
+ return z35.object({
1974
2464
  purchase: topUpEsimOkResponsePurchaseResponse.optional(),
1975
2465
  profile: topUpEsimOkResponseProfileResponse.optional()
1976
2466
  }).transform((data) => ({
@@ -1978,34 +2468,68 @@ var topUpEsimOkResponseResponse = z21.lazy(() => {
1978
2468
  profile: data["profile"]
1979
2469
  }));
1980
2470
  });
1981
- var topUpEsimOkResponseRequest = z21.lazy(() => {
1982
- return z21.object({
1983
- purchase: topUpEsimOkResponsePurchaseRequest.nullish(),
1984
- profile: topUpEsimOkResponseProfileRequest.nullish()
2471
+ var topUpEsimOkResponseRequest = z35.lazy(() => {
2472
+ return z35.object({
2473
+ purchase: topUpEsimOkResponsePurchaseRequest.optional(),
2474
+ profile: topUpEsimOkResponseProfileRequest.optional()
1985
2475
  }).transform((data) => ({
1986
2476
  purchase: data["purchase"],
1987
2477
  profile: data["profile"]
1988
2478
  }));
1989
2479
  });
1990
2480
 
2481
+ // src/services/purchases/models/_10.ts
2482
+ import { z as z36 } from "zod";
2483
+ var _10Response = z36.lazy(() => {
2484
+ return z36.object({
2485
+ message: z36.string().optional()
2486
+ }).transform((data) => ({
2487
+ message: data["message"]
2488
+ }));
2489
+ });
2490
+ var _10 = class extends Error {
2491
+ constructor(message, response) {
2492
+ super(message);
2493
+ const parsedResponse = _10Response.parse(response);
2494
+ this.message = parsedResponse.message || "";
2495
+ }
2496
+ };
2497
+
2498
+ // src/services/purchases/models/_11.ts
2499
+ import { z as z37 } from "zod";
2500
+ var _11Response = z37.lazy(() => {
2501
+ return z37.object({
2502
+ message: z37.string().optional()
2503
+ }).transform((data) => ({
2504
+ message: data["message"]
2505
+ }));
2506
+ });
2507
+ var _11 = class extends Error {
2508
+ constructor(message, response) {
2509
+ super(message);
2510
+ const parsedResponse = _11Response.parse(response);
2511
+ this.message = parsedResponse.message || "";
2512
+ }
2513
+ };
2514
+
1991
2515
  // src/services/purchases/models/edit-purchase-request.ts
1992
- import { z as z22 } from "zod";
1993
- var editPurchaseRequest = z22.lazy(() => {
1994
- return z22.object({
1995
- purchaseId: z22.string(),
1996
- startDate: z22.string(),
1997
- endDate: z22.string(),
1998
- startTime: z22.number().optional(),
1999
- endTime: z22.number().optional()
2516
+ import { z as z38 } from "zod";
2517
+ var editPurchaseRequest = z38.lazy(() => {
2518
+ return z38.object({
2519
+ purchaseId: z38.string(),
2520
+ startDate: z38.string(),
2521
+ endDate: z38.string(),
2522
+ startTime: z38.number().optional(),
2523
+ endTime: z38.number().optional()
2000
2524
  });
2001
2525
  });
2002
- var editPurchaseRequestResponse = z22.lazy(() => {
2003
- return z22.object({
2004
- purchaseId: z22.string(),
2005
- startDate: z22.string(),
2006
- endDate: z22.string(),
2007
- startTime: z22.number().optional(),
2008
- endTime: z22.number().optional()
2526
+ var editPurchaseRequestResponse = z38.lazy(() => {
2527
+ return z38.object({
2528
+ purchaseId: z38.string(),
2529
+ startDate: z38.string(),
2530
+ endDate: z38.string(),
2531
+ startTime: z38.number().optional(),
2532
+ endTime: z38.number().optional()
2009
2533
  }).transform((data) => ({
2010
2534
  purchaseId: data["purchaseId"],
2011
2535
  startDate: data["startDate"],
@@ -2014,13 +2538,13 @@ var editPurchaseRequestResponse = z22.lazy(() => {
2014
2538
  endTime: data["endTime"]
2015
2539
  }));
2016
2540
  });
2017
- var editPurchaseRequestRequest = z22.lazy(() => {
2018
- return z22.object({
2019
- purchaseId: z22.string().nullish(),
2020
- startDate: z22.string().nullish(),
2021
- endDate: z22.string().nullish(),
2022
- startTime: z22.number().nullish(),
2023
- endTime: z22.number().nullish()
2541
+ var editPurchaseRequestRequest = z38.lazy(() => {
2542
+ return z38.object({
2543
+ purchaseId: z38.string(),
2544
+ startDate: z38.string(),
2545
+ endDate: z38.string(),
2546
+ startTime: z38.number().optional(),
2547
+ endTime: z38.number().optional()
2024
2548
  }).transform((data) => ({
2025
2549
  purchaseId: data["purchaseId"],
2026
2550
  startDate: data["startDate"],
@@ -2031,23 +2555,23 @@ var editPurchaseRequestRequest = z22.lazy(() => {
2031
2555
  });
2032
2556
 
2033
2557
  // src/services/purchases/models/edit-purchase-ok-response.ts
2034
- import { z as z23 } from "zod";
2035
- var editPurchaseOkResponse = z23.lazy(() => {
2036
- return z23.object({
2037
- purchaseId: z23.string().optional(),
2038
- newStartDate: z23.string().optional(),
2039
- newEndDate: z23.string().optional(),
2040
- newStartTime: z23.number().optional(),
2041
- newEndTime: z23.number().optional()
2558
+ import { z as z39 } from "zod";
2559
+ var editPurchaseOkResponse = z39.lazy(() => {
2560
+ return z39.object({
2561
+ purchaseId: z39.string().optional(),
2562
+ newStartDate: z39.string().optional(),
2563
+ newEndDate: z39.string().optional(),
2564
+ newStartTime: z39.number().optional(),
2565
+ newEndTime: z39.number().optional()
2042
2566
  });
2043
2567
  });
2044
- var editPurchaseOkResponseResponse = z23.lazy(() => {
2045
- return z23.object({
2046
- purchaseId: z23.string().optional(),
2047
- newStartDate: z23.string().optional(),
2048
- newEndDate: z23.string().optional(),
2049
- newStartTime: z23.number().optional(),
2050
- newEndTime: z23.number().optional()
2568
+ var editPurchaseOkResponseResponse = z39.lazy(() => {
2569
+ return z39.object({
2570
+ purchaseId: z39.string().optional(),
2571
+ newStartDate: z39.string().optional(),
2572
+ newEndDate: z39.string().optional(),
2573
+ newStartTime: z39.number().optional(),
2574
+ newEndTime: z39.number().optional()
2051
2575
  }).transform((data) => ({
2052
2576
  purchaseId: data["purchaseId"],
2053
2577
  newStartDate: data["newStartDate"],
@@ -2056,13 +2580,13 @@ var editPurchaseOkResponseResponse = z23.lazy(() => {
2056
2580
  newEndTime: data["newEndTime"]
2057
2581
  }));
2058
2582
  });
2059
- var editPurchaseOkResponseRequest = z23.lazy(() => {
2060
- return z23.object({
2061
- purchaseId: z23.string().nullish(),
2062
- newStartDate: z23.string().nullish(),
2063
- newEndDate: z23.string().nullish(),
2064
- newStartTime: z23.number().nullish(),
2065
- newEndTime: z23.number().nullish()
2583
+ var editPurchaseOkResponseRequest = z39.lazy(() => {
2584
+ return z39.object({
2585
+ purchaseId: z39.string().optional(),
2586
+ newStartDate: z39.string().optional(),
2587
+ newEndDate: z39.string().optional(),
2588
+ newStartTime: z39.number().optional(),
2589
+ newEndTime: z39.number().optional()
2066
2590
  }).transform((data) => ({
2067
2591
  purchaseId: data["purchaseId"],
2068
2592
  newStartDate: data["newStartDate"],
@@ -2072,49 +2596,150 @@ var editPurchaseOkResponseRequest = z23.lazy(() => {
2072
2596
  }));
2073
2597
  });
2074
2598
 
2599
+ // src/services/purchases/models/_12.ts
2600
+ import { z as z40 } from "zod";
2601
+ var _12Response = z40.lazy(() => {
2602
+ return z40.object({
2603
+ message: z40.string().optional()
2604
+ }).transform((data) => ({
2605
+ message: data["message"]
2606
+ }));
2607
+ });
2608
+ var _12 = class extends Error {
2609
+ constructor(message, response) {
2610
+ super(message);
2611
+ const parsedResponse = _12Response.parse(response);
2612
+ this.message = parsedResponse.message || "";
2613
+ }
2614
+ };
2615
+
2616
+ // src/services/purchases/models/_13.ts
2617
+ import { z as z41 } from "zod";
2618
+ var _13Response = z41.lazy(() => {
2619
+ return z41.object({
2620
+ message: z41.string().optional()
2621
+ }).transform((data) => ({
2622
+ message: data["message"]
2623
+ }));
2624
+ });
2625
+ var _13 = class extends Error {
2626
+ constructor(message, response) {
2627
+ super(message);
2628
+ const parsedResponse = _13Response.parse(response);
2629
+ this.message = parsedResponse.message || "";
2630
+ }
2631
+ };
2632
+
2075
2633
  // src/services/purchases/models/get-purchase-consumption-ok-response.ts
2076
- import { z as z24 } from "zod";
2077
- var getPurchaseConsumptionOkResponse = z24.lazy(() => {
2078
- return z24.object({
2079
- dataUsageRemainingInBytes: z24.number().optional(),
2080
- status: z24.string().optional()
2634
+ import { z as z42 } from "zod";
2635
+ var getPurchaseConsumptionOkResponse = z42.lazy(() => {
2636
+ return z42.object({
2637
+ dataUsageRemainingInBytes: z42.number().optional(),
2638
+ status: z42.string().optional()
2081
2639
  });
2082
2640
  });
2083
- var getPurchaseConsumptionOkResponseResponse = z24.lazy(() => {
2084
- return z24.object({
2085
- dataUsageRemainingInBytes: z24.number().optional(),
2086
- status: z24.string().optional()
2641
+ var getPurchaseConsumptionOkResponseResponse = z42.lazy(() => {
2642
+ return z42.object({
2643
+ dataUsageRemainingInBytes: z42.number().optional(),
2644
+ status: z42.string().optional()
2087
2645
  }).transform((data) => ({
2088
2646
  dataUsageRemainingInBytes: data["dataUsageRemainingInBytes"],
2089
2647
  status: data["status"]
2090
2648
  }));
2091
2649
  });
2092
- var getPurchaseConsumptionOkResponseRequest = z24.lazy(() => {
2093
- return z24.object({ dataUsageRemainingInBytes: z24.number().nullish(), status: z24.string().nullish() }).transform((data) => ({
2650
+ var getPurchaseConsumptionOkResponseRequest = z42.lazy(() => {
2651
+ return z42.object({
2652
+ dataUsageRemainingInBytes: z42.number().optional(),
2653
+ status: z42.string().optional()
2654
+ }).transform((data) => ({
2094
2655
  dataUsageRemainingInBytes: data["dataUsageRemainingInBytes"],
2095
2656
  status: data["status"]
2096
2657
  }));
2097
2658
  });
2098
2659
 
2099
- // src/services/purchases/purchases.ts
2660
+ // src/services/purchases/models/_14.ts
2661
+ import { z as z43 } from "zod";
2662
+ var _14Response = z43.lazy(() => {
2663
+ return z43.object({
2664
+ message: z43.string().optional()
2665
+ }).transform((data) => ({
2666
+ message: data["message"]
2667
+ }));
2668
+ });
2669
+ var _14 = class extends Error {
2670
+ constructor(message, response) {
2671
+ super(message);
2672
+ const parsedResponse = _14Response.parse(response);
2673
+ this.message = parsedResponse.message || "";
2674
+ }
2675
+ };
2676
+
2677
+ // src/services/purchases/models/_15.ts
2678
+ import { z as z44 } from "zod";
2679
+ var _15Response = z44.lazy(() => {
2680
+ return z44.object({
2681
+ message: z44.string().optional()
2682
+ }).transform((data) => ({
2683
+ message: data["message"]
2684
+ }));
2685
+ });
2686
+ var _15 = class extends Error {
2687
+ constructor(message, response) {
2688
+ super(message);
2689
+ const parsedResponse = _15Response.parse(response);
2690
+ this.message = parsedResponse.message || "";
2691
+ }
2692
+ };
2693
+
2694
+ // src/services/purchases/purchases-service.ts
2100
2695
  var PurchasesService = class extends BaseService {
2696
+ /**
2697
+ * This endpoint is used to purchase a new eSIM by providing the package details.
2698
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2699
+ * @returns {Promise<HttpResponse<CreatePurchaseV2OkResponse[]>>} Successful Response
2700
+ */
2701
+ async createPurchaseV2(body, requestConfig) {
2702
+ 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({
2703
+ schema: z45.array(createPurchaseV2OkResponseResponse),
2704
+ contentType: "json" /* Json */,
2705
+ status: 200
2706
+ }).addError({
2707
+ error: _4,
2708
+ contentType: "json" /* Json */,
2709
+ status: 400
2710
+ }).addError({
2711
+ error: _5,
2712
+ contentType: "json" /* Json */,
2713
+ status: 401
2714
+ }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2715
+ return this.client.call(request);
2716
+ }
2101
2717
  /**
2102
2718
  * This endpoint can be used to list all the successful purchases made between a given interval.
2103
- * @param {string} [iccid] - ID of the eSIM
2104
- * @param {string} [afterDate] - Start date of the interval for filtering purchases in the format 'yyyy-MM-dd'
2105
- * @param {string} [beforeDate] - End date of the interval for filtering purchases in the format 'yyyy-MM-dd'
2106
- * @param {string} [referenceId] - The referenceId that was provided by the partner during the purchase or topup flow.
2107
- * @param {string} [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.
2108
- * @param {number} [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
2109
- * @param {number} [after] - Epoch value representing the start of the time interval for filtering purchases
2110
- * @param {number} [before] - Epoch value representing the end of the time interval for filtering purchases
2719
+ * @param {string} [params.iccid] - ID of the eSIM
2720
+ * @param {string} [params.afterDate] - Start date of the interval for filtering purchases in the format 'yyyy-MM-dd'
2721
+ * @param {string} [params.beforeDate] - End date of the interval for filtering purchases in the format 'yyyy-MM-dd'
2722
+ * @param {string} [params.referenceId] - The referenceId that was provided by the partner during the purchase or topup flow.
2723
+ * @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.
2724
+ * @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
2725
+ * @param {number} [params.after] - Epoch value representing the start of the time interval for filtering purchases
2726
+ * @param {number} [params.before] - Epoch value representing the end of the time interval for filtering purchases
2727
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2111
2728
  * @returns {Promise<HttpResponse<ListPurchasesOkResponse>>} Successful Response
2112
2729
  */
2113
2730
  async listPurchases(params, requestConfig) {
2114
- const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases").setRequestSchema(z25.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
2731
+ 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(z45.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
2115
2732
  schema: listPurchasesOkResponseResponse,
2116
2733
  contentType: "json" /* Json */,
2117
2734
  status: 200
2735
+ }).addError({
2736
+ error: _6,
2737
+ contentType: "json" /* Json */,
2738
+ status: 400
2739
+ }).addError({
2740
+ error: _7,
2741
+ contentType: "json" /* Json */,
2742
+ status: 401
2118
2743
  }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
2119
2744
  key: "iccid",
2120
2745
  value: params == null ? void 0 : params.iccid
@@ -2144,50 +2769,86 @@ var PurchasesService = class extends BaseService {
2144
2769
  }
2145
2770
  /**
2146
2771
  * This endpoint is used to purchase a new eSIM by providing the package details.
2772
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2147
2773
  * @returns {Promise<HttpResponse<CreatePurchaseOkResponse>>} Successful Response
2148
2774
  */
2149
2775
  async createPurchase(body, requestConfig) {
2150
- const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases").setRequestSchema(createPurchaseRequestRequest).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
2776
+ 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({
2151
2777
  schema: createPurchaseOkResponseResponse,
2152
2778
  contentType: "json" /* Json */,
2153
2779
  status: 200
2780
+ }).addError({
2781
+ error: _8,
2782
+ contentType: "json" /* Json */,
2783
+ status: 400
2784
+ }).addError({
2785
+ error: _9,
2786
+ contentType: "json" /* Json */,
2787
+ status: 401
2154
2788
  }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2155
2789
  return this.client.call(request);
2156
2790
  }
2157
2791
  /**
2158
- * This endpoint is used to top-up an eSIM with the previously associated destination by providing an existing ICCID and the package details. The top-up is not feasible for eSIMs in "DELETED" or "ERROR" state.
2792
+ * This endpoint is used to top-up an eSIM with the previously associated destination by providing an existing ICCID and the package details. The top-up is only feasible for eSIMs in "ENABLED" or "INSTALLED" state. You can check this state using the Get eSIM Status endpoint.
2793
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2159
2794
  * @returns {Promise<HttpResponse<TopUpEsimOkResponse>>} Successful Response
2160
2795
  */
2161
2796
  async topUpEsim(body, requestConfig) {
2162
- const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/topup").setRequestSchema(topUpEsimRequestRequest).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
2797
+ 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({
2163
2798
  schema: topUpEsimOkResponseResponse,
2164
2799
  contentType: "json" /* Json */,
2165
2800
  status: 200
2801
+ }).addError({
2802
+ error: _10,
2803
+ contentType: "json" /* Json */,
2804
+ status: 400
2805
+ }).addError({
2806
+ error: _11,
2807
+ contentType: "json" /* Json */,
2808
+ status: 401
2166
2809
  }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2167
2810
  return this.client.call(request);
2168
2811
  }
2169
2812
  /**
2170
2813
  * This endpoint allows you to modify the dates of an existing package with a future activation start time. Editing can only be performed for packages that have not been activated, and it cannot change the package size. The modification must not change the package duration category to ensure pricing consistency.
2814
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2171
2815
  * @returns {Promise<HttpResponse<EditPurchaseOkResponse>>} Successful Response
2172
2816
  */
2173
2817
  async editPurchase(body, requestConfig) {
2174
- const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/edit").setRequestSchema(editPurchaseRequestRequest).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
2818
+ 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({
2175
2819
  schema: editPurchaseOkResponseResponse,
2176
2820
  contentType: "json" /* Json */,
2177
2821
  status: 200
2822
+ }).addError({
2823
+ error: _12,
2824
+ contentType: "json" /* Json */,
2825
+ status: 400
2826
+ }).addError({
2827
+ error: _13,
2828
+ contentType: "json" /* Json */,
2829
+ status: 401
2178
2830
  }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2179
2831
  return this.client.call(request);
2180
2832
  }
2181
2833
  /**
2182
2834
  * 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.
2183
2835
  * @param {string} purchaseId - ID of the purchase
2836
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2184
2837
  * @returns {Promise<HttpResponse<GetPurchaseConsumptionOkResponse>>} Successful Response
2185
2838
  */
2186
2839
  async getPurchaseConsumption(purchaseId, requestConfig) {
2187
- const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(z25.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
2840
+ 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(z45.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
2188
2841
  schema: getPurchaseConsumptionOkResponseResponse,
2189
2842
  contentType: "json" /* Json */,
2190
2843
  status: 200
2844
+ }).addError({
2845
+ error: _14,
2846
+ contentType: "json" /* Json */,
2847
+ status: 400
2848
+ }).addError({
2849
+ error: _15,
2850
+ contentType: "json" /* Json */,
2851
+ status: 401
2191
2852
  }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2192
2853
  key: "purchaseId",
2193
2854
  value: purchaseId
@@ -2196,28 +2857,28 @@ var PurchasesService = class extends BaseService {
2196
2857
  }
2197
2858
  };
2198
2859
 
2199
- // src/services/e-sim/e-sim.ts
2200
- import { z as z35 } from "zod";
2860
+ // src/services/e-sim/e-sim-service.ts
2861
+ import { z as z63 } from "zod";
2201
2862
 
2202
2863
  // src/services/e-sim/models/get-esim-ok-response.ts
2203
- import { z as z27 } from "zod";
2864
+ import { z as z47 } from "zod";
2204
2865
 
2205
2866
  // src/services/e-sim/models/get-esim-ok-response-esim.ts
2206
- import { z as z26 } from "zod";
2207
- var getEsimOkResponseEsim = z26.lazy(() => {
2208
- return z26.object({
2209
- iccid: z26.string().min(18).max(22).optional(),
2210
- smdpAddress: z26.string().optional(),
2211
- manualActivationCode: z26.string().optional(),
2212
- status: z26.string().optional()
2867
+ import { z as z46 } from "zod";
2868
+ var getEsimOkResponseEsim = z46.lazy(() => {
2869
+ return z46.object({
2870
+ iccid: z46.string().min(18).max(22).optional(),
2871
+ smdpAddress: z46.string().optional(),
2872
+ manualActivationCode: z46.string().optional(),
2873
+ status: z46.string().optional()
2213
2874
  });
2214
2875
  });
2215
- var getEsimOkResponseEsimResponse = z26.lazy(() => {
2216
- return z26.object({
2217
- iccid: z26.string().min(18).max(22).optional(),
2218
- smdpAddress: z26.string().optional(),
2219
- manualActivationCode: z26.string().optional(),
2220
- status: z26.string().optional()
2876
+ var getEsimOkResponseEsimResponse = z46.lazy(() => {
2877
+ return z46.object({
2878
+ iccid: z46.string().min(18).max(22).optional(),
2879
+ smdpAddress: z46.string().optional(),
2880
+ manualActivationCode: z46.string().optional(),
2881
+ status: z46.string().optional()
2221
2882
  }).transform((data) => ({
2222
2883
  iccid: data["iccid"],
2223
2884
  smdpAddress: data["smdpAddress"],
@@ -2225,12 +2886,12 @@ var getEsimOkResponseEsimResponse = z26.lazy(() => {
2225
2886
  status: data["status"]
2226
2887
  }));
2227
2888
  });
2228
- var getEsimOkResponseEsimRequest = z26.lazy(() => {
2229
- return z26.object({
2230
- iccid: z26.string().nullish(),
2231
- smdpAddress: z26.string().nullish(),
2232
- manualActivationCode: z26.string().nullish(),
2233
- status: z26.string().nullish()
2889
+ var getEsimOkResponseEsimRequest = z46.lazy(() => {
2890
+ return z46.object({
2891
+ iccid: z46.string().min(18).max(22).optional(),
2892
+ smdpAddress: z46.string().optional(),
2893
+ manualActivationCode: z46.string().optional(),
2894
+ status: z46.string().optional()
2234
2895
  }).transform((data) => ({
2235
2896
  iccid: data["iccid"],
2236
2897
  smdpAddress: data["smdpAddress"],
@@ -2240,43 +2901,79 @@ var getEsimOkResponseEsimRequest = z26.lazy(() => {
2240
2901
  });
2241
2902
 
2242
2903
  // src/services/e-sim/models/get-esim-ok-response.ts
2243
- var getEsimOkResponse = z27.lazy(() => {
2244
- return z27.object({
2904
+ var getEsimOkResponse = z47.lazy(() => {
2905
+ return z47.object({
2245
2906
  esim: getEsimOkResponseEsim.optional()
2246
2907
  });
2247
2908
  });
2248
- var getEsimOkResponseResponse = z27.lazy(() => {
2249
- return z27.object({
2909
+ var getEsimOkResponseResponse = z47.lazy(() => {
2910
+ return z47.object({
2250
2911
  esim: getEsimOkResponseEsimResponse.optional()
2251
2912
  }).transform((data) => ({
2252
2913
  esim: data["esim"]
2253
2914
  }));
2254
2915
  });
2255
- var getEsimOkResponseRequest = z27.lazy(() => {
2256
- return z27.object({ esim: getEsimOkResponseEsimRequest.nullish() }).transform((data) => ({
2916
+ var getEsimOkResponseRequest = z47.lazy(() => {
2917
+ return z47.object({
2918
+ esim: getEsimOkResponseEsimRequest.optional()
2919
+ }).transform((data) => ({
2257
2920
  esim: data["esim"]
2258
2921
  }));
2259
2922
  });
2260
2923
 
2924
+ // src/services/e-sim/models/_16.ts
2925
+ import { z as z48 } from "zod";
2926
+ var _16Response = z48.lazy(() => {
2927
+ return z48.object({
2928
+ message: z48.string().optional()
2929
+ }).transform((data) => ({
2930
+ message: data["message"]
2931
+ }));
2932
+ });
2933
+ var _16 = class extends Error {
2934
+ constructor(message, response) {
2935
+ super(message);
2936
+ const parsedResponse = _16Response.parse(response);
2937
+ this.message = parsedResponse.message || "";
2938
+ }
2939
+ };
2940
+
2941
+ // src/services/e-sim/models/_17.ts
2942
+ import { z as z49 } from "zod";
2943
+ var _17Response = z49.lazy(() => {
2944
+ return z49.object({
2945
+ message: z49.string().optional()
2946
+ }).transform((data) => ({
2947
+ message: data["message"]
2948
+ }));
2949
+ });
2950
+ var _17 = class extends Error {
2951
+ constructor(message, response) {
2952
+ super(message);
2953
+ const parsedResponse = _17Response.parse(response);
2954
+ this.message = parsedResponse.message || "";
2955
+ }
2956
+ };
2957
+
2261
2958
  // src/services/e-sim/models/get-esim-device-ok-response.ts
2262
- import { z as z29 } from "zod";
2959
+ import { z as z51 } from "zod";
2263
2960
 
2264
2961
  // src/services/e-sim/models/device.ts
2265
- import { z as z28 } from "zod";
2266
- var device = z28.lazy(() => {
2267
- return z28.object({
2268
- oem: z28.string().optional(),
2269
- hardwareName: z28.string().optional(),
2270
- hardwareModel: z28.string().optional(),
2271
- eid: z28.string().optional()
2962
+ import { z as z50 } from "zod";
2963
+ var device = z50.lazy(() => {
2964
+ return z50.object({
2965
+ oem: z50.string().optional(),
2966
+ hardwareName: z50.string().optional(),
2967
+ hardwareModel: z50.string().optional(),
2968
+ eid: z50.string().optional()
2272
2969
  });
2273
2970
  });
2274
- var deviceResponse = z28.lazy(() => {
2275
- return z28.object({
2276
- oem: z28.string().optional(),
2277
- hardwareName: z28.string().optional(),
2278
- hardwareModel: z28.string().optional(),
2279
- eid: z28.string().optional()
2971
+ var deviceResponse = z50.lazy(() => {
2972
+ return z50.object({
2973
+ oem: z50.string().optional(),
2974
+ hardwareName: z50.string().optional(),
2975
+ hardwareModel: z50.string().optional(),
2976
+ eid: z50.string().optional()
2280
2977
  }).transform((data) => ({
2281
2978
  oem: data["oem"],
2282
2979
  hardwareName: data["hardwareName"],
@@ -2284,12 +2981,12 @@ var deviceResponse = z28.lazy(() => {
2284
2981
  eid: data["eid"]
2285
2982
  }));
2286
2983
  });
2287
- var deviceRequest = z28.lazy(() => {
2288
- return z28.object({
2289
- oem: z28.string().nullish(),
2290
- hardwareName: z28.string().nullish(),
2291
- hardwareModel: z28.string().nullish(),
2292
- eid: z28.string().nullish()
2984
+ var deviceRequest = z50.lazy(() => {
2985
+ return z50.object({
2986
+ oem: z50.string().optional(),
2987
+ hardwareName: z50.string().optional(),
2988
+ hardwareModel: z50.string().optional(),
2989
+ eid: z50.string().optional()
2293
2990
  }).transform((data) => ({
2294
2991
  oem: data["oem"],
2295
2992
  hardwareName: data["hardwareName"],
@@ -2299,52 +2996,92 @@ var deviceRequest = z28.lazy(() => {
2299
2996
  });
2300
2997
 
2301
2998
  // src/services/e-sim/models/get-esim-device-ok-response.ts
2302
- var getEsimDeviceOkResponse = z29.lazy(() => {
2303
- return z29.object({
2999
+ var getEsimDeviceOkResponse = z51.lazy(() => {
3000
+ return z51.object({
2304
3001
  device: device.optional()
2305
3002
  });
2306
3003
  });
2307
- var getEsimDeviceOkResponseResponse = z29.lazy(() => {
2308
- return z29.object({
3004
+ var getEsimDeviceOkResponseResponse = z51.lazy(() => {
3005
+ return z51.object({
2309
3006
  device: deviceResponse.optional()
2310
3007
  }).transform((data) => ({
2311
3008
  device: data["device"]
2312
3009
  }));
2313
3010
  });
2314
- var getEsimDeviceOkResponseRequest = z29.lazy(() => {
2315
- return z29.object({ device: deviceRequest.nullish() }).transform((data) => ({
3011
+ var getEsimDeviceOkResponseRequest = z51.lazy(() => {
3012
+ return z51.object({
3013
+ device: deviceRequest.optional()
3014
+ }).transform((data) => ({
2316
3015
  device: data["device"]
2317
3016
  }));
2318
3017
  });
2319
3018
 
3019
+ // src/services/e-sim/models/_18.ts
3020
+ import { z as z52 } from "zod";
3021
+ var _18Response = z52.lazy(() => {
3022
+ return z52.object({
3023
+ message: z52.string().optional()
3024
+ }).transform((data) => ({
3025
+ message: data["message"]
3026
+ }));
3027
+ });
3028
+ var _18 = class extends Error {
3029
+ constructor(message, response) {
3030
+ super(message);
3031
+ const parsedResponse = _18Response.parse(response);
3032
+ this.message = parsedResponse.message || "";
3033
+ }
3034
+ };
3035
+
3036
+ // src/services/e-sim/models/_19.ts
3037
+ import { z as z53 } from "zod";
3038
+ var _19Response = z53.lazy(() => {
3039
+ return z53.object({
3040
+ message: z53.string().optional()
3041
+ }).transform((data) => ({
3042
+ message: data["message"]
3043
+ }));
3044
+ });
3045
+ var _19 = class extends Error {
3046
+ constructor(message, response) {
3047
+ super(message);
3048
+ const parsedResponse = _19Response.parse(response);
3049
+ this.message = parsedResponse.message || "";
3050
+ }
3051
+ };
3052
+
2320
3053
  // src/services/e-sim/models/get-esim-history-ok-response.ts
2321
- import { z as z32 } from "zod";
3054
+ import { z as z56 } from "zod";
2322
3055
 
2323
3056
  // src/services/e-sim/models/get-esim-history-ok-response-esim.ts
2324
- import { z as z31 } from "zod";
3057
+ import { z as z55 } from "zod";
2325
3058
 
2326
3059
  // src/services/e-sim/models/history.ts
2327
- import { z as z30 } from "zod";
2328
- var history = z30.lazy(() => {
2329
- return z30.object({
2330
- status: z30.string().optional(),
2331
- statusDate: z30.string().optional(),
2332
- date: z30.number().optional()
3060
+ import { z as z54 } from "zod";
3061
+ var history = z54.lazy(() => {
3062
+ return z54.object({
3063
+ status: z54.string().optional(),
3064
+ statusDate: z54.string().optional(),
3065
+ date: z54.number().optional()
2333
3066
  });
2334
3067
  });
2335
- var historyResponse = z30.lazy(() => {
2336
- return z30.object({
2337
- status: z30.string().optional(),
2338
- statusDate: z30.string().optional(),
2339
- date: z30.number().optional()
3068
+ var historyResponse = z54.lazy(() => {
3069
+ return z54.object({
3070
+ status: z54.string().optional(),
3071
+ statusDate: z54.string().optional(),
3072
+ date: z54.number().optional()
2340
3073
  }).transform((data) => ({
2341
3074
  status: data["status"],
2342
3075
  statusDate: data["statusDate"],
2343
3076
  date: data["date"]
2344
3077
  }));
2345
3078
  });
2346
- var historyRequest = z30.lazy(() => {
2347
- return z30.object({ status: z30.string().nullish(), statusDate: z30.string().nullish(), date: z30.number().nullish() }).transform((data) => ({
3079
+ var historyRequest = z54.lazy(() => {
3080
+ return z54.object({
3081
+ status: z54.string().optional(),
3082
+ statusDate: z54.string().optional(),
3083
+ date: z54.number().optional()
3084
+ }).transform((data) => ({
2348
3085
  status: data["status"],
2349
3086
  statusDate: data["statusDate"],
2350
3087
  date: data["date"]
@@ -2352,75 +3089,114 @@ var historyRequest = z30.lazy(() => {
2352
3089
  });
2353
3090
 
2354
3091
  // src/services/e-sim/models/get-esim-history-ok-response-esim.ts
2355
- var getEsimHistoryOkResponseEsim = z31.lazy(() => {
2356
- return z31.object({
2357
- iccid: z31.string().min(18).max(22).optional(),
2358
- history: z31.array(history).optional()
3092
+ var getEsimHistoryOkResponseEsim = z55.lazy(() => {
3093
+ return z55.object({
3094
+ iccid: z55.string().min(18).max(22).optional(),
3095
+ history: z55.array(history).optional()
2359
3096
  });
2360
3097
  });
2361
- var getEsimHistoryOkResponseEsimResponse = z31.lazy(() => {
2362
- return z31.object({
2363
- iccid: z31.string().min(18).max(22).optional(),
2364
- history: z31.array(historyResponse).optional()
3098
+ var getEsimHistoryOkResponseEsimResponse = z55.lazy(() => {
3099
+ return z55.object({
3100
+ iccid: z55.string().min(18).max(22).optional(),
3101
+ history: z55.array(historyResponse).optional()
2365
3102
  }).transform((data) => ({
2366
3103
  iccid: data["iccid"],
2367
3104
  history: data["history"]
2368
3105
  }));
2369
3106
  });
2370
- var getEsimHistoryOkResponseEsimRequest = z31.lazy(() => {
2371
- return z31.object({ iccid: z31.string().nullish(), history: z31.array(historyRequest).nullish() }).transform((data) => ({
3107
+ var getEsimHistoryOkResponseEsimRequest = z55.lazy(() => {
3108
+ return z55.object({
3109
+ iccid: z55.string().min(18).max(22).optional(),
3110
+ history: z55.array(historyRequest).optional()
3111
+ }).transform((data) => ({
2372
3112
  iccid: data["iccid"],
2373
3113
  history: data["history"]
2374
3114
  }));
2375
3115
  });
2376
3116
 
2377
3117
  // src/services/e-sim/models/get-esim-history-ok-response.ts
2378
- var getEsimHistoryOkResponse = z32.lazy(() => {
2379
- return z32.object({
3118
+ var getEsimHistoryOkResponse = z56.lazy(() => {
3119
+ return z56.object({
2380
3120
  esim: getEsimHistoryOkResponseEsim.optional()
2381
3121
  });
2382
3122
  });
2383
- var getEsimHistoryOkResponseResponse = z32.lazy(() => {
2384
- return z32.object({
3123
+ var getEsimHistoryOkResponseResponse = z56.lazy(() => {
3124
+ return z56.object({
2385
3125
  esim: getEsimHistoryOkResponseEsimResponse.optional()
2386
3126
  }).transform((data) => ({
2387
3127
  esim: data["esim"]
2388
3128
  }));
2389
3129
  });
2390
- var getEsimHistoryOkResponseRequest = z32.lazy(() => {
2391
- return z32.object({ esim: getEsimHistoryOkResponseEsimRequest.nullish() }).transform((data) => ({
3130
+ var getEsimHistoryOkResponseRequest = z56.lazy(() => {
3131
+ return z56.object({
3132
+ esim: getEsimHistoryOkResponseEsimRequest.optional()
3133
+ }).transform((data) => ({
2392
3134
  esim: data["esim"]
2393
3135
  }));
2394
3136
  });
2395
3137
 
3138
+ // src/services/e-sim/models/_20.ts
3139
+ import { z as z57 } from "zod";
3140
+ var _20Response = z57.lazy(() => {
3141
+ return z57.object({
3142
+ message: z57.string().optional()
3143
+ }).transform((data) => ({
3144
+ message: data["message"]
3145
+ }));
3146
+ });
3147
+ var _20 = class extends Error {
3148
+ constructor(message, response) {
3149
+ super(message);
3150
+ const parsedResponse = _20Response.parse(response);
3151
+ this.message = parsedResponse.message || "";
3152
+ }
3153
+ };
3154
+
3155
+ // src/services/e-sim/models/_21.ts
3156
+ import { z as z58 } from "zod";
3157
+ var _21Response = z58.lazy(() => {
3158
+ return z58.object({
3159
+ message: z58.string().optional()
3160
+ }).transform((data) => ({
3161
+ message: data["message"]
3162
+ }));
3163
+ });
3164
+ var _21 = class extends Error {
3165
+ constructor(message, response) {
3166
+ super(message);
3167
+ const parsedResponse = _21Response.parse(response);
3168
+ this.message = parsedResponse.message || "";
3169
+ }
3170
+ };
3171
+
2396
3172
  // src/services/e-sim/models/get-esim-mac-ok-response.ts
2397
- import { z as z34 } from "zod";
3173
+ import { z as z60 } from "zod";
2398
3174
 
2399
3175
  // src/services/e-sim/models/get-esim-mac-ok-response-esim.ts
2400
- import { z as z33 } from "zod";
2401
- var getEsimMacOkResponseEsim = z33.lazy(() => {
2402
- return z33.object({
2403
- iccid: z33.string().min(18).max(22).optional(),
2404
- smdpAddress: z33.string().optional(),
2405
- manualActivationCode: z33.string().optional()
3176
+ import { z as z59 } from "zod";
3177
+ var getEsimMacOkResponseEsim = z59.lazy(() => {
3178
+ return z59.object({
3179
+ iccid: z59.string().min(18).max(22).optional(),
3180
+ smdpAddress: z59.string().optional(),
3181
+ manualActivationCode: z59.string().optional()
2406
3182
  });
2407
3183
  });
2408
- var getEsimMacOkResponseEsimResponse = z33.lazy(() => {
2409
- return z33.object({
2410
- iccid: z33.string().min(18).max(22).optional(),
2411
- smdpAddress: z33.string().optional(),
2412
- manualActivationCode: z33.string().optional()
3184
+ var getEsimMacOkResponseEsimResponse = z59.lazy(() => {
3185
+ return z59.object({
3186
+ iccid: z59.string().min(18).max(22).optional(),
3187
+ smdpAddress: z59.string().optional(),
3188
+ manualActivationCode: z59.string().optional()
2413
3189
  }).transform((data) => ({
2414
3190
  iccid: data["iccid"],
2415
3191
  smdpAddress: data["smdpAddress"],
2416
3192
  manualActivationCode: data["manualActivationCode"]
2417
3193
  }));
2418
3194
  });
2419
- var getEsimMacOkResponseEsimRequest = z33.lazy(() => {
2420
- return z33.object({
2421
- iccid: z33.string().nullish(),
2422
- smdpAddress: z33.string().nullish(),
2423
- manualActivationCode: z33.string().nullish()
3195
+ var getEsimMacOkResponseEsimRequest = z59.lazy(() => {
3196
+ return z59.object({
3197
+ iccid: z59.string().min(18).max(22).optional(),
3198
+ smdpAddress: z59.string().optional(),
3199
+ manualActivationCode: z59.string().optional()
2424
3200
  }).transform((data) => ({
2425
3201
  iccid: data["iccid"],
2426
3202
  smdpAddress: data["smdpAddress"],
@@ -2429,36 +3205,81 @@ var getEsimMacOkResponseEsimRequest = z33.lazy(() => {
2429
3205
  });
2430
3206
 
2431
3207
  // src/services/e-sim/models/get-esim-mac-ok-response.ts
2432
- var getEsimMacOkResponse = z34.lazy(() => {
2433
- return z34.object({
3208
+ var getEsimMacOkResponse = z60.lazy(() => {
3209
+ return z60.object({
2434
3210
  esim: getEsimMacOkResponseEsim.optional()
2435
3211
  });
2436
3212
  });
2437
- var getEsimMacOkResponseResponse = z34.lazy(() => {
2438
- return z34.object({
3213
+ var getEsimMacOkResponseResponse = z60.lazy(() => {
3214
+ return z60.object({
2439
3215
  esim: getEsimMacOkResponseEsimResponse.optional()
2440
3216
  }).transform((data) => ({
2441
3217
  esim: data["esim"]
2442
3218
  }));
2443
3219
  });
2444
- var getEsimMacOkResponseRequest = z34.lazy(() => {
2445
- return z34.object({ esim: getEsimMacOkResponseEsimRequest.nullish() }).transform((data) => ({
3220
+ var getEsimMacOkResponseRequest = z60.lazy(() => {
3221
+ return z60.object({
3222
+ esim: getEsimMacOkResponseEsimRequest.optional()
3223
+ }).transform((data) => ({
2446
3224
  esim: data["esim"]
2447
3225
  }));
2448
3226
  });
2449
3227
 
2450
- // src/services/e-sim/e-sim.ts
3228
+ // src/services/e-sim/models/_22.ts
3229
+ import { z as z61 } from "zod";
3230
+ var _22Response = z61.lazy(() => {
3231
+ return z61.object({
3232
+ message: z61.string().optional()
3233
+ }).transform((data) => ({
3234
+ message: data["message"]
3235
+ }));
3236
+ });
3237
+ var _22 = class extends Error {
3238
+ constructor(message, response) {
3239
+ super(message);
3240
+ const parsedResponse = _22Response.parse(response);
3241
+ this.message = parsedResponse.message || "";
3242
+ }
3243
+ };
3244
+
3245
+ // src/services/e-sim/models/_23.ts
3246
+ import { z as z62 } from "zod";
3247
+ var _23Response = z62.lazy(() => {
3248
+ return z62.object({
3249
+ message: z62.string().optional()
3250
+ }).transform((data) => ({
3251
+ message: data["message"]
3252
+ }));
3253
+ });
3254
+ var _23 = class extends Error {
3255
+ constructor(message, response) {
3256
+ super(message);
3257
+ const parsedResponse = _23Response.parse(response);
3258
+ this.message = parsedResponse.message || "";
3259
+ }
3260
+ };
3261
+
3262
+ // src/services/e-sim/e-sim-service.ts
2451
3263
  var ESimService = class extends BaseService {
2452
3264
  /**
2453
3265
  * Get eSIM Status
2454
3266
  * @param {string} iccid - ID of the eSIM
3267
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2455
3268
  * @returns {Promise<HttpResponse<GetEsimOkResponse>>} Successful Response
2456
3269
  */
2457
3270
  async getEsim(params, requestConfig) {
2458
- const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim").setRequestSchema(z35.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
3271
+ 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(z63.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
2459
3272
  schema: getEsimOkResponseResponse,
2460
3273
  contentType: "json" /* Json */,
2461
3274
  status: 200
3275
+ }).addError({
3276
+ error: _16,
3277
+ contentType: "json" /* Json */,
3278
+ status: 400
3279
+ }).addError({
3280
+ error: _17,
3281
+ contentType: "json" /* Json */,
3282
+ status: 401
2462
3283
  }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
2463
3284
  key: "iccid",
2464
3285
  value: params == null ? void 0 : params.iccid
@@ -2468,13 +3289,22 @@ var ESimService = class extends BaseService {
2468
3289
  /**
2469
3290
  * Get eSIM Device
2470
3291
  * @param {string} iccid - ID of the eSIM
3292
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2471
3293
  * @returns {Promise<HttpResponse<GetEsimDeviceOkResponse>>} Successful Response
2472
3294
  */
2473
3295
  async getEsimDevice(iccid, requestConfig) {
2474
- const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(z35.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
3296
+ 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(z63.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
2475
3297
  schema: getEsimDeviceOkResponseResponse,
2476
3298
  contentType: "json" /* Json */,
2477
3299
  status: 200
3300
+ }).addError({
3301
+ error: _18,
3302
+ contentType: "json" /* Json */,
3303
+ status: 400
3304
+ }).addError({
3305
+ error: _19,
3306
+ contentType: "json" /* Json */,
3307
+ status: 401
2478
3308
  }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2479
3309
  key: "iccid",
2480
3310
  value: iccid
@@ -2484,13 +3314,22 @@ var ESimService = class extends BaseService {
2484
3314
  /**
2485
3315
  * Get eSIM History
2486
3316
  * @param {string} iccid - ID of the eSIM
3317
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2487
3318
  * @returns {Promise<HttpResponse<GetEsimHistoryOkResponse>>} Successful Response
2488
3319
  */
2489
3320
  async getEsimHistory(iccid, requestConfig) {
2490
- const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(z35.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
3321
+ 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(z63.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
2491
3322
  schema: getEsimHistoryOkResponseResponse,
2492
3323
  contentType: "json" /* Json */,
2493
3324
  status: 200
3325
+ }).addError({
3326
+ error: _20,
3327
+ contentType: "json" /* Json */,
3328
+ status: 400
3329
+ }).addError({
3330
+ error: _21,
3331
+ contentType: "json" /* Json */,
3332
+ status: 401
2494
3333
  }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2495
3334
  key: "iccid",
2496
3335
  value: iccid
@@ -2500,13 +3339,22 @@ var ESimService = class extends BaseService {
2500
3339
  /**
2501
3340
  * Get eSIM MAC
2502
3341
  * @param {string} iccid - ID of the eSIM
3342
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2503
3343
  * @returns {Promise<HttpResponse<GetEsimMacOkResponse>>} Successful Response
2504
3344
  */
2505
3345
  async getEsimMac(iccid, requestConfig) {
2506
- const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/mac").setRequestSchema(z35.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
3346
+ 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}/mac").setRequestSchema(z63.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
2507
3347
  schema: getEsimMacOkResponseResponse,
2508
3348
  contentType: "json" /* Json */,
2509
3349
  status: 200
3350
+ }).addError({
3351
+ error: _22,
3352
+ contentType: "json" /* Json */,
3353
+ status: 400
3354
+ }).addError({
3355
+ error: _23,
3356
+ contentType: "json" /* Json */,
3357
+ status: 401
2510
3358
  }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2511
3359
  key: "iccid",
2512
3360
  value: iccid
@@ -2515,21 +3363,101 @@ var ESimService = class extends BaseService {
2515
3363
  }
2516
3364
  };
2517
3365
 
3366
+ // src/services/i-frame/i-frame-service.ts
3367
+ import { z as z67 } from "zod";
3368
+
3369
+ // src/services/i-frame/models/token-ok-response.ts
3370
+ import { z as z64 } from "zod";
3371
+ var tokenOkResponse = z64.lazy(() => {
3372
+ return z64.object({
3373
+ token: z64.string().optional()
3374
+ });
3375
+ });
3376
+ var tokenOkResponseResponse = z64.lazy(() => {
3377
+ return z64.object({
3378
+ token: z64.string().optional()
3379
+ }).transform((data) => ({
3380
+ token: data["token"]
3381
+ }));
3382
+ });
3383
+ var tokenOkResponseRequest = z64.lazy(() => {
3384
+ return z64.object({
3385
+ token: z64.string().optional()
3386
+ }).transform((data) => ({
3387
+ token: data["token"]
3388
+ }));
3389
+ });
3390
+
3391
+ // src/services/i-frame/models/_24.ts
3392
+ import { z as z65 } from "zod";
3393
+ var _24Response = z65.lazy(() => {
3394
+ return z65.object({
3395
+ message: z65.string().optional()
3396
+ }).transform((data) => ({
3397
+ message: data["message"]
3398
+ }));
3399
+ });
3400
+ var _24 = class extends Error {
3401
+ constructor(message, response) {
3402
+ super(message);
3403
+ const parsedResponse = _24Response.parse(response);
3404
+ this.message = parsedResponse.message || "";
3405
+ }
3406
+ };
3407
+
3408
+ // src/services/i-frame/models/_25.ts
3409
+ import { z as z66 } from "zod";
3410
+ var _25Response = z66.lazy(() => {
3411
+ return z66.object({
3412
+ message: z66.string().optional()
3413
+ }).transform((data) => ({
3414
+ message: data["message"]
3415
+ }));
3416
+ });
3417
+ var _25 = class extends Error {
3418
+ constructor(message, response) {
3419
+ super(message);
3420
+ const parsedResponse = _25Response.parse(response);
3421
+ this.message = parsedResponse.message || "";
3422
+ }
3423
+ };
3424
+
3425
+ // src/services/i-frame/i-frame-service.ts
3426
+ var IFrameService = class extends BaseService {
3427
+ /**
3428
+ * Generate a new token to be used in the iFrame
3429
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
3430
+ * @returns {Promise<HttpResponse<TokenOkResponse>>} Successful Response
3431
+ */
3432
+ async token(requestConfig) {
3433
+ 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(z67.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
3434
+ schema: tokenOkResponseResponse,
3435
+ contentType: "json" /* Json */,
3436
+ status: 200
3437
+ }).addError({
3438
+ error: _24,
3439
+ contentType: "json" /* Json */,
3440
+ status: 400
3441
+ }).addError({
3442
+ error: _25,
3443
+ contentType: "json" /* Json */,
3444
+ status: 401
3445
+ }).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).build();
3446
+ return this.client.call(request);
3447
+ }
3448
+ };
3449
+
2518
3450
  // src/index.ts
2519
3451
  var Celitech = class {
2520
3452
  constructor(config) {
2521
3453
  this.config = config;
2522
3454
  this.tokenManager = new OAuthTokenManager();
2523
- const baseUrl = config.environment || config.baseUrl || "https://api.celitech.net/v1" /* DEFAULT */;
2524
- this.config = {
2525
- ...config,
2526
- baseUrl
2527
- };
2528
3455
  this.oAuth = new OAuthService(this.config, this.tokenManager);
2529
3456
  this.destinations = new DestinationsService(this.config, this.tokenManager);
2530
3457
  this.packages = new PackagesService(this.config, this.tokenManager);
2531
3458
  this.purchases = new PurchasesService(this.config, this.tokenManager);
2532
3459
  this.eSim = new ESimService(this.config, this.tokenManager);
3460
+ this.iFrame = new IFrameService(this.config, this.tokenManager);
2533
3461
  }
2534
3462
  set baseUrl(baseUrl) {
2535
3463
  this.oAuth.baseUrl = baseUrl;
@@ -2537,6 +3465,7 @@ var Celitech = class {
2537
3465
  this.packages.baseUrl = baseUrl;
2538
3466
  this.purchases.baseUrl = baseUrl;
2539
3467
  this.eSim.baseUrl = baseUrl;
3468
+ this.iFrame.baseUrl = baseUrl;
2540
3469
  }
2541
3470
  set environment(environment) {
2542
3471
  this.oAuth.baseUrl = environment;
@@ -2544,6 +3473,7 @@ var Celitech = class {
2544
3473
  this.packages.baseUrl = environment;
2545
3474
  this.purchases.baseUrl = environment;
2546
3475
  this.eSim.baseUrl = environment;
3476
+ this.iFrame.baseUrl = environment;
2547
3477
  }
2548
3478
  set timeoutMs(timeoutMs) {
2549
3479
  this.oAuth.timeoutMs = timeoutMs;
@@ -2551,6 +3481,7 @@ var Celitech = class {
2551
3481
  this.packages.timeoutMs = timeoutMs;
2552
3482
  this.purchases.timeoutMs = timeoutMs;
2553
3483
  this.eSim.timeoutMs = timeoutMs;
3484
+ this.iFrame.timeoutMs = timeoutMs;
2554
3485
  }
2555
3486
  set clientId(clientId) {
2556
3487
  this.oAuth.clientId = clientId;
@@ -2558,6 +3489,7 @@ var Celitech = class {
2558
3489
  this.packages.clientId = clientId;
2559
3490
  this.purchases.clientId = clientId;
2560
3491
  this.eSim.clientId = clientId;
3492
+ this.iFrame.clientId = clientId;
2561
3493
  }
2562
3494
  set clientSecret(clientSecret) {
2563
3495
  this.oAuth.clientSecret = clientSecret;
@@ -2565,6 +3497,7 @@ var Celitech = class {
2565
3497
  this.packages.clientSecret = clientSecret;
2566
3498
  this.purchases.clientSecret = clientSecret;
2567
3499
  this.eSim.clientSecret = clientSecret;
3500
+ this.iFrame.clientSecret = clientSecret;
2568
3501
  }
2569
3502
  set oAuthBaseUrl(oAuthBaseUrl) {
2570
3503
  this.oAuth.oAuthBaseUrl = oAuthBaseUrl;
@@ -2572,13 +3505,24 @@ var Celitech = class {
2572
3505
  this.packages.oAuthBaseUrl = oAuthBaseUrl;
2573
3506
  this.purchases.oAuthBaseUrl = oAuthBaseUrl;
2574
3507
  this.eSim.oAuthBaseUrl = oAuthBaseUrl;
3508
+ this.iFrame.oAuthBaseUrl = oAuthBaseUrl;
3509
+ }
3510
+ set accessToken(accessToken) {
3511
+ this.oAuth.accessToken = accessToken;
3512
+ this.destinations.accessToken = accessToken;
3513
+ this.packages.accessToken = accessToken;
3514
+ this.purchases.accessToken = accessToken;
3515
+ this.eSim.accessToken = accessToken;
3516
+ this.iFrame.accessToken = accessToken;
2575
3517
  }
2576
3518
  };
2577
3519
  export {
2578
3520
  Celitech,
2579
3521
  DestinationsService,
2580
3522
  ESimService,
3523
+ Environment,
2581
3524
  GrantType,
3525
+ IFrameService,
2582
3526
  OAuthService,
2583
3527
  PackagesService,
2584
3528
  PurchasesService