celitech-sdk 1.3.49 → 1.3.53
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 +3 -3
- package/dist/index.d.ts +107 -70
- package/dist/index.js +60 -25
- package/dist/index.mjs +60 -25
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Celitech TypeScript SDK 1.3.
|
1
|
+
# Celitech TypeScript SDK 1.3.53
|
2
2
|
|
3
3
|
Welcome to the Celitech SDK documentation. This guide will help you get started with integrating and using the Celitech SDK in your project.
|
4
4
|
|
@@ -6,8 +6,8 @@ Welcome to the Celitech SDK documentation. This guide will help you get started
|
|
6
6
|
|
7
7
|
## Versions
|
8
8
|
|
9
|
-
- API version: `1.3.
|
10
|
-
- SDK version: `1.3.
|
9
|
+
- API version: `1.3.53`
|
10
|
+
- SDK version: `1.3.53`
|
11
11
|
|
12
12
|
## About the API
|
13
13
|
|
package/dist/index.d.ts
CHANGED
@@ -92,6 +92,8 @@ interface CreateRequestParameters<Page = unknown[]> {
|
|
92
92
|
validation: ValidationOptions;
|
93
93
|
retry: RetryOptions;
|
94
94
|
pagination?: RequestPagination<Page>;
|
95
|
+
filename?: string;
|
96
|
+
filenames?: string[];
|
95
97
|
scopes?: Set<string>;
|
96
98
|
tokenManager: OAuthTokenManager;
|
97
99
|
}
|
@@ -126,6 +128,8 @@ declare class Request<PageSchema = unknown[]> {
|
|
126
128
|
validation: ValidationOptions;
|
127
129
|
retry: RetryOptions;
|
128
130
|
pagination?: RequestPagination<PageSchema>;
|
131
|
+
filename?: string;
|
132
|
+
filenames?: string[];
|
129
133
|
scopes?: Set<string>;
|
130
134
|
tokenManager: OAuthTokenManager;
|
131
135
|
private readonly pathPattern;
|
@@ -239,69 +243,6 @@ declare class BaseService {
|
|
239
243
|
set accessToken(accessToken: string);
|
240
244
|
}
|
241
245
|
|
242
|
-
/**
|
243
|
-
* The shape of the model inside the application code - what the users use
|
244
|
-
*/
|
245
|
-
declare const getAccessTokenRequest: z.ZodLazy<z.ZodObject<{
|
246
|
-
grantType: z.ZodOptional<z.ZodString>;
|
247
|
-
clientId: z.ZodOptional<z.ZodString>;
|
248
|
-
clientSecret: z.ZodOptional<z.ZodString>;
|
249
|
-
}, "strip", z.ZodTypeAny, {
|
250
|
-
grantType?: string | undefined;
|
251
|
-
clientId?: string | undefined;
|
252
|
-
clientSecret?: string | undefined;
|
253
|
-
}, {
|
254
|
-
grantType?: string | undefined;
|
255
|
-
clientId?: string | undefined;
|
256
|
-
clientSecret?: string | undefined;
|
257
|
-
}>>;
|
258
|
-
/**
|
259
|
-
*
|
260
|
-
* @typedef {GetAccessTokenRequest} getAccessTokenRequest
|
261
|
-
* @property {GrantType}
|
262
|
-
* @property {string}
|
263
|
-
* @property {string}
|
264
|
-
*/
|
265
|
-
type GetAccessTokenRequest = z.infer<typeof getAccessTokenRequest>;
|
266
|
-
|
267
|
-
/**
|
268
|
-
* The shape of the model inside the application code - what the users use
|
269
|
-
*/
|
270
|
-
declare const getAccessTokenOkResponse: z.ZodLazy<z.ZodObject<{
|
271
|
-
accessToken: z.ZodOptional<z.ZodString>;
|
272
|
-
tokenType: z.ZodOptional<z.ZodString>;
|
273
|
-
expiresIn: z.ZodOptional<z.ZodNumber>;
|
274
|
-
}, "strip", z.ZodTypeAny, {
|
275
|
-
accessToken?: string | undefined;
|
276
|
-
tokenType?: string | undefined;
|
277
|
-
expiresIn?: number | undefined;
|
278
|
-
}, {
|
279
|
-
accessToken?: string | undefined;
|
280
|
-
tokenType?: string | undefined;
|
281
|
-
expiresIn?: number | undefined;
|
282
|
-
}>>;
|
283
|
-
/**
|
284
|
-
*
|
285
|
-
* @typedef {GetAccessTokenOkResponse} getAccessTokenOkResponse
|
286
|
-
* @property {string}
|
287
|
-
* @property {string}
|
288
|
-
* @property {number}
|
289
|
-
*/
|
290
|
-
type GetAccessTokenOkResponse = z.infer<typeof getAccessTokenOkResponse>;
|
291
|
-
|
292
|
-
declare class OAuthService extends BaseService {
|
293
|
-
/**
|
294
|
-
* This endpoint was added by liblab
|
295
|
-
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
296
|
-
* @returns {Promise<HttpResponse<GetAccessTokenOkResponse>>} Successful Response
|
297
|
-
*/
|
298
|
-
getAccessToken(body: GetAccessTokenRequest, requestConfig?: RequestConfig): Promise<HttpResponse<GetAccessTokenOkResponse>>;
|
299
|
-
}
|
300
|
-
|
301
|
-
declare enum GrantType {
|
302
|
-
CLIENT_CREDENTIALS = "client_credentials"
|
303
|
-
}
|
304
|
-
|
305
246
|
/**
|
306
247
|
* The shape of the model inside the application code - what the users use
|
307
248
|
*/
|
@@ -309,26 +250,31 @@ declare const listDestinationsOkResponse: z.ZodLazy<z.ZodObject<{
|
|
309
250
|
destinations: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodObject<{
|
310
251
|
name: z.ZodOptional<z.ZodString>;
|
311
252
|
destination: z.ZodOptional<z.ZodString>;
|
253
|
+
destinationIso2: z.ZodOptional<z.ZodString>;
|
312
254
|
supportedCountries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
313
255
|
}, "strip", z.ZodTypeAny, {
|
314
256
|
name?: string | undefined;
|
315
257
|
destination?: string | undefined;
|
258
|
+
destinationIso2?: string | undefined;
|
316
259
|
supportedCountries?: string[] | undefined;
|
317
260
|
}, {
|
318
261
|
name?: string | undefined;
|
319
262
|
destination?: string | undefined;
|
263
|
+
destinationIso2?: string | undefined;
|
320
264
|
supportedCountries?: string[] | undefined;
|
321
265
|
}>>, "many">>;
|
322
266
|
}, "strip", z.ZodTypeAny, {
|
323
267
|
destinations?: {
|
324
268
|
name?: string | undefined;
|
325
269
|
destination?: string | undefined;
|
270
|
+
destinationIso2?: string | undefined;
|
326
271
|
supportedCountries?: string[] | undefined;
|
327
272
|
}[] | undefined;
|
328
273
|
}, {
|
329
274
|
destinations?: {
|
330
275
|
name?: string | undefined;
|
331
276
|
destination?: string | undefined;
|
277
|
+
destinationIso2?: string | undefined;
|
332
278
|
supportedCountries?: string[] | undefined;
|
333
279
|
}[] | undefined;
|
334
280
|
}>>;
|
@@ -354,21 +300,25 @@ declare class DestinationsService extends BaseService {
|
|
354
300
|
declare const destinations: z.ZodLazy<z.ZodObject<{
|
355
301
|
name: z.ZodOptional<z.ZodString>;
|
356
302
|
destination: z.ZodOptional<z.ZodString>;
|
303
|
+
destinationIso2: z.ZodOptional<z.ZodString>;
|
357
304
|
supportedCountries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
358
305
|
}, "strip", z.ZodTypeAny, {
|
359
306
|
name?: string | undefined;
|
360
307
|
destination?: string | undefined;
|
308
|
+
destinationIso2?: string | undefined;
|
361
309
|
supportedCountries?: string[] | undefined;
|
362
310
|
}, {
|
363
311
|
name?: string | undefined;
|
364
312
|
destination?: string | undefined;
|
313
|
+
destinationIso2?: string | undefined;
|
365
314
|
supportedCountries?: string[] | undefined;
|
366
315
|
}>>;
|
367
316
|
/**
|
368
317
|
*
|
369
318
|
* @typedef {Destinations} destinations
|
370
319
|
* @property {string} - Name of the destination
|
371
|
-
* @property {string} -
|
320
|
+
* @property {string} - ISO3 representation of the destination
|
321
|
+
* @property {string} - ISO2 representation of the destination
|
372
322
|
* @property {string[]} - This array indicates the geographical area covered by a specific destination. If the destination represents a single country, the array will include that country. However, if the destination represents a broader regional scope, the array will be populated with the names of the countries belonging to that region.
|
373
323
|
*/
|
374
324
|
type Destinations = z.infer<typeof destinations>;
|
@@ -394,6 +344,7 @@ declare const listPackagesOkResponse: z.ZodLazy<z.ZodObject<{
|
|
394
344
|
packages: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodObject<{
|
395
345
|
id: z.ZodOptional<z.ZodString>;
|
396
346
|
destination: z.ZodOptional<z.ZodString>;
|
347
|
+
destinationIso2: z.ZodOptional<z.ZodString>;
|
397
348
|
dataLimitInBytes: z.ZodOptional<z.ZodNumber>;
|
398
349
|
minDays: z.ZodOptional<z.ZodNumber>;
|
399
350
|
maxDays: z.ZodOptional<z.ZodNumber>;
|
@@ -401,6 +352,7 @@ declare const listPackagesOkResponse: z.ZodLazy<z.ZodObject<{
|
|
401
352
|
}, "strip", z.ZodTypeAny, {
|
402
353
|
id?: string | undefined;
|
403
354
|
destination?: string | undefined;
|
355
|
+
destinationIso2?: string | undefined;
|
404
356
|
dataLimitInBytes?: number | undefined;
|
405
357
|
minDays?: number | undefined;
|
406
358
|
maxDays?: number | undefined;
|
@@ -408,6 +360,7 @@ declare const listPackagesOkResponse: z.ZodLazy<z.ZodObject<{
|
|
408
360
|
}, {
|
409
361
|
id?: string | undefined;
|
410
362
|
destination?: string | undefined;
|
363
|
+
destinationIso2?: string | undefined;
|
411
364
|
dataLimitInBytes?: number | undefined;
|
412
365
|
minDays?: number | undefined;
|
413
366
|
maxDays?: number | undefined;
|
@@ -418,6 +371,7 @@ declare const listPackagesOkResponse: z.ZodLazy<z.ZodObject<{
|
|
418
371
|
packages?: {
|
419
372
|
id?: string | undefined;
|
420
373
|
destination?: string | undefined;
|
374
|
+
destinationIso2?: string | undefined;
|
421
375
|
dataLimitInBytes?: number | undefined;
|
422
376
|
minDays?: number | undefined;
|
423
377
|
maxDays?: number | undefined;
|
@@ -428,6 +382,7 @@ declare const listPackagesOkResponse: z.ZodLazy<z.ZodObject<{
|
|
428
382
|
packages?: {
|
429
383
|
id?: string | undefined;
|
430
384
|
destination?: string | undefined;
|
385
|
+
destinationIso2?: string | undefined;
|
431
386
|
dataLimitInBytes?: number | undefined;
|
432
387
|
minDays?: number | undefined;
|
433
388
|
maxDays?: number | undefined;
|
@@ -457,7 +412,7 @@ interface ListPackagesParams {
|
|
457
412
|
declare class PackagesService extends BaseService {
|
458
413
|
/**
|
459
414
|
* List Packages
|
460
|
-
* @param {string} [params.destination] - ISO representation of the package's destination.
|
415
|
+
* @param {string} [params.destination] - ISO representation of the package's destination. Supports both ISO2 (e.g., 'FR') and ISO3 (e.g., 'FRA') country codes.
|
461
416
|
* @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.
|
462
417
|
* @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.
|
463
418
|
* @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.
|
@@ -477,6 +432,7 @@ declare class PackagesService extends BaseService {
|
|
477
432
|
declare const packages: z.ZodLazy<z.ZodObject<{
|
478
433
|
id: z.ZodOptional<z.ZodString>;
|
479
434
|
destination: z.ZodOptional<z.ZodString>;
|
435
|
+
destinationIso2: z.ZodOptional<z.ZodString>;
|
480
436
|
dataLimitInBytes: z.ZodOptional<z.ZodNumber>;
|
481
437
|
minDays: z.ZodOptional<z.ZodNumber>;
|
482
438
|
maxDays: z.ZodOptional<z.ZodNumber>;
|
@@ -484,6 +440,7 @@ declare const packages: z.ZodLazy<z.ZodObject<{
|
|
484
440
|
}, "strip", z.ZodTypeAny, {
|
485
441
|
id?: string | undefined;
|
486
442
|
destination?: string | undefined;
|
443
|
+
destinationIso2?: string | undefined;
|
487
444
|
dataLimitInBytes?: number | undefined;
|
488
445
|
minDays?: number | undefined;
|
489
446
|
maxDays?: number | undefined;
|
@@ -491,6 +448,7 @@ declare const packages: z.ZodLazy<z.ZodObject<{
|
|
491
448
|
}, {
|
492
449
|
id?: string | undefined;
|
493
450
|
destination?: string | undefined;
|
451
|
+
destinationIso2?: string | undefined;
|
494
452
|
dataLimitInBytes?: number | undefined;
|
495
453
|
minDays?: number | undefined;
|
496
454
|
maxDays?: number | undefined;
|
@@ -500,7 +458,8 @@ declare const packages: z.ZodLazy<z.ZodObject<{
|
|
500
458
|
*
|
501
459
|
* @typedef {Packages} packages
|
502
460
|
* @property {string} - ID of the package
|
503
|
-
* @property {string} -
|
461
|
+
* @property {string} - ISO3 representation of the package's destination.
|
462
|
+
* @property {string} - ISO2 representation of the package's destination.
|
504
463
|
* @property {number} - Size of the package in Bytes
|
505
464
|
* @property {number} - Min number of days for the package
|
506
465
|
* @property {number} - Max number of days for the package
|
@@ -559,7 +518,7 @@ declare const createPurchaseV2Request: z.ZodLazy<z.ZodObject<{
|
|
559
518
|
/**
|
560
519
|
*
|
561
520
|
* @typedef {CreatePurchaseV2Request} createPurchaseV2Request
|
562
|
-
* @property {string} - ISO representation of the package's destination.
|
521
|
+
* @property {string} - ISO representation of the package's destination. Supports both ISO2 (e.g., 'FR') and ISO3 (e.g., 'FRA') country codes.
|
563
522
|
* @property {number} - Size of the package in GB. The available options are 0.5, 1, 2, 3, 5, 8, 20GB
|
564
523
|
* @property {string} - 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.
|
565
524
|
* @property {string} - End date of the package's validity in the format 'yyyy-MM-dd'. End date can be maximum 90 days after Start date.
|
@@ -648,18 +607,21 @@ declare const listPurchasesOkResponse: z.ZodLazy<z.ZodObject<{
|
|
648
607
|
id: z.ZodOptional<z.ZodString>;
|
649
608
|
dataLimitInBytes: z.ZodOptional<z.ZodNumber>;
|
650
609
|
destination: z.ZodOptional<z.ZodString>;
|
610
|
+
destinationIso2: z.ZodOptional<z.ZodString>;
|
651
611
|
destinationName: z.ZodOptional<z.ZodString>;
|
652
612
|
priceInCents: z.ZodOptional<z.ZodNumber>;
|
653
613
|
}, "strip", z.ZodTypeAny, {
|
654
614
|
id?: string | undefined;
|
655
615
|
dataLimitInBytes?: number | undefined;
|
656
616
|
destination?: string | undefined;
|
617
|
+
destinationIso2?: string | undefined;
|
657
618
|
destinationName?: string | undefined;
|
658
619
|
priceInCents?: number | undefined;
|
659
620
|
}, {
|
660
621
|
id?: string | undefined;
|
661
622
|
dataLimitInBytes?: number | undefined;
|
662
623
|
destination?: string | undefined;
|
624
|
+
destinationIso2?: string | undefined;
|
663
625
|
destinationName?: string | undefined;
|
664
626
|
priceInCents?: number | undefined;
|
665
627
|
}>>>;
|
@@ -685,6 +647,7 @@ declare const listPurchasesOkResponse: z.ZodLazy<z.ZodObject<{
|
|
685
647
|
id?: string | undefined;
|
686
648
|
dataLimitInBytes?: number | undefined;
|
687
649
|
destination?: string | undefined;
|
650
|
+
destinationIso2?: string | undefined;
|
688
651
|
destinationName?: string | undefined;
|
689
652
|
priceInCents?: number | undefined;
|
690
653
|
} | undefined;
|
@@ -706,6 +669,7 @@ declare const listPurchasesOkResponse: z.ZodLazy<z.ZodObject<{
|
|
706
669
|
id?: string | undefined;
|
707
670
|
dataLimitInBytes?: number | undefined;
|
708
671
|
destination?: string | undefined;
|
672
|
+
destinationIso2?: string | undefined;
|
709
673
|
destinationName?: string | undefined;
|
710
674
|
priceInCents?: number | undefined;
|
711
675
|
} | undefined;
|
@@ -730,6 +694,7 @@ declare const listPurchasesOkResponse: z.ZodLazy<z.ZodObject<{
|
|
730
694
|
id?: string | undefined;
|
731
695
|
dataLimitInBytes?: number | undefined;
|
732
696
|
destination?: string | undefined;
|
697
|
+
destinationIso2?: string | undefined;
|
733
698
|
destinationName?: string | undefined;
|
734
699
|
priceInCents?: number | undefined;
|
735
700
|
} | undefined;
|
@@ -754,6 +719,7 @@ declare const listPurchasesOkResponse: z.ZodLazy<z.ZodObject<{
|
|
754
719
|
id?: string | undefined;
|
755
720
|
dataLimitInBytes?: number | undefined;
|
756
721
|
destination?: string | undefined;
|
722
|
+
destinationIso2?: string | undefined;
|
757
723
|
destinationName?: string | undefined;
|
758
724
|
priceInCents?: number | undefined;
|
759
725
|
} | undefined;
|
@@ -825,7 +791,7 @@ declare const createPurchaseRequest: z.ZodLazy<z.ZodObject<{
|
|
825
791
|
/**
|
826
792
|
*
|
827
793
|
* @typedef {CreatePurchaseRequest} createPurchaseRequest
|
828
|
-
* @property {string} - ISO representation of the package's destination.
|
794
|
+
* @property {string} - ISO representation of the package's destination. Supports both ISO2 (e.g., 'FR') and ISO3 (e.g., 'FRA') country codes.
|
829
795
|
* @property {number} - Size of the package in GB. The available options are 0.5, 1, 2, 3, 5, 8, 20GB
|
830
796
|
* @property {string} - 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.
|
831
797
|
* @property {string} - End date of the package's validity in the format 'yyyy-MM-dd'. End date can be maximum 90 days after Start date.
|
@@ -1239,18 +1205,21 @@ declare const purchases: z.ZodLazy<z.ZodObject<{
|
|
1239
1205
|
id: z.ZodOptional<z.ZodString>;
|
1240
1206
|
dataLimitInBytes: z.ZodOptional<z.ZodNumber>;
|
1241
1207
|
destination: z.ZodOptional<z.ZodString>;
|
1208
|
+
destinationIso2: z.ZodOptional<z.ZodString>;
|
1242
1209
|
destinationName: z.ZodOptional<z.ZodString>;
|
1243
1210
|
priceInCents: z.ZodOptional<z.ZodNumber>;
|
1244
1211
|
}, "strip", z.ZodTypeAny, {
|
1245
1212
|
id?: string | undefined;
|
1246
1213
|
dataLimitInBytes?: number | undefined;
|
1247
1214
|
destination?: string | undefined;
|
1215
|
+
destinationIso2?: string | undefined;
|
1248
1216
|
destinationName?: string | undefined;
|
1249
1217
|
priceInCents?: number | undefined;
|
1250
1218
|
}, {
|
1251
1219
|
id?: string | undefined;
|
1252
1220
|
dataLimitInBytes?: number | undefined;
|
1253
1221
|
destination?: string | undefined;
|
1222
|
+
destinationIso2?: string | undefined;
|
1254
1223
|
destinationName?: string | undefined;
|
1255
1224
|
priceInCents?: number | undefined;
|
1256
1225
|
}>>>;
|
@@ -1276,6 +1245,7 @@ declare const purchases: z.ZodLazy<z.ZodObject<{
|
|
1276
1245
|
id?: string | undefined;
|
1277
1246
|
dataLimitInBytes?: number | undefined;
|
1278
1247
|
destination?: string | undefined;
|
1248
|
+
destinationIso2?: string | undefined;
|
1279
1249
|
destinationName?: string | undefined;
|
1280
1250
|
priceInCents?: number | undefined;
|
1281
1251
|
} | undefined;
|
@@ -1297,6 +1267,7 @@ declare const purchases: z.ZodLazy<z.ZodObject<{
|
|
1297
1267
|
id?: string | undefined;
|
1298
1268
|
dataLimitInBytes?: number | undefined;
|
1299
1269
|
destination?: string | undefined;
|
1270
|
+
destinationIso2?: string | undefined;
|
1300
1271
|
destinationName?: string | undefined;
|
1301
1272
|
priceInCents?: number | undefined;
|
1302
1273
|
} | undefined;
|
@@ -1332,18 +1303,21 @@ declare const package_: z.ZodLazy<z.ZodObject<{
|
|
1332
1303
|
id: z.ZodOptional<z.ZodString>;
|
1333
1304
|
dataLimitInBytes: z.ZodOptional<z.ZodNumber>;
|
1334
1305
|
destination: z.ZodOptional<z.ZodString>;
|
1306
|
+
destinationIso2: z.ZodOptional<z.ZodString>;
|
1335
1307
|
destinationName: z.ZodOptional<z.ZodString>;
|
1336
1308
|
priceInCents: z.ZodOptional<z.ZodNumber>;
|
1337
1309
|
}, "strip", z.ZodTypeAny, {
|
1338
1310
|
id?: string | undefined;
|
1339
1311
|
dataLimitInBytes?: number | undefined;
|
1340
1312
|
destination?: string | undefined;
|
1313
|
+
destinationIso2?: string | undefined;
|
1341
1314
|
destinationName?: string | undefined;
|
1342
1315
|
priceInCents?: number | undefined;
|
1343
1316
|
}, {
|
1344
1317
|
id?: string | undefined;
|
1345
1318
|
dataLimitInBytes?: number | undefined;
|
1346
1319
|
destination?: string | undefined;
|
1320
|
+
destinationIso2?: string | undefined;
|
1347
1321
|
destinationName?: string | undefined;
|
1348
1322
|
priceInCents?: number | undefined;
|
1349
1323
|
}>>;
|
@@ -1352,7 +1326,8 @@ declare const package_: z.ZodLazy<z.ZodObject<{
|
|
1352
1326
|
* @typedef {Package_} package_
|
1353
1327
|
* @property {string} - ID of the package
|
1354
1328
|
* @property {number} - Size of the package in Bytes
|
1355
|
-
* @property {string} -
|
1329
|
+
* @property {string} - ISO3 representation of the package's destination.
|
1330
|
+
* @property {string} - ISO2 representation of the package's destination.
|
1356
1331
|
* @property {string} - Name of the package's destination
|
1357
1332
|
* @property {number} - Price of the package in cents
|
1358
1333
|
*/
|
@@ -2044,9 +2019,71 @@ declare class _25 extends ThrowableError {
|
|
2044
2019
|
throw(): void;
|
2045
2020
|
}
|
2046
2021
|
|
2022
|
+
/**
|
2023
|
+
* The shape of the model inside the application code - what the users use
|
2024
|
+
*/
|
2025
|
+
declare const getAccessTokenRequest: z.ZodLazy<z.ZodObject<{
|
2026
|
+
grantType: z.ZodOptional<z.ZodString>;
|
2027
|
+
clientId: z.ZodOptional<z.ZodString>;
|
2028
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
2029
|
+
}, "strip", z.ZodTypeAny, {
|
2030
|
+
grantType?: string | undefined;
|
2031
|
+
clientId?: string | undefined;
|
2032
|
+
clientSecret?: string | undefined;
|
2033
|
+
}, {
|
2034
|
+
grantType?: string | undefined;
|
2035
|
+
clientId?: string | undefined;
|
2036
|
+
clientSecret?: string | undefined;
|
2037
|
+
}>>;
|
2038
|
+
/**
|
2039
|
+
*
|
2040
|
+
* @typedef {GetAccessTokenRequest} getAccessTokenRequest
|
2041
|
+
* @property {GrantType}
|
2042
|
+
* @property {string}
|
2043
|
+
* @property {string}
|
2044
|
+
*/
|
2045
|
+
type GetAccessTokenRequest = z.infer<typeof getAccessTokenRequest>;
|
2046
|
+
|
2047
|
+
/**
|
2048
|
+
* The shape of the model inside the application code - what the users use
|
2049
|
+
*/
|
2050
|
+
declare const getAccessTokenOkResponse: z.ZodLazy<z.ZodObject<{
|
2051
|
+
accessToken: z.ZodOptional<z.ZodString>;
|
2052
|
+
tokenType: z.ZodOptional<z.ZodString>;
|
2053
|
+
expiresIn: z.ZodOptional<z.ZodNumber>;
|
2054
|
+
}, "strip", z.ZodTypeAny, {
|
2055
|
+
accessToken?: string | undefined;
|
2056
|
+
tokenType?: string | undefined;
|
2057
|
+
expiresIn?: number | undefined;
|
2058
|
+
}, {
|
2059
|
+
accessToken?: string | undefined;
|
2060
|
+
tokenType?: string | undefined;
|
2061
|
+
expiresIn?: number | undefined;
|
2062
|
+
}>>;
|
2063
|
+
/**
|
2064
|
+
*
|
2065
|
+
* @typedef {GetAccessTokenOkResponse} getAccessTokenOkResponse
|
2066
|
+
* @property {string}
|
2067
|
+
* @property {string}
|
2068
|
+
* @property {number}
|
2069
|
+
*/
|
2070
|
+
type GetAccessTokenOkResponse = z.infer<typeof getAccessTokenOkResponse>;
|
2071
|
+
|
2072
|
+
declare class OAuthService extends BaseService {
|
2073
|
+
/**
|
2074
|
+
* This endpoint was added by liblab
|
2075
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
2076
|
+
* @returns {Promise<HttpResponse<GetAccessTokenOkResponse>>} Successful Response
|
2077
|
+
*/
|
2078
|
+
getAccessToken(body: GetAccessTokenRequest, requestConfig?: RequestConfig): Promise<HttpResponse<GetAccessTokenOkResponse>>;
|
2079
|
+
}
|
2080
|
+
|
2081
|
+
declare enum GrantType {
|
2082
|
+
CLIENT_CREDENTIALS = "client_credentials"
|
2083
|
+
}
|
2084
|
+
|
2047
2085
|
declare class Celitech {
|
2048
2086
|
config: SdkConfig;
|
2049
|
-
readonly oAuth: OAuthService;
|
2050
2087
|
readonly destinations: DestinationsService;
|
2051
2088
|
readonly packages: PackagesService;
|
2052
2089
|
readonly purchases: PurchasesService;
|
package/dist/index.js
CHANGED
@@ -248,25 +248,26 @@ var TransportHookAdapter = class {
|
|
248
248
|
|
249
249
|
// src/http/utils/content-type.ts
|
250
250
|
function getContentTypeDefinition(contentType) {
|
251
|
-
|
251
|
+
const ct = contentType.toLowerCase();
|
252
|
+
if (ct.startsWith("application/") && ct.includes("xml")) {
|
252
253
|
return "xml" /* Xml */;
|
253
254
|
}
|
254
|
-
if (
|
255
|
+
if (ct === "application/x-www-form-urlencoded") {
|
255
256
|
return "form" /* FormUrlEncoded */;
|
256
257
|
}
|
257
|
-
if (
|
258
|
+
if (ct === "text/event-stream") {
|
258
259
|
return "eventStream" /* EventStream */;
|
259
260
|
}
|
260
|
-
if (
|
261
|
+
if (ct.startsWith("text/")) {
|
261
262
|
return "text" /* Text */;
|
262
263
|
}
|
263
|
-
if (
|
264
|
+
if (ct.startsWith("image/")) {
|
264
265
|
return "image" /* Image */;
|
265
266
|
}
|
266
|
-
if (
|
267
|
+
if (ct === "application/octet-stream" || ct === "application/pdf") {
|
267
268
|
return "binary" /* Binary */;
|
268
269
|
}
|
269
|
-
if (
|
270
|
+
if (ct === "application/json") {
|
270
271
|
return "json" /* Json */;
|
271
272
|
}
|
272
273
|
return "json" /* Json */;
|
@@ -379,7 +380,7 @@ var ResponseValidationHandler = class {
|
|
379
380
|
const encoder = new TextEncoder();
|
380
381
|
return text.split("\n").filter((line) => line.startsWith("data: ")).map((part) => ({
|
381
382
|
...response,
|
382
|
-
raw: encoder.encode(part)
|
383
|
+
raw: encoder.encode(part).buffer
|
383
384
|
}));
|
384
385
|
}
|
385
386
|
decodeBody(request, response) {
|
@@ -549,7 +550,7 @@ var RequestValidationHandler = class {
|
|
549
550
|
} else if (request.requestContentType === "form" /* FormUrlEncoded */) {
|
550
551
|
request.body = this.toFormUrlEncoded(request);
|
551
552
|
} else if (request.requestContentType === "multipartFormData" /* MultipartFormData */) {
|
552
|
-
request.body = this.toFormData(request.body);
|
553
|
+
request.body = this.toFormData(request.body, request.filename, request.filenames);
|
553
554
|
} else {
|
554
555
|
request.body = JSON.stringify((_b = request.requestSchema) == null ? void 0 : _b.parse(request.body));
|
555
556
|
}
|
@@ -586,14 +587,22 @@ var RequestValidationHandler = class {
|
|
586
587
|
}
|
587
588
|
return "";
|
588
589
|
}
|
589
|
-
toFormData(body) {
|
590
|
+
toFormData(body, filename, filenames) {
|
590
591
|
const formData = new FormData();
|
591
592
|
Object.keys(body).forEach((key) => {
|
592
593
|
const value = body[key];
|
593
594
|
if (Array.isArray(value)) {
|
594
|
-
value.forEach((v, i) =>
|
595
|
+
value.forEach((v, i) => {
|
596
|
+
if (v instanceof ArrayBuffer) {
|
597
|
+
const fileFilename = filenames && filenames[i] ? filenames[i] : `${key}[${i}]`;
|
598
|
+
formData.append(`${key}[${i}]`, new Blob([v]), fileFilename);
|
599
|
+
} else {
|
600
|
+
formData.append(`${key}[${i}]`, v);
|
601
|
+
}
|
602
|
+
});
|
595
603
|
} else if (value instanceof ArrayBuffer) {
|
596
|
-
|
604
|
+
const fileFilename = filename || key;
|
605
|
+
formData.append(key, new Blob([value]), fileFilename);
|
597
606
|
} else {
|
598
607
|
formData.append(key, value);
|
599
608
|
}
|
@@ -685,14 +694,14 @@ var RequestFetchAdapter = class {
|
|
685
694
|
for (const line of lineDecoder.splitLines(value)) {
|
686
695
|
yield {
|
687
696
|
metadata,
|
688
|
-
raw: line
|
697
|
+
raw: this.toArrayBuffer(line)
|
689
698
|
};
|
690
699
|
}
|
691
700
|
}
|
692
701
|
for (const line of lineDecoder.flush()) {
|
693
702
|
yield {
|
694
703
|
metadata,
|
695
|
-
raw: line
|
704
|
+
raw: this.toArrayBuffer(line)
|
696
705
|
};
|
697
706
|
}
|
698
707
|
}
|
@@ -739,6 +748,9 @@ var RequestFetchAdapter = class {
|
|
739
748
|
});
|
740
749
|
return headers;
|
741
750
|
}
|
751
|
+
toArrayBuffer(uint8Array) {
|
752
|
+
return uint8Array.buffer.slice(uint8Array.byteOffset, uint8Array.byteOffset + uint8Array.byteLength);
|
753
|
+
}
|
742
754
|
};
|
743
755
|
|
744
756
|
// src/http/handlers/terminating-handler.ts
|
@@ -997,6 +1009,8 @@ var Request = class {
|
|
997
1009
|
this.retry = params.retry;
|
998
1010
|
this.validation = params.validation;
|
999
1011
|
this.pagination = params.pagination;
|
1012
|
+
this.filename = params.filename;
|
1013
|
+
this.filenames = params.filenames;
|
1000
1014
|
this.scopes = params.scopes;
|
1001
1015
|
this.tokenManager = params.tokenManager;
|
1002
1016
|
}
|
@@ -1064,7 +1078,7 @@ var Request = class {
|
|
1064
1078
|
return `${baseUrl}${path}${queryString}`;
|
1065
1079
|
}
|
1066
1080
|
copy(overrides) {
|
1067
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
1081
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
1068
1082
|
const createRequestParams = {
|
1069
1083
|
baseUrl: (_a = overrides == null ? void 0 : overrides.baseUrl) != null ? _a : this.baseUrl,
|
1070
1084
|
errors: (_b = overrides == null ? void 0 : overrides.errors) != null ? _b : this.errors,
|
@@ -1080,6 +1094,8 @@ var Request = class {
|
|
1080
1094
|
requestContentType: (_l = overrides == null ? void 0 : overrides.requestContentType) != null ? _l : this.requestContentType,
|
1081
1095
|
retry: (_m = overrides == null ? void 0 : overrides.retry) != null ? _m : this.retry,
|
1082
1096
|
validation: (_n = overrides == null ? void 0 : overrides.validation) != null ? _n : this.validation,
|
1097
|
+
filename: (_o = overrides == null ? void 0 : overrides.filename) != null ? _o : this.filename,
|
1098
|
+
filenames: (_p = overrides == null ? void 0 : overrides.filenames) != null ? _p : this.filenames,
|
1083
1099
|
scopes: overrides == null ? void 0 : overrides.scopes,
|
1084
1100
|
tokenManager: this.tokenManager
|
1085
1101
|
};
|
@@ -1210,6 +1226,18 @@ var RequestBuilder = class {
|
|
1210
1226
|
this.params.requestSchema = requestSchema;
|
1211
1227
|
return this;
|
1212
1228
|
}
|
1229
|
+
setFilename(filename) {
|
1230
|
+
if (filename !== void 0) {
|
1231
|
+
this.params.filename = filename;
|
1232
|
+
}
|
1233
|
+
return this;
|
1234
|
+
}
|
1235
|
+
setFilenames(filenames) {
|
1236
|
+
if (filenames !== void 0) {
|
1237
|
+
this.params.filenames = filenames;
|
1238
|
+
}
|
1239
|
+
return this;
|
1240
|
+
}
|
1213
1241
|
setPagination(pagination) {
|
1214
1242
|
this.params.pagination = pagination;
|
1215
1243
|
return this;
|
@@ -1447,7 +1475,7 @@ var OAuthToken = class {
|
|
1447
1475
|
var OAuthTokenManager = class {
|
1448
1476
|
async getToken(scopes, config) {
|
1449
1477
|
var _a, _b, _c, _d, _e, _f;
|
1450
|
-
if (((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) && ((_b = this.token) == null ? void 0 : _b.expiresAt) && this.token.expiresAt - Date.now() >
|
1478
|
+
if (((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) && ((_b = this.token) == null ? void 0 : _b.expiresAt) && this.token.expiresAt - Date.now() > 5e3) {
|
1451
1479
|
return this.token;
|
1452
1480
|
}
|
1453
1481
|
if (!config.clientId || !config.clientSecret) {
|
@@ -1495,6 +1523,7 @@ var destinations = import_zod6.z.lazy(() => {
|
|
1495
1523
|
return import_zod6.z.object({
|
1496
1524
|
name: import_zod6.z.string().optional(),
|
1497
1525
|
destination: import_zod6.z.string().optional(),
|
1526
|
+
destinationIso2: import_zod6.z.string().optional(),
|
1498
1527
|
supportedCountries: import_zod6.z.array(import_zod6.z.string()).optional()
|
1499
1528
|
});
|
1500
1529
|
});
|
@@ -1502,10 +1531,12 @@ var destinationsResponse = import_zod6.z.lazy(() => {
|
|
1502
1531
|
return import_zod6.z.object({
|
1503
1532
|
name: import_zod6.z.string().optional(),
|
1504
1533
|
destination: import_zod6.z.string().optional(),
|
1534
|
+
destinationISO2: import_zod6.z.string().optional(),
|
1505
1535
|
supportedCountries: import_zod6.z.array(import_zod6.z.string()).optional()
|
1506
1536
|
}).transform((data) => ({
|
1507
1537
|
name: data["name"],
|
1508
1538
|
destination: data["destination"],
|
1539
|
+
destinationIso2: data["destinationISO2"],
|
1509
1540
|
supportedCountries: data["supportedCountries"]
|
1510
1541
|
}));
|
1511
1542
|
});
|
@@ -1513,10 +1544,12 @@ var destinationsRequest = import_zod6.z.lazy(() => {
|
|
1513
1544
|
return import_zod6.z.object({
|
1514
1545
|
name: import_zod6.z.string().optional(),
|
1515
1546
|
destination: import_zod6.z.string().optional(),
|
1547
|
+
destinationIso2: import_zod6.z.string().optional(),
|
1516
1548
|
supportedCountries: import_zod6.z.array(import_zod6.z.string()).optional()
|
1517
1549
|
}).transform((data) => ({
|
1518
1550
|
name: data["name"],
|
1519
1551
|
destination: data["destination"],
|
1552
|
+
destinationISO2: data["destinationIso2"],
|
1520
1553
|
supportedCountries: data["supportedCountries"]
|
1521
1554
|
}));
|
1522
1555
|
});
|
@@ -1637,6 +1670,7 @@ var packages = import_zod11.z.lazy(() => {
|
|
1637
1670
|
return import_zod11.z.object({
|
1638
1671
|
id: import_zod11.z.string().optional(),
|
1639
1672
|
destination: import_zod11.z.string().optional(),
|
1673
|
+
destinationIso2: import_zod11.z.string().optional(),
|
1640
1674
|
dataLimitInBytes: import_zod11.z.number().optional(),
|
1641
1675
|
minDays: import_zod11.z.number().optional(),
|
1642
1676
|
maxDays: import_zod11.z.number().optional(),
|
@@ -1647,6 +1681,7 @@ var packagesResponse = import_zod11.z.lazy(() => {
|
|
1647
1681
|
return import_zod11.z.object({
|
1648
1682
|
id: import_zod11.z.string().optional(),
|
1649
1683
|
destination: import_zod11.z.string().optional(),
|
1684
|
+
destinationISO2: import_zod11.z.string().optional(),
|
1650
1685
|
dataLimitInBytes: import_zod11.z.number().optional(),
|
1651
1686
|
minDays: import_zod11.z.number().optional(),
|
1652
1687
|
maxDays: import_zod11.z.number().optional(),
|
@@ -1654,6 +1689,7 @@ var packagesResponse = import_zod11.z.lazy(() => {
|
|
1654
1689
|
}).transform((data) => ({
|
1655
1690
|
id: data["id"],
|
1656
1691
|
destination: data["destination"],
|
1692
|
+
destinationIso2: data["destinationISO2"],
|
1657
1693
|
dataLimitInBytes: data["dataLimitInBytes"],
|
1658
1694
|
minDays: data["minDays"],
|
1659
1695
|
maxDays: data["maxDays"],
|
@@ -1664,6 +1700,7 @@ var packagesRequest = import_zod11.z.lazy(() => {
|
|
1664
1700
|
return import_zod11.z.object({
|
1665
1701
|
id: import_zod11.z.string().optional(),
|
1666
1702
|
destination: import_zod11.z.string().optional(),
|
1703
|
+
destinationIso2: import_zod11.z.string().optional(),
|
1667
1704
|
dataLimitInBytes: import_zod11.z.number().optional(),
|
1668
1705
|
minDays: import_zod11.z.number().optional(),
|
1669
1706
|
maxDays: import_zod11.z.number().optional(),
|
@@ -1671,6 +1708,7 @@ var packagesRequest = import_zod11.z.lazy(() => {
|
|
1671
1708
|
}).transform((data) => ({
|
1672
1709
|
id: data["id"],
|
1673
1710
|
destination: data["destination"],
|
1711
|
+
destinationISO2: data["destinationIso2"],
|
1674
1712
|
dataLimitInBytes: data["dataLimitInBytes"],
|
1675
1713
|
minDays: data["minDays"],
|
1676
1714
|
maxDays: data["maxDays"],
|
@@ -1752,7 +1790,7 @@ var _3 = class extends ThrowableError {
|
|
1752
1790
|
var PackagesService = class extends BaseService {
|
1753
1791
|
/**
|
1754
1792
|
* List Packages
|
1755
|
-
* @param {string} [params.destination] - ISO representation of the package's destination.
|
1793
|
+
* @param {string} [params.destination] - ISO representation of the package's destination. Supports both ISO2 (e.g., 'FR') and ISO3 (e.g., 'FRA') country codes.
|
1756
1794
|
* @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.
|
1757
1795
|
* @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.
|
1758
1796
|
* @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.
|
@@ -2020,6 +2058,7 @@ var package_ = import_zod22.z.lazy(() => {
|
|
2020
2058
|
id: import_zod22.z.string().optional(),
|
2021
2059
|
dataLimitInBytes: import_zod22.z.number().optional(),
|
2022
2060
|
destination: import_zod22.z.string().optional(),
|
2061
|
+
destinationIso2: import_zod22.z.string().optional(),
|
2023
2062
|
destinationName: import_zod22.z.string().optional(),
|
2024
2063
|
priceInCents: import_zod22.z.number().optional()
|
2025
2064
|
});
|
@@ -2029,12 +2068,14 @@ var packageResponse = import_zod22.z.lazy(() => {
|
|
2029
2068
|
id: import_zod22.z.string().optional(),
|
2030
2069
|
dataLimitInBytes: import_zod22.z.number().optional(),
|
2031
2070
|
destination: import_zod22.z.string().optional(),
|
2071
|
+
destinationISO2: import_zod22.z.string().optional(),
|
2032
2072
|
destinationName: import_zod22.z.string().optional(),
|
2033
2073
|
priceInCents: import_zod22.z.number().optional()
|
2034
2074
|
}).transform((data) => ({
|
2035
2075
|
id: data["id"],
|
2036
2076
|
dataLimitInBytes: data["dataLimitInBytes"],
|
2037
2077
|
destination: data["destination"],
|
2078
|
+
destinationIso2: data["destinationISO2"],
|
2038
2079
|
destinationName: data["destinationName"],
|
2039
2080
|
priceInCents: data["priceInCents"]
|
2040
2081
|
}));
|
@@ -2044,12 +2085,14 @@ var packageRequest = import_zod22.z.lazy(() => {
|
|
2044
2085
|
id: import_zod22.z.string().optional(),
|
2045
2086
|
dataLimitInBytes: import_zod22.z.number().optional(),
|
2046
2087
|
destination: import_zod22.z.string().optional(),
|
2088
|
+
destinationIso2: import_zod22.z.string().optional(),
|
2047
2089
|
destinationName: import_zod22.z.string().optional(),
|
2048
2090
|
priceInCents: import_zod22.z.number().optional()
|
2049
2091
|
}).transform((data) => ({
|
2050
2092
|
id: data["id"],
|
2051
2093
|
dataLimitInBytes: data["dataLimitInBytes"],
|
2052
2094
|
destination: data["destination"],
|
2095
|
+
destinationISO2: data["destinationIso2"],
|
2053
2096
|
destinationName: data["destinationName"],
|
2054
2097
|
priceInCents: data["priceInCents"]
|
2055
2098
|
}));
|
@@ -3666,7 +3709,6 @@ var Celitech = class {
|
|
3666
3709
|
constructor(config) {
|
3667
3710
|
this.config = config;
|
3668
3711
|
this.tokenManager = new OAuthTokenManager();
|
3669
|
-
this.oAuth = new OAuthService(this.config, this.tokenManager);
|
3670
3712
|
this.destinations = new DestinationsService(this.config, this.tokenManager);
|
3671
3713
|
this.packages = new PackagesService(this.config, this.tokenManager);
|
3672
3714
|
this.purchases = new PurchasesService(this.config, this.tokenManager);
|
@@ -3674,7 +3716,6 @@ var Celitech = class {
|
|
3674
3716
|
this.iFrame = new IFrameService(this.config, this.tokenManager);
|
3675
3717
|
}
|
3676
3718
|
set baseUrl(baseUrl) {
|
3677
|
-
this.oAuth.baseUrl = baseUrl;
|
3678
3719
|
this.destinations.baseUrl = baseUrl;
|
3679
3720
|
this.packages.baseUrl = baseUrl;
|
3680
3721
|
this.purchases.baseUrl = baseUrl;
|
@@ -3682,7 +3723,6 @@ var Celitech = class {
|
|
3682
3723
|
this.iFrame.baseUrl = baseUrl;
|
3683
3724
|
}
|
3684
3725
|
set environment(environment) {
|
3685
|
-
this.oAuth.baseUrl = environment;
|
3686
3726
|
this.destinations.baseUrl = environment;
|
3687
3727
|
this.packages.baseUrl = environment;
|
3688
3728
|
this.purchases.baseUrl = environment;
|
@@ -3690,7 +3730,6 @@ var Celitech = class {
|
|
3690
3730
|
this.iFrame.baseUrl = environment;
|
3691
3731
|
}
|
3692
3732
|
set timeoutMs(timeoutMs) {
|
3693
|
-
this.oAuth.timeoutMs = timeoutMs;
|
3694
3733
|
this.destinations.timeoutMs = timeoutMs;
|
3695
3734
|
this.packages.timeoutMs = timeoutMs;
|
3696
3735
|
this.purchases.timeoutMs = timeoutMs;
|
@@ -3698,7 +3737,6 @@ var Celitech = class {
|
|
3698
3737
|
this.iFrame.timeoutMs = timeoutMs;
|
3699
3738
|
}
|
3700
3739
|
set clientId(clientId) {
|
3701
|
-
this.oAuth.clientId = clientId;
|
3702
3740
|
this.destinations.clientId = clientId;
|
3703
3741
|
this.packages.clientId = clientId;
|
3704
3742
|
this.purchases.clientId = clientId;
|
@@ -3706,7 +3744,6 @@ var Celitech = class {
|
|
3706
3744
|
this.iFrame.clientId = clientId;
|
3707
3745
|
}
|
3708
3746
|
set clientSecret(clientSecret) {
|
3709
|
-
this.oAuth.clientSecret = clientSecret;
|
3710
3747
|
this.destinations.clientSecret = clientSecret;
|
3711
3748
|
this.packages.clientSecret = clientSecret;
|
3712
3749
|
this.purchases.clientSecret = clientSecret;
|
@@ -3714,7 +3751,6 @@ var Celitech = class {
|
|
3714
3751
|
this.iFrame.clientSecret = clientSecret;
|
3715
3752
|
}
|
3716
3753
|
set oAuthBaseUrl(oAuthBaseUrl) {
|
3717
|
-
this.oAuth.oAuthBaseUrl = oAuthBaseUrl;
|
3718
3754
|
this.destinations.oAuthBaseUrl = oAuthBaseUrl;
|
3719
3755
|
this.packages.oAuthBaseUrl = oAuthBaseUrl;
|
3720
3756
|
this.purchases.oAuthBaseUrl = oAuthBaseUrl;
|
@@ -3722,7 +3758,6 @@ var Celitech = class {
|
|
3722
3758
|
this.iFrame.oAuthBaseUrl = oAuthBaseUrl;
|
3723
3759
|
}
|
3724
3760
|
set accessToken(accessToken) {
|
3725
|
-
this.oAuth.accessToken = accessToken;
|
3726
3761
|
this.destinations.accessToken = accessToken;
|
3727
3762
|
this.packages.accessToken = accessToken;
|
3728
3763
|
this.purchases.accessToken = accessToken;
|
package/dist/index.mjs
CHANGED
@@ -204,25 +204,26 @@ var TransportHookAdapter = class {
|
|
204
204
|
|
205
205
|
// src/http/utils/content-type.ts
|
206
206
|
function getContentTypeDefinition(contentType) {
|
207
|
-
|
207
|
+
const ct = contentType.toLowerCase();
|
208
|
+
if (ct.startsWith("application/") && ct.includes("xml")) {
|
208
209
|
return "xml" /* Xml */;
|
209
210
|
}
|
210
|
-
if (
|
211
|
+
if (ct === "application/x-www-form-urlencoded") {
|
211
212
|
return "form" /* FormUrlEncoded */;
|
212
213
|
}
|
213
|
-
if (
|
214
|
+
if (ct === "text/event-stream") {
|
214
215
|
return "eventStream" /* EventStream */;
|
215
216
|
}
|
216
|
-
if (
|
217
|
+
if (ct.startsWith("text/")) {
|
217
218
|
return "text" /* Text */;
|
218
219
|
}
|
219
|
-
if (
|
220
|
+
if (ct.startsWith("image/")) {
|
220
221
|
return "image" /* Image */;
|
221
222
|
}
|
222
|
-
if (
|
223
|
+
if (ct === "application/octet-stream" || ct === "application/pdf") {
|
223
224
|
return "binary" /* Binary */;
|
224
225
|
}
|
225
|
-
if (
|
226
|
+
if (ct === "application/json") {
|
226
227
|
return "json" /* Json */;
|
227
228
|
}
|
228
229
|
return "json" /* Json */;
|
@@ -335,7 +336,7 @@ var ResponseValidationHandler = class {
|
|
335
336
|
const encoder = new TextEncoder();
|
336
337
|
return text.split("\n").filter((line) => line.startsWith("data: ")).map((part) => ({
|
337
338
|
...response,
|
338
|
-
raw: encoder.encode(part)
|
339
|
+
raw: encoder.encode(part).buffer
|
339
340
|
}));
|
340
341
|
}
|
341
342
|
decodeBody(request, response) {
|
@@ -505,7 +506,7 @@ var RequestValidationHandler = class {
|
|
505
506
|
} else if (request.requestContentType === "form" /* FormUrlEncoded */) {
|
506
507
|
request.body = this.toFormUrlEncoded(request);
|
507
508
|
} else if (request.requestContentType === "multipartFormData" /* MultipartFormData */) {
|
508
|
-
request.body = this.toFormData(request.body);
|
509
|
+
request.body = this.toFormData(request.body, request.filename, request.filenames);
|
509
510
|
} else {
|
510
511
|
request.body = JSON.stringify((_b = request.requestSchema) == null ? void 0 : _b.parse(request.body));
|
511
512
|
}
|
@@ -542,14 +543,22 @@ var RequestValidationHandler = class {
|
|
542
543
|
}
|
543
544
|
return "";
|
544
545
|
}
|
545
|
-
toFormData(body) {
|
546
|
+
toFormData(body, filename, filenames) {
|
546
547
|
const formData = new FormData();
|
547
548
|
Object.keys(body).forEach((key) => {
|
548
549
|
const value = body[key];
|
549
550
|
if (Array.isArray(value)) {
|
550
|
-
value.forEach((v, i) =>
|
551
|
+
value.forEach((v, i) => {
|
552
|
+
if (v instanceof ArrayBuffer) {
|
553
|
+
const fileFilename = filenames && filenames[i] ? filenames[i] : `${key}[${i}]`;
|
554
|
+
formData.append(`${key}[${i}]`, new Blob([v]), fileFilename);
|
555
|
+
} else {
|
556
|
+
formData.append(`${key}[${i}]`, v);
|
557
|
+
}
|
558
|
+
});
|
551
559
|
} else if (value instanceof ArrayBuffer) {
|
552
|
-
|
560
|
+
const fileFilename = filename || key;
|
561
|
+
formData.append(key, new Blob([value]), fileFilename);
|
553
562
|
} else {
|
554
563
|
formData.append(key, value);
|
555
564
|
}
|
@@ -641,14 +650,14 @@ var RequestFetchAdapter = class {
|
|
641
650
|
for (const line of lineDecoder.splitLines(value)) {
|
642
651
|
yield {
|
643
652
|
metadata,
|
644
|
-
raw: line
|
653
|
+
raw: this.toArrayBuffer(line)
|
645
654
|
};
|
646
655
|
}
|
647
656
|
}
|
648
657
|
for (const line of lineDecoder.flush()) {
|
649
658
|
yield {
|
650
659
|
metadata,
|
651
|
-
raw: line
|
660
|
+
raw: this.toArrayBuffer(line)
|
652
661
|
};
|
653
662
|
}
|
654
663
|
}
|
@@ -695,6 +704,9 @@ var RequestFetchAdapter = class {
|
|
695
704
|
});
|
696
705
|
return headers;
|
697
706
|
}
|
707
|
+
toArrayBuffer(uint8Array) {
|
708
|
+
return uint8Array.buffer.slice(uint8Array.byteOffset, uint8Array.byteOffset + uint8Array.byteLength);
|
709
|
+
}
|
698
710
|
};
|
699
711
|
|
700
712
|
// src/http/handlers/terminating-handler.ts
|
@@ -953,6 +965,8 @@ var Request = class {
|
|
953
965
|
this.retry = params.retry;
|
954
966
|
this.validation = params.validation;
|
955
967
|
this.pagination = params.pagination;
|
968
|
+
this.filename = params.filename;
|
969
|
+
this.filenames = params.filenames;
|
956
970
|
this.scopes = params.scopes;
|
957
971
|
this.tokenManager = params.tokenManager;
|
958
972
|
}
|
@@ -1020,7 +1034,7 @@ var Request = class {
|
|
1020
1034
|
return `${baseUrl}${path}${queryString}`;
|
1021
1035
|
}
|
1022
1036
|
copy(overrides) {
|
1023
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
1037
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
1024
1038
|
const createRequestParams = {
|
1025
1039
|
baseUrl: (_a = overrides == null ? void 0 : overrides.baseUrl) != null ? _a : this.baseUrl,
|
1026
1040
|
errors: (_b = overrides == null ? void 0 : overrides.errors) != null ? _b : this.errors,
|
@@ -1036,6 +1050,8 @@ var Request = class {
|
|
1036
1050
|
requestContentType: (_l = overrides == null ? void 0 : overrides.requestContentType) != null ? _l : this.requestContentType,
|
1037
1051
|
retry: (_m = overrides == null ? void 0 : overrides.retry) != null ? _m : this.retry,
|
1038
1052
|
validation: (_n = overrides == null ? void 0 : overrides.validation) != null ? _n : this.validation,
|
1053
|
+
filename: (_o = overrides == null ? void 0 : overrides.filename) != null ? _o : this.filename,
|
1054
|
+
filenames: (_p = overrides == null ? void 0 : overrides.filenames) != null ? _p : this.filenames,
|
1039
1055
|
scopes: overrides == null ? void 0 : overrides.scopes,
|
1040
1056
|
tokenManager: this.tokenManager
|
1041
1057
|
};
|
@@ -1166,6 +1182,18 @@ var RequestBuilder = class {
|
|
1166
1182
|
this.params.requestSchema = requestSchema;
|
1167
1183
|
return this;
|
1168
1184
|
}
|
1185
|
+
setFilename(filename) {
|
1186
|
+
if (filename !== void 0) {
|
1187
|
+
this.params.filename = filename;
|
1188
|
+
}
|
1189
|
+
return this;
|
1190
|
+
}
|
1191
|
+
setFilenames(filenames) {
|
1192
|
+
if (filenames !== void 0) {
|
1193
|
+
this.params.filenames = filenames;
|
1194
|
+
}
|
1195
|
+
return this;
|
1196
|
+
}
|
1169
1197
|
setPagination(pagination) {
|
1170
1198
|
this.params.pagination = pagination;
|
1171
1199
|
return this;
|
@@ -1403,7 +1431,7 @@ var OAuthToken = class {
|
|
1403
1431
|
var OAuthTokenManager = class {
|
1404
1432
|
async getToken(scopes, config) {
|
1405
1433
|
var _a, _b, _c, _d, _e, _f;
|
1406
|
-
if (((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) && ((_b = this.token) == null ? void 0 : _b.expiresAt) && this.token.expiresAt - Date.now() >
|
1434
|
+
if (((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) && ((_b = this.token) == null ? void 0 : _b.expiresAt) && this.token.expiresAt - Date.now() > 5e3) {
|
1407
1435
|
return this.token;
|
1408
1436
|
}
|
1409
1437
|
if (!config.clientId || !config.clientSecret) {
|
@@ -1451,6 +1479,7 @@ var destinations = z4.lazy(() => {
|
|
1451
1479
|
return z4.object({
|
1452
1480
|
name: z4.string().optional(),
|
1453
1481
|
destination: z4.string().optional(),
|
1482
|
+
destinationIso2: z4.string().optional(),
|
1454
1483
|
supportedCountries: z4.array(z4.string()).optional()
|
1455
1484
|
});
|
1456
1485
|
});
|
@@ -1458,10 +1487,12 @@ var destinationsResponse = z4.lazy(() => {
|
|
1458
1487
|
return z4.object({
|
1459
1488
|
name: z4.string().optional(),
|
1460
1489
|
destination: z4.string().optional(),
|
1490
|
+
destinationISO2: z4.string().optional(),
|
1461
1491
|
supportedCountries: z4.array(z4.string()).optional()
|
1462
1492
|
}).transform((data) => ({
|
1463
1493
|
name: data["name"],
|
1464
1494
|
destination: data["destination"],
|
1495
|
+
destinationIso2: data["destinationISO2"],
|
1465
1496
|
supportedCountries: data["supportedCountries"]
|
1466
1497
|
}));
|
1467
1498
|
});
|
@@ -1469,10 +1500,12 @@ var destinationsRequest = z4.lazy(() => {
|
|
1469
1500
|
return z4.object({
|
1470
1501
|
name: z4.string().optional(),
|
1471
1502
|
destination: z4.string().optional(),
|
1503
|
+
destinationIso2: z4.string().optional(),
|
1472
1504
|
supportedCountries: z4.array(z4.string()).optional()
|
1473
1505
|
}).transform((data) => ({
|
1474
1506
|
name: data["name"],
|
1475
1507
|
destination: data["destination"],
|
1508
|
+
destinationISO2: data["destinationIso2"],
|
1476
1509
|
supportedCountries: data["supportedCountries"]
|
1477
1510
|
}));
|
1478
1511
|
});
|
@@ -1593,6 +1626,7 @@ var packages = z9.lazy(() => {
|
|
1593
1626
|
return z9.object({
|
1594
1627
|
id: z9.string().optional(),
|
1595
1628
|
destination: z9.string().optional(),
|
1629
|
+
destinationIso2: z9.string().optional(),
|
1596
1630
|
dataLimitInBytes: z9.number().optional(),
|
1597
1631
|
minDays: z9.number().optional(),
|
1598
1632
|
maxDays: z9.number().optional(),
|
@@ -1603,6 +1637,7 @@ var packagesResponse = z9.lazy(() => {
|
|
1603
1637
|
return z9.object({
|
1604
1638
|
id: z9.string().optional(),
|
1605
1639
|
destination: z9.string().optional(),
|
1640
|
+
destinationISO2: z9.string().optional(),
|
1606
1641
|
dataLimitInBytes: z9.number().optional(),
|
1607
1642
|
minDays: z9.number().optional(),
|
1608
1643
|
maxDays: z9.number().optional(),
|
@@ -1610,6 +1645,7 @@ var packagesResponse = z9.lazy(() => {
|
|
1610
1645
|
}).transform((data) => ({
|
1611
1646
|
id: data["id"],
|
1612
1647
|
destination: data["destination"],
|
1648
|
+
destinationIso2: data["destinationISO2"],
|
1613
1649
|
dataLimitInBytes: data["dataLimitInBytes"],
|
1614
1650
|
minDays: data["minDays"],
|
1615
1651
|
maxDays: data["maxDays"],
|
@@ -1620,6 +1656,7 @@ var packagesRequest = z9.lazy(() => {
|
|
1620
1656
|
return z9.object({
|
1621
1657
|
id: z9.string().optional(),
|
1622
1658
|
destination: z9.string().optional(),
|
1659
|
+
destinationIso2: z9.string().optional(),
|
1623
1660
|
dataLimitInBytes: z9.number().optional(),
|
1624
1661
|
minDays: z9.number().optional(),
|
1625
1662
|
maxDays: z9.number().optional(),
|
@@ -1627,6 +1664,7 @@ var packagesRequest = z9.lazy(() => {
|
|
1627
1664
|
}).transform((data) => ({
|
1628
1665
|
id: data["id"],
|
1629
1666
|
destination: data["destination"],
|
1667
|
+
destinationISO2: data["destinationIso2"],
|
1630
1668
|
dataLimitInBytes: data["dataLimitInBytes"],
|
1631
1669
|
minDays: data["minDays"],
|
1632
1670
|
maxDays: data["maxDays"],
|
@@ -1708,7 +1746,7 @@ var _3 = class extends ThrowableError {
|
|
1708
1746
|
var PackagesService = class extends BaseService {
|
1709
1747
|
/**
|
1710
1748
|
* List Packages
|
1711
|
-
* @param {string} [params.destination] - ISO representation of the package's destination.
|
1749
|
+
* @param {string} [params.destination] - ISO representation of the package's destination. Supports both ISO2 (e.g., 'FR') and ISO3 (e.g., 'FRA') country codes.
|
1712
1750
|
* @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.
|
1713
1751
|
* @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.
|
1714
1752
|
* @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.
|
@@ -1976,6 +2014,7 @@ var package_ = z20.lazy(() => {
|
|
1976
2014
|
id: z20.string().optional(),
|
1977
2015
|
dataLimitInBytes: z20.number().optional(),
|
1978
2016
|
destination: z20.string().optional(),
|
2017
|
+
destinationIso2: z20.string().optional(),
|
1979
2018
|
destinationName: z20.string().optional(),
|
1980
2019
|
priceInCents: z20.number().optional()
|
1981
2020
|
});
|
@@ -1985,12 +2024,14 @@ var packageResponse = z20.lazy(() => {
|
|
1985
2024
|
id: z20.string().optional(),
|
1986
2025
|
dataLimitInBytes: z20.number().optional(),
|
1987
2026
|
destination: z20.string().optional(),
|
2027
|
+
destinationISO2: z20.string().optional(),
|
1988
2028
|
destinationName: z20.string().optional(),
|
1989
2029
|
priceInCents: z20.number().optional()
|
1990
2030
|
}).transform((data) => ({
|
1991
2031
|
id: data["id"],
|
1992
2032
|
dataLimitInBytes: data["dataLimitInBytes"],
|
1993
2033
|
destination: data["destination"],
|
2034
|
+
destinationIso2: data["destinationISO2"],
|
1994
2035
|
destinationName: data["destinationName"],
|
1995
2036
|
priceInCents: data["priceInCents"]
|
1996
2037
|
}));
|
@@ -2000,12 +2041,14 @@ var packageRequest = z20.lazy(() => {
|
|
2000
2041
|
id: z20.string().optional(),
|
2001
2042
|
dataLimitInBytes: z20.number().optional(),
|
2002
2043
|
destination: z20.string().optional(),
|
2044
|
+
destinationIso2: z20.string().optional(),
|
2003
2045
|
destinationName: z20.string().optional(),
|
2004
2046
|
priceInCents: z20.number().optional()
|
2005
2047
|
}).transform((data) => ({
|
2006
2048
|
id: data["id"],
|
2007
2049
|
dataLimitInBytes: data["dataLimitInBytes"],
|
2008
2050
|
destination: data["destination"],
|
2051
|
+
destinationISO2: data["destinationIso2"],
|
2009
2052
|
destinationName: data["destinationName"],
|
2010
2053
|
priceInCents: data["priceInCents"]
|
2011
2054
|
}));
|
@@ -3622,7 +3665,6 @@ var Celitech = class {
|
|
3622
3665
|
constructor(config) {
|
3623
3666
|
this.config = config;
|
3624
3667
|
this.tokenManager = new OAuthTokenManager();
|
3625
|
-
this.oAuth = new OAuthService(this.config, this.tokenManager);
|
3626
3668
|
this.destinations = new DestinationsService(this.config, this.tokenManager);
|
3627
3669
|
this.packages = new PackagesService(this.config, this.tokenManager);
|
3628
3670
|
this.purchases = new PurchasesService(this.config, this.tokenManager);
|
@@ -3630,7 +3672,6 @@ var Celitech = class {
|
|
3630
3672
|
this.iFrame = new IFrameService(this.config, this.tokenManager);
|
3631
3673
|
}
|
3632
3674
|
set baseUrl(baseUrl) {
|
3633
|
-
this.oAuth.baseUrl = baseUrl;
|
3634
3675
|
this.destinations.baseUrl = baseUrl;
|
3635
3676
|
this.packages.baseUrl = baseUrl;
|
3636
3677
|
this.purchases.baseUrl = baseUrl;
|
@@ -3638,7 +3679,6 @@ var Celitech = class {
|
|
3638
3679
|
this.iFrame.baseUrl = baseUrl;
|
3639
3680
|
}
|
3640
3681
|
set environment(environment) {
|
3641
|
-
this.oAuth.baseUrl = environment;
|
3642
3682
|
this.destinations.baseUrl = environment;
|
3643
3683
|
this.packages.baseUrl = environment;
|
3644
3684
|
this.purchases.baseUrl = environment;
|
@@ -3646,7 +3686,6 @@ var Celitech = class {
|
|
3646
3686
|
this.iFrame.baseUrl = environment;
|
3647
3687
|
}
|
3648
3688
|
set timeoutMs(timeoutMs) {
|
3649
|
-
this.oAuth.timeoutMs = timeoutMs;
|
3650
3689
|
this.destinations.timeoutMs = timeoutMs;
|
3651
3690
|
this.packages.timeoutMs = timeoutMs;
|
3652
3691
|
this.purchases.timeoutMs = timeoutMs;
|
@@ -3654,7 +3693,6 @@ var Celitech = class {
|
|
3654
3693
|
this.iFrame.timeoutMs = timeoutMs;
|
3655
3694
|
}
|
3656
3695
|
set clientId(clientId) {
|
3657
|
-
this.oAuth.clientId = clientId;
|
3658
3696
|
this.destinations.clientId = clientId;
|
3659
3697
|
this.packages.clientId = clientId;
|
3660
3698
|
this.purchases.clientId = clientId;
|
@@ -3662,7 +3700,6 @@ var Celitech = class {
|
|
3662
3700
|
this.iFrame.clientId = clientId;
|
3663
3701
|
}
|
3664
3702
|
set clientSecret(clientSecret) {
|
3665
|
-
this.oAuth.clientSecret = clientSecret;
|
3666
3703
|
this.destinations.clientSecret = clientSecret;
|
3667
3704
|
this.packages.clientSecret = clientSecret;
|
3668
3705
|
this.purchases.clientSecret = clientSecret;
|
@@ -3670,7 +3707,6 @@ var Celitech = class {
|
|
3670
3707
|
this.iFrame.clientSecret = clientSecret;
|
3671
3708
|
}
|
3672
3709
|
set oAuthBaseUrl(oAuthBaseUrl) {
|
3673
|
-
this.oAuth.oAuthBaseUrl = oAuthBaseUrl;
|
3674
3710
|
this.destinations.oAuthBaseUrl = oAuthBaseUrl;
|
3675
3711
|
this.packages.oAuthBaseUrl = oAuthBaseUrl;
|
3676
3712
|
this.purchases.oAuthBaseUrl = oAuthBaseUrl;
|
@@ -3678,7 +3714,6 @@ var Celitech = class {
|
|
3678
3714
|
this.iFrame.oAuthBaseUrl = oAuthBaseUrl;
|
3679
3715
|
}
|
3680
3716
|
set accessToken(accessToken) {
|
3681
|
-
this.oAuth.accessToken = accessToken;
|
3682
3717
|
this.destinations.accessToken = accessToken;
|
3683
3718
|
this.packages.accessToken = accessToken;
|
3684
3719
|
this.purchases.accessToken = accessToken;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "celitech-sdk",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.53",
|
4
4
|
"description": "Welcome to the CELITECH API documentation! Useful links: [Homepage](https://www.celitech.com) | [Support email](mailto:support@celitech.com) | [Blog](https://www.celitech.com/blog/)",
|
5
5
|
"source": "./src/index.ts",
|
6
6
|
"main": "./dist/index.js",
|