celitech-sdk 1.3.63 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -9
- package/dist/index.d.ts +213 -62
- package/dist/index.js +479 -164
- package/dist/index.mjs +477 -164
- package/package.json +7 -3
package/dist/index.mjs
CHANGED
|
@@ -235,7 +235,11 @@ var TransportHookAdapter = class {
|
|
|
235
235
|
method: newRequest.method,
|
|
236
236
|
path: newRequest.path,
|
|
237
237
|
body: newRequest.body,
|
|
238
|
-
queryParams: this.hookParamsToTransportParams(
|
|
238
|
+
queryParams: this.hookParamsToTransportParams(
|
|
239
|
+
newRequest.queryParams,
|
|
240
|
+
request.queryParams,
|
|
241
|
+
true
|
|
242
|
+
),
|
|
239
243
|
headers: this.hookParamsToTransportParams(newRequest.headers, request.headers, false),
|
|
240
244
|
pathParams: this.hookParamsToTransportParams(newRequest.pathParams, request.headers, false)
|
|
241
245
|
});
|
|
@@ -399,7 +403,9 @@ var HookHandler = class {
|
|
|
399
403
|
if (error) {
|
|
400
404
|
const decodedBody2 = new TextDecoder().decode(arrayBuffer);
|
|
401
405
|
const json = JSON.parse(decodedBody2);
|
|
402
|
-
new error.error((json == null ? void 0 : json.message) || "", json)
|
|
406
|
+
const customError = new error.error((json == null ? void 0 : json.message) || "", json);
|
|
407
|
+
customError.metadata = response.metadata;
|
|
408
|
+
customError.throw();
|
|
403
409
|
}
|
|
404
410
|
const decodedBody = new TextDecoder().decode(arrayBuffer);
|
|
405
411
|
throw new HttpError(
|
|
@@ -602,8 +608,8 @@ var ResponseValidationHandler = class {
|
|
|
602
608
|
* @returns The validated data (parsed if validation enabled, raw otherwise)
|
|
603
609
|
*/
|
|
604
610
|
validate(request, response, data) {
|
|
605
|
-
var _a;
|
|
606
|
-
if ((_a = request.validation) == null ? void 0 : _a.responseValidation) {
|
|
611
|
+
var _a, _b;
|
|
612
|
+
if ((_b = (_a = request.config.validation) == null ? void 0 : _a.responseValidation) != null ? _b : true) {
|
|
607
613
|
return response.schema.parse(data);
|
|
608
614
|
}
|
|
609
615
|
return data;
|
|
@@ -676,7 +682,9 @@ var ValidationError = class extends Error {
|
|
|
676
682
|
}
|
|
677
683
|
const error = [
|
|
678
684
|
`ValidationError:`,
|
|
679
|
-
...zodError.issues.map(
|
|
685
|
+
...zodError.issues.map(
|
|
686
|
+
(issue) => ` Property: ${issue.path.join(".")}. Message: ${issue.message}`
|
|
687
|
+
),
|
|
680
688
|
" Validated:",
|
|
681
689
|
...actual.split("\n").map((line) => ` ${line}`)
|
|
682
690
|
].join("\n");
|
|
@@ -984,7 +992,10 @@ var RequestFetchAdapter = class {
|
|
|
984
992
|
return headers;
|
|
985
993
|
}
|
|
986
994
|
toArrayBuffer(uint8Array) {
|
|
987
|
-
return uint8Array.buffer.slice(
|
|
995
|
+
return uint8Array.buffer.slice(
|
|
996
|
+
uint8Array.byteOffset,
|
|
997
|
+
uint8Array.byteOffset + uint8Array.byteLength
|
|
998
|
+
);
|
|
988
999
|
}
|
|
989
1000
|
};
|
|
990
1001
|
|
|
@@ -1015,23 +1026,27 @@ var RetryHandler = class {
|
|
|
1015
1026
|
/**
|
|
1016
1027
|
* Handles a standard HTTP request with retry logic.
|
|
1017
1028
|
* Retries failed requests based on the configured retry settings.
|
|
1029
|
+
* Implements exponential backoff with optional jitter between retry attempts.
|
|
1018
1030
|
* @template T - The expected response data type
|
|
1019
1031
|
* @param request - The HTTP request to process
|
|
1020
1032
|
* @returns A promise that resolves to the HTTP response
|
|
1021
1033
|
* @throws Error if no next handler is set, or if all retry attempts fail
|
|
1022
1034
|
*/
|
|
1023
1035
|
async handle(request) {
|
|
1036
|
+
var _a, _b;
|
|
1024
1037
|
if (!this.next) {
|
|
1025
1038
|
throw new Error("No next handler set in retry handler.");
|
|
1026
1039
|
}
|
|
1027
|
-
|
|
1040
|
+
const maxAttempts = (_b = (_a = request.config.retry) == null ? void 0 : _a.attempts) != null ? _b : 3;
|
|
1041
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
1028
1042
|
try {
|
|
1029
1043
|
return await this.next.handle(request);
|
|
1030
1044
|
} catch (error) {
|
|
1031
|
-
if (!this.shouldRetry(error) || attempt ===
|
|
1045
|
+
if (!this.shouldRetry(error, request) || attempt === maxAttempts) {
|
|
1032
1046
|
throw error;
|
|
1033
1047
|
}
|
|
1034
|
-
|
|
1048
|
+
const delayMs = this.calculateDelay(attempt, request);
|
|
1049
|
+
await this.delay(delayMs);
|
|
1035
1050
|
}
|
|
1036
1051
|
}
|
|
1037
1052
|
throw new Error("Error retrying request.");
|
|
@@ -1044,38 +1059,78 @@ var RetryHandler = class {
|
|
|
1044
1059
|
* @throws Error if no next handler is set, or if all retry attempts fail
|
|
1045
1060
|
*/
|
|
1046
1061
|
async *stream(request) {
|
|
1062
|
+
var _a, _b;
|
|
1047
1063
|
if (!this.next) {
|
|
1048
1064
|
throw new Error("No next handler set in retry handler.");
|
|
1049
1065
|
}
|
|
1050
|
-
|
|
1066
|
+
const maxAttempts = (_b = (_a = request.config.retry) == null ? void 0 : _a.attempts) != null ? _b : 3;
|
|
1067
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
1051
1068
|
try {
|
|
1052
1069
|
yield* this.next.stream(request);
|
|
1053
1070
|
return;
|
|
1054
1071
|
} catch (error) {
|
|
1055
|
-
if (!this.shouldRetry(error) || attempt ===
|
|
1072
|
+
if (!this.shouldRetry(error, request) || attempt === maxAttempts) {
|
|
1056
1073
|
throw error;
|
|
1057
1074
|
}
|
|
1058
|
-
|
|
1075
|
+
const delayMs = this.calculateDelay(attempt, request);
|
|
1076
|
+
await this.delay(delayMs);
|
|
1059
1077
|
}
|
|
1060
1078
|
}
|
|
1061
1079
|
throw new Error("Error retrying request.");
|
|
1062
1080
|
}
|
|
1063
1081
|
/**
|
|
1064
1082
|
* Determines if an error should trigger a retry.
|
|
1065
|
-
*
|
|
1083
|
+
* Checks both HTTP status codes and HTTP methods against the configured retry settings.
|
|
1084
|
+
* By default, retries all 5xx server errors and specific 4xx client errors (408 Timeout, 429 Rate Limit).
|
|
1066
1085
|
* @param error - The error to check
|
|
1086
|
+
* @param request - The HTTP request being retried
|
|
1067
1087
|
* @returns True if the request should be retried, false otherwise
|
|
1068
1088
|
*/
|
|
1069
|
-
shouldRetry(error) {
|
|
1070
|
-
|
|
1089
|
+
shouldRetry(error, request) {
|
|
1090
|
+
var _a, _b, _c;
|
|
1091
|
+
if (!(error instanceof HttpError)) {
|
|
1092
|
+
return false;
|
|
1093
|
+
}
|
|
1094
|
+
const httpMethodsToRetry = (_b = (_a = request.config.retry) == null ? void 0 : _a.httpMethodsToRetry) != null ? _b : [
|
|
1095
|
+
"GET",
|
|
1096
|
+
"POST",
|
|
1097
|
+
"PUT",
|
|
1098
|
+
"DELETE",
|
|
1099
|
+
"PATCH",
|
|
1100
|
+
"HEAD",
|
|
1101
|
+
"OPTIONS"
|
|
1102
|
+
];
|
|
1103
|
+
const shouldRetryStatus = ((_c = request.config.retry) == null ? void 0 : _c.statusCodesToRetry) ? request.config.retry.statusCodesToRetry.includes(error.metadata.status) : error.metadata.status >= 500 || [408, 429].includes(error.metadata.status);
|
|
1104
|
+
const shouldRetryMethod = httpMethodsToRetry.includes(request.method);
|
|
1105
|
+
return shouldRetryStatus && shouldRetryMethod;
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* Calculates the delay before the next retry attempt using exponential backoff.
|
|
1109
|
+
* Optionally adds jitter to prevent thundering herd problems.
|
|
1110
|
+
* @param attempt - The current retry attempt number (1-indexed)
|
|
1111
|
+
* @param request - The HTTP request being retried
|
|
1112
|
+
* @returns The delay in milliseconds, capped at the configured maximum delay
|
|
1113
|
+
*/
|
|
1114
|
+
calculateDelay(attempt, request) {
|
|
1115
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1116
|
+
const baseDelay = (_b = (_a = request.config.retry) == null ? void 0 : _a.delayMs) != null ? _b : 150;
|
|
1117
|
+
const backoffFactor = (_d = (_c = request.config.retry) == null ? void 0 : _c.backoffFactor) != null ? _d : 2;
|
|
1118
|
+
const maxDelay = (_f = (_e = request.config.retry) == null ? void 0 : _e.maxDelayMs) != null ? _f : 5e3;
|
|
1119
|
+
const jitter = (_h = (_g = request.config.retry) == null ? void 0 : _g.jitterMs) != null ? _h : 50;
|
|
1120
|
+
let delay = baseDelay * Math.pow(backoffFactor, attempt - 1);
|
|
1121
|
+
delay = Math.min(delay, maxDelay);
|
|
1122
|
+
if (jitter > 0) {
|
|
1123
|
+
delay += Math.random() * jitter;
|
|
1124
|
+
}
|
|
1125
|
+
return Math.floor(delay);
|
|
1071
1126
|
}
|
|
1072
1127
|
/**
|
|
1073
1128
|
* Delays execution for a specified duration before retrying.
|
|
1074
|
-
* @param delayMs - The delay in milliseconds
|
|
1129
|
+
* @param delayMs - The delay in milliseconds
|
|
1075
1130
|
* @returns A promise that resolves after the delay
|
|
1076
1131
|
*/
|
|
1077
1132
|
delay(delayMs) {
|
|
1078
|
-
if (
|
|
1133
|
+
if (delayMs <= 0) {
|
|
1079
1134
|
return Promise.resolve();
|
|
1080
1135
|
}
|
|
1081
1136
|
return new Promise((resolve, reject) => {
|
|
@@ -1186,6 +1241,15 @@ var HttpClient = class {
|
|
|
1186
1241
|
call(request) {
|
|
1187
1242
|
return this.requestHandlerChain.callChain(request);
|
|
1188
1243
|
}
|
|
1244
|
+
/**
|
|
1245
|
+
* Executes a standard HTTP request and returns only the data directly.
|
|
1246
|
+
* @template T - The expected response data type
|
|
1247
|
+
* @param request - The HTTP request to execute
|
|
1248
|
+
* @returns A promise that resolves to the response data
|
|
1249
|
+
*/
|
|
1250
|
+
callDirect(request) {
|
|
1251
|
+
return this.call(request).then((response) => response.data);
|
|
1252
|
+
}
|
|
1189
1253
|
/**
|
|
1190
1254
|
* Executes a streaming HTTP request that yields responses incrementally.
|
|
1191
1255
|
* @template T - The expected response data type for each chunk
|
|
@@ -1306,6 +1370,61 @@ var BaseService = class {
|
|
|
1306
1370
|
this.tokenManager = tokenManager;
|
|
1307
1371
|
this.client = new HttpClient(this.config);
|
|
1308
1372
|
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Sets service-level configuration that applies to all methods in this service.
|
|
1375
|
+
* @param config - Partial configuration to override SDK-level defaults
|
|
1376
|
+
* @returns This service instance for method chaining
|
|
1377
|
+
*/
|
|
1378
|
+
setConfig(config) {
|
|
1379
|
+
this.serviceConfig = config;
|
|
1380
|
+
return this;
|
|
1381
|
+
}
|
|
1382
|
+
/**
|
|
1383
|
+
* Recursively merges two objects. Plain nested objects are merged key-by-key so a
|
|
1384
|
+
* partial override (e.g. `{ retry: { attempts: 5 } }`) only overwrites the specified
|
|
1385
|
+
* keys instead of replacing the whole nested object. Arrays and non-plain values are
|
|
1386
|
+
* replaced wholesale.
|
|
1387
|
+
*
|
|
1388
|
+
* Override keys with the value `undefined` are skipped so the base value is preserved,
|
|
1389
|
+
* matching the common JS merge idiom (e.g. lodash.merge). To explicitly clear a key,
|
|
1390
|
+
* assign `null` or omit the key from the override entirely.
|
|
1391
|
+
*/
|
|
1392
|
+
static deepMerge(base, override) {
|
|
1393
|
+
const result = { ...base };
|
|
1394
|
+
for (const [key, value] of Object.entries(override)) {
|
|
1395
|
+
const existing = result[key];
|
|
1396
|
+
if (BaseService.isPlainObject(value) && BaseService.isPlainObject(existing)) {
|
|
1397
|
+
result[key] = BaseService.deepMerge(existing, value);
|
|
1398
|
+
} else if (value !== void 0) {
|
|
1399
|
+
result[key] = value;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
return result;
|
|
1403
|
+
}
|
|
1404
|
+
static isPlainObject(value) {
|
|
1405
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Resolves configuration from the hierarchy: requestConfig > methodConfig > serviceConfig > sdkConfig
|
|
1409
|
+
* Deep-merges all config levels so partial nested overrides (e.g. `{ retry: { attempts: 5 } }`)
|
|
1410
|
+
* preserve unoverridden sibling keys from the SDK default.
|
|
1411
|
+
* @param methodConfig - Method-level configuration override
|
|
1412
|
+
* @param requestConfig - Request-level configuration override
|
|
1413
|
+
* @returns Merged configuration with all overrides applied
|
|
1414
|
+
*/
|
|
1415
|
+
getResolvedConfig(methodConfig, requestConfig) {
|
|
1416
|
+
let merged = { ...this.config };
|
|
1417
|
+
if (this.serviceConfig) {
|
|
1418
|
+
merged = BaseService.deepMerge(merged, this.serviceConfig);
|
|
1419
|
+
}
|
|
1420
|
+
if (methodConfig) {
|
|
1421
|
+
merged = BaseService.deepMerge(merged, methodConfig);
|
|
1422
|
+
}
|
|
1423
|
+
if (requestConfig) {
|
|
1424
|
+
merged = BaseService.deepMerge(merged, requestConfig);
|
|
1425
|
+
}
|
|
1426
|
+
return merged;
|
|
1427
|
+
}
|
|
1309
1428
|
set baseUrl(baseUrl) {
|
|
1310
1429
|
this.config.baseUrl = baseUrl;
|
|
1311
1430
|
}
|
|
@@ -1482,8 +1601,6 @@ var Request = class {
|
|
|
1482
1601
|
this.queryParams = /* @__PURE__ */ new Map();
|
|
1483
1602
|
this.pathParams = /* @__PURE__ */ new Map();
|
|
1484
1603
|
this.cookies = /* @__PURE__ */ new Map();
|
|
1485
|
-
this.validation = {};
|
|
1486
|
-
this.retry = {};
|
|
1487
1604
|
this.baseUrl = params.baseUrl;
|
|
1488
1605
|
this.method = params.method;
|
|
1489
1606
|
this.pathPattern = params.path;
|
|
@@ -1498,8 +1615,6 @@ var Request = class {
|
|
|
1498
1615
|
this.errors = params.errors;
|
|
1499
1616
|
this.requestSchema = params.requestSchema;
|
|
1500
1617
|
this.requestContentType = params.requestContentType;
|
|
1501
|
-
this.retry = params.retry;
|
|
1502
|
-
this.validation = params.validation;
|
|
1503
1618
|
this.pagination = params.pagination;
|
|
1504
1619
|
this.filename = params.filename;
|
|
1505
1620
|
this.filenames = params.filenames;
|
|
@@ -1612,7 +1727,7 @@ var Request = class {
|
|
|
1612
1727
|
* @returns A new Request instance with the specified overrides
|
|
1613
1728
|
*/
|
|
1614
1729
|
copy(overrides) {
|
|
1615
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o
|
|
1730
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
1616
1731
|
const createRequestParams = {
|
|
1617
1732
|
baseUrl: (_a = overrides == null ? void 0 : overrides.baseUrl) != null ? _a : this.baseUrl,
|
|
1618
1733
|
errors: (_b = overrides == null ? void 0 : overrides.errors) != null ? _b : this.errors,
|
|
@@ -1627,10 +1742,8 @@ var Request = class {
|
|
|
1627
1742
|
responses: (_k = overrides == null ? void 0 : overrides.responses) != null ? _k : this.responses,
|
|
1628
1743
|
requestSchema: (_l = overrides == null ? void 0 : overrides.requestSchema) != null ? _l : this.requestSchema,
|
|
1629
1744
|
requestContentType: (_m = overrides == null ? void 0 : overrides.requestContentType) != null ? _m : this.requestContentType,
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
filename: (_p = overrides == null ? void 0 : overrides.filename) != null ? _p : this.filename,
|
|
1633
|
-
filenames: (_q = overrides == null ? void 0 : overrides.filenames) != null ? _q : this.filenames,
|
|
1745
|
+
filename: (_n = overrides == null ? void 0 : overrides.filename) != null ? _n : this.filename,
|
|
1746
|
+
filenames: (_o = overrides == null ? void 0 : overrides.filenames) != null ? _o : this.filenames,
|
|
1634
1747
|
scopes: overrides == null ? void 0 : overrides.scopes,
|
|
1635
1748
|
tokenManager: this.tokenManager
|
|
1636
1749
|
};
|
|
@@ -1732,55 +1845,73 @@ var RequestBuilder = class {
|
|
|
1732
1845
|
baseUrl: "https://api.celitech.net/v1" /* DEFAULT */,
|
|
1733
1846
|
method: "GET",
|
|
1734
1847
|
path: "",
|
|
1735
|
-
config: {
|
|
1848
|
+
config: {
|
|
1849
|
+
clientId: "",
|
|
1850
|
+
clientSecret: "",
|
|
1851
|
+
retry: {
|
|
1852
|
+
attempts: 3,
|
|
1853
|
+
delayMs: 150,
|
|
1854
|
+
maxDelayMs: 5e3,
|
|
1855
|
+
backoffFactor: 2,
|
|
1856
|
+
jitterMs: 50,
|
|
1857
|
+
httpMethodsToRetry: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]
|
|
1858
|
+
},
|
|
1859
|
+
validation: { responseValidation: true }
|
|
1860
|
+
},
|
|
1736
1861
|
responses: [],
|
|
1737
1862
|
errors: [],
|
|
1738
1863
|
requestSchema: z.any(),
|
|
1739
1864
|
requestContentType: "json" /* Json */,
|
|
1740
|
-
retry: {
|
|
1741
|
-
attempts: 3,
|
|
1742
|
-
delayMs: 150
|
|
1743
|
-
},
|
|
1744
|
-
validation: {
|
|
1745
|
-
responseValidation: true
|
|
1746
|
-
},
|
|
1747
1865
|
pathParams: /* @__PURE__ */ new Map(),
|
|
1748
1866
|
queryParams: /* @__PURE__ */ new Map(),
|
|
1749
1867
|
headers: /* @__PURE__ */ new Map(),
|
|
1750
1868
|
cookies: /* @__PURE__ */ new Map(),
|
|
1751
1869
|
tokenManager: new OAuthTokenManager()
|
|
1752
1870
|
};
|
|
1871
|
+
this.addHeaderParam({
|
|
1872
|
+
key: "User-Agent",
|
|
1873
|
+
value: "postman-codegen/1.1.2 celitech-sdk/2.0.0 (typescript)"
|
|
1874
|
+
});
|
|
1753
1875
|
}
|
|
1754
|
-
|
|
1876
|
+
setConfig(config) {
|
|
1755
1877
|
var _a, _b;
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
this.params.retry.attempts = sdkConfig.retry.attempts;
|
|
1878
|
+
let mergedRetry = (_a = config.retry) != null ? _a : this.params.config.retry;
|
|
1879
|
+
if (config.retry !== void 0 && this.params.config.retry !== void 0) {
|
|
1880
|
+
mergedRetry = { ...this.params.config.retry, ...config.retry };
|
|
1760
1881
|
}
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
var _a, _b;
|
|
1765
|
-
if (((_a = requestConfig == null ? void 0 : requestConfig.retry) == null ? void 0 : _a.delayMs) !== void 0) {
|
|
1766
|
-
this.params.retry.delayMs = requestConfig.retry.delayMs;
|
|
1767
|
-
} else if (((_b = sdkConfig == null ? void 0 : sdkConfig.retry) == null ? void 0 : _b.delayMs) !== void 0) {
|
|
1768
|
-
this.params.retry.delayMs = sdkConfig.retry.delayMs;
|
|
1882
|
+
let mergedValidation = (_b = config.validation) != null ? _b : this.params.config.validation;
|
|
1883
|
+
if (config.validation !== void 0 && this.params.config.validation !== void 0) {
|
|
1884
|
+
mergedValidation = { ...this.params.config.validation, ...config.validation };
|
|
1769
1885
|
}
|
|
1886
|
+
this.params.config = {
|
|
1887
|
+
...this.params.config,
|
|
1888
|
+
...config,
|
|
1889
|
+
...mergedRetry !== void 0 && { retry: mergedRetry },
|
|
1890
|
+
...mergedValidation !== void 0 && { validation: mergedValidation }
|
|
1891
|
+
};
|
|
1770
1892
|
return this;
|
|
1771
1893
|
}
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1894
|
+
/**
|
|
1895
|
+
* Sets the base URL for the request using hierarchical configuration resolution.
|
|
1896
|
+
*
|
|
1897
|
+
* Resolution logic:
|
|
1898
|
+
* 1. First tries to resolve 'baseUrl' (string) from the resolved config
|
|
1899
|
+
* 2. If no 'baseUrl' found, falls back to 'environment' (enum) from the resolved config
|
|
1900
|
+
* 3. 'baseUrl' always takes precedence over 'environment'
|
|
1901
|
+
*
|
|
1902
|
+
* @param config - Resolved configuration from all hierarchy levels
|
|
1903
|
+
* @returns This builder instance for method chaining
|
|
1904
|
+
*/
|
|
1905
|
+
setBaseUrl(config) {
|
|
1906
|
+
if (!config) {
|
|
1907
|
+
return this;
|
|
1778
1908
|
}
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1909
|
+
if ("baseUrl" in config && typeof config.baseUrl === "string" && config.baseUrl) {
|
|
1910
|
+
this.params.baseUrl = config.baseUrl;
|
|
1911
|
+
return this;
|
|
1912
|
+
}
|
|
1913
|
+
if ("environment" in config && config.environment) {
|
|
1914
|
+
this.params.baseUrl = config.environment;
|
|
1784
1915
|
}
|
|
1785
1916
|
return this;
|
|
1786
1917
|
}
|
|
@@ -1792,10 +1923,6 @@ var RequestBuilder = class {
|
|
|
1792
1923
|
this.params.path = path;
|
|
1793
1924
|
return this;
|
|
1794
1925
|
}
|
|
1795
|
-
setConfig(config) {
|
|
1796
|
-
this.params.config = config;
|
|
1797
|
-
return this;
|
|
1798
|
-
}
|
|
1799
1926
|
setRequestContentType(contentType) {
|
|
1800
1927
|
this.params.requestContentType = contentType;
|
|
1801
1928
|
return this;
|
|
@@ -1838,7 +1965,7 @@ var RequestBuilder = class {
|
|
|
1838
1965
|
}
|
|
1839
1966
|
this.params.headers.set("Authorization", {
|
|
1840
1967
|
key: "Authorization",
|
|
1841
|
-
value: `${prefix != null ? prefix : "
|
|
1968
|
+
value: `${prefix != null ? prefix : "Bearer"} ${accessToken}`,
|
|
1842
1969
|
explode: false,
|
|
1843
1970
|
style: "simple" /* SIMPLE */,
|
|
1844
1971
|
encode: true,
|
|
@@ -1985,66 +2112,66 @@ var RequestBuilder = class {
|
|
|
1985
2112
|
}
|
|
1986
2113
|
};
|
|
1987
2114
|
|
|
1988
|
-
// src/services/o-auth/models/
|
|
2115
|
+
// src/services/o-auth/models/o-auth-token-request.ts
|
|
1989
2116
|
import { z as z2 } from "zod";
|
|
1990
|
-
var
|
|
2117
|
+
var oAuthTokenRequest = z2.lazy(() => {
|
|
1991
2118
|
return z2.object({
|
|
1992
|
-
grantType: z2.string()
|
|
1993
|
-
clientId: z2.string()
|
|
1994
|
-
clientSecret: z2.string()
|
|
2119
|
+
grantType: z2.string(),
|
|
2120
|
+
clientId: z2.string(),
|
|
2121
|
+
clientSecret: z2.string(),
|
|
2122
|
+
scope: z2.string()
|
|
1995
2123
|
});
|
|
1996
2124
|
});
|
|
1997
|
-
var
|
|
2125
|
+
var oAuthTokenRequestResponse = z2.lazy(() => {
|
|
1998
2126
|
return z2.object({
|
|
1999
|
-
grant_type: z2.string()
|
|
2000
|
-
client_id: z2.string()
|
|
2001
|
-
client_secret: z2.string()
|
|
2127
|
+
grant_type: z2.string(),
|
|
2128
|
+
client_id: z2.string(),
|
|
2129
|
+
client_secret: z2.string(),
|
|
2130
|
+
scope: z2.string()
|
|
2002
2131
|
}).transform((data) => ({
|
|
2003
2132
|
grantType: data["grant_type"],
|
|
2004
2133
|
clientId: data["client_id"],
|
|
2005
|
-
clientSecret: data["client_secret"]
|
|
2134
|
+
clientSecret: data["client_secret"],
|
|
2135
|
+
scope: data["scope"]
|
|
2006
2136
|
}));
|
|
2007
2137
|
});
|
|
2008
|
-
var
|
|
2138
|
+
var oAuthTokenRequestRequest = z2.lazy(() => {
|
|
2009
2139
|
return z2.object({
|
|
2010
|
-
grantType: z2.string()
|
|
2011
|
-
clientId: z2.string()
|
|
2012
|
-
clientSecret: z2.string()
|
|
2140
|
+
grantType: z2.string(),
|
|
2141
|
+
clientId: z2.string(),
|
|
2142
|
+
clientSecret: z2.string(),
|
|
2143
|
+
scope: z2.string()
|
|
2013
2144
|
}).transform((data) => ({
|
|
2014
2145
|
grant_type: data["grantType"],
|
|
2015
2146
|
client_id: data["clientId"],
|
|
2016
|
-
client_secret: data["clientSecret"]
|
|
2147
|
+
client_secret: data["clientSecret"],
|
|
2148
|
+
scope: data["scope"]
|
|
2017
2149
|
}));
|
|
2018
2150
|
});
|
|
2019
2151
|
|
|
2020
|
-
// src/services/o-auth/models/
|
|
2152
|
+
// src/services/o-auth/models/o-auth-token-response.ts
|
|
2021
2153
|
import { z as z3 } from "zod";
|
|
2022
|
-
var
|
|
2154
|
+
var oAuthTokenResponse = z3.lazy(() => {
|
|
2023
2155
|
return z3.object({
|
|
2024
2156
|
accessToken: z3.string().optional(),
|
|
2025
|
-
|
|
2026
|
-
expiresIn: z3.number().optional()
|
|
2157
|
+
expiresIn: z3.number().optional().nullable()
|
|
2027
2158
|
});
|
|
2028
2159
|
});
|
|
2029
|
-
var
|
|
2160
|
+
var oAuthTokenResponseResponse = z3.lazy(() => {
|
|
2030
2161
|
return z3.object({
|
|
2031
2162
|
access_token: z3.string().optional(),
|
|
2032
|
-
|
|
2033
|
-
expires_in: z3.number().optional()
|
|
2163
|
+
expires_in: z3.number().optional().nullable()
|
|
2034
2164
|
}).transform((data) => ({
|
|
2035
2165
|
accessToken: data["access_token"],
|
|
2036
|
-
tokenType: data["token_type"],
|
|
2037
2166
|
expiresIn: data["expires_in"]
|
|
2038
2167
|
}));
|
|
2039
2168
|
});
|
|
2040
|
-
var
|
|
2169
|
+
var oAuthTokenResponseRequest = z3.lazy(() => {
|
|
2041
2170
|
return z3.object({
|
|
2042
2171
|
accessToken: z3.string().optional(),
|
|
2043
|
-
|
|
2044
|
-
expiresIn: z3.number().optional()
|
|
2172
|
+
expiresIn: z3.number().optional().nullable()
|
|
2045
2173
|
}).transform((data) => ({
|
|
2046
2174
|
access_token: data["accessToken"],
|
|
2047
|
-
token_type: data["tokenType"],
|
|
2048
2175
|
expires_in: data["expiresIn"]
|
|
2049
2176
|
}));
|
|
2050
2177
|
});
|
|
@@ -2052,17 +2179,27 @@ var getAccessTokenOkResponseRequest = z3.lazy(() => {
|
|
|
2052
2179
|
// src/services/o-auth/o-auth-service.ts
|
|
2053
2180
|
var OAuthService = class extends BaseService {
|
|
2054
2181
|
/**
|
|
2055
|
-
*
|
|
2056
|
-
* @param
|
|
2057
|
-
* @returns
|
|
2182
|
+
* Sets method-level configuration for getAccessToken.
|
|
2183
|
+
* @param config - Partial configuration to override service-level defaults
|
|
2184
|
+
* @returns This service instance for method chaining
|
|
2185
|
+
*/
|
|
2186
|
+
setGetAccessTokenConfig(config) {
|
|
2187
|
+
this.getAccessTokenConfig = config;
|
|
2188
|
+
return this;
|
|
2189
|
+
}
|
|
2190
|
+
/**
|
|
2191
|
+
*
|
|
2192
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
2193
|
+
* @returns {Promise<HttpResponse<OAuthTokenResponse>>} - OAuth token
|
|
2058
2194
|
*/
|
|
2059
2195
|
async getAccessToken(body, requestConfig) {
|
|
2060
|
-
const
|
|
2061
|
-
|
|
2196
|
+
const resolvedConfig = this.getResolvedConfig(this.getAccessTokenConfig, requestConfig);
|
|
2197
|
+
const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/oauth2/token").setRequestSchema(oAuthTokenRequestRequest).setTokenManager(this.tokenManager).setRequestContentType("form" /* FormUrlEncoded */).addResponse({
|
|
2198
|
+
schema: oAuthTokenResponseResponse,
|
|
2062
2199
|
contentType: "json" /* Json */,
|
|
2063
2200
|
status: 200
|
|
2064
|
-
}).
|
|
2065
|
-
return this.client.
|
|
2201
|
+
}).addHeaderParam({ key: "Content-Type", value: "application/x-www-form-urlencoded" }).addBody(body).build();
|
|
2202
|
+
return this.client.callDirect(request);
|
|
2066
2203
|
}
|
|
2067
2204
|
};
|
|
2068
2205
|
|
|
@@ -2109,7 +2246,7 @@ var OAuthTokenManager = class {
|
|
|
2109
2246
|
* @throws Error if client credentials are missing or token request fails
|
|
2110
2247
|
*/
|
|
2111
2248
|
async getToken(scopes, config) {
|
|
2112
|
-
var _a, _b, _c
|
|
2249
|
+
var _a, _b, _c;
|
|
2113
2250
|
if (((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) && ((_b = this.token) == null ? void 0 : _b.expiresAt) && this.token.expiresAt - Date.now() > 5e3) {
|
|
2114
2251
|
return this.token;
|
|
2115
2252
|
}
|
|
@@ -2124,23 +2261,21 @@ var OAuthTokenManager = class {
|
|
|
2124
2261
|
},
|
|
2125
2262
|
this
|
|
2126
2263
|
);
|
|
2127
|
-
const response = await oAuth.getAccessToken(
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
);
|
|
2135
|
-
if (!((_d = response.data) == null ? void 0 : _d.accessToken)) {
|
|
2264
|
+
const response = await oAuth.getAccessToken({
|
|
2265
|
+
grantType: "client_credentials",
|
|
2266
|
+
clientId: config.clientId,
|
|
2267
|
+
clientSecret: config.clientSecret,
|
|
2268
|
+
scope: Array.from(scopes).join(" ")
|
|
2269
|
+
});
|
|
2270
|
+
if (!(response == null ? void 0 : response.accessToken)) {
|
|
2136
2271
|
throw new Error(
|
|
2137
2272
|
`OAuthError: token endpoint response did not return access token. Response: ${JSON.stringify(response), void 0, 2}.`
|
|
2138
2273
|
);
|
|
2139
2274
|
}
|
|
2140
2275
|
this.token = new OAuthToken(
|
|
2141
|
-
response.
|
|
2276
|
+
response.accessToken,
|
|
2142
2277
|
updatedScopes,
|
|
2143
|
-
(
|
|
2278
|
+
(response == null ? void 0 : response.expiresIn) ? (response == null ? void 0 : response.expiresIn) * 1e3 + Date.now() : null
|
|
2144
2279
|
);
|
|
2145
2280
|
return this.token;
|
|
2146
2281
|
}
|
|
@@ -2252,7 +2387,9 @@ var BadRequest = class extends ThrowableError {
|
|
|
2252
2387
|
this.message = parsedResponse.message || "";
|
|
2253
2388
|
}
|
|
2254
2389
|
throw() {
|
|
2255
|
-
|
|
2390
|
+
const error = new BadRequest(this.message, this.response);
|
|
2391
|
+
error.metadata = this.metadata;
|
|
2392
|
+
throw error;
|
|
2256
2393
|
}
|
|
2257
2394
|
};
|
|
2258
2395
|
|
|
@@ -2274,19 +2411,31 @@ var Unauthorized = class extends ThrowableError {
|
|
|
2274
2411
|
this.message = parsedResponse.message || "";
|
|
2275
2412
|
}
|
|
2276
2413
|
throw() {
|
|
2277
|
-
|
|
2414
|
+
const error = new Unauthorized(this.message, this.response);
|
|
2415
|
+
error.metadata = this.metadata;
|
|
2416
|
+
throw error;
|
|
2278
2417
|
}
|
|
2279
2418
|
};
|
|
2280
2419
|
|
|
2281
2420
|
// src/services/destinations/destinations-service.ts
|
|
2282
2421
|
var DestinationsService = class extends BaseService {
|
|
2422
|
+
/**
|
|
2423
|
+
* Sets method-level configuration for listDestinations.
|
|
2424
|
+
* @param config - Partial configuration to override service-level defaults
|
|
2425
|
+
* @returns This service instance for method chaining
|
|
2426
|
+
*/
|
|
2427
|
+
setListDestinationsConfig(config) {
|
|
2428
|
+
this.listDestinationsConfig = config;
|
|
2429
|
+
return this;
|
|
2430
|
+
}
|
|
2283
2431
|
/**
|
|
2284
2432
|
* List Destinations
|
|
2285
|
-
* @param {
|
|
2433
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
2286
2434
|
* @returns {Promise<HttpResponse<ListDestinationsOkResponse>>} - Successful Response
|
|
2287
2435
|
*/
|
|
2288
2436
|
async listDestinations(requestConfig) {
|
|
2289
|
-
const
|
|
2437
|
+
const resolvedConfig = this.getResolvedConfig(this.listDestinationsConfig, requestConfig);
|
|
2438
|
+
const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/destinations").setRequestSchema(z8.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
|
|
2290
2439
|
schema: listDestinationsOkResponseResponse,
|
|
2291
2440
|
contentType: "json" /* Json */,
|
|
2292
2441
|
status: 200
|
|
@@ -2298,8 +2447,8 @@ var DestinationsService = class extends BaseService {
|
|
|
2298
2447
|
error: Unauthorized,
|
|
2299
2448
|
contentType: "json" /* Json */,
|
|
2300
2449
|
status: 401
|
|
2301
|
-
}).
|
|
2302
|
-
return this.client.
|
|
2450
|
+
}).build();
|
|
2451
|
+
return this.client.callDirect(request);
|
|
2303
2452
|
}
|
|
2304
2453
|
};
|
|
2305
2454
|
|
|
@@ -2394,6 +2543,15 @@ var listPackagesOkResponseRequest = z10.lazy(() => {
|
|
|
2394
2543
|
|
|
2395
2544
|
// src/services/packages/packages-service.ts
|
|
2396
2545
|
var PackagesService = class extends BaseService {
|
|
2546
|
+
/**
|
|
2547
|
+
* Sets method-level configuration for listPackages.
|
|
2548
|
+
* @param config - Partial configuration to override service-level defaults
|
|
2549
|
+
* @returns This service instance for method chaining
|
|
2550
|
+
*/
|
|
2551
|
+
setListPackagesConfig(config) {
|
|
2552
|
+
this.listPackagesConfig = config;
|
|
2553
|
+
return this;
|
|
2554
|
+
}
|
|
2397
2555
|
/**
|
|
2398
2556
|
* List Packages
|
|
2399
2557
|
* @param {string} [params.destination] - ISO representation of the package's destination. Supports both ISO2 (e.g., 'FR') and ISO3 (e.g., 'FRA') country codes.
|
|
@@ -2403,11 +2561,21 @@ var PackagesService = class extends BaseService {
|
|
|
2403
2561
|
* @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
|
|
2404
2562
|
* @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
|
|
2405
2563
|
* @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
|
|
2406
|
-
* @param {
|
|
2564
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
2407
2565
|
* @returns {Promise<HttpResponse<ListPackagesOkResponse>>} - Successful Response
|
|
2408
2566
|
*/
|
|
2409
2567
|
async listPackages(params, requestConfig) {
|
|
2410
|
-
const
|
|
2568
|
+
const resolvedConfig = this.getResolvedConfig(this.listPackagesConfig, requestConfig);
|
|
2569
|
+
z11.object({
|
|
2570
|
+
destination: z11.string().optional(),
|
|
2571
|
+
startDate: z11.string().optional(),
|
|
2572
|
+
endDate: z11.string().optional(),
|
|
2573
|
+
afterCursor: z11.string().optional(),
|
|
2574
|
+
limit: z11.number().optional(),
|
|
2575
|
+
startTime: z11.number().optional(),
|
|
2576
|
+
endTime: z11.number().optional()
|
|
2577
|
+
}).parse(params != null ? params : {});
|
|
2578
|
+
const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/packages").setRequestSchema(z11.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
|
|
2411
2579
|
schema: listPackagesOkResponseResponse,
|
|
2412
2580
|
contentType: "json" /* Json */,
|
|
2413
2581
|
status: 200
|
|
@@ -2419,7 +2587,7 @@ var PackagesService = class extends BaseService {
|
|
|
2419
2587
|
error: Unauthorized,
|
|
2420
2588
|
contentType: "json" /* Json */,
|
|
2421
2589
|
status: 401
|
|
2422
|
-
}).
|
|
2590
|
+
}).addQueryParam({
|
|
2423
2591
|
key: "destination",
|
|
2424
2592
|
value: params == null ? void 0 : params.destination
|
|
2425
2593
|
}).addQueryParam({
|
|
@@ -2441,7 +2609,7 @@ var PackagesService = class extends BaseService {
|
|
|
2441
2609
|
key: "endTime",
|
|
2442
2610
|
value: params == null ? void 0 : params.endTime
|
|
2443
2611
|
}).build();
|
|
2444
|
-
return this.client.
|
|
2612
|
+
return this.client.callDirect(request);
|
|
2445
2613
|
}
|
|
2446
2614
|
};
|
|
2447
2615
|
|
|
@@ -2461,7 +2629,8 @@ var createPurchaseV2Request = z12.lazy(() => {
|
|
|
2461
2629
|
email: z12.string().optional(),
|
|
2462
2630
|
referenceId: z12.string().optional(),
|
|
2463
2631
|
networkBrand: z12.string().optional(),
|
|
2464
|
-
emailBrand: z12.string().optional()
|
|
2632
|
+
emailBrand: z12.string().optional(),
|
|
2633
|
+
language: z12.string().optional()
|
|
2465
2634
|
});
|
|
2466
2635
|
});
|
|
2467
2636
|
var createPurchaseV2RequestResponse = z12.lazy(() => {
|
|
@@ -2475,7 +2644,8 @@ var createPurchaseV2RequestResponse = z12.lazy(() => {
|
|
|
2475
2644
|
email: z12.string().optional(),
|
|
2476
2645
|
referenceId: z12.string().optional(),
|
|
2477
2646
|
networkBrand: z12.string().optional(),
|
|
2478
|
-
emailBrand: z12.string().optional()
|
|
2647
|
+
emailBrand: z12.string().optional(),
|
|
2648
|
+
language: z12.string().optional()
|
|
2479
2649
|
}).transform((data) => ({
|
|
2480
2650
|
destination: data["destination"],
|
|
2481
2651
|
dataLimitInGb: data["dataLimitInGB"],
|
|
@@ -2486,7 +2656,8 @@ var createPurchaseV2RequestResponse = z12.lazy(() => {
|
|
|
2486
2656
|
email: data["email"],
|
|
2487
2657
|
referenceId: data["referenceId"],
|
|
2488
2658
|
networkBrand: data["networkBrand"],
|
|
2489
|
-
emailBrand: data["emailBrand"]
|
|
2659
|
+
emailBrand: data["emailBrand"],
|
|
2660
|
+
language: data["language"]
|
|
2490
2661
|
}));
|
|
2491
2662
|
});
|
|
2492
2663
|
var createPurchaseV2RequestRequest = z12.lazy(() => {
|
|
@@ -2500,7 +2671,8 @@ var createPurchaseV2RequestRequest = z12.lazy(() => {
|
|
|
2500
2671
|
email: z12.string().optional(),
|
|
2501
2672
|
referenceId: z12.string().optional(),
|
|
2502
2673
|
networkBrand: z12.string().optional(),
|
|
2503
|
-
emailBrand: z12.string().optional()
|
|
2674
|
+
emailBrand: z12.string().optional(),
|
|
2675
|
+
language: z12.string().optional()
|
|
2504
2676
|
}).transform((data) => ({
|
|
2505
2677
|
destination: data["destination"],
|
|
2506
2678
|
dataLimitInGB: data["dataLimitInGb"],
|
|
@@ -2511,7 +2683,8 @@ var createPurchaseV2RequestRequest = z12.lazy(() => {
|
|
|
2511
2683
|
email: data["email"],
|
|
2512
2684
|
referenceId: data["referenceId"],
|
|
2513
2685
|
networkBrand: data["networkBrand"],
|
|
2514
|
-
emailBrand: data["emailBrand"]
|
|
2686
|
+
emailBrand: data["emailBrand"],
|
|
2687
|
+
language: data["language"]
|
|
2515
2688
|
}));
|
|
2516
2689
|
});
|
|
2517
2690
|
|
|
@@ -2817,6 +2990,7 @@ var createPurchaseRequest = z20.lazy(() => {
|
|
|
2817
2990
|
referenceId: z20.string().optional(),
|
|
2818
2991
|
networkBrand: z20.string().optional(),
|
|
2819
2992
|
emailBrand: z20.string().optional(),
|
|
2993
|
+
language: z20.string().optional(),
|
|
2820
2994
|
startTime: z20.number().optional(),
|
|
2821
2995
|
endTime: z20.number().optional()
|
|
2822
2996
|
});
|
|
@@ -2831,6 +3005,7 @@ var createPurchaseRequestResponse = z20.lazy(() => {
|
|
|
2831
3005
|
referenceId: z20.string().optional(),
|
|
2832
3006
|
networkBrand: z20.string().optional(),
|
|
2833
3007
|
emailBrand: z20.string().optional(),
|
|
3008
|
+
language: z20.string().optional(),
|
|
2834
3009
|
startTime: z20.number().optional(),
|
|
2835
3010
|
endTime: z20.number().optional()
|
|
2836
3011
|
}).transform((data) => ({
|
|
@@ -2842,6 +3017,7 @@ var createPurchaseRequestResponse = z20.lazy(() => {
|
|
|
2842
3017
|
referenceId: data["referenceId"],
|
|
2843
3018
|
networkBrand: data["networkBrand"],
|
|
2844
3019
|
emailBrand: data["emailBrand"],
|
|
3020
|
+
language: data["language"],
|
|
2845
3021
|
startTime: data["startTime"],
|
|
2846
3022
|
endTime: data["endTime"]
|
|
2847
3023
|
}));
|
|
@@ -2856,6 +3032,7 @@ var createPurchaseRequestRequest = z20.lazy(() => {
|
|
|
2856
3032
|
referenceId: z20.string().optional(),
|
|
2857
3033
|
networkBrand: z20.string().optional(),
|
|
2858
3034
|
emailBrand: z20.string().optional(),
|
|
3035
|
+
language: z20.string().optional(),
|
|
2859
3036
|
startTime: z20.number().optional(),
|
|
2860
3037
|
endTime: z20.number().optional()
|
|
2861
3038
|
}).transform((data) => ({
|
|
@@ -2867,6 +3044,7 @@ var createPurchaseRequestRequest = z20.lazy(() => {
|
|
|
2867
3044
|
referenceId: data["referenceId"],
|
|
2868
3045
|
networkBrand: data["networkBrand"],
|
|
2869
3046
|
emailBrand: data["emailBrand"],
|
|
3047
|
+
language: data["language"],
|
|
2870
3048
|
startTime: data["startTime"],
|
|
2871
3049
|
endTime: data["endTime"]
|
|
2872
3050
|
}));
|
|
@@ -3273,13 +3451,68 @@ var getPurchaseConsumptionOkResponseRequest = z30.lazy(() => {
|
|
|
3273
3451
|
|
|
3274
3452
|
// src/services/purchases/purchases-service.ts
|
|
3275
3453
|
var PurchasesService = class extends BaseService {
|
|
3454
|
+
/**
|
|
3455
|
+
* Sets method-level configuration for createPurchaseV2.
|
|
3456
|
+
* @param config - Partial configuration to override service-level defaults
|
|
3457
|
+
* @returns This service instance for method chaining
|
|
3458
|
+
*/
|
|
3459
|
+
setCreatePurchaseV2Config(config) {
|
|
3460
|
+
this.createPurchaseV2Config = config;
|
|
3461
|
+
return this;
|
|
3462
|
+
}
|
|
3463
|
+
/**
|
|
3464
|
+
* Sets method-level configuration for listPurchases.
|
|
3465
|
+
* @param config - Partial configuration to override service-level defaults
|
|
3466
|
+
* @returns This service instance for method chaining
|
|
3467
|
+
*/
|
|
3468
|
+
setListPurchasesConfig(config) {
|
|
3469
|
+
this.listPurchasesConfig = config;
|
|
3470
|
+
return this;
|
|
3471
|
+
}
|
|
3472
|
+
/**
|
|
3473
|
+
* Sets method-level configuration for createPurchase.
|
|
3474
|
+
* @param config - Partial configuration to override service-level defaults
|
|
3475
|
+
* @returns This service instance for method chaining
|
|
3476
|
+
*/
|
|
3477
|
+
setCreatePurchaseConfig(config) {
|
|
3478
|
+
this.createPurchaseConfig = config;
|
|
3479
|
+
return this;
|
|
3480
|
+
}
|
|
3481
|
+
/**
|
|
3482
|
+
* Sets method-level configuration for topUpEsim.
|
|
3483
|
+
* @param config - Partial configuration to override service-level defaults
|
|
3484
|
+
* @returns This service instance for method chaining
|
|
3485
|
+
*/
|
|
3486
|
+
setTopUpEsimConfig(config) {
|
|
3487
|
+
this.topUpEsimConfig = config;
|
|
3488
|
+
return this;
|
|
3489
|
+
}
|
|
3490
|
+
/**
|
|
3491
|
+
* Sets method-level configuration for editPurchase.
|
|
3492
|
+
* @param config - Partial configuration to override service-level defaults
|
|
3493
|
+
* @returns This service instance for method chaining
|
|
3494
|
+
*/
|
|
3495
|
+
setEditPurchaseConfig(config) {
|
|
3496
|
+
this.editPurchaseConfig = config;
|
|
3497
|
+
return this;
|
|
3498
|
+
}
|
|
3499
|
+
/**
|
|
3500
|
+
* Sets method-level configuration for getPurchaseConsumption.
|
|
3501
|
+
* @param config - Partial configuration to override service-level defaults
|
|
3502
|
+
* @returns This service instance for method chaining
|
|
3503
|
+
*/
|
|
3504
|
+
setGetPurchaseConsumptionConfig(config) {
|
|
3505
|
+
this.getPurchaseConsumptionConfig = config;
|
|
3506
|
+
return this;
|
|
3507
|
+
}
|
|
3276
3508
|
/**
|
|
3277
3509
|
* This endpoint is used to purchase a new eSIM by providing the package details.
|
|
3278
|
-
* @param {
|
|
3510
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
3279
3511
|
* @returns {Promise<HttpResponse<CreatePurchaseV2OkResponse[]>>} - Successful Response
|
|
3280
3512
|
*/
|
|
3281
3513
|
async createPurchaseV2(body, requestConfig) {
|
|
3282
|
-
const
|
|
3514
|
+
const resolvedConfig = this.getResolvedConfig(this.createPurchaseV2Config, requestConfig);
|
|
3515
|
+
const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/purchases/v2").setRequestSchema(createPurchaseV2RequestRequest).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
|
|
3283
3516
|
schema: z31.array(createPurchaseV2OkResponseResponse),
|
|
3284
3517
|
contentType: "json" /* Json */,
|
|
3285
3518
|
status: 200
|
|
@@ -3291,8 +3524,8 @@ var PurchasesService = class extends BaseService {
|
|
|
3291
3524
|
error: Unauthorized,
|
|
3292
3525
|
contentType: "json" /* Json */,
|
|
3293
3526
|
status: 401
|
|
3294
|
-
}).
|
|
3295
|
-
return this.client.
|
|
3527
|
+
}).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
|
3528
|
+
return this.client.callDirect(request);
|
|
3296
3529
|
}
|
|
3297
3530
|
/**
|
|
3298
3531
|
* This endpoint can be used to list all the successful purchases made between a given interval.
|
|
@@ -3306,11 +3539,24 @@ var PurchasesService = class extends BaseService {
|
|
|
3306
3539
|
* @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
|
|
3307
3540
|
* @param {number} [params.after] - Epoch value representing the start of the time interval for filtering purchases
|
|
3308
3541
|
* @param {number} [params.before] - Epoch value representing the end of the time interval for filtering purchases
|
|
3309
|
-
* @param {
|
|
3542
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
3310
3543
|
* @returns {Promise<HttpResponse<ListPurchasesOkResponse>>} - Successful Response
|
|
3311
3544
|
*/
|
|
3312
3545
|
async listPurchases(params, requestConfig) {
|
|
3313
|
-
const
|
|
3546
|
+
const resolvedConfig = this.getResolvedConfig(this.listPurchasesConfig, requestConfig);
|
|
3547
|
+
z31.object({
|
|
3548
|
+
purchaseId: z31.string().optional(),
|
|
3549
|
+
iccid: z31.string().optional(),
|
|
3550
|
+
afterDate: z31.string().optional(),
|
|
3551
|
+
beforeDate: z31.string().optional(),
|
|
3552
|
+
email: z31.string().optional(),
|
|
3553
|
+
referenceId: z31.string().optional(),
|
|
3554
|
+
afterCursor: z31.string().optional(),
|
|
3555
|
+
limit: z31.number().optional(),
|
|
3556
|
+
after: z31.number().optional(),
|
|
3557
|
+
before: z31.number().optional()
|
|
3558
|
+
}).parse(params != null ? params : {});
|
|
3559
|
+
const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/purchases").setRequestSchema(z31.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
|
|
3314
3560
|
schema: listPurchasesOkResponseResponse,
|
|
3315
3561
|
contentType: "json" /* Json */,
|
|
3316
3562
|
status: 200
|
|
@@ -3322,7 +3568,7 @@ var PurchasesService = class extends BaseService {
|
|
|
3322
3568
|
error: Unauthorized,
|
|
3323
3569
|
contentType: "json" /* Json */,
|
|
3324
3570
|
status: 401
|
|
3325
|
-
}).
|
|
3571
|
+
}).addQueryParam({
|
|
3326
3572
|
key: "purchaseId",
|
|
3327
3573
|
value: params == null ? void 0 : params.purchaseId
|
|
3328
3574
|
}).addQueryParam({
|
|
@@ -3353,15 +3599,16 @@ var PurchasesService = class extends BaseService {
|
|
|
3353
3599
|
key: "before",
|
|
3354
3600
|
value: params == null ? void 0 : params.before
|
|
3355
3601
|
}).build();
|
|
3356
|
-
return this.client.
|
|
3602
|
+
return this.client.callDirect(request);
|
|
3357
3603
|
}
|
|
3358
3604
|
/**
|
|
3359
3605
|
* This endpoint is used to purchase a new eSIM by providing the package details.
|
|
3360
|
-
* @param {
|
|
3606
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
3361
3607
|
* @returns {Promise<HttpResponse<CreatePurchaseOkResponse>>} - Successful Response
|
|
3362
3608
|
*/
|
|
3363
3609
|
async createPurchase(body, requestConfig) {
|
|
3364
|
-
const
|
|
3610
|
+
const resolvedConfig = this.getResolvedConfig(this.createPurchaseConfig, requestConfig);
|
|
3611
|
+
const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/purchases").setRequestSchema(createPurchaseRequestRequest).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
|
|
3365
3612
|
schema: createPurchaseOkResponseResponse,
|
|
3366
3613
|
contentType: "json" /* Json */,
|
|
3367
3614
|
status: 200
|
|
@@ -3373,16 +3620,17 @@ var PurchasesService = class extends BaseService {
|
|
|
3373
3620
|
error: Unauthorized,
|
|
3374
3621
|
contentType: "json" /* Json */,
|
|
3375
3622
|
status: 401
|
|
3376
|
-
}).
|
|
3377
|
-
return this.client.
|
|
3623
|
+
}).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
|
3624
|
+
return this.client.callDirect(request);
|
|
3378
3625
|
}
|
|
3379
3626
|
/**
|
|
3380
3627
|
* This endpoint is used to top-up an existing eSIM with the previously associated destination by providing its ICCID and package details. To determine if an eSIM can be topped up, use the Get eSIM endpoint, which returns the `isTopUpAllowed` flag.
|
|
3381
|
-
* @param {
|
|
3628
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
3382
3629
|
* @returns {Promise<HttpResponse<TopUpEsimOkResponse>>} - Successful Response
|
|
3383
3630
|
*/
|
|
3384
3631
|
async topUpEsim(body, requestConfig) {
|
|
3385
|
-
const
|
|
3632
|
+
const resolvedConfig = this.getResolvedConfig(this.topUpEsimConfig, requestConfig);
|
|
3633
|
+
const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/purchases/topup").setRequestSchema(topUpEsimRequestRequest).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
|
|
3386
3634
|
schema: topUpEsimOkResponseResponse,
|
|
3387
3635
|
contentType: "json" /* Json */,
|
|
3388
3636
|
status: 200
|
|
@@ -3394,8 +3642,8 @@ var PurchasesService = class extends BaseService {
|
|
|
3394
3642
|
error: Unauthorized,
|
|
3395
3643
|
contentType: "json" /* Json */,
|
|
3396
3644
|
status: 401
|
|
3397
|
-
}).
|
|
3398
|
-
return this.client.
|
|
3645
|
+
}).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
|
3646
|
+
return this.client.callDirect(request);
|
|
3399
3647
|
}
|
|
3400
3648
|
/**
|
|
3401
3649
|
* This endpoint allows you to modify the validity dates of an existing purchase.
|
|
@@ -3406,11 +3654,12 @@ var PurchasesService = class extends BaseService {
|
|
|
3406
3654
|
|
|
3407
3655
|
The end date can be extended or shortened as long as it adheres to the same pricing category and does not exceed the allowed duration limits.
|
|
3408
3656
|
|
|
3409
|
-
* @param {
|
|
3657
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
3410
3658
|
* @returns {Promise<HttpResponse<EditPurchaseOkResponse>>} - Successful Response
|
|
3411
3659
|
*/
|
|
3412
3660
|
async editPurchase(body, requestConfig) {
|
|
3413
|
-
const
|
|
3661
|
+
const resolvedConfig = this.getResolvedConfig(this.editPurchaseConfig, requestConfig);
|
|
3662
|
+
const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/purchases/edit").setRequestSchema(editPurchaseRequestRequest).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
|
|
3414
3663
|
schema: editPurchaseOkResponseResponse,
|
|
3415
3664
|
contentType: "json" /* Json */,
|
|
3416
3665
|
status: 200
|
|
@@ -3422,17 +3671,18 @@ var PurchasesService = class extends BaseService {
|
|
|
3422
3671
|
error: Unauthorized,
|
|
3423
3672
|
contentType: "json" /* Json */,
|
|
3424
3673
|
status: 401
|
|
3425
|
-
}).
|
|
3426
|
-
return this.client.
|
|
3674
|
+
}).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
|
3675
|
+
return this.client.callDirect(request);
|
|
3427
3676
|
}
|
|
3428
3677
|
/**
|
|
3429
3678
|
* 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.
|
|
3430
3679
|
* @param {string} purchaseId - ID of the purchase
|
|
3431
|
-
* @param {
|
|
3680
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
3432
3681
|
* @returns {Promise<HttpResponse<GetPurchaseConsumptionOkResponse>>} - Successful Response
|
|
3433
3682
|
*/
|
|
3434
3683
|
async getPurchaseConsumption(purchaseId, requestConfig) {
|
|
3435
|
-
const
|
|
3684
|
+
const resolvedConfig = this.getResolvedConfig(this.getPurchaseConsumptionConfig, requestConfig);
|
|
3685
|
+
const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(z31.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
|
|
3436
3686
|
schema: getPurchaseConsumptionOkResponseResponse,
|
|
3437
3687
|
contentType: "json" /* Json */,
|
|
3438
3688
|
status: 200
|
|
@@ -3444,14 +3694,34 @@ var PurchasesService = class extends BaseService {
|
|
|
3444
3694
|
error: Unauthorized,
|
|
3445
3695
|
contentType: "json" /* Json */,
|
|
3446
3696
|
status: 401
|
|
3447
|
-
}).
|
|
3697
|
+
}).addPathParam({
|
|
3448
3698
|
key: "purchaseId",
|
|
3449
3699
|
value: purchaseId
|
|
3450
3700
|
}).build();
|
|
3451
|
-
return this.client.
|
|
3701
|
+
return this.client.callDirect(request);
|
|
3452
3702
|
}
|
|
3453
3703
|
};
|
|
3454
3704
|
|
|
3705
|
+
// src/services/purchases/models/create-purchase-v2-request-language.ts
|
|
3706
|
+
var CreatePurchaseV2RequestLanguage = /* @__PURE__ */ ((CreatePurchaseV2RequestLanguage2) => {
|
|
3707
|
+
CreatePurchaseV2RequestLanguage2["EN"] = "en";
|
|
3708
|
+
CreatePurchaseV2RequestLanguage2["ES"] = "es";
|
|
3709
|
+
CreatePurchaseV2RequestLanguage2["FR"] = "fr";
|
|
3710
|
+
CreatePurchaseV2RequestLanguage2["DE"] = "de";
|
|
3711
|
+
CreatePurchaseV2RequestLanguage2["PT_BR"] = "pt-br";
|
|
3712
|
+
return CreatePurchaseV2RequestLanguage2;
|
|
3713
|
+
})(CreatePurchaseV2RequestLanguage || {});
|
|
3714
|
+
|
|
3715
|
+
// src/services/purchases/models/create-purchase-request-language.ts
|
|
3716
|
+
var CreatePurchaseRequestLanguage = /* @__PURE__ */ ((CreatePurchaseRequestLanguage2) => {
|
|
3717
|
+
CreatePurchaseRequestLanguage2["EN"] = "en";
|
|
3718
|
+
CreatePurchaseRequestLanguage2["ES"] = "es";
|
|
3719
|
+
CreatePurchaseRequestLanguage2["FR"] = "fr";
|
|
3720
|
+
CreatePurchaseRequestLanguage2["DE"] = "de";
|
|
3721
|
+
CreatePurchaseRequestLanguage2["PT_BR"] = "pt-br";
|
|
3722
|
+
return CreatePurchaseRequestLanguage2;
|
|
3723
|
+
})(CreatePurchaseRequestLanguage || {});
|
|
3724
|
+
|
|
3455
3725
|
// src/services/e-sim/e-sim-service.ts
|
|
3456
3726
|
import { z as z39 } from "zod";
|
|
3457
3727
|
|
|
@@ -3679,14 +3949,43 @@ var getEsimHistoryOkResponseRequest = z38.lazy(() => {
|
|
|
3679
3949
|
|
|
3680
3950
|
// src/services/e-sim/e-sim-service.ts
|
|
3681
3951
|
var ESimService = class extends BaseService {
|
|
3952
|
+
/**
|
|
3953
|
+
* Sets method-level configuration for getEsim.
|
|
3954
|
+
* @param config - Partial configuration to override service-level defaults
|
|
3955
|
+
* @returns This service instance for method chaining
|
|
3956
|
+
*/
|
|
3957
|
+
setGetEsimConfig(config) {
|
|
3958
|
+
this.getEsimConfig = config;
|
|
3959
|
+
return this;
|
|
3960
|
+
}
|
|
3961
|
+
/**
|
|
3962
|
+
* Sets method-level configuration for getEsimDevice.
|
|
3963
|
+
* @param config - Partial configuration to override service-level defaults
|
|
3964
|
+
* @returns This service instance for method chaining
|
|
3965
|
+
*/
|
|
3966
|
+
setGetEsimDeviceConfig(config) {
|
|
3967
|
+
this.getEsimDeviceConfig = config;
|
|
3968
|
+
return this;
|
|
3969
|
+
}
|
|
3970
|
+
/**
|
|
3971
|
+
* Sets method-level configuration for getEsimHistory.
|
|
3972
|
+
* @param config - Partial configuration to override service-level defaults
|
|
3973
|
+
* @returns This service instance for method chaining
|
|
3974
|
+
*/
|
|
3975
|
+
setGetEsimHistoryConfig(config) {
|
|
3976
|
+
this.getEsimHistoryConfig = config;
|
|
3977
|
+
return this;
|
|
3978
|
+
}
|
|
3682
3979
|
/**
|
|
3683
3980
|
* Get eSIM
|
|
3684
3981
|
* @param {string} params.iccid - ID of the eSIM
|
|
3685
|
-
* @param {
|
|
3982
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
3686
3983
|
* @returns {Promise<HttpResponse<GetEsimOkResponse>>} - Successful Response
|
|
3687
3984
|
*/
|
|
3688
3985
|
async getEsim(params, requestConfig) {
|
|
3689
|
-
const
|
|
3986
|
+
const resolvedConfig = this.getResolvedConfig(this.getEsimConfig, requestConfig);
|
|
3987
|
+
z39.object({ iccid: z39.string() }).parse(params != null ? params : {});
|
|
3988
|
+
const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/esim").setRequestSchema(z39.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
|
|
3690
3989
|
schema: getEsimOkResponseResponse,
|
|
3691
3990
|
contentType: "json" /* Json */,
|
|
3692
3991
|
status: 200
|
|
@@ -3698,20 +3997,21 @@ var ESimService = class extends BaseService {
|
|
|
3698
3997
|
error: Unauthorized,
|
|
3699
3998
|
contentType: "json" /* Json */,
|
|
3700
3999
|
status: 401
|
|
3701
|
-
}).
|
|
4000
|
+
}).addQueryParam({
|
|
3702
4001
|
key: "iccid",
|
|
3703
4002
|
value: params == null ? void 0 : params.iccid
|
|
3704
4003
|
}).build();
|
|
3705
|
-
return this.client.
|
|
4004
|
+
return this.client.callDirect(request);
|
|
3706
4005
|
}
|
|
3707
4006
|
/**
|
|
3708
4007
|
* Get eSIM Device
|
|
3709
4008
|
* @param {string} iccid - ID of the eSIM
|
|
3710
|
-
* @param {
|
|
4009
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
3711
4010
|
* @returns {Promise<HttpResponse<GetEsimDeviceOkResponse>>} - Successful Response
|
|
3712
4011
|
*/
|
|
3713
4012
|
async getEsimDevice(iccid, requestConfig) {
|
|
3714
|
-
const
|
|
4013
|
+
const resolvedConfig = this.getResolvedConfig(this.getEsimDeviceConfig, requestConfig);
|
|
4014
|
+
const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(z39.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
|
|
3715
4015
|
schema: getEsimDeviceOkResponseResponse,
|
|
3716
4016
|
contentType: "json" /* Json */,
|
|
3717
4017
|
status: 200
|
|
@@ -3723,20 +4023,21 @@ var ESimService = class extends BaseService {
|
|
|
3723
4023
|
error: Unauthorized,
|
|
3724
4024
|
contentType: "json" /* Json */,
|
|
3725
4025
|
status: 401
|
|
3726
|
-
}).
|
|
4026
|
+
}).addPathParam({
|
|
3727
4027
|
key: "iccid",
|
|
3728
4028
|
value: iccid
|
|
3729
4029
|
}).build();
|
|
3730
|
-
return this.client.
|
|
4030
|
+
return this.client.callDirect(request);
|
|
3731
4031
|
}
|
|
3732
4032
|
/**
|
|
3733
4033
|
* Get eSIM History
|
|
3734
4034
|
* @param {string} iccid - ID of the eSIM
|
|
3735
|
-
* @param {
|
|
4035
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
3736
4036
|
* @returns {Promise<HttpResponse<GetEsimHistoryOkResponse>>} - Successful Response
|
|
3737
4037
|
*/
|
|
3738
4038
|
async getEsimHistory(iccid, requestConfig) {
|
|
3739
|
-
const
|
|
4039
|
+
const resolvedConfig = this.getResolvedConfig(this.getEsimHistoryConfig, requestConfig);
|
|
4040
|
+
const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(z39.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
|
|
3740
4041
|
schema: getEsimHistoryOkResponseResponse,
|
|
3741
4042
|
contentType: "json" /* Json */,
|
|
3742
4043
|
status: 200
|
|
@@ -3748,11 +4049,11 @@ var ESimService = class extends BaseService {
|
|
|
3748
4049
|
error: Unauthorized,
|
|
3749
4050
|
contentType: "json" /* Json */,
|
|
3750
4051
|
status: 401
|
|
3751
|
-
}).
|
|
4052
|
+
}).addPathParam({
|
|
3752
4053
|
key: "iccid",
|
|
3753
4054
|
value: iccid
|
|
3754
4055
|
}).build();
|
|
3755
|
-
return this.client.
|
|
4056
|
+
return this.client.callDirect(request);
|
|
3756
4057
|
}
|
|
3757
4058
|
};
|
|
3758
4059
|
|
|
@@ -3783,13 +4084,23 @@ var tokenOkResponseRequest = z40.lazy(() => {
|
|
|
3783
4084
|
|
|
3784
4085
|
// src/services/i-frame/i-frame-service.ts
|
|
3785
4086
|
var IFrameService = class extends BaseService {
|
|
4087
|
+
/**
|
|
4088
|
+
* Sets method-level configuration for token.
|
|
4089
|
+
* @param config - Partial configuration to override service-level defaults
|
|
4090
|
+
* @returns This service instance for method chaining
|
|
4091
|
+
*/
|
|
4092
|
+
setTokenConfig(config) {
|
|
4093
|
+
this.tokenConfig = config;
|
|
4094
|
+
return this;
|
|
4095
|
+
}
|
|
3786
4096
|
/**
|
|
3787
4097
|
* Generate a new token to be used in the iFrame
|
|
3788
|
-
* @param {
|
|
4098
|
+
* @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
|
|
3789
4099
|
* @returns {Promise<HttpResponse<TokenOkResponse>>} - Successful Response
|
|
3790
4100
|
*/
|
|
3791
4101
|
async token(requestConfig) {
|
|
3792
|
-
const
|
|
4102
|
+
const resolvedConfig = this.getResolvedConfig(this.tokenConfig, requestConfig);
|
|
4103
|
+
const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/iframe/token").setRequestSchema(z41.any()).setScopes([]).setTokenManager(this.tokenManager).setRequestContentType("json" /* Json */).addResponse({
|
|
3793
4104
|
schema: tokenOkResponseResponse,
|
|
3794
4105
|
contentType: "json" /* Json */,
|
|
3795
4106
|
status: 200
|
|
@@ -3801,8 +4112,8 @@ var IFrameService = class extends BaseService {
|
|
|
3801
4112
|
error: Unauthorized,
|
|
3802
4113
|
contentType: "json" /* Json */,
|
|
3803
4114
|
status: 401
|
|
3804
|
-
}).
|
|
3805
|
-
return this.client.
|
|
4115
|
+
}).build();
|
|
4116
|
+
return this.client.callDirect(request);
|
|
3806
4117
|
}
|
|
3807
4118
|
};
|
|
3808
4119
|
|
|
@@ -3869,6 +4180,8 @@ var Celitech = class {
|
|
|
3869
4180
|
};
|
|
3870
4181
|
export {
|
|
3871
4182
|
Celitech,
|
|
4183
|
+
CreatePurchaseRequestLanguage,
|
|
4184
|
+
CreatePurchaseV2RequestLanguage,
|
|
3872
4185
|
DestinationsService,
|
|
3873
4186
|
ESimService,
|
|
3874
4187
|
Environment,
|