celitech-sdk 1.1.85 → 1.1.86
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -18
- package/dist/index.d.ts +1503 -12
- package/dist/index.js +2140 -76
- package/dist/index.mjs +2102 -0
- package/package.json +22 -5
- package/.devcontainer/devcontainer.json +0 -24
- package/.github/workflows/publish_npmjs.yml +0 -32
- package/.manifest.json +0 -256
- package/dist/http/client.d.ts +0 -14
- package/dist/http/client.d.ts.map +0 -1
- package/dist/http/client.js +0 -36
- package/dist/http/client.js.map +0 -1
- package/dist/http/environment.d.ts +0 -4
- package/dist/http/environment.d.ts.map +0 -1
- package/dist/http/environment.js +0 -8
- package/dist/http/environment.js.map +0 -1
- package/dist/http/error.d.ts +0 -7
- package/dist/http/error.d.ts.map +0 -1
- package/dist/http/error.js +0 -12
- package/dist/http/error.js.map +0 -1
- package/dist/http/handlers/handler-chain.d.ts +0 -8
- package/dist/http/handlers/handler-chain.d.ts.map +0 -1
- package/dist/http/handlers/handler-chain.js +0 -34
- package/dist/http/handlers/handler-chain.js.map +0 -1
- package/dist/http/handlers/hook-handler.d.ts +0 -12
- package/dist/http/handlers/hook-handler.d.ts.map +0 -1
- package/dist/http/handlers/hook-handler.js +0 -49
- package/dist/http/handlers/hook-handler.js.map +0 -1
- package/dist/http/handlers/request-validation-handler.d.ts +0 -9
- package/dist/http/handlers/request-validation-handler.d.ts.map +0 -1
- package/dist/http/handlers/request-validation-handler.js +0 -78
- package/dist/http/handlers/request-validation-handler.js.map +0 -1
- package/dist/http/handlers/response-validation-handler.d.ts +0 -11
- package/dist/http/handlers/response-validation-handler.d.ts.map +0 -1
- package/dist/http/handlers/response-validation-handler.js +0 -89
- package/dist/http/handlers/response-validation-handler.js.map +0 -1
- package/dist/http/handlers/retry-handler.d.ts +0 -9
- package/dist/http/handlers/retry-handler.d.ts.map +0 -1
- package/dist/http/handlers/retry-handler.js +0 -47
- package/dist/http/handlers/retry-handler.js.map +0 -1
- package/dist/http/handlers/terminating-handler.d.ts +0 -8
- package/dist/http/handlers/terminating-handler.d.ts.map +0 -1
- package/dist/http/handlers/terminating-handler.js +0 -45
- package/dist/http/handlers/terminating-handler.js.map +0 -1
- package/dist/http/hooks/custom-hook.d.ts +0 -8
- package/dist/http/hooks/custom-hook.d.ts.map +0 -1
- package/dist/http/hooks/custom-hook.js +0 -37
- package/dist/http/hooks/custom-hook.js.map +0 -1
- package/dist/http/hooks/hook.d.ts +0 -31
- package/dist/http/hooks/hook.d.ts.map +0 -1
- package/dist/http/hooks/hook.js +0 -3
- package/dist/http/hooks/hook.js.map +0 -1
- package/dist/http/serializer.d.ts +0 -13
- package/dist/http/serializer.d.ts.map +0 -1
- package/dist/http/serializer.js +0 -150
- package/dist/http/serializer.js.map +0 -1
- package/dist/http/transport/request-builder.d.ts +0 -24
- package/dist/http/transport/request-builder.d.ts.map +0 -1
- package/dist/http/transport/request-builder.js +0 -130
- package/dist/http/transport/request-builder.js.map +0 -1
- package/dist/http/transport/request.d.ts +0 -53
- package/dist/http/transport/request.d.ts.map +0 -1
- package/dist/http/transport/request.js +0 -116
- package/dist/http/transport/request.js.map +0 -1
- package/dist/http/types.d.ts +0 -60
- package/dist/http/types.d.ts.map +0 -1
- package/dist/http/types.js +0 -16
- package/dist/http/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/services/base-service.d.ts +0 -14
- package/dist/services/base-service.d.ts.map +0 -1
- package/dist/services/base-service.js +0 -27
- package/dist/services/base-service.js.map +0 -1
- package/dist/services/destinations/destinations.d.ts +0 -11
- package/dist/services/destinations/destinations.d.ts.map +0 -1
- package/dist/services/destinations/destinations.js +0 -43
- package/dist/services/destinations/destinations.js.map +0 -1
- package/dist/services/destinations/index.d.ts +0 -3
- package/dist/services/destinations/index.d.ts.map +0 -1
- package/dist/services/destinations/index.js +0 -21
- package/dist/services/destinations/index.js.map +0 -1
- package/dist/services/destinations/models/destinations.d.ts +0 -76
- package/dist/services/destinations/models/destinations.d.ts.map +0 -1
- package/dist/services/destinations/models/destinations.js +0 -49
- package/dist/services/destinations/models/destinations.js.map +0 -1
- package/dist/services/destinations/models/index.d.ts +0 -3
- package/dist/services/destinations/models/index.d.ts.map +0 -1
- package/dist/services/destinations/models/index.js +0 -3
- package/dist/services/destinations/models/index.js.map +0 -1
- package/dist/services/destinations/models/list-destinations-ok-response.d.ts +0 -140
- package/dist/services/destinations/models/list-destinations-ok-response.d.ts.map +0 -1
- package/dist/services/destinations/models/list-destinations-ok-response.js +0 -36
- package/dist/services/destinations/models/list-destinations-ok-response.js.map +0 -1
- package/dist/services/e-sim/e-sim.d.ts +0 -34
- package/dist/services/e-sim/e-sim.d.ts.map +0 -1
- package/dist/services/e-sim/e-sim.js +0 -120
- package/dist/services/e-sim/e-sim.js.map +0 -1
- package/dist/services/e-sim/index.d.ts +0 -3
- package/dist/services/e-sim/index.d.ts.map +0 -1
- package/dist/services/e-sim/index.js +0 -21
- package/dist/services/e-sim/index.js.map +0 -1
- package/dist/services/e-sim/models/device.d.ts +0 -90
- package/dist/services/e-sim/models/device.d.ts.map +0 -1
- package/dist/services/e-sim/models/device.js +0 -54
- package/dist/services/e-sim/models/device.js.map +0 -1
- package/dist/services/e-sim/models/get-esim-device-ok-response.d.ts +0 -163
- package/dist/services/e-sim/models/get-esim-device-ok-response.d.ts.map +0 -1
- package/dist/services/e-sim/models/get-esim-device-ok-response.js +0 -36
- package/dist/services/e-sim/models/get-esim-device-ok-response.js.map +0 -1
- package/dist/services/e-sim/models/get-esim-history-ok-response-esim.d.ts +0 -154
- package/dist/services/e-sim/models/get-esim-history-ok-response-esim.d.ts.map +0 -1
- package/dist/services/e-sim/models/get-esim-history-ok-response-esim.js +0 -40
- package/dist/services/e-sim/models/get-esim-history-ok-response-esim.js.map +0 -1
- package/dist/services/e-sim/models/get-esim-history-ok-response.d.ts +0 -249
- package/dist/services/e-sim/models/get-esim-history-ok-response.d.ts.map +0 -1
- package/dist/services/e-sim/models/get-esim-history-ok-response.js +0 -36
- package/dist/services/e-sim/models/get-esim-history-ok-response.js.map +0 -1
- package/dist/services/e-sim/models/get-esim-mac-ok-response-esim.d.ts +0 -76
- package/dist/services/e-sim/models/get-esim-mac-ok-response-esim.d.ts.map +0 -1
- package/dist/services/e-sim/models/get-esim-mac-ok-response-esim.js +0 -49
- package/dist/services/e-sim/models/get-esim-mac-ok-response-esim.js.map +0 -1
- package/dist/services/e-sim/models/get-esim-mac-ok-response.d.ts +0 -140
- package/dist/services/e-sim/models/get-esim-mac-ok-response.d.ts.map +0 -1
- package/dist/services/e-sim/models/get-esim-mac-ok-response.js +0 -36
- package/dist/services/e-sim/models/get-esim-mac-ok-response.js.map +0 -1
- package/dist/services/e-sim/models/get-esim-ok-response-esim.d.ts +0 -90
- package/dist/services/e-sim/models/get-esim-ok-response-esim.d.ts.map +0 -1
- package/dist/services/e-sim/models/get-esim-ok-response-esim.js +0 -54
- package/dist/services/e-sim/models/get-esim-ok-response-esim.js.map +0 -1
- package/dist/services/e-sim/models/get-esim-ok-response.d.ts +0 -163
- package/dist/services/e-sim/models/get-esim-ok-response.d.ts.map +0 -1
- package/dist/services/e-sim/models/get-esim-ok-response.js +0 -36
- package/dist/services/e-sim/models/get-esim-ok-response.js.map +0 -1
- package/dist/services/e-sim/models/history.d.ts +0 -76
- package/dist/services/e-sim/models/history.d.ts.map +0 -1
- package/dist/services/e-sim/models/history.js +0 -45
- package/dist/services/e-sim/models/history.js.map +0 -1
- package/dist/services/e-sim/models/index.d.ts +0 -10
- package/dist/services/e-sim/models/index.d.ts.map +0 -1
- package/dist/services/e-sim/models/index.js +0 -3
- package/dist/services/e-sim/models/index.js.map +0 -1
- package/dist/services/e-sim/request-params.d.ts +0 -4
- package/dist/services/e-sim/request-params.d.ts.map +0 -1
- package/dist/services/e-sim/request-params.js +0 -3
- package/dist/services/e-sim/request-params.js.map +0 -1
- package/dist/services/packages/index.d.ts +0 -3
- package/dist/services/packages/index.d.ts.map +0 -1
- package/dist/services/packages/index.js +0 -21
- package/dist/services/packages/index.js.map +0 -1
- package/dist/services/packages/models/index.d.ts +0 -3
- package/dist/services/packages/models/index.d.ts.map +0 -1
- package/dist/services/packages/models/index.js +0 -3
- package/dist/services/packages/models/index.js.map +0 -1
- package/dist/services/packages/models/list-packages-ok-response.d.ts +0 -223
- package/dist/services/packages/models/list-packages-ok-response.d.ts.map +0 -1
- package/dist/services/packages/models/list-packages-ok-response.js +0 -42
- package/dist/services/packages/models/list-packages-ok-response.js.map +0 -1
- package/dist/services/packages/models/packages.d.ts +0 -118
- package/dist/services/packages/models/packages.d.ts.map +0 -1
- package/dist/services/packages/models/packages.js +0 -64
- package/dist/services/packages/models/packages.js.map +0 -1
- package/dist/services/packages/packages.d.ts +0 -20
- package/dist/services/packages/packages.d.ts.map +0 -1
- package/dist/services/packages/packages.js +0 -59
- package/dist/services/packages/packages.js.map +0 -1
- package/dist/services/packages/request-params.d.ts +0 -11
- package/dist/services/packages/request-params.d.ts.map +0 -1
- package/dist/services/packages/request-params.js +0 -3
- package/dist/services/packages/request-params.js.map +0 -1
- package/dist/services/purchases/index.d.ts +0 -3
- package/dist/services/purchases/index.d.ts.map +0 -1
- package/dist/services/purchases/index.js +0 -21
- package/dist/services/purchases/index.js.map +0 -1
- package/dist/services/purchases/models/create-purchase-ok-response-profile.d.ts +0 -62
- package/dist/services/purchases/models/create-purchase-ok-response-profile.d.ts.map +0 -1
- package/dist/services/purchases/models/create-purchase-ok-response-profile.js +0 -39
- package/dist/services/purchases/models/create-purchase-ok-response-profile.js.map +0 -1
- package/dist/services/purchases/models/create-purchase-ok-response-purchase.d.ts +0 -132
- package/dist/services/purchases/models/create-purchase-ok-response-purchase.d.ts.map +0 -1
- package/dist/services/purchases/models/create-purchase-ok-response-purchase.js +0 -69
- package/dist/services/purchases/models/create-purchase-ok-response-purchase.js.map +0 -1
- package/dist/services/purchases/models/create-purchase-ok-response.d.ts +0 -315
- package/dist/services/purchases/models/create-purchase-ok-response.d.ts.map +0 -1
- package/dist/services/purchases/models/create-purchase-ok-response.js +0 -46
- package/dist/services/purchases/models/create-purchase-ok-response.js.map +0 -1
- package/dist/services/purchases/models/create-purchase-request.d.ts +0 -160
- package/dist/services/purchases/models/create-purchase-request.d.ts.map +0 -1
- package/dist/services/purchases/models/create-purchase-request.js +0 -79
- package/dist/services/purchases/models/create-purchase-request.js.map +0 -1
- package/dist/services/purchases/models/edit-purchase-ok-response.d.ts +0 -104
- package/dist/services/purchases/models/edit-purchase-ok-response.d.ts.map +0 -1
- package/dist/services/purchases/models/edit-purchase-ok-response.js +0 -59
- package/dist/services/purchases/models/edit-purchase-ok-response.js.map +0 -1
- package/dist/services/purchases/models/edit-purchase-request.d.ts +0 -104
- package/dist/services/purchases/models/edit-purchase-request.d.ts.map +0 -1
- package/dist/services/purchases/models/edit-purchase-request.js +0 -59
- package/dist/services/purchases/models/edit-purchase-request.js.map +0 -1
- package/dist/services/purchases/models/get-purchase-consumption-ok-response.d.ts +0 -62
- package/dist/services/purchases/models/get-purchase-consumption-ok-response.d.ts.map +0 -1
- package/dist/services/purchases/models/get-purchase-consumption-ok-response.js +0 -41
- package/dist/services/purchases/models/get-purchase-consumption-ok-response.js.map +0 -1
- package/dist/services/purchases/models/index.d.ts +0 -16
- package/dist/services/purchases/models/index.d.ts.map +0 -1
- package/dist/services/purchases/models/index.js +0 -3
- package/dist/services/purchases/models/index.js.map +0 -1
- package/dist/services/purchases/models/list-purchases-ok-response.d.ts +0 -622
- package/dist/services/purchases/models/list-purchases-ok-response.d.ts.map +0 -1
- package/dist/services/purchases/models/list-purchases-ok-response.js +0 -42
- package/dist/services/purchases/models/list-purchases-ok-response.js.map +0 -1
- package/dist/services/purchases/models/package_.d.ts +0 -104
- package/dist/services/purchases/models/package_.d.ts.map +0 -1
- package/dist/services/purchases/models/package_.js +0 -59
- package/dist/services/purchases/models/package_.js.map +0 -1
- package/dist/services/purchases/models/purchases-esim.d.ts +0 -48
- package/dist/services/purchases/models/purchases-esim.d.ts.map +0 -1
- package/dist/services/purchases/models/purchases-esim.js +0 -35
- package/dist/services/purchases/models/purchases-esim.js.map +0 -1
- package/dist/services/purchases/models/purchases.d.ts +0 -372
- package/dist/services/purchases/models/purchases.d.ts.map +0 -1
- package/dist/services/purchases/models/purchases.js +0 -91
- package/dist/services/purchases/models/purchases.js.map +0 -1
- package/dist/services/purchases/models/top-up-esim-ok-response-profile.d.ts +0 -48
- package/dist/services/purchases/models/top-up-esim-ok-response-profile.d.ts.map +0 -1
- package/dist/services/purchases/models/top-up-esim-ok-response-profile.js +0 -35
- package/dist/services/purchases/models/top-up-esim-ok-response-profile.js.map +0 -1
- package/dist/services/purchases/models/top-up-esim-ok-response-purchase.d.ts +0 -132
- package/dist/services/purchases/models/top-up-esim-ok-response-purchase.d.ts.map +0 -1
- package/dist/services/purchases/models/top-up-esim-ok-response-purchase.js +0 -69
- package/dist/services/purchases/models/top-up-esim-ok-response-purchase.js.map +0 -1
- package/dist/services/purchases/models/top-up-esim-ok-response.d.ts +0 -292
- package/dist/services/purchases/models/top-up-esim-ok-response.d.ts.map +0 -1
- package/dist/services/purchases/models/top-up-esim-ok-response.js +0 -46
- package/dist/services/purchases/models/top-up-esim-ok-response.js.map +0 -1
- package/dist/services/purchases/models/top-up-esim-request.d.ts +0 -146
- package/dist/services/purchases/models/top-up-esim-request.d.ts.map +0 -1
- package/dist/services/purchases/models/top-up-esim-request.js +0 -74
- package/dist/services/purchases/models/top-up-esim-request.js.map +0 -1
- package/dist/services/purchases/purchases.d.ts +0 -48
- package/dist/services/purchases/purchases.d.ts.map +0 -1
- package/dist/services/purchases/purchases.js +0 -162
- package/dist/services/purchases/purchases.js.map +0 -1
- package/dist/services/purchases/request-params.d.ts +0 -11
- package/dist/services/purchases/request-params.d.ts.map +0 -1
- package/dist/services/purchases/request-params.js +0 -3
- package/dist/services/purchases/request-params.js.map +0 -1
- package/documentation/models/CreatePurchaseOkResponse.md +0 -31
- package/documentation/models/CreatePurchaseRequest.md +0 -15
- package/documentation/models/EditPurchaseOkResponse.md +0 -11
- package/documentation/models/EditPurchaseRequest.md +0 -11
- package/documentation/models/GetEsimDeviceOkResponse.md +0 -18
- package/documentation/models/GetEsimHistoryOkResponse.md +0 -26
- package/documentation/models/GetEsimMacOkResponse.md +0 -17
- package/documentation/models/GetEsimOkResponse.md +0 -18
- package/documentation/models/GetPurchaseConsumptionOkResponse.md +0 -8
- package/documentation/models/ListDestinationsOkResponse.md +0 -17
- package/documentation/models/ListPackagesOkResponse.md +0 -21
- package/documentation/models/ListPurchasesOkResponse.md +0 -46
- package/documentation/models/TopUpEsimOkResponse.md +0 -30
- package/documentation/models/TopUpEsimRequest.md +0 -14
- package/documentation/services/DestinationsService.md +0 -35
- package/documentation/services/ESimService.md +0 -148
- package/documentation/services/PackagesService.md +0 -48
- package/documentation/services/PurchasesService.md +0 -222
- package/documentation/snippets/destinations-get.md +0 -14
- package/documentation/snippets/esim-get.md +0 -16
- package/documentation/snippets/esim-{iccid}-device-get.md +0 -14
- package/documentation/snippets/esim-{iccid}-history-get.md +0 -14
- package/documentation/snippets/esim-{iccid}-mac-get.md +0 -14
- package/documentation/snippets/packages-get.md +0 -14
- package/documentation/snippets/purchases-edit-post.md +0 -23
- package/documentation/snippets/purchases-get.md +0 -14
- package/documentation/snippets/purchases-post.md +0 -27
- package/documentation/snippets/purchases-topup-post.md +0 -26
- package/documentation/snippets/purchases-{purchaseId}-consumption-get.md +0 -14
- package/examples/README.md +0 -27
- package/examples/package.json +0 -18
- package/examples/src/index.ts +0 -12
- package/examples/tsconfig.json +0 -22
- package/src/http/client.ts +0 -46
- package/src/http/environment.ts +0 -3
- package/src/http/error.ts +0 -12
- package/src/http/handlers/handler-chain.ts +0 -22
- package/src/http/handlers/hook-handler.ts +0 -47
- package/src/http/handlers/request-validation-handler.ts +0 -72
- package/src/http/handlers/response-validation-handler.ts +0 -106
- package/src/http/handlers/retry-handler.ts +0 -40
- package/src/http/handlers/terminating-handler.ts +0 -38
- package/src/http/hooks/custom-hook.ts +0 -32
- package/src/http/hooks/hook.ts +0 -40
- package/src/http/serializer.ts +0 -183
- package/src/http/transport/request-builder.ts +0 -145
- package/src/http/transport/request.ts +0 -178
- package/src/http/types.ts +0 -70
- package/src/index.ts +0 -73
- package/src/services/base-service.ts +0 -29
- package/src/services/destinations/destinations.ts +0 -28
- package/src/services/destinations/index.ts +0 -2
- package/src/services/destinations/models/destinations.ts +0 -57
- package/src/services/destinations/models/index.ts +0 -2
- package/src/services/destinations/models/list-destinations-ok-response.ts +0 -42
- package/src/services/e-sim/e-sim.ts +0 -103
- package/src/services/e-sim/index.ts +0 -2
- package/src/services/e-sim/models/device.ts +0 -63
- package/src/services/e-sim/models/get-esim-device-ok-response.ts +0 -42
- package/src/services/e-sim/models/get-esim-history-ok-response-esim.ts +0 -47
- package/src/services/e-sim/models/get-esim-history-ok-response.ts +0 -46
- package/src/services/e-sim/models/get-esim-mac-ok-response-esim.ts +0 -57
- package/src/services/e-sim/models/get-esim-mac-ok-response.ts +0 -46
- package/src/services/e-sim/models/get-esim-ok-response-esim.ts +0 -63
- package/src/services/e-sim/models/get-esim-ok-response.ts +0 -46
- package/src/services/e-sim/models/history.ts +0 -53
- package/src/services/e-sim/models/index.ts +0 -9
- package/src/services/e-sim/request-params.ts +0 -3
- package/src/services/packages/index.ts +0 -2
- package/src/services/packages/models/index.ts +0 -2
- package/src/services/packages/models/list-packages-ok-response.ts +0 -49
- package/src/services/packages/models/packages.ts +0 -75
- package/src/services/packages/packages.ts +0 -48
- package/src/services/packages/request-params.ts +0 -10
- package/src/services/purchases/index.ts +0 -2
- package/src/services/purchases/models/create-purchase-ok-response-profile.ts +0 -46
- package/src/services/purchases/models/create-purchase-ok-response-purchase.ts +0 -81
- package/src/services/purchases/models/create-purchase-ok-response.ts +0 -61
- package/src/services/purchases/models/create-purchase-request.ts +0 -93
- package/src/services/purchases/models/edit-purchase-ok-response.ts +0 -69
- package/src/services/purchases/models/edit-purchase-request.ts +0 -69
- package/src/services/purchases/models/get-purchase-consumption-ok-response.ts +0 -48
- package/src/services/purchases/models/index.ts +0 -15
- package/src/services/purchases/models/list-purchases-ok-response.ts +0 -49
- package/src/services/purchases/models/package_.ts +0 -69
- package/src/services/purchases/models/purchases-esim.ts +0 -41
- package/src/services/purchases/models/purchases.ts +0 -107
- package/src/services/purchases/models/top-up-esim-ok-response-profile.ts +0 -41
- package/src/services/purchases/models/top-up-esim-ok-response-purchase.ts +0 -81
- package/src/services/purchases/models/top-up-esim-ok-response.ts +0 -61
- package/src/services/purchases/models/top-up-esim-request.ts +0 -87
- package/src/services/purchases/purchases.ts +0 -159
- package/src/services/purchases/request-params.ts +0 -10
- package/tsconfig.json +0 -22
package/dist/index.js
CHANGED
@@ -1,79 +1,2143 @@
|
|
1
1
|
"use strict";
|
2
|
-
var
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
}
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
|
30
|
+
// src/index.ts
|
31
|
+
var src_exports = {};
|
32
|
+
__export(src_exports, {
|
33
|
+
Celitech: () => Celitech,
|
34
|
+
DestinationsService: () => DestinationsService,
|
35
|
+
ESimService: () => ESimService,
|
36
|
+
PackagesService: () => PackagesService,
|
37
|
+
PurchasesService: () => PurchasesService
|
38
|
+
});
|
39
|
+
module.exports = __toCommonJS(src_exports);
|
40
|
+
|
41
|
+
// src/services/destinations/destinations.ts
|
42
|
+
var import_zod5 = require("zod");
|
43
|
+
|
44
|
+
// src/http/handlers/handler-chain.ts
|
45
|
+
var RequestHandlerChain = class {
|
46
|
+
constructor() {
|
47
|
+
this.handlers = [];
|
48
|
+
}
|
49
|
+
addHandler(handler) {
|
50
|
+
if (this.handlers.length > 0) {
|
51
|
+
const previousHandler = this.handlers[this.handlers.length - 1];
|
52
|
+
previousHandler.next = handler;
|
53
|
+
}
|
54
|
+
this.handlers.push(handler);
|
55
|
+
}
|
56
|
+
async callChain(request) {
|
57
|
+
if (!this.handlers.length) {
|
58
|
+
throw new Error("No handlers added to the chain");
|
59
|
+
}
|
60
|
+
return this.handlers[0].handle(request);
|
61
|
+
}
|
62
|
+
};
|
63
|
+
|
64
|
+
// src/http/error.ts
|
65
|
+
var HttpError = class extends Error {
|
66
|
+
constructor(metadata, error) {
|
67
|
+
super(error);
|
68
|
+
this.error = metadata.statusText;
|
69
|
+
this.metadata = metadata;
|
70
|
+
}
|
71
|
+
};
|
72
|
+
|
73
|
+
// src/http/hooks/custom-hook.ts
|
74
|
+
var CURRENT_TOKEN = "";
|
75
|
+
var CURRENT_EXPIRY = -1;
|
76
|
+
var CustomHook = class {
|
77
|
+
async getToken(clientId, clientSecret) {
|
78
|
+
const tokenUrl = "https://auth.celitech.net/oauth2/token";
|
79
|
+
const headers = {
|
80
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
81
|
+
};
|
82
|
+
const body = {
|
83
|
+
client_id: clientId,
|
84
|
+
client_secret: clientSecret,
|
85
|
+
grant_type: "client_credentials"
|
86
|
+
};
|
87
|
+
const response = await fetch(tokenUrl, {
|
88
|
+
method: "POST",
|
89
|
+
headers,
|
90
|
+
body: new URLSearchParams(body)
|
91
|
+
});
|
92
|
+
return response.json();
|
93
|
+
}
|
94
|
+
async beforeRequest(request, params) {
|
95
|
+
console.log("request", request);
|
96
|
+
console.log("params", params);
|
97
|
+
const clientId = params.get("clientId") || "";
|
98
|
+
const clientSecret = params.get("clientSecret") || "";
|
99
|
+
console.log("clientId", clientId);
|
100
|
+
console.log("clientSecret", clientSecret);
|
101
|
+
if (!clientId || !clientSecret) {
|
102
|
+
throw new Error("Missing clientId and/or clientSecret constructor parameters");
|
103
|
+
}
|
104
|
+
if (!CURRENT_TOKEN || CURRENT_EXPIRY < Date.now()) {
|
105
|
+
const tokenResponse = await this.getToken(clientId, clientSecret);
|
106
|
+
console.log("tokenResponse", tokenResponse);
|
107
|
+
if (tokenResponse.error) {
|
108
|
+
throw new Error(tokenResponse.error);
|
109
|
+
}
|
110
|
+
const { expires_in, access_token } = tokenResponse;
|
111
|
+
if (!expires_in || !access_token) {
|
112
|
+
throw new Error("There is an issue with getting the oauth token");
|
113
|
+
}
|
114
|
+
CURRENT_EXPIRY = Date.now() + expires_in * 1e3;
|
115
|
+
CURRENT_TOKEN = access_token;
|
116
|
+
}
|
117
|
+
const authorization = `Bearer ${CURRENT_TOKEN}`;
|
118
|
+
console.log("authorization", authorization);
|
119
|
+
if (!request.headers) {
|
120
|
+
request.headers = /* @__PURE__ */ new Map();
|
121
|
+
}
|
122
|
+
request.headers.set("Authorization", authorization);
|
123
|
+
return request;
|
124
|
+
}
|
125
|
+
async afterResponse(request, response, params) {
|
126
|
+
return response;
|
127
|
+
}
|
128
|
+
async onError(request, response, params) {
|
129
|
+
return new CustomHttpError("a custom error message", response.metadata);
|
130
|
+
}
|
131
|
+
};
|
132
|
+
var CustomHttpError = class {
|
133
|
+
constructor(error, metadata) {
|
134
|
+
this.error = error;
|
135
|
+
this.metadata = metadata;
|
136
|
+
}
|
137
|
+
};
|
138
|
+
|
139
|
+
// src/http/serialization/base-serializer.ts
|
140
|
+
var Serializer = class {
|
141
|
+
serializeValue(param) {
|
142
|
+
if (Array.isArray(param.value)) {
|
143
|
+
return this.serializeArray(param.value, param);
|
144
|
+
}
|
145
|
+
if (this.isNonNullObject(param.value)) {
|
146
|
+
return this.serializeObject(param.value, param);
|
147
|
+
}
|
148
|
+
return this.serializePrimitive(param);
|
149
|
+
}
|
150
|
+
serializePrimitive(param) {
|
151
|
+
if (param.style === "label" /* LABEL */) {
|
152
|
+
return `.${param.value}`;
|
153
|
+
} else if (param.style === "matrix" /* MATRIX */) {
|
154
|
+
return `;${param.key}=${param.value}`;
|
155
|
+
} else if (param.style === "form" /* FORM */) {
|
156
|
+
return `${encodeURIComponent(param.key || "")}=${encodeURIComponent(`${param.value}`)}`;
|
157
|
+
}
|
158
|
+
return `${param.value}`;
|
159
|
+
}
|
160
|
+
serializeArray(value, param) {
|
161
|
+
if (param.explode) {
|
162
|
+
this.serializeArrayExploded(value, param);
|
163
|
+
return this.serializeArrayExploded(value, param);
|
164
|
+
}
|
165
|
+
if (param.style === "simple" /* SIMPLE */) {
|
166
|
+
return `${value.join(",")}`;
|
167
|
+
} else if (param.style === "label" /* LABEL */) {
|
168
|
+
return `.${value.join(",")}`;
|
169
|
+
} else if (param.style === "matrix" /* MATRIX */) {
|
170
|
+
return `;${param.key}=${value.join(",")}`;
|
171
|
+
} else if (param.style === "form" /* FORM */) {
|
172
|
+
return `${encodeURIComponent(param.key || "")}=${encodeURIComponent(value.join(","))}`;
|
173
|
+
} else if (param.style === "space_delimited" /* SPACE_DELIMITED */) {
|
174
|
+
return `${param.key}=${value.join(" ")}`;
|
175
|
+
} else if (param.style === "pipe_delimited" /* PIPE_DELIMITED */) {
|
176
|
+
return `${param.key}=${value.join("|")}`;
|
177
|
+
}
|
178
|
+
return `${value.join(",")}`;
|
179
|
+
}
|
180
|
+
serializeArrayExploded(value, param) {
|
181
|
+
if (param.style === "simple" /* SIMPLE */) {
|
182
|
+
return value.map((val) => `${val}`).join(",");
|
183
|
+
} else if (param.style === "label" /* LABEL */) {
|
184
|
+
return value.map((val) => `.${val}`).join("");
|
185
|
+
} else if (param.style === "matrix" /* MATRIX */) {
|
186
|
+
return value.map((val) => `;${param.key}=${val}`).join("");
|
187
|
+
} else if (param.style === "form" /* FORM */ || param.style === "space_delimited" /* SPACE_DELIMITED */ || param.style === "pipe_delimited" /* PIPE_DELIMITED */) {
|
188
|
+
return value.map((val) => `${encodeURIComponent(param.key || "")}=${encodeURIComponent(`${val}`)}`).join("&");
|
189
|
+
}
|
190
|
+
return `${value.join(",")}`;
|
191
|
+
}
|
192
|
+
serializeObject(obj, param) {
|
193
|
+
if (param.explode) {
|
194
|
+
if (param.style === "simple" /* SIMPLE */) {
|
195
|
+
return Object.entries(obj).map(([key, val]) => `${key}=${val}`).join(",");
|
196
|
+
} else if (param.style === "label" /* LABEL */) {
|
197
|
+
return Object.entries(obj).map(([key, val]) => `.${key}=${val}`).join("");
|
198
|
+
} else if (param.style === "matrix" /* MATRIX */) {
|
199
|
+
return Object.entries(obj).map(([key, val]) => `;${key}=${val}`).join("");
|
200
|
+
} else if (param.style === "form" /* FORM */) {
|
201
|
+
return Object.entries(obj).map(([key, val]) => `${key}=${val}`).join("&");
|
202
|
+
}
|
203
|
+
}
|
204
|
+
if (param.style === "simple" /* SIMPLE */) {
|
205
|
+
return Object.entries(obj).map(([key, val]) => `${key},${val}`).join(",");
|
206
|
+
} else if (param.style === "label" /* LABEL */) {
|
207
|
+
return `.${Object.entries(obj).map(([key, val]) => `${key},${val}`).join(",")}`;
|
208
|
+
} else if (param.style === "matrix" /* MATRIX */) {
|
209
|
+
return `;${param.key}=${Object.entries(obj).map(([key, val]) => `${key},${val}`).join(",")}`;
|
210
|
+
} else if (param.style === "form" /* FORM */) {
|
211
|
+
return Object.entries(obj).map(([key, val]) => `${key}=${val}`).join("&");
|
212
|
+
} else if (param.style === "deep_object" /* DEEP_OBJECT */) {
|
213
|
+
return Object.entries(obj).map(([key, val]) => {
|
214
|
+
return `${param.key}[${key}]=${val}`;
|
215
|
+
}).join("&");
|
216
|
+
}
|
217
|
+
return Object.entries(obj).map(([key, val]) => `${key}=${val}`).join("&");
|
218
|
+
}
|
219
|
+
isNonNullObject(value) {
|
220
|
+
return typeof value === "object" && value !== null;
|
221
|
+
}
|
222
|
+
};
|
223
|
+
|
224
|
+
// src/http/transport/transport-hook-adapter.ts
|
225
|
+
var TransportHookAdapter = class {
|
226
|
+
constructor() {
|
227
|
+
this.hook = new CustomHook();
|
228
|
+
}
|
229
|
+
async beforeRequest(request, params) {
|
230
|
+
const hookRequest = this.requestToHookRequest(request);
|
231
|
+
const newRequest = await this.hook.beforeRequest(hookRequest, params);
|
232
|
+
const newTransportRequest = request.copy({
|
233
|
+
baseUrl: newRequest.baseUrl,
|
234
|
+
method: newRequest.method,
|
235
|
+
path: newRequest.path,
|
236
|
+
body: newRequest.body,
|
237
|
+
queryParams: this.hookParamsToTransportParams(newRequest.queryParams, request.queryParams, true),
|
238
|
+
headers: this.hookParamsToTransportParams(newRequest.headers, request.headers, false)
|
239
|
+
});
|
240
|
+
return newTransportRequest;
|
241
|
+
}
|
242
|
+
async afterResponse(request, response, params) {
|
243
|
+
const hookRequest = this.requestToHookRequest(request);
|
244
|
+
return this.hook.afterResponse(hookRequest, response, params);
|
245
|
+
}
|
246
|
+
async onError(request, response, params) {
|
247
|
+
const hookRequest = this.requestToHookRequest(request);
|
248
|
+
return this.hook.onError(hookRequest, response, params);
|
249
|
+
}
|
250
|
+
requestToHookRequest(request) {
|
251
|
+
const hookHeaders = /* @__PURE__ */ new Map();
|
252
|
+
request.headers.forEach((header, key) => {
|
253
|
+
hookHeaders.set(key, header.value);
|
254
|
+
});
|
255
|
+
const hookQueryParams = /* @__PURE__ */ new Map();
|
256
|
+
request.queryParams.forEach((queryParam, key) => {
|
257
|
+
hookQueryParams.set(key, queryParam.value);
|
258
|
+
});
|
259
|
+
const hookRequest = {
|
260
|
+
baseUrl: request.baseUrl,
|
261
|
+
method: request.method,
|
262
|
+
path: request.path,
|
263
|
+
headers: hookHeaders,
|
264
|
+
body: request.body,
|
265
|
+
queryParams: hookQueryParams
|
266
|
+
};
|
267
|
+
return hookRequest;
|
268
|
+
}
|
269
|
+
hookParamsToTransportParams(hookParams, originalTransportParams, encode) {
|
270
|
+
const transportParams = /* @__PURE__ */ new Map();
|
271
|
+
hookParams.forEach((hookParamValue, hookParamKey) => {
|
272
|
+
var _a, _b;
|
273
|
+
const requestParam = originalTransportParams.get(hookParamKey);
|
274
|
+
transportParams.set(hookParamKey, {
|
275
|
+
key: hookParamKey,
|
276
|
+
value: hookParamValue,
|
277
|
+
encode: (_a = requestParam == null ? void 0 : requestParam.encode) != null ? _a : false,
|
278
|
+
style: (requestParam == null ? void 0 : requestParam.style) || "none" /* NONE */,
|
279
|
+
explode: (_b = requestParam == null ? void 0 : requestParam.explode) != null ? _b : false
|
280
|
+
});
|
281
|
+
});
|
282
|
+
return transportParams;
|
283
|
+
}
|
284
|
+
};
|
285
|
+
|
286
|
+
// src/http/handlers/hook-handler.ts
|
287
|
+
var HookHandler = class {
|
288
|
+
constructor(hook) {
|
289
|
+
this.hook = hook;
|
290
|
+
}
|
291
|
+
async handle(request) {
|
292
|
+
if (!this.next) {
|
293
|
+
throw new Error("No next handler set in hook handler.");
|
294
|
+
}
|
295
|
+
const hook = new TransportHookAdapter();
|
296
|
+
const hookParams = this.getHookParams(request);
|
297
|
+
const nextRequest = await hook.beforeRequest(request, hookParams);
|
298
|
+
const response = await this.next.handle(nextRequest);
|
299
|
+
if (response.metadata.status < 400) {
|
300
|
+
return await hook.afterResponse(nextRequest, response, hookParams);
|
301
|
+
}
|
302
|
+
const error = await hook.onError(nextRequest, response, hookParams);
|
303
|
+
throw new HttpError(error.metadata, error.error);
|
304
|
+
}
|
305
|
+
getHookParams(request) {
|
306
|
+
const hookParams = /* @__PURE__ */ new Map();
|
307
|
+
hookParams.set("clientId", request.config.clientId || "");
|
308
|
+
hookParams.set("clientSecret", request.config.clientSecret || "");
|
309
|
+
return hookParams;
|
310
|
+
}
|
311
|
+
};
|
312
|
+
|
313
|
+
// src/http/handlers/response-validation-handler.ts
|
314
|
+
var import_zod = require("zod");
|
315
|
+
var ResponseValidationHandler = class {
|
316
|
+
async handle(request) {
|
317
|
+
const response = await this.next.handle(request);
|
318
|
+
if (!this.hasContent(request, response)) {
|
319
|
+
return response;
|
320
|
+
}
|
321
|
+
if (request.responseContentType === "json" /* Json */) {
|
322
|
+
const decodedBody = new TextDecoder().decode(response.raw);
|
323
|
+
const json = JSON.parse(decodedBody);
|
324
|
+
return {
|
325
|
+
...response,
|
326
|
+
data: this.validate(request, json)
|
327
|
+
};
|
328
|
+
} else if (request.responseContentType === "binary" /* Binary */ || request.responseContentType === "image" /* Image */) {
|
329
|
+
return {
|
330
|
+
...response,
|
331
|
+
data: this.validate(request, response.raw)
|
332
|
+
};
|
333
|
+
} else if (request.responseContentType === "text" /* Text */ || request.responseContentType === "xml" /* Xml */) {
|
334
|
+
const text = new TextDecoder().decode(response.raw);
|
335
|
+
return {
|
336
|
+
...response,
|
337
|
+
data: this.validate(request, text)
|
338
|
+
};
|
339
|
+
} else if (request.responseContentType === "form" /* FormUrlEncoded */) {
|
340
|
+
const urlEncoded = this.fromUrlEncoded(new TextDecoder().decode(response.raw));
|
341
|
+
return {
|
342
|
+
...response,
|
343
|
+
data: this.validate(request, urlEncoded)
|
344
|
+
};
|
345
|
+
} else if (request.responseContentType === "multipartFormData" /* MultipartFormData */) {
|
346
|
+
const formData = this.fromFormData(response.raw);
|
347
|
+
return {
|
348
|
+
...response,
|
349
|
+
data: this.validate(request, formData)
|
350
|
+
};
|
351
|
+
} else {
|
352
|
+
const decodedBody = new TextDecoder().decode(response.raw);
|
353
|
+
const json = JSON.parse(decodedBody);
|
354
|
+
return {
|
355
|
+
...response,
|
356
|
+
data: this.validate(request, json)
|
357
|
+
};
|
358
|
+
}
|
359
|
+
}
|
360
|
+
validate(request, data) {
|
361
|
+
var _a;
|
362
|
+
if ((_a = request.validation) == null ? void 0 : _a.responseValidation) {
|
363
|
+
return request.responseSchema.parse(data);
|
364
|
+
}
|
365
|
+
return data;
|
366
|
+
}
|
367
|
+
hasContent(request, response) {
|
368
|
+
return !!request.responseSchema && !(request.responseSchema instanceof import_zod.ZodUndefined) && response.metadata.status !== 204;
|
369
|
+
}
|
370
|
+
fromUrlEncoded(urlEncodedData) {
|
371
|
+
const pairs = urlEncodedData.split("&");
|
372
|
+
const result = {};
|
373
|
+
pairs.forEach((pair) => {
|
374
|
+
const [key, value] = pair.split("=");
|
375
|
+
if (key && value !== void 0) {
|
376
|
+
result[decodeURIComponent(key)] = decodeURIComponent(value);
|
377
|
+
}
|
378
|
+
});
|
23
379
|
return result;
|
380
|
+
}
|
381
|
+
fromFormData(arrayBuffer) {
|
382
|
+
const decoder = new TextDecoder();
|
383
|
+
const text = decoder.decode(arrayBuffer);
|
384
|
+
const boundary = text.split("\r\n")[0];
|
385
|
+
const parts = text.split(boundary).slice(1, -1);
|
386
|
+
const formDataObj = {};
|
387
|
+
parts.forEach((part) => {
|
388
|
+
const [header, value] = part.split("\r\n\r\n");
|
389
|
+
const nameMatch = header.match(/name="([^"]+)"/);
|
390
|
+
if (nameMatch) {
|
391
|
+
const name = nameMatch[1].trim();
|
392
|
+
formDataObj[name] = (value == null ? void 0 : value.trim()) || "";
|
393
|
+
}
|
394
|
+
});
|
395
|
+
return formDataObj;
|
396
|
+
}
|
397
|
+
};
|
398
|
+
|
399
|
+
// src/http/handlers/request-validation-handler.ts
|
400
|
+
var RequestValidationHandler = class {
|
401
|
+
async handle(request) {
|
402
|
+
var _a, _b;
|
403
|
+
if (!this.next) {
|
404
|
+
throw new Error("No next handler set in ContentTypeHandler.");
|
405
|
+
}
|
406
|
+
if (request.requestContentType === "json" /* Json */) {
|
407
|
+
request.body = JSON.stringify((_a = request.requestSchema) == null ? void 0 : _a.parse(request.body));
|
408
|
+
} else if (request.requestContentType === "xml" /* Xml */ || request.requestContentType === "binary" /* Binary */ || request.requestContentType === "text" /* Text */) {
|
409
|
+
request.body = request.body;
|
410
|
+
} else if (request.requestContentType === "form" /* FormUrlEncoded */) {
|
411
|
+
request.body = this.toFormUrlEncoded(request.body);
|
412
|
+
} else if (request.requestContentType === "multipartFormData" /* MultipartFormData */) {
|
413
|
+
request.body = this.toFormData(request.body);
|
414
|
+
} else {
|
415
|
+
request.body = JSON.stringify((_b = request.requestSchema) == null ? void 0 : _b.parse(request.body));
|
416
|
+
}
|
417
|
+
return await this.next.handle(request);
|
418
|
+
}
|
419
|
+
toFormUrlEncoded(body) {
|
420
|
+
if (body === void 0) {
|
421
|
+
return "";
|
422
|
+
}
|
423
|
+
if (typeof body === "string") {
|
424
|
+
return body;
|
425
|
+
}
|
426
|
+
if (body instanceof URLSearchParams) {
|
427
|
+
return body.toString();
|
428
|
+
}
|
429
|
+
if (body instanceof FormData) {
|
430
|
+
const params = new URLSearchParams();
|
431
|
+
body.forEach((value, key) => {
|
432
|
+
params.append(key, value.toString());
|
433
|
+
});
|
434
|
+
return params.toString();
|
435
|
+
}
|
436
|
+
return "";
|
437
|
+
}
|
438
|
+
toFormData(body) {
|
439
|
+
const formData = new FormData();
|
440
|
+
Object.keys(body).forEach((key) => {
|
441
|
+
const value = body[key];
|
442
|
+
if (Array.isArray(value)) {
|
443
|
+
value.forEach((v, i) => formData.append(`${key}[${i}]`, v));
|
444
|
+
} else if (value instanceof ArrayBuffer) {
|
445
|
+
formData.append(key, new Blob([value]));
|
446
|
+
} else {
|
447
|
+
formData.append(key, value);
|
448
|
+
}
|
449
|
+
});
|
450
|
+
return formData;
|
451
|
+
}
|
452
|
+
};
|
453
|
+
|
454
|
+
// src/http/transport/request-fetch-adapter.ts
|
455
|
+
var RequestFetchAdapter = class {
|
456
|
+
constructor(request) {
|
457
|
+
this.request = request;
|
458
|
+
this.requestInit = {};
|
459
|
+
this.setMethod(request.method);
|
460
|
+
this.setHeaders(request.getHeaders());
|
461
|
+
this.setBody(request.body);
|
462
|
+
this.setTimeout(request.config.timeout);
|
463
|
+
}
|
464
|
+
async send() {
|
465
|
+
return fetch(this.request.constructFullUrl(), this.requestInit);
|
466
|
+
}
|
467
|
+
setMethod(method) {
|
468
|
+
if (!method) {
|
469
|
+
return;
|
470
|
+
}
|
471
|
+
this.requestInit = {
|
472
|
+
...this.requestInit,
|
473
|
+
method
|
474
|
+
};
|
475
|
+
}
|
476
|
+
setBody(body) {
|
477
|
+
if (!body) {
|
478
|
+
return;
|
479
|
+
}
|
480
|
+
this.requestInit = {
|
481
|
+
...this.requestInit,
|
482
|
+
body
|
483
|
+
};
|
484
|
+
}
|
485
|
+
setHeaders(headers) {
|
486
|
+
if (!headers) {
|
487
|
+
return;
|
488
|
+
}
|
489
|
+
this.requestInit = {
|
490
|
+
...this.requestInit,
|
491
|
+
headers
|
492
|
+
};
|
493
|
+
}
|
494
|
+
setTimeout(timeout) {
|
495
|
+
if (!timeout) {
|
496
|
+
return;
|
497
|
+
}
|
498
|
+
this.requestInit = {
|
499
|
+
...this.requestInit,
|
500
|
+
signal: AbortSignal.timeout(timeout)
|
501
|
+
};
|
502
|
+
}
|
503
|
+
};
|
504
|
+
|
505
|
+
// src/http/handlers/terminating-handler.ts
|
506
|
+
var TerminatingHandler = class {
|
507
|
+
async handle(request) {
|
508
|
+
const response = await new RequestFetchAdapter(request).send();
|
509
|
+
const metadata = {
|
510
|
+
status: response.status,
|
511
|
+
statusText: response.statusText,
|
512
|
+
headers: this.getHeaders(response)
|
513
|
+
};
|
514
|
+
if (metadata.status >= 400) {
|
515
|
+
throw new HttpError(metadata);
|
516
|
+
}
|
517
|
+
return {
|
518
|
+
metadata,
|
519
|
+
raw: await response.clone().arrayBuffer()
|
520
|
+
};
|
521
|
+
}
|
522
|
+
getHeaders(response) {
|
523
|
+
const headers = {};
|
524
|
+
response.headers.forEach((value, key) => {
|
525
|
+
headers[key] = value;
|
526
|
+
});
|
527
|
+
return headers;
|
528
|
+
}
|
529
|
+
isErrorResponse(response) {
|
530
|
+
return response.metadata.status >= 400;
|
531
|
+
}
|
532
|
+
};
|
533
|
+
|
534
|
+
// src/http/handlers/retry-handler.ts
|
535
|
+
var RetryHandler = class {
|
536
|
+
async handle(request) {
|
537
|
+
if (!this.next) {
|
538
|
+
throw new Error("No next handler set in retry handler.");
|
539
|
+
}
|
540
|
+
for (let attempt = 1; attempt <= request.retry.attempts; attempt++) {
|
541
|
+
try {
|
542
|
+
return await this.next.handle(request);
|
543
|
+
} catch (error) {
|
544
|
+
if (!this.shouldRetry(error) || attempt === request.retry.attempts) {
|
545
|
+
throw error;
|
546
|
+
}
|
547
|
+
await this.delay(request.retry.delayMs);
|
548
|
+
}
|
549
|
+
}
|
550
|
+
throw new Error("Error retrying request.");
|
551
|
+
}
|
552
|
+
shouldRetry(error) {
|
553
|
+
return error instanceof HttpError && (error.metadata.status >= 500 || error.metadata.status === 408);
|
554
|
+
}
|
555
|
+
delay(delayMs) {
|
556
|
+
if (!delayMs) {
|
557
|
+
return Promise.resolve();
|
558
|
+
}
|
559
|
+
return new Promise((resolve, reject) => {
|
560
|
+
setTimeout(() => resolve(), delayMs);
|
561
|
+
});
|
562
|
+
}
|
563
|
+
};
|
564
|
+
|
565
|
+
// src/http/client.ts
|
566
|
+
var HttpClient = class {
|
567
|
+
constructor(config, hook = new CustomHook()) {
|
568
|
+
this.config = config;
|
569
|
+
this.requestHandlerChain = new RequestHandlerChain();
|
570
|
+
this.requestHandlerChain.addHandler(new ResponseValidationHandler());
|
571
|
+
this.requestHandlerChain.addHandler(new RequestValidationHandler());
|
572
|
+
this.requestHandlerChain.addHandler(new RetryHandler());
|
573
|
+
this.requestHandlerChain.addHandler(new HookHandler(hook));
|
574
|
+
this.requestHandlerChain.addHandler(new TerminatingHandler());
|
575
|
+
}
|
576
|
+
call(request) {
|
577
|
+
return this.requestHandlerChain.callChain(request);
|
578
|
+
}
|
579
|
+
setBaseUrl(url) {
|
580
|
+
this.config.baseUrl = url;
|
581
|
+
}
|
582
|
+
setConfig(config) {
|
583
|
+
this.config = config;
|
584
|
+
}
|
585
|
+
};
|
586
|
+
|
587
|
+
// src/services/base-service.ts
|
588
|
+
var BaseService = class {
|
589
|
+
constructor(config) {
|
590
|
+
this.config = config;
|
591
|
+
this.client = new HttpClient(this.config);
|
592
|
+
}
|
593
|
+
set baseUrl(baseUrl) {
|
594
|
+
this.config.baseUrl = baseUrl;
|
595
|
+
}
|
596
|
+
set environment(environment) {
|
597
|
+
this.config.environment = environment;
|
598
|
+
}
|
599
|
+
set timeout(timeout) {
|
600
|
+
this.config.timeout = timeout;
|
601
|
+
}
|
602
|
+
set clientId(clientId) {
|
603
|
+
this.config.clientId = clientId;
|
604
|
+
}
|
605
|
+
set clientSecret(clientSecret) {
|
606
|
+
this.config.clientSecret = clientSecret;
|
607
|
+
}
|
608
|
+
};
|
609
|
+
|
610
|
+
// src/http/transport/request-builder.ts
|
611
|
+
var import_zod2 = __toESM(require("zod"));
|
612
|
+
|
613
|
+
// src/http/serialization/path-serializer.ts
|
614
|
+
var PathSerializer = class extends Serializer {
|
615
|
+
serialize(pathPattern, pathArguments) {
|
616
|
+
let serializedPath = pathPattern;
|
617
|
+
pathArguments.forEach((param) => {
|
618
|
+
serializedPath = serializedPath.replace(`{${param.key}}`, `${this.serializeValue(param)}`);
|
619
|
+
});
|
620
|
+
return serializedPath;
|
621
|
+
}
|
622
|
+
};
|
623
|
+
|
624
|
+
// src/http/serialization/query-serializer.ts
|
625
|
+
var QuerySerializer = class extends Serializer {
|
626
|
+
serialize(queryParams) {
|
627
|
+
if (!queryParams || !queryParams.size) {
|
628
|
+
return "";
|
629
|
+
}
|
630
|
+
const query = [];
|
631
|
+
queryParams.forEach((param) => {
|
632
|
+
return query.push(`${this.serializeValue(param)}`);
|
633
|
+
});
|
634
|
+
return query.length ? `?${query.join("&")}` : "";
|
635
|
+
}
|
636
|
+
};
|
637
|
+
|
638
|
+
// src/http/serialization/header-serializer.ts
|
639
|
+
var HeaderSerializer = class extends Serializer {
|
640
|
+
serialize(headerParams) {
|
641
|
+
if (!headerParams || !headerParams.size) {
|
642
|
+
return void 0;
|
643
|
+
}
|
644
|
+
const headers = {};
|
645
|
+
headerParams.forEach((param) => {
|
646
|
+
if (!param.key) {
|
647
|
+
return;
|
648
|
+
}
|
649
|
+
headers[param.key] = this.serializeValue(param);
|
650
|
+
});
|
651
|
+
return headers;
|
652
|
+
}
|
653
|
+
};
|
654
|
+
|
655
|
+
// src/http/transport/request.ts
|
656
|
+
var Request = class {
|
657
|
+
constructor(params) {
|
658
|
+
this.baseUrl = "";
|
659
|
+
this.headers = /* @__PURE__ */ new Map();
|
660
|
+
this.queryParams = /* @__PURE__ */ new Map();
|
661
|
+
this.pathParams = /* @__PURE__ */ new Map();
|
662
|
+
this.validation = {};
|
663
|
+
this.retry = {};
|
664
|
+
this.baseUrl = params.baseUrl;
|
665
|
+
this.method = params.method;
|
666
|
+
this.pathPattern = params.path;
|
667
|
+
this.body = params.body;
|
668
|
+
this.path = this.constructPath();
|
669
|
+
this.config = params.config;
|
670
|
+
this.pathParams = params.pathParams;
|
671
|
+
this.headers = params.headers;
|
672
|
+
this.queryParams = params.queryParams;
|
673
|
+
this.responseSchema = params.responseSchema;
|
674
|
+
this.requestSchema = params.requestSchema;
|
675
|
+
this.requestContentType = params.requestContentType;
|
676
|
+
this.responseContentType = params.responseContentType;
|
677
|
+
this.retry = params.retry;
|
678
|
+
this.validation = params.validation;
|
679
|
+
}
|
680
|
+
addHeaderParam(key, param) {
|
681
|
+
if (param.value === void 0) {
|
682
|
+
return;
|
683
|
+
}
|
684
|
+
if (param.explode === void 0) {
|
685
|
+
param.explode = false;
|
686
|
+
}
|
687
|
+
if (param.style === void 0) {
|
688
|
+
param.style = "simple" /* SIMPLE */;
|
689
|
+
}
|
690
|
+
if (param.encode === void 0) {
|
691
|
+
param.encode = false;
|
692
|
+
}
|
693
|
+
this.headers.set(key, param);
|
694
|
+
}
|
695
|
+
addQueryParam(key, param) {
|
696
|
+
if (param.value === void 0) {
|
697
|
+
return;
|
698
|
+
}
|
699
|
+
if (param.explode === void 0) {
|
700
|
+
param.explode = true;
|
701
|
+
}
|
702
|
+
if (param.style === void 0) {
|
703
|
+
param.style = "form" /* FORM */;
|
704
|
+
}
|
705
|
+
if (param.encode === void 0) {
|
706
|
+
param.encode = true;
|
707
|
+
}
|
708
|
+
this.queryParams.set(key, param);
|
709
|
+
}
|
710
|
+
addPathParam(key, param) {
|
711
|
+
if (param.value === void 0) {
|
712
|
+
return;
|
713
|
+
}
|
714
|
+
if (param.explode === void 0) {
|
715
|
+
param.explode = false;
|
716
|
+
}
|
717
|
+
if (param.style === void 0) {
|
718
|
+
param.style = "simple" /* SIMPLE */;
|
719
|
+
}
|
720
|
+
if (param.encode === void 0) {
|
721
|
+
param.encode = true;
|
722
|
+
}
|
723
|
+
this.pathParams.set(key, param);
|
724
|
+
}
|
725
|
+
addBody(body) {
|
726
|
+
if (body === void 0) {
|
727
|
+
return;
|
728
|
+
}
|
729
|
+
this.body = body;
|
730
|
+
}
|
731
|
+
updateFromHookRequest(hookRequest) {
|
732
|
+
this.baseUrl = hookRequest.baseUrl;
|
733
|
+
this.method = hookRequest.method;
|
734
|
+
this.path = hookRequest.path;
|
735
|
+
this.body = hookRequest.body;
|
736
|
+
}
|
737
|
+
toHookRequest() {
|
738
|
+
return {
|
739
|
+
baseUrl: this.baseUrl,
|
740
|
+
method: this.method,
|
741
|
+
path: this.path,
|
742
|
+
headers: this.headers,
|
743
|
+
body: this.body,
|
744
|
+
queryParams: this.queryParams
|
745
|
+
};
|
746
|
+
}
|
747
|
+
constructFullUrl() {
|
748
|
+
const queryString = new QuerySerializer().serialize(this.queryParams);
|
749
|
+
const path = this.constructPath();
|
750
|
+
return `${this.baseUrl}${path}${queryString}`;
|
751
|
+
}
|
752
|
+
copy(overrides) {
|
753
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
754
|
+
const createRequestParams = {
|
755
|
+
baseUrl: (_a = overrides == null ? void 0 : overrides.baseUrl) != null ? _a : this.baseUrl,
|
756
|
+
method: (_b = overrides == null ? void 0 : overrides.method) != null ? _b : this.method,
|
757
|
+
path: (_c = overrides == null ? void 0 : overrides.path) != null ? _c : this.path,
|
758
|
+
body: (_d = overrides == null ? void 0 : overrides.body) != null ? _d : this.body,
|
759
|
+
config: (_e = overrides == null ? void 0 : overrides.config) != null ? _e : this.config,
|
760
|
+
pathParams: (_f = overrides == null ? void 0 : overrides.pathParams) != null ? _f : this.pathParams,
|
761
|
+
queryParams: (_g = overrides == null ? void 0 : overrides.queryParams) != null ? _g : this.queryParams,
|
762
|
+
headers: (_h = overrides == null ? void 0 : overrides.headers) != null ? _h : this.headers,
|
763
|
+
responseSchema: (_i = overrides == null ? void 0 : overrides.responseSchema) != null ? _i : this.responseSchema,
|
764
|
+
requestSchema: (_j = overrides == null ? void 0 : overrides.requestSchema) != null ? _j : this.requestSchema,
|
765
|
+
requestContentType: (_k = overrides == null ? void 0 : overrides.requestContentType) != null ? _k : this.requestContentType,
|
766
|
+
responseContentType: (_l = overrides == null ? void 0 : overrides.responseContentType) != null ? _l : this.responseContentType,
|
767
|
+
retry: (_m = overrides == null ? void 0 : overrides.retry) != null ? _m : this.retry,
|
768
|
+
validation: (_n = overrides == null ? void 0 : overrides.validation) != null ? _n : this.validation
|
769
|
+
};
|
770
|
+
return new Request({
|
771
|
+
...createRequestParams,
|
772
|
+
...overrides
|
773
|
+
});
|
774
|
+
}
|
775
|
+
getHeaders() {
|
776
|
+
if (!this.headers || !this.headers.size) {
|
777
|
+
return void 0;
|
778
|
+
}
|
779
|
+
return new HeaderSerializer().serialize(this.headers);
|
780
|
+
}
|
781
|
+
constructPath() {
|
782
|
+
return new PathSerializer().serialize(this.pathPattern, this.pathParams);
|
783
|
+
}
|
784
|
+
};
|
785
|
+
|
786
|
+
// src/http/transport/request-builder.ts
|
787
|
+
var RequestBuilder = class {
|
788
|
+
constructor() {
|
789
|
+
this.params = {
|
790
|
+
baseUrl: "https://api.celitech.net/v1" /* DEFAULT */,
|
791
|
+
method: "GET",
|
792
|
+
path: "",
|
793
|
+
config: {},
|
794
|
+
responseSchema: import_zod2.default.any(),
|
795
|
+
requestSchema: import_zod2.default.any(),
|
796
|
+
requestContentType: "json" /* Json */,
|
797
|
+
responseContentType: "json" /* Json */,
|
798
|
+
retry: {
|
799
|
+
attempts: 3,
|
800
|
+
delayMs: 150
|
801
|
+
},
|
802
|
+
validation: {
|
803
|
+
responseValidation: true
|
804
|
+
},
|
805
|
+
pathParams: /* @__PURE__ */ new Map(),
|
806
|
+
queryParams: /* @__PURE__ */ new Map(),
|
807
|
+
headers: /* @__PURE__ */ new Map()
|
808
|
+
};
|
809
|
+
}
|
810
|
+
setRetryAttempts(sdkConfig, requestConfig) {
|
811
|
+
var _a, _b;
|
812
|
+
if (((_a = requestConfig == null ? void 0 : requestConfig.retry) == null ? void 0 : _a.attempts) !== void 0) {
|
813
|
+
this.params.retry.attempts = requestConfig.retry.attempts;
|
814
|
+
} else if (((_b = sdkConfig == null ? void 0 : sdkConfig.retry) == null ? void 0 : _b.attempts) !== void 0) {
|
815
|
+
this.params.retry.attempts = sdkConfig.retry.attempts;
|
816
|
+
}
|
817
|
+
return this;
|
818
|
+
}
|
819
|
+
setRetryDelayMs(sdkConfig, requestConfig) {
|
820
|
+
var _a, _b;
|
821
|
+
if (((_a = requestConfig == null ? void 0 : requestConfig.retry) == null ? void 0 : _a.delayMs) !== void 0) {
|
822
|
+
this.params.retry.delayMs = requestConfig.retry.delayMs;
|
823
|
+
} else if (((_b = sdkConfig == null ? void 0 : sdkConfig.retry) == null ? void 0 : _b.delayMs) !== void 0) {
|
824
|
+
this.params.retry.delayMs = sdkConfig.retry.delayMs;
|
825
|
+
}
|
826
|
+
return this;
|
827
|
+
}
|
828
|
+
setResponseValidation(sdkConfig, requestConfig) {
|
829
|
+
var _a, _b;
|
830
|
+
if (((_a = requestConfig == null ? void 0 : requestConfig.validation) == null ? void 0 : _a.responseValidation) !== void 0) {
|
831
|
+
this.params.validation.responseValidation = requestConfig.validation.responseValidation;
|
832
|
+
} else if (((_b = sdkConfig == null ? void 0 : sdkConfig.validation) == null ? void 0 : _b.responseValidation) !== void 0) {
|
833
|
+
this.params.validation.responseValidation = sdkConfig.validation.responseValidation;
|
834
|
+
}
|
835
|
+
return this;
|
836
|
+
}
|
837
|
+
setBaseUrl(sdkConfig) {
|
838
|
+
if ((sdkConfig == null ? void 0 : sdkConfig.baseUrl) !== void 0) {
|
839
|
+
this.params.baseUrl = sdkConfig.baseUrl;
|
840
|
+
}
|
841
|
+
return this;
|
842
|
+
}
|
843
|
+
setMethod(method) {
|
844
|
+
this.params.method = method;
|
845
|
+
return this;
|
846
|
+
}
|
847
|
+
setPath(path) {
|
848
|
+
this.params.path = path;
|
849
|
+
return this;
|
850
|
+
}
|
851
|
+
setConfig(config) {
|
852
|
+
this.params.config = config;
|
853
|
+
return this;
|
854
|
+
}
|
855
|
+
setRequestContentType(contentType) {
|
856
|
+
this.params.requestContentType = contentType;
|
857
|
+
return this;
|
858
|
+
}
|
859
|
+
setResponseContentType(contentType) {
|
860
|
+
this.params.responseContentType = contentType;
|
861
|
+
return this;
|
862
|
+
}
|
863
|
+
setRequestSchema(requestSchema) {
|
864
|
+
this.params.requestSchema = requestSchema;
|
865
|
+
return this;
|
866
|
+
}
|
867
|
+
setResponseSchema(responseSchema) {
|
868
|
+
this.params.responseSchema = responseSchema;
|
869
|
+
return this;
|
870
|
+
}
|
871
|
+
addBody(body) {
|
872
|
+
if (body !== void 0) {
|
873
|
+
this.params.body = body;
|
874
|
+
}
|
875
|
+
return this;
|
876
|
+
}
|
877
|
+
addPathParam(param) {
|
878
|
+
var _a, _b, _c;
|
879
|
+
if (param.value === void 0 || param.key === void 0) {
|
880
|
+
return this;
|
881
|
+
}
|
882
|
+
this.params.pathParams.set(param.key, {
|
883
|
+
key: param.key,
|
884
|
+
value: param.value,
|
885
|
+
explode: (_a = param.explode) != null ? _a : true,
|
886
|
+
style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
|
887
|
+
encode: (_c = param.encode) != null ? _c : true
|
888
|
+
});
|
889
|
+
return this;
|
890
|
+
}
|
891
|
+
addQueryParam(param) {
|
892
|
+
var _a, _b, _c;
|
893
|
+
if (param.value === void 0 || param.key === void 0) {
|
894
|
+
return this;
|
895
|
+
}
|
896
|
+
this.params.queryParams.set(param.key, {
|
897
|
+
key: param.key,
|
898
|
+
value: param.value,
|
899
|
+
explode: (_a = param.explode) != null ? _a : true,
|
900
|
+
style: (_b = param.style) != null ? _b : "form" /* FORM */,
|
901
|
+
encode: (_c = param.encode) != null ? _c : true
|
902
|
+
});
|
903
|
+
return this;
|
904
|
+
}
|
905
|
+
addHeaderParam(param) {
|
906
|
+
var _a, _b, _c;
|
907
|
+
if (param.value === void 0 || param.key === void 0) {
|
908
|
+
return this;
|
909
|
+
}
|
910
|
+
this.params.headers.set(param.key, {
|
911
|
+
key: param.key,
|
912
|
+
value: param.value,
|
913
|
+
explode: (_a = param.explode) != null ? _a : true,
|
914
|
+
style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
|
915
|
+
encode: (_c = param.encode) != null ? _c : false
|
916
|
+
});
|
917
|
+
return this;
|
918
|
+
}
|
919
|
+
build() {
|
920
|
+
return new Request(this.params);
|
921
|
+
}
|
922
|
+
};
|
923
|
+
|
924
|
+
// src/services/destinations/models/list-destinations-ok-response.ts
|
925
|
+
var import_zod4 = require("zod");
|
926
|
+
|
927
|
+
// src/services/destinations/models/destinations.ts
|
928
|
+
var import_zod3 = require("zod");
|
929
|
+
var destinations = import_zod3.z.lazy(() => {
|
930
|
+
return import_zod3.z.object({
|
931
|
+
name: import_zod3.z.string().optional(),
|
932
|
+
destination: import_zod3.z.string().optional(),
|
933
|
+
supportedCountries: import_zod3.z.array(import_zod3.z.string()).optional()
|
934
|
+
});
|
935
|
+
});
|
936
|
+
var destinationsResponse = import_zod3.z.lazy(() => {
|
937
|
+
return import_zod3.z.object({
|
938
|
+
name: import_zod3.z.string().optional(),
|
939
|
+
destination: import_zod3.z.string().optional(),
|
940
|
+
supportedCountries: import_zod3.z.array(import_zod3.z.string()).optional()
|
941
|
+
}).transform((data) => ({
|
942
|
+
name: data["name"],
|
943
|
+
destination: data["destination"],
|
944
|
+
supportedCountries: data["supportedCountries"]
|
945
|
+
}));
|
946
|
+
});
|
947
|
+
var destinationsRequest = import_zod3.z.lazy(() => {
|
948
|
+
return import_zod3.z.object({
|
949
|
+
name: import_zod3.z.string().nullish(),
|
950
|
+
destination: import_zod3.z.string().nullish(),
|
951
|
+
supportedCountries: import_zod3.z.array(import_zod3.z.string()).nullish()
|
952
|
+
}).transform((data) => ({
|
953
|
+
name: data["name"],
|
954
|
+
destination: data["destination"],
|
955
|
+
supportedCountries: data["supportedCountries"]
|
956
|
+
}));
|
957
|
+
});
|
958
|
+
|
959
|
+
// src/services/destinations/models/list-destinations-ok-response.ts
|
960
|
+
var listDestinationsOkResponse = import_zod4.z.lazy(() => {
|
961
|
+
return import_zod4.z.object({
|
962
|
+
destinations: import_zod4.z.array(destinations).optional()
|
963
|
+
});
|
964
|
+
});
|
965
|
+
var listDestinationsOkResponseResponse = import_zod4.z.lazy(() => {
|
966
|
+
return import_zod4.z.object({
|
967
|
+
destinations: import_zod4.z.array(destinationsResponse).optional()
|
968
|
+
}).transform((data) => ({
|
969
|
+
destinations: data["destinations"]
|
970
|
+
}));
|
971
|
+
});
|
972
|
+
var listDestinationsOkResponseRequest = import_zod4.z.lazy(() => {
|
973
|
+
return import_zod4.z.object({ destinations: import_zod4.z.array(destinationsRequest).nullish() }).transform((data) => ({
|
974
|
+
destinations: data["destinations"]
|
975
|
+
}));
|
976
|
+
});
|
977
|
+
|
978
|
+
// src/services/destinations/destinations.ts
|
979
|
+
var DestinationsService = class extends BaseService {
|
980
|
+
/**
|
981
|
+
* List Destinations
|
982
|
+
* @returns {Promise<HttpResponse<ListDestinationsOkResponse>>} Successful Response
|
983
|
+
*/
|
984
|
+
async listDestinations(requestConfig) {
|
985
|
+
const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/destinations").setRequestSchema(import_zod5.z.any()).setResponseSchema(listDestinationsOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).build();
|
986
|
+
return this.client.call(request);
|
987
|
+
}
|
24
988
|
};
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
}
|
77
|
-
|
78
|
-
|
79
|
-
|
989
|
+
|
990
|
+
// src/services/packages/packages.ts
|
991
|
+
var import_zod8 = require("zod");
|
992
|
+
|
993
|
+
// src/services/packages/models/list-packages-ok-response.ts
|
994
|
+
var import_zod7 = require("zod");
|
995
|
+
|
996
|
+
// src/services/packages/models/packages.ts
|
997
|
+
var import_zod6 = require("zod");
|
998
|
+
var packages = import_zod6.z.lazy(() => {
|
999
|
+
return import_zod6.z.object({
|
1000
|
+
id: import_zod6.z.string().optional(),
|
1001
|
+
destination: import_zod6.z.string().optional(),
|
1002
|
+
dataLimitInBytes: import_zod6.z.number().optional(),
|
1003
|
+
minDays: import_zod6.z.number().optional(),
|
1004
|
+
maxDays: import_zod6.z.number().optional(),
|
1005
|
+
priceInCents: import_zod6.z.number().optional()
|
1006
|
+
});
|
1007
|
+
});
|
1008
|
+
var packagesResponse = import_zod6.z.lazy(() => {
|
1009
|
+
return import_zod6.z.object({
|
1010
|
+
id: import_zod6.z.string().optional(),
|
1011
|
+
destination: import_zod6.z.string().optional(),
|
1012
|
+
dataLimitInBytes: import_zod6.z.number().optional(),
|
1013
|
+
minDays: import_zod6.z.number().optional(),
|
1014
|
+
maxDays: import_zod6.z.number().optional(),
|
1015
|
+
priceInCents: import_zod6.z.number().optional()
|
1016
|
+
}).transform((data) => ({
|
1017
|
+
id: data["id"],
|
1018
|
+
destination: data["destination"],
|
1019
|
+
dataLimitInBytes: data["dataLimitInBytes"],
|
1020
|
+
minDays: data["minDays"],
|
1021
|
+
maxDays: data["maxDays"],
|
1022
|
+
priceInCents: data["priceInCents"]
|
1023
|
+
}));
|
1024
|
+
});
|
1025
|
+
var packagesRequest = import_zod6.z.lazy(() => {
|
1026
|
+
return import_zod6.z.object({
|
1027
|
+
id: import_zod6.z.string().nullish(),
|
1028
|
+
destination: import_zod6.z.string().nullish(),
|
1029
|
+
dataLimitInBytes: import_zod6.z.number().nullish(),
|
1030
|
+
minDays: import_zod6.z.number().nullish(),
|
1031
|
+
maxDays: import_zod6.z.number().nullish(),
|
1032
|
+
priceInCents: import_zod6.z.number().nullish()
|
1033
|
+
}).transform((data) => ({
|
1034
|
+
id: data["id"],
|
1035
|
+
destination: data["destination"],
|
1036
|
+
dataLimitInBytes: data["dataLimitInBytes"],
|
1037
|
+
minDays: data["minDays"],
|
1038
|
+
maxDays: data["maxDays"],
|
1039
|
+
priceInCents: data["priceInCents"]
|
1040
|
+
}));
|
1041
|
+
});
|
1042
|
+
|
1043
|
+
// src/services/packages/models/list-packages-ok-response.ts
|
1044
|
+
var listPackagesOkResponse = import_zod7.z.lazy(() => {
|
1045
|
+
return import_zod7.z.object({
|
1046
|
+
packages: import_zod7.z.array(packages).optional(),
|
1047
|
+
afterCursor: import_zod7.z.string().optional().nullable()
|
1048
|
+
});
|
1049
|
+
});
|
1050
|
+
var listPackagesOkResponseResponse = import_zod7.z.lazy(() => {
|
1051
|
+
return import_zod7.z.object({
|
1052
|
+
packages: import_zod7.z.array(packagesResponse).optional(),
|
1053
|
+
afterCursor: import_zod7.z.string().optional().nullable()
|
1054
|
+
}).transform((data) => ({
|
1055
|
+
packages: data["packages"],
|
1056
|
+
afterCursor: data["afterCursor"]
|
1057
|
+
}));
|
1058
|
+
});
|
1059
|
+
var listPackagesOkResponseRequest = import_zod7.z.lazy(() => {
|
1060
|
+
return import_zod7.z.object({ packages: import_zod7.z.array(packagesRequest).nullish(), afterCursor: import_zod7.z.string().nullish() }).transform((data) => ({
|
1061
|
+
packages: data["packages"],
|
1062
|
+
afterCursor: data["afterCursor"]
|
1063
|
+
}));
|
1064
|
+
});
|
1065
|
+
|
1066
|
+
// src/services/packages/packages.ts
|
1067
|
+
var PackagesService = class extends BaseService {
|
1068
|
+
/**
|
1069
|
+
* List Packages
|
1070
|
+
* @param {string} [destination] - ISO representation of the package's destination.
|
1071
|
+
* @param {string} [startDate] - Start date of the package's validity in the format 'yyyy-MM-dd'. This date can be set to the current day or any day within the next 12 months.
|
1072
|
+
* @param {string} [endDate] - End date of the package's validity in the format 'yyyy-MM-dd'. End date can be maximum 90 days after Start date.
|
1073
|
+
* @param {string} [afterCursor] - To get the next batch of results, use this parameter. It tells the API where to start fetching data after the last item you received. It helps you avoid repeats and efficiently browse through large sets of data.
|
1074
|
+
* @param {number} [limit] - Maximum number of packages to be returned in the response. The value must be greater than 0 and less than or equal to 160. If not provided, the default value is 20
|
1075
|
+
* @param {number} [startTime] - Epoch value representing the start time of the package's validity. This timestamp can be set to the current time or any time within the next 12 months
|
1076
|
+
* @param {number} [endTime] - Epoch value representing the end time of the package's validity. End time can be maximum 90 days after Start time
|
1077
|
+
* @param {number} [duration] - Duration in seconds for the package's validity. If this parameter is present, it will override the startTime and endTime parameters. The maximum duration for a package's validity period is 90 days
|
1078
|
+
* @returns {Promise<HttpResponse<ListPackagesOkResponse>>} Successful Response
|
1079
|
+
*/
|
1080
|
+
async listPackages(params, requestConfig) {
|
1081
|
+
const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/packages").setRequestSchema(import_zod8.z.any()).setResponseSchema(listPackagesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
1082
|
+
key: "destination",
|
1083
|
+
value: params == null ? void 0 : params.destination
|
1084
|
+
}).addQueryParam({
|
1085
|
+
key: "startDate",
|
1086
|
+
value: params == null ? void 0 : params.startDate
|
1087
|
+
}).addQueryParam({
|
1088
|
+
key: "endDate",
|
1089
|
+
value: params == null ? void 0 : params.endDate
|
1090
|
+
}).addQueryParam({
|
1091
|
+
key: "afterCursor",
|
1092
|
+
value: params == null ? void 0 : params.afterCursor
|
1093
|
+
}).addQueryParam({
|
1094
|
+
key: "limit",
|
1095
|
+
value: params == null ? void 0 : params.limit
|
1096
|
+
}).addQueryParam({
|
1097
|
+
key: "startTime",
|
1098
|
+
value: params == null ? void 0 : params.startTime
|
1099
|
+
}).addQueryParam({
|
1100
|
+
key: "endTime",
|
1101
|
+
value: params == null ? void 0 : params.endTime
|
1102
|
+
}).addQueryParam({
|
1103
|
+
key: "duration",
|
1104
|
+
value: params == null ? void 0 : params.duration
|
1105
|
+
}).build();
|
1106
|
+
return this.client.call(request);
|
1107
|
+
}
|
1108
|
+
};
|
1109
|
+
|
1110
|
+
// src/services/purchases/purchases.ts
|
1111
|
+
var import_zod24 = require("zod");
|
1112
|
+
|
1113
|
+
// src/services/purchases/models/list-purchases-ok-response.ts
|
1114
|
+
var import_zod12 = require("zod");
|
1115
|
+
|
1116
|
+
// src/services/purchases/models/purchases.ts
|
1117
|
+
var import_zod11 = require("zod");
|
1118
|
+
|
1119
|
+
// src/services/purchases/models/package_.ts
|
1120
|
+
var import_zod9 = require("zod");
|
1121
|
+
var package_ = import_zod9.z.lazy(() => {
|
1122
|
+
return import_zod9.z.object({
|
1123
|
+
id: import_zod9.z.string().optional(),
|
1124
|
+
dataLimitInBytes: import_zod9.z.number().optional(),
|
1125
|
+
destination: import_zod9.z.string().optional(),
|
1126
|
+
destinationName: import_zod9.z.string().optional(),
|
1127
|
+
priceInCents: import_zod9.z.number().optional()
|
1128
|
+
});
|
1129
|
+
});
|
1130
|
+
var packageResponse = import_zod9.z.lazy(() => {
|
1131
|
+
return import_zod9.z.object({
|
1132
|
+
id: import_zod9.z.string().optional(),
|
1133
|
+
dataLimitInBytes: import_zod9.z.number().optional(),
|
1134
|
+
destination: import_zod9.z.string().optional(),
|
1135
|
+
destinationName: import_zod9.z.string().optional(),
|
1136
|
+
priceInCents: import_zod9.z.number().optional()
|
1137
|
+
}).transform((data) => ({
|
1138
|
+
id: data["id"],
|
1139
|
+
dataLimitInBytes: data["dataLimitInBytes"],
|
1140
|
+
destination: data["destination"],
|
1141
|
+
destinationName: data["destinationName"],
|
1142
|
+
priceInCents: data["priceInCents"]
|
1143
|
+
}));
|
1144
|
+
});
|
1145
|
+
var packageRequest = import_zod9.z.lazy(() => {
|
1146
|
+
return import_zod9.z.object({
|
1147
|
+
id: import_zod9.z.string().nullish(),
|
1148
|
+
dataLimitInBytes: import_zod9.z.number().nullish(),
|
1149
|
+
destination: import_zod9.z.string().nullish(),
|
1150
|
+
destinationName: import_zod9.z.string().nullish(),
|
1151
|
+
priceInCents: import_zod9.z.number().nullish()
|
1152
|
+
}).transform((data) => ({
|
1153
|
+
id: data["id"],
|
1154
|
+
dataLimitInBytes: data["dataLimitInBytes"],
|
1155
|
+
destination: data["destination"],
|
1156
|
+
destinationName: data["destinationName"],
|
1157
|
+
priceInCents: data["priceInCents"]
|
1158
|
+
}));
|
1159
|
+
});
|
1160
|
+
|
1161
|
+
// src/services/purchases/models/purchases-esim.ts
|
1162
|
+
var import_zod10 = require("zod");
|
1163
|
+
var purchasesEsim = import_zod10.z.lazy(() => {
|
1164
|
+
return import_zod10.z.object({
|
1165
|
+
iccid: import_zod10.z.string().min(18).max(22).optional()
|
1166
|
+
});
|
1167
|
+
});
|
1168
|
+
var purchasesEsimResponse = import_zod10.z.lazy(() => {
|
1169
|
+
return import_zod10.z.object({
|
1170
|
+
iccid: import_zod10.z.string().min(18).max(22).optional()
|
1171
|
+
}).transform((data) => ({
|
1172
|
+
iccid: data["iccid"]
|
1173
|
+
}));
|
1174
|
+
});
|
1175
|
+
var purchasesEsimRequest = import_zod10.z.lazy(() => {
|
1176
|
+
return import_zod10.z.object({ iccid: import_zod10.z.string().nullish() }).transform((data) => ({
|
1177
|
+
iccid: data["iccid"]
|
1178
|
+
}));
|
1179
|
+
});
|
1180
|
+
|
1181
|
+
// src/services/purchases/models/purchases.ts
|
1182
|
+
var purchases = import_zod11.z.lazy(() => {
|
1183
|
+
return import_zod11.z.object({
|
1184
|
+
id: import_zod11.z.string().optional(),
|
1185
|
+
startDate: import_zod11.z.string().optional(),
|
1186
|
+
endDate: import_zod11.z.string().optional(),
|
1187
|
+
createdDate: import_zod11.z.string().optional(),
|
1188
|
+
startTime: import_zod11.z.number().optional(),
|
1189
|
+
endTime: import_zod11.z.number().optional(),
|
1190
|
+
createdAt: import_zod11.z.number().optional(),
|
1191
|
+
package: package_.optional(),
|
1192
|
+
esim: purchasesEsim.optional(),
|
1193
|
+
source: import_zod11.z.string().optional(),
|
1194
|
+
referenceId: import_zod11.z.string().optional()
|
1195
|
+
});
|
1196
|
+
});
|
1197
|
+
var purchasesResponse = import_zod11.z.lazy(() => {
|
1198
|
+
return import_zod11.z.object({
|
1199
|
+
id: import_zod11.z.string().optional(),
|
1200
|
+
startDate: import_zod11.z.string().optional(),
|
1201
|
+
endDate: import_zod11.z.string().optional(),
|
1202
|
+
createdDate: import_zod11.z.string().optional(),
|
1203
|
+
startTime: import_zod11.z.number().optional(),
|
1204
|
+
endTime: import_zod11.z.number().optional(),
|
1205
|
+
createdAt: import_zod11.z.number().optional(),
|
1206
|
+
package: packageResponse.optional(),
|
1207
|
+
esim: purchasesEsimResponse.optional(),
|
1208
|
+
source: import_zod11.z.string().optional(),
|
1209
|
+
referenceId: import_zod11.z.string().optional()
|
1210
|
+
}).transform((data) => ({
|
1211
|
+
id: data["id"],
|
1212
|
+
startDate: data["startDate"],
|
1213
|
+
endDate: data["endDate"],
|
1214
|
+
createdDate: data["createdDate"],
|
1215
|
+
startTime: data["startTime"],
|
1216
|
+
endTime: data["endTime"],
|
1217
|
+
createdAt: data["createdAt"],
|
1218
|
+
package: data["package"],
|
1219
|
+
esim: data["esim"],
|
1220
|
+
source: data["source"],
|
1221
|
+
referenceId: data["referenceId"]
|
1222
|
+
}));
|
1223
|
+
});
|
1224
|
+
var purchasesRequest = import_zod11.z.lazy(() => {
|
1225
|
+
return import_zod11.z.object({
|
1226
|
+
id: import_zod11.z.string().nullish(),
|
1227
|
+
startDate: import_zod11.z.string().nullish(),
|
1228
|
+
endDate: import_zod11.z.string().nullish(),
|
1229
|
+
createdDate: import_zod11.z.string().nullish(),
|
1230
|
+
startTime: import_zod11.z.number().nullish(),
|
1231
|
+
endTime: import_zod11.z.number().nullish(),
|
1232
|
+
createdAt: import_zod11.z.number().nullish(),
|
1233
|
+
package: packageRequest.nullish(),
|
1234
|
+
esim: purchasesEsimRequest.nullish(),
|
1235
|
+
source: import_zod11.z.string().nullish(),
|
1236
|
+
referenceId: import_zod11.z.string().nullish()
|
1237
|
+
}).transform((data) => ({
|
1238
|
+
id: data["id"],
|
1239
|
+
startDate: data["startDate"],
|
1240
|
+
endDate: data["endDate"],
|
1241
|
+
createdDate: data["createdDate"],
|
1242
|
+
startTime: data["startTime"],
|
1243
|
+
endTime: data["endTime"],
|
1244
|
+
createdAt: data["createdAt"],
|
1245
|
+
package: data["package"],
|
1246
|
+
esim: data["esim"],
|
1247
|
+
source: data["source"],
|
1248
|
+
referenceId: data["referenceId"]
|
1249
|
+
}));
|
1250
|
+
});
|
1251
|
+
|
1252
|
+
// src/services/purchases/models/list-purchases-ok-response.ts
|
1253
|
+
var listPurchasesOkResponse = import_zod12.z.lazy(() => {
|
1254
|
+
return import_zod12.z.object({
|
1255
|
+
purchases: import_zod12.z.array(purchases).optional(),
|
1256
|
+
afterCursor: import_zod12.z.string().optional().nullable()
|
1257
|
+
});
|
1258
|
+
});
|
1259
|
+
var listPurchasesOkResponseResponse = import_zod12.z.lazy(() => {
|
1260
|
+
return import_zod12.z.object({
|
1261
|
+
purchases: import_zod12.z.array(purchasesResponse).optional(),
|
1262
|
+
afterCursor: import_zod12.z.string().optional().nullable()
|
1263
|
+
}).transform((data) => ({
|
1264
|
+
purchases: data["purchases"],
|
1265
|
+
afterCursor: data["afterCursor"]
|
1266
|
+
}));
|
1267
|
+
});
|
1268
|
+
var listPurchasesOkResponseRequest = import_zod12.z.lazy(() => {
|
1269
|
+
return import_zod12.z.object({ purchases: import_zod12.z.array(purchasesRequest).nullish(), afterCursor: import_zod12.z.string().nullish() }).transform((data) => ({
|
1270
|
+
purchases: data["purchases"],
|
1271
|
+
afterCursor: data["afterCursor"]
|
1272
|
+
}));
|
1273
|
+
});
|
1274
|
+
|
1275
|
+
// src/services/purchases/models/create-purchase-request.ts
|
1276
|
+
var import_zod13 = require("zod");
|
1277
|
+
var createPurchaseRequest = import_zod13.z.lazy(() => {
|
1278
|
+
return import_zod13.z.object({
|
1279
|
+
destination: import_zod13.z.string(),
|
1280
|
+
dataLimitInGb: import_zod13.z.number(),
|
1281
|
+
startDate: import_zod13.z.string(),
|
1282
|
+
endDate: import_zod13.z.string(),
|
1283
|
+
email: import_zod13.z.string().optional(),
|
1284
|
+
referenceId: import_zod13.z.string().optional(),
|
1285
|
+
networkBrand: import_zod13.z.string().optional(),
|
1286
|
+
startTime: import_zod13.z.number().optional(),
|
1287
|
+
endTime: import_zod13.z.number().optional()
|
1288
|
+
});
|
1289
|
+
});
|
1290
|
+
var createPurchaseRequestResponse = import_zod13.z.lazy(() => {
|
1291
|
+
return import_zod13.z.object({
|
1292
|
+
destination: import_zod13.z.string(),
|
1293
|
+
dataLimitInGB: import_zod13.z.number(),
|
1294
|
+
startDate: import_zod13.z.string(),
|
1295
|
+
endDate: import_zod13.z.string(),
|
1296
|
+
email: import_zod13.z.string().optional(),
|
1297
|
+
referenceId: import_zod13.z.string().optional(),
|
1298
|
+
networkBrand: import_zod13.z.string().optional(),
|
1299
|
+
startTime: import_zod13.z.number().optional(),
|
1300
|
+
endTime: import_zod13.z.number().optional()
|
1301
|
+
}).transform((data) => ({
|
1302
|
+
destination: data["destination"],
|
1303
|
+
dataLimitInGb: data["dataLimitInGB"],
|
1304
|
+
startDate: data["startDate"],
|
1305
|
+
endDate: data["endDate"],
|
1306
|
+
email: data["email"],
|
1307
|
+
referenceId: data["referenceId"],
|
1308
|
+
networkBrand: data["networkBrand"],
|
1309
|
+
startTime: data["startTime"],
|
1310
|
+
endTime: data["endTime"]
|
1311
|
+
}));
|
1312
|
+
});
|
1313
|
+
var createPurchaseRequestRequest = import_zod13.z.lazy(() => {
|
1314
|
+
return import_zod13.z.object({
|
1315
|
+
destination: import_zod13.z.string().nullish(),
|
1316
|
+
dataLimitInGb: import_zod13.z.number().nullish(),
|
1317
|
+
startDate: import_zod13.z.string().nullish(),
|
1318
|
+
endDate: import_zod13.z.string().nullish(),
|
1319
|
+
email: import_zod13.z.string().nullish(),
|
1320
|
+
referenceId: import_zod13.z.string().nullish(),
|
1321
|
+
networkBrand: import_zod13.z.string().nullish(),
|
1322
|
+
startTime: import_zod13.z.number().nullish(),
|
1323
|
+
endTime: import_zod13.z.number().nullish()
|
1324
|
+
}).transform((data) => ({
|
1325
|
+
destination: data["destination"],
|
1326
|
+
dataLimitInGB: data["dataLimitInGb"],
|
1327
|
+
startDate: data["startDate"],
|
1328
|
+
endDate: data["endDate"],
|
1329
|
+
email: data["email"],
|
1330
|
+
referenceId: data["referenceId"],
|
1331
|
+
networkBrand: data["networkBrand"],
|
1332
|
+
startTime: data["startTime"],
|
1333
|
+
endTime: data["endTime"]
|
1334
|
+
}));
|
1335
|
+
});
|
1336
|
+
|
1337
|
+
// src/services/purchases/models/create-purchase-ok-response.ts
|
1338
|
+
var import_zod16 = require("zod");
|
1339
|
+
|
1340
|
+
// src/services/purchases/models/create-purchase-ok-response-purchase.ts
|
1341
|
+
var import_zod14 = require("zod");
|
1342
|
+
var createPurchaseOkResponsePurchase = import_zod14.z.lazy(() => {
|
1343
|
+
return import_zod14.z.object({
|
1344
|
+
id: import_zod14.z.string().optional(),
|
1345
|
+
packageId: import_zod14.z.string().optional(),
|
1346
|
+
startDate: import_zod14.z.string().optional(),
|
1347
|
+
endDate: import_zod14.z.string().optional(),
|
1348
|
+
createdDate: import_zod14.z.string().optional(),
|
1349
|
+
startTime: import_zod14.z.number().optional(),
|
1350
|
+
endTime: import_zod14.z.number().optional()
|
1351
|
+
});
|
1352
|
+
});
|
1353
|
+
var createPurchaseOkResponsePurchaseResponse = import_zod14.z.lazy(() => {
|
1354
|
+
return import_zod14.z.object({
|
1355
|
+
id: import_zod14.z.string().optional(),
|
1356
|
+
packageId: import_zod14.z.string().optional(),
|
1357
|
+
startDate: import_zod14.z.string().optional(),
|
1358
|
+
endDate: import_zod14.z.string().optional(),
|
1359
|
+
createdDate: import_zod14.z.string().optional(),
|
1360
|
+
startTime: import_zod14.z.number().optional(),
|
1361
|
+
endTime: import_zod14.z.number().optional()
|
1362
|
+
}).transform((data) => ({
|
1363
|
+
id: data["id"],
|
1364
|
+
packageId: data["packageId"],
|
1365
|
+
startDate: data["startDate"],
|
1366
|
+
endDate: data["endDate"],
|
1367
|
+
createdDate: data["createdDate"],
|
1368
|
+
startTime: data["startTime"],
|
1369
|
+
endTime: data["endTime"]
|
1370
|
+
}));
|
1371
|
+
});
|
1372
|
+
var createPurchaseOkResponsePurchaseRequest = import_zod14.z.lazy(() => {
|
1373
|
+
return import_zod14.z.object({
|
1374
|
+
id: import_zod14.z.string().nullish(),
|
1375
|
+
packageId: import_zod14.z.string().nullish(),
|
1376
|
+
startDate: import_zod14.z.string().nullish(),
|
1377
|
+
endDate: import_zod14.z.string().nullish(),
|
1378
|
+
createdDate: import_zod14.z.string().nullish(),
|
1379
|
+
startTime: import_zod14.z.number().nullish(),
|
1380
|
+
endTime: import_zod14.z.number().nullish()
|
1381
|
+
}).transform((data) => ({
|
1382
|
+
id: data["id"],
|
1383
|
+
packageId: data["packageId"],
|
1384
|
+
startDate: data["startDate"],
|
1385
|
+
endDate: data["endDate"],
|
1386
|
+
createdDate: data["createdDate"],
|
1387
|
+
startTime: data["startTime"],
|
1388
|
+
endTime: data["endTime"]
|
1389
|
+
}));
|
1390
|
+
});
|
1391
|
+
|
1392
|
+
// src/services/purchases/models/create-purchase-ok-response-profile.ts
|
1393
|
+
var import_zod15 = require("zod");
|
1394
|
+
var createPurchaseOkResponseProfile = import_zod15.z.lazy(() => {
|
1395
|
+
return import_zod15.z.object({
|
1396
|
+
iccid: import_zod15.z.string().min(18).max(22).optional(),
|
1397
|
+
activationCode: import_zod15.z.string().min(1e3).max(8e3).optional()
|
1398
|
+
});
|
1399
|
+
});
|
1400
|
+
var createPurchaseOkResponseProfileResponse = import_zod15.z.lazy(() => {
|
1401
|
+
return import_zod15.z.object({
|
1402
|
+
iccid: import_zod15.z.string().min(18).max(22).optional(),
|
1403
|
+
activationCode: import_zod15.z.string().min(1e3).max(8e3).optional()
|
1404
|
+
}).transform((data) => ({
|
1405
|
+
iccid: data["iccid"],
|
1406
|
+
activationCode: data["activationCode"]
|
1407
|
+
}));
|
1408
|
+
});
|
1409
|
+
var createPurchaseOkResponseProfileRequest = import_zod15.z.lazy(() => {
|
1410
|
+
return import_zod15.z.object({ iccid: import_zod15.z.string().nullish(), activationCode: import_zod15.z.string().nullish() }).transform((data) => ({
|
1411
|
+
iccid: data["iccid"],
|
1412
|
+
activationCode: data["activationCode"]
|
1413
|
+
}));
|
1414
|
+
});
|
1415
|
+
|
1416
|
+
// src/services/purchases/models/create-purchase-ok-response.ts
|
1417
|
+
var createPurchaseOkResponse = import_zod16.z.lazy(() => {
|
1418
|
+
return import_zod16.z.object({
|
1419
|
+
purchase: createPurchaseOkResponsePurchase.optional(),
|
1420
|
+
profile: createPurchaseOkResponseProfile.optional()
|
1421
|
+
});
|
1422
|
+
});
|
1423
|
+
var createPurchaseOkResponseResponse = import_zod16.z.lazy(() => {
|
1424
|
+
return import_zod16.z.object({
|
1425
|
+
purchase: createPurchaseOkResponsePurchaseResponse.optional(),
|
1426
|
+
profile: createPurchaseOkResponseProfileResponse.optional()
|
1427
|
+
}).transform((data) => ({
|
1428
|
+
purchase: data["purchase"],
|
1429
|
+
profile: data["profile"]
|
1430
|
+
}));
|
1431
|
+
});
|
1432
|
+
var createPurchaseOkResponseRequest = import_zod16.z.lazy(() => {
|
1433
|
+
return import_zod16.z.object({
|
1434
|
+
purchase: createPurchaseOkResponsePurchaseRequest.nullish(),
|
1435
|
+
profile: createPurchaseOkResponseProfileRequest.nullish()
|
1436
|
+
}).transform((data) => ({
|
1437
|
+
purchase: data["purchase"],
|
1438
|
+
profile: data["profile"]
|
1439
|
+
}));
|
1440
|
+
});
|
1441
|
+
|
1442
|
+
// src/services/purchases/models/top-up-esim-request.ts
|
1443
|
+
var import_zod17 = require("zod");
|
1444
|
+
var topUpEsimRequest = import_zod17.z.lazy(() => {
|
1445
|
+
return import_zod17.z.object({
|
1446
|
+
iccid: import_zod17.z.string().min(18).max(22),
|
1447
|
+
dataLimitInGb: import_zod17.z.number(),
|
1448
|
+
startDate: import_zod17.z.string(),
|
1449
|
+
endDate: import_zod17.z.string(),
|
1450
|
+
email: import_zod17.z.string().optional(),
|
1451
|
+
referenceId: import_zod17.z.string().optional(),
|
1452
|
+
startTime: import_zod17.z.number().optional(),
|
1453
|
+
endTime: import_zod17.z.number().optional()
|
1454
|
+
});
|
1455
|
+
});
|
1456
|
+
var topUpEsimRequestResponse = import_zod17.z.lazy(() => {
|
1457
|
+
return import_zod17.z.object({
|
1458
|
+
iccid: import_zod17.z.string().min(18).max(22),
|
1459
|
+
dataLimitInGB: import_zod17.z.number(),
|
1460
|
+
startDate: import_zod17.z.string(),
|
1461
|
+
endDate: import_zod17.z.string(),
|
1462
|
+
email: import_zod17.z.string().optional(),
|
1463
|
+
referenceId: import_zod17.z.string().optional(),
|
1464
|
+
startTime: import_zod17.z.number().optional(),
|
1465
|
+
endTime: import_zod17.z.number().optional()
|
1466
|
+
}).transform((data) => ({
|
1467
|
+
iccid: data["iccid"],
|
1468
|
+
dataLimitInGb: data["dataLimitInGB"],
|
1469
|
+
startDate: data["startDate"],
|
1470
|
+
endDate: data["endDate"],
|
1471
|
+
email: data["email"],
|
1472
|
+
referenceId: data["referenceId"],
|
1473
|
+
startTime: data["startTime"],
|
1474
|
+
endTime: data["endTime"]
|
1475
|
+
}));
|
1476
|
+
});
|
1477
|
+
var topUpEsimRequestRequest = import_zod17.z.lazy(() => {
|
1478
|
+
return import_zod17.z.object({
|
1479
|
+
iccid: import_zod17.z.string().nullish(),
|
1480
|
+
dataLimitInGb: import_zod17.z.number().nullish(),
|
1481
|
+
startDate: import_zod17.z.string().nullish(),
|
1482
|
+
endDate: import_zod17.z.string().nullish(),
|
1483
|
+
email: import_zod17.z.string().nullish(),
|
1484
|
+
referenceId: import_zod17.z.string().nullish(),
|
1485
|
+
startTime: import_zod17.z.number().nullish(),
|
1486
|
+
endTime: import_zod17.z.number().nullish()
|
1487
|
+
}).transform((data) => ({
|
1488
|
+
iccid: data["iccid"],
|
1489
|
+
dataLimitInGB: data["dataLimitInGb"],
|
1490
|
+
startDate: data["startDate"],
|
1491
|
+
endDate: data["endDate"],
|
1492
|
+
email: data["email"],
|
1493
|
+
referenceId: data["referenceId"],
|
1494
|
+
startTime: data["startTime"],
|
1495
|
+
endTime: data["endTime"]
|
1496
|
+
}));
|
1497
|
+
});
|
1498
|
+
|
1499
|
+
// src/services/purchases/models/top-up-esim-ok-response.ts
|
1500
|
+
var import_zod20 = require("zod");
|
1501
|
+
|
1502
|
+
// src/services/purchases/models/top-up-esim-ok-response-purchase.ts
|
1503
|
+
var import_zod18 = require("zod");
|
1504
|
+
var topUpEsimOkResponsePurchase = import_zod18.z.lazy(() => {
|
1505
|
+
return import_zod18.z.object({
|
1506
|
+
id: import_zod18.z.string().optional(),
|
1507
|
+
packageId: import_zod18.z.string().optional(),
|
1508
|
+
startDate: import_zod18.z.string().optional(),
|
1509
|
+
endDate: import_zod18.z.string().optional(),
|
1510
|
+
createdDate: import_zod18.z.string().optional(),
|
1511
|
+
startTime: import_zod18.z.number().optional(),
|
1512
|
+
endTime: import_zod18.z.number().optional()
|
1513
|
+
});
|
1514
|
+
});
|
1515
|
+
var topUpEsimOkResponsePurchaseResponse = import_zod18.z.lazy(() => {
|
1516
|
+
return import_zod18.z.object({
|
1517
|
+
id: import_zod18.z.string().optional(),
|
1518
|
+
packageId: import_zod18.z.string().optional(),
|
1519
|
+
startDate: import_zod18.z.string().optional(),
|
1520
|
+
endDate: import_zod18.z.string().optional(),
|
1521
|
+
createdDate: import_zod18.z.string().optional(),
|
1522
|
+
startTime: import_zod18.z.number().optional(),
|
1523
|
+
endTime: import_zod18.z.number().optional()
|
1524
|
+
}).transform((data) => ({
|
1525
|
+
id: data["id"],
|
1526
|
+
packageId: data["packageId"],
|
1527
|
+
startDate: data["startDate"],
|
1528
|
+
endDate: data["endDate"],
|
1529
|
+
createdDate: data["createdDate"],
|
1530
|
+
startTime: data["startTime"],
|
1531
|
+
endTime: data["endTime"]
|
1532
|
+
}));
|
1533
|
+
});
|
1534
|
+
var topUpEsimOkResponsePurchaseRequest = import_zod18.z.lazy(() => {
|
1535
|
+
return import_zod18.z.object({
|
1536
|
+
id: import_zod18.z.string().nullish(),
|
1537
|
+
packageId: import_zod18.z.string().nullish(),
|
1538
|
+
startDate: import_zod18.z.string().nullish(),
|
1539
|
+
endDate: import_zod18.z.string().nullish(),
|
1540
|
+
createdDate: import_zod18.z.string().nullish(),
|
1541
|
+
startTime: import_zod18.z.number().nullish(),
|
1542
|
+
endTime: import_zod18.z.number().nullish()
|
1543
|
+
}).transform((data) => ({
|
1544
|
+
id: data["id"],
|
1545
|
+
packageId: data["packageId"],
|
1546
|
+
startDate: data["startDate"],
|
1547
|
+
endDate: data["endDate"],
|
1548
|
+
createdDate: data["createdDate"],
|
1549
|
+
startTime: data["startTime"],
|
1550
|
+
endTime: data["endTime"]
|
1551
|
+
}));
|
1552
|
+
});
|
1553
|
+
|
1554
|
+
// src/services/purchases/models/top-up-esim-ok-response-profile.ts
|
1555
|
+
var import_zod19 = require("zod");
|
1556
|
+
var topUpEsimOkResponseProfile = import_zod19.z.lazy(() => {
|
1557
|
+
return import_zod19.z.object({
|
1558
|
+
iccid: import_zod19.z.string().min(18).max(22).optional()
|
1559
|
+
});
|
1560
|
+
});
|
1561
|
+
var topUpEsimOkResponseProfileResponse = import_zod19.z.lazy(() => {
|
1562
|
+
return import_zod19.z.object({
|
1563
|
+
iccid: import_zod19.z.string().min(18).max(22).optional()
|
1564
|
+
}).transform((data) => ({
|
1565
|
+
iccid: data["iccid"]
|
1566
|
+
}));
|
1567
|
+
});
|
1568
|
+
var topUpEsimOkResponseProfileRequest = import_zod19.z.lazy(() => {
|
1569
|
+
return import_zod19.z.object({ iccid: import_zod19.z.string().nullish() }).transform((data) => ({
|
1570
|
+
iccid: data["iccid"]
|
1571
|
+
}));
|
1572
|
+
});
|
1573
|
+
|
1574
|
+
// src/services/purchases/models/top-up-esim-ok-response.ts
|
1575
|
+
var topUpEsimOkResponse = import_zod20.z.lazy(() => {
|
1576
|
+
return import_zod20.z.object({
|
1577
|
+
purchase: topUpEsimOkResponsePurchase.optional(),
|
1578
|
+
profile: topUpEsimOkResponseProfile.optional()
|
1579
|
+
});
|
1580
|
+
});
|
1581
|
+
var topUpEsimOkResponseResponse = import_zod20.z.lazy(() => {
|
1582
|
+
return import_zod20.z.object({
|
1583
|
+
purchase: topUpEsimOkResponsePurchaseResponse.optional(),
|
1584
|
+
profile: topUpEsimOkResponseProfileResponse.optional()
|
1585
|
+
}).transform((data) => ({
|
1586
|
+
purchase: data["purchase"],
|
1587
|
+
profile: data["profile"]
|
1588
|
+
}));
|
1589
|
+
});
|
1590
|
+
var topUpEsimOkResponseRequest = import_zod20.z.lazy(() => {
|
1591
|
+
return import_zod20.z.object({
|
1592
|
+
purchase: topUpEsimOkResponsePurchaseRequest.nullish(),
|
1593
|
+
profile: topUpEsimOkResponseProfileRequest.nullish()
|
1594
|
+
}).transform((data) => ({
|
1595
|
+
purchase: data["purchase"],
|
1596
|
+
profile: data["profile"]
|
1597
|
+
}));
|
1598
|
+
});
|
1599
|
+
|
1600
|
+
// src/services/purchases/models/edit-purchase-request.ts
|
1601
|
+
var import_zod21 = require("zod");
|
1602
|
+
var editPurchaseRequest = import_zod21.z.lazy(() => {
|
1603
|
+
return import_zod21.z.object({
|
1604
|
+
purchaseId: import_zod21.z.string(),
|
1605
|
+
startDate: import_zod21.z.string(),
|
1606
|
+
endDate: import_zod21.z.string(),
|
1607
|
+
startTime: import_zod21.z.number().optional(),
|
1608
|
+
endTime: import_zod21.z.number().optional()
|
1609
|
+
});
|
1610
|
+
});
|
1611
|
+
var editPurchaseRequestResponse = import_zod21.z.lazy(() => {
|
1612
|
+
return import_zod21.z.object({
|
1613
|
+
purchaseId: import_zod21.z.string(),
|
1614
|
+
startDate: import_zod21.z.string(),
|
1615
|
+
endDate: import_zod21.z.string(),
|
1616
|
+
startTime: import_zod21.z.number().optional(),
|
1617
|
+
endTime: import_zod21.z.number().optional()
|
1618
|
+
}).transform((data) => ({
|
1619
|
+
purchaseId: data["purchaseId"],
|
1620
|
+
startDate: data["startDate"],
|
1621
|
+
endDate: data["endDate"],
|
1622
|
+
startTime: data["startTime"],
|
1623
|
+
endTime: data["endTime"]
|
1624
|
+
}));
|
1625
|
+
});
|
1626
|
+
var editPurchaseRequestRequest = import_zod21.z.lazy(() => {
|
1627
|
+
return import_zod21.z.object({
|
1628
|
+
purchaseId: import_zod21.z.string().nullish(),
|
1629
|
+
startDate: import_zod21.z.string().nullish(),
|
1630
|
+
endDate: import_zod21.z.string().nullish(),
|
1631
|
+
startTime: import_zod21.z.number().nullish(),
|
1632
|
+
endTime: import_zod21.z.number().nullish()
|
1633
|
+
}).transform((data) => ({
|
1634
|
+
purchaseId: data["purchaseId"],
|
1635
|
+
startDate: data["startDate"],
|
1636
|
+
endDate: data["endDate"],
|
1637
|
+
startTime: data["startTime"],
|
1638
|
+
endTime: data["endTime"]
|
1639
|
+
}));
|
1640
|
+
});
|
1641
|
+
|
1642
|
+
// src/services/purchases/models/edit-purchase-ok-response.ts
|
1643
|
+
var import_zod22 = require("zod");
|
1644
|
+
var editPurchaseOkResponse = import_zod22.z.lazy(() => {
|
1645
|
+
return import_zod22.z.object({
|
1646
|
+
purchaseId: import_zod22.z.string().optional(),
|
1647
|
+
newStartDate: import_zod22.z.string().optional(),
|
1648
|
+
newEndDate: import_zod22.z.string().optional(),
|
1649
|
+
newStartTime: import_zod22.z.number().optional(),
|
1650
|
+
newEndTime: import_zod22.z.number().optional()
|
1651
|
+
});
|
1652
|
+
});
|
1653
|
+
var editPurchaseOkResponseResponse = import_zod22.z.lazy(() => {
|
1654
|
+
return import_zod22.z.object({
|
1655
|
+
purchaseId: import_zod22.z.string().optional(),
|
1656
|
+
newStartDate: import_zod22.z.string().optional(),
|
1657
|
+
newEndDate: import_zod22.z.string().optional(),
|
1658
|
+
newStartTime: import_zod22.z.number().optional(),
|
1659
|
+
newEndTime: import_zod22.z.number().optional()
|
1660
|
+
}).transform((data) => ({
|
1661
|
+
purchaseId: data["purchaseId"],
|
1662
|
+
newStartDate: data["newStartDate"],
|
1663
|
+
newEndDate: data["newEndDate"],
|
1664
|
+
newStartTime: data["newStartTime"],
|
1665
|
+
newEndTime: data["newEndTime"]
|
1666
|
+
}));
|
1667
|
+
});
|
1668
|
+
var editPurchaseOkResponseRequest = import_zod22.z.lazy(() => {
|
1669
|
+
return import_zod22.z.object({
|
1670
|
+
purchaseId: import_zod22.z.string().nullish(),
|
1671
|
+
newStartDate: import_zod22.z.string().nullish(),
|
1672
|
+
newEndDate: import_zod22.z.string().nullish(),
|
1673
|
+
newStartTime: import_zod22.z.number().nullish(),
|
1674
|
+
newEndTime: import_zod22.z.number().nullish()
|
1675
|
+
}).transform((data) => ({
|
1676
|
+
purchaseId: data["purchaseId"],
|
1677
|
+
newStartDate: data["newStartDate"],
|
1678
|
+
newEndDate: data["newEndDate"],
|
1679
|
+
newStartTime: data["newStartTime"],
|
1680
|
+
newEndTime: data["newEndTime"]
|
1681
|
+
}));
|
1682
|
+
});
|
1683
|
+
|
1684
|
+
// src/services/purchases/models/get-purchase-consumption-ok-response.ts
|
1685
|
+
var import_zod23 = require("zod");
|
1686
|
+
var getPurchaseConsumptionOkResponse = import_zod23.z.lazy(() => {
|
1687
|
+
return import_zod23.z.object({
|
1688
|
+
dataUsageRemainingInBytes: import_zod23.z.number().optional(),
|
1689
|
+
status: import_zod23.z.string().optional()
|
1690
|
+
});
|
1691
|
+
});
|
1692
|
+
var getPurchaseConsumptionOkResponseResponse = import_zod23.z.lazy(() => {
|
1693
|
+
return import_zod23.z.object({
|
1694
|
+
dataUsageRemainingInBytes: import_zod23.z.number().optional(),
|
1695
|
+
status: import_zod23.z.string().optional()
|
1696
|
+
}).transform((data) => ({
|
1697
|
+
dataUsageRemainingInBytes: data["dataUsageRemainingInBytes"],
|
1698
|
+
status: data["status"]
|
1699
|
+
}));
|
1700
|
+
});
|
1701
|
+
var getPurchaseConsumptionOkResponseRequest = import_zod23.z.lazy(() => {
|
1702
|
+
return import_zod23.z.object({ dataUsageRemainingInBytes: import_zod23.z.number().nullish(), status: import_zod23.z.string().nullish() }).transform((data) => ({
|
1703
|
+
dataUsageRemainingInBytes: data["dataUsageRemainingInBytes"],
|
1704
|
+
status: data["status"]
|
1705
|
+
}));
|
1706
|
+
});
|
1707
|
+
|
1708
|
+
// src/services/purchases/purchases.ts
|
1709
|
+
var PurchasesService = class extends BaseService {
|
1710
|
+
/**
|
1711
|
+
* This endpoint can be used to list all the successful purchases made between a given interval.
|
1712
|
+
* @param {string} [iccid] - ID of the eSIM
|
1713
|
+
* @param {string} [afterDate] - Start date of the interval for filtering purchases in the format 'yyyy-MM-dd'
|
1714
|
+
* @param {string} [beforeDate] - End date of the interval for filtering purchases in the format 'yyyy-MM-dd'
|
1715
|
+
* @param {string} [referenceId] - The referenceId that was provided by the partner during the purchase or topup flow.
|
1716
|
+
* @param {string} [afterCursor] - To get the next batch of results, use this parameter. It tells the API where to start fetching data after the last item you received. It helps you avoid repeats and efficiently browse through large sets of data.
|
1717
|
+
* @param {number} [limit] - Maximum number of purchases to be returned in the response. The value must be greater than 0 and less than or equal to 100. If not provided, the default value is 20
|
1718
|
+
* @param {number} [after] - Epoch value representing the start of the time interval for filtering purchases
|
1719
|
+
* @param {number} [before] - Epoch value representing the end of the time interval for filtering purchases
|
1720
|
+
* @returns {Promise<HttpResponse<ListPurchasesOkResponse>>} Successful Response
|
1721
|
+
*/
|
1722
|
+
async listPurchases(params, requestConfig) {
|
1723
|
+
const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/purchases").setRequestSchema(import_zod24.z.any()).setResponseSchema(listPurchasesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
1724
|
+
key: "iccid",
|
1725
|
+
value: params == null ? void 0 : params.iccid
|
1726
|
+
}).addQueryParam({
|
1727
|
+
key: "afterDate",
|
1728
|
+
value: params == null ? void 0 : params.afterDate
|
1729
|
+
}).addQueryParam({
|
1730
|
+
key: "beforeDate",
|
1731
|
+
value: params == null ? void 0 : params.beforeDate
|
1732
|
+
}).addQueryParam({
|
1733
|
+
key: "referenceId",
|
1734
|
+
value: params == null ? void 0 : params.referenceId
|
1735
|
+
}).addQueryParam({
|
1736
|
+
key: "afterCursor",
|
1737
|
+
value: params == null ? void 0 : params.afterCursor
|
1738
|
+
}).addQueryParam({
|
1739
|
+
key: "limit",
|
1740
|
+
value: params == null ? void 0 : params.limit
|
1741
|
+
}).addQueryParam({
|
1742
|
+
key: "after",
|
1743
|
+
value: params == null ? void 0 : params.after
|
1744
|
+
}).addQueryParam({
|
1745
|
+
key: "before",
|
1746
|
+
value: params == null ? void 0 : params.before
|
1747
|
+
}).build();
|
1748
|
+
return this.client.call(request);
|
1749
|
+
}
|
1750
|
+
/**
|
1751
|
+
* This endpoint is used to purchase a new eSIM by providing the package details.
|
1752
|
+
* @returns {Promise<HttpResponse<CreatePurchaseOkResponse>>} Successful Response
|
1753
|
+
*/
|
1754
|
+
async createPurchase(body, requestConfig) {
|
1755
|
+
const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("POST").setPath("/purchases").setRequestSchema(createPurchaseRequestRequest).setResponseSchema(createPurchaseOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1756
|
+
return this.client.call(request);
|
1757
|
+
}
|
1758
|
+
/**
|
1759
|
+
* This endpoint is used to top-up an eSIM with the previously associated destination by providing an existing ICCID and the package details. The top-up is not feasible for eSIMs in "DELETED" or "ERROR" state.
|
1760
|
+
* @returns {Promise<HttpResponse<TopUpEsimOkResponse>>} Successful Response
|
1761
|
+
*/
|
1762
|
+
async topUpEsim(body, requestConfig) {
|
1763
|
+
const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("POST").setPath("/purchases/topup").setRequestSchema(topUpEsimRequestRequest).setResponseSchema(topUpEsimOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1764
|
+
return this.client.call(request);
|
1765
|
+
}
|
1766
|
+
/**
|
1767
|
+
* This endpoint allows you to modify the dates of an existing package with a future activation start time. Editing can only be performed for packages that have not been activated, and it cannot change the package size. The modification must not change the package duration category to ensure pricing consistency.
|
1768
|
+
* @returns {Promise<HttpResponse<EditPurchaseOkResponse>>} Successful Response
|
1769
|
+
*/
|
1770
|
+
async editPurchase(body, requestConfig) {
|
1771
|
+
const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("POST").setPath("/purchases/edit").setRequestSchema(editPurchaseRequestRequest).setResponseSchema(editPurchaseOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
|
1772
|
+
return this.client.call(request);
|
1773
|
+
}
|
1774
|
+
/**
|
1775
|
+
* 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.
|
1776
|
+
* @param {string} purchaseId - ID of the purchase
|
1777
|
+
* @returns {Promise<HttpResponse<GetPurchaseConsumptionOkResponse>>} Successful Response
|
1778
|
+
*/
|
1779
|
+
async getPurchaseConsumption(purchaseId, requestConfig) {
|
1780
|
+
const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(import_zod24.z.any()).setResponseSchema(getPurchaseConsumptionOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
1781
|
+
key: "purchaseId",
|
1782
|
+
value: purchaseId
|
1783
|
+
}).build();
|
1784
|
+
return this.client.call(request);
|
1785
|
+
}
|
1786
|
+
};
|
1787
|
+
|
1788
|
+
// src/services/e-sim/e-sim.ts
|
1789
|
+
var import_zod34 = require("zod");
|
1790
|
+
|
1791
|
+
// src/services/e-sim/models/get-esim-ok-response.ts
|
1792
|
+
var import_zod26 = require("zod");
|
1793
|
+
|
1794
|
+
// src/services/e-sim/models/get-esim-ok-response-esim.ts
|
1795
|
+
var import_zod25 = require("zod");
|
1796
|
+
var getEsimOkResponseEsim = import_zod25.z.lazy(() => {
|
1797
|
+
return import_zod25.z.object({
|
1798
|
+
iccid: import_zod25.z.string().min(18).max(22).optional(),
|
1799
|
+
smdpAddress: import_zod25.z.string().optional(),
|
1800
|
+
manualActivationCode: import_zod25.z.string().optional(),
|
1801
|
+
status: import_zod25.z.string().optional()
|
1802
|
+
});
|
1803
|
+
});
|
1804
|
+
var getEsimOkResponseEsimResponse = import_zod25.z.lazy(() => {
|
1805
|
+
return import_zod25.z.object({
|
1806
|
+
iccid: import_zod25.z.string().min(18).max(22).optional(),
|
1807
|
+
smdpAddress: import_zod25.z.string().optional(),
|
1808
|
+
manualActivationCode: import_zod25.z.string().optional(),
|
1809
|
+
status: import_zod25.z.string().optional()
|
1810
|
+
}).transform((data) => ({
|
1811
|
+
iccid: data["iccid"],
|
1812
|
+
smdpAddress: data["smdpAddress"],
|
1813
|
+
manualActivationCode: data["manualActivationCode"],
|
1814
|
+
status: data["status"]
|
1815
|
+
}));
|
1816
|
+
});
|
1817
|
+
var getEsimOkResponseEsimRequest = import_zod25.z.lazy(() => {
|
1818
|
+
return import_zod25.z.object({
|
1819
|
+
iccid: import_zod25.z.string().nullish(),
|
1820
|
+
smdpAddress: import_zod25.z.string().nullish(),
|
1821
|
+
manualActivationCode: import_zod25.z.string().nullish(),
|
1822
|
+
status: import_zod25.z.string().nullish()
|
1823
|
+
}).transform((data) => ({
|
1824
|
+
iccid: data["iccid"],
|
1825
|
+
smdpAddress: data["smdpAddress"],
|
1826
|
+
manualActivationCode: data["manualActivationCode"],
|
1827
|
+
status: data["status"]
|
1828
|
+
}));
|
1829
|
+
});
|
1830
|
+
|
1831
|
+
// src/services/e-sim/models/get-esim-ok-response.ts
|
1832
|
+
var getEsimOkResponse = import_zod26.z.lazy(() => {
|
1833
|
+
return import_zod26.z.object({
|
1834
|
+
esim: getEsimOkResponseEsim.optional()
|
1835
|
+
});
|
1836
|
+
});
|
1837
|
+
var getEsimOkResponseResponse = import_zod26.z.lazy(() => {
|
1838
|
+
return import_zod26.z.object({
|
1839
|
+
esim: getEsimOkResponseEsimResponse.optional()
|
1840
|
+
}).transform((data) => ({
|
1841
|
+
esim: data["esim"]
|
1842
|
+
}));
|
1843
|
+
});
|
1844
|
+
var getEsimOkResponseRequest = import_zod26.z.lazy(() => {
|
1845
|
+
return import_zod26.z.object({ esim: getEsimOkResponseEsimRequest.nullish() }).transform((data) => ({
|
1846
|
+
esim: data["esim"]
|
1847
|
+
}));
|
1848
|
+
});
|
1849
|
+
|
1850
|
+
// src/services/e-sim/models/get-esim-device-ok-response.ts
|
1851
|
+
var import_zod28 = require("zod");
|
1852
|
+
|
1853
|
+
// src/services/e-sim/models/device.ts
|
1854
|
+
var import_zod27 = require("zod");
|
1855
|
+
var device = import_zod27.z.lazy(() => {
|
1856
|
+
return import_zod27.z.object({
|
1857
|
+
oem: import_zod27.z.string().optional(),
|
1858
|
+
hardwareName: import_zod27.z.string().optional(),
|
1859
|
+
hardwareModel: import_zod27.z.string().optional(),
|
1860
|
+
eid: import_zod27.z.string().optional()
|
1861
|
+
});
|
1862
|
+
});
|
1863
|
+
var deviceResponse = import_zod27.z.lazy(() => {
|
1864
|
+
return import_zod27.z.object({
|
1865
|
+
oem: import_zod27.z.string().optional(),
|
1866
|
+
hardwareName: import_zod27.z.string().optional(),
|
1867
|
+
hardwareModel: import_zod27.z.string().optional(),
|
1868
|
+
eid: import_zod27.z.string().optional()
|
1869
|
+
}).transform((data) => ({
|
1870
|
+
oem: data["oem"],
|
1871
|
+
hardwareName: data["hardwareName"],
|
1872
|
+
hardwareModel: data["hardwareModel"],
|
1873
|
+
eid: data["eid"]
|
1874
|
+
}));
|
1875
|
+
});
|
1876
|
+
var deviceRequest = import_zod27.z.lazy(() => {
|
1877
|
+
return import_zod27.z.object({
|
1878
|
+
oem: import_zod27.z.string().nullish(),
|
1879
|
+
hardwareName: import_zod27.z.string().nullish(),
|
1880
|
+
hardwareModel: import_zod27.z.string().nullish(),
|
1881
|
+
eid: import_zod27.z.string().nullish()
|
1882
|
+
}).transform((data) => ({
|
1883
|
+
oem: data["oem"],
|
1884
|
+
hardwareName: data["hardwareName"],
|
1885
|
+
hardwareModel: data["hardwareModel"],
|
1886
|
+
eid: data["eid"]
|
1887
|
+
}));
|
1888
|
+
});
|
1889
|
+
|
1890
|
+
// src/services/e-sim/models/get-esim-device-ok-response.ts
|
1891
|
+
var getEsimDeviceOkResponse = import_zod28.z.lazy(() => {
|
1892
|
+
return import_zod28.z.object({
|
1893
|
+
device: device.optional()
|
1894
|
+
});
|
1895
|
+
});
|
1896
|
+
var getEsimDeviceOkResponseResponse = import_zod28.z.lazy(() => {
|
1897
|
+
return import_zod28.z.object({
|
1898
|
+
device: deviceResponse.optional()
|
1899
|
+
}).transform((data) => ({
|
1900
|
+
device: data["device"]
|
1901
|
+
}));
|
1902
|
+
});
|
1903
|
+
var getEsimDeviceOkResponseRequest = import_zod28.z.lazy(() => {
|
1904
|
+
return import_zod28.z.object({ device: deviceRequest.nullish() }).transform((data) => ({
|
1905
|
+
device: data["device"]
|
1906
|
+
}));
|
1907
|
+
});
|
1908
|
+
|
1909
|
+
// src/services/e-sim/models/get-esim-history-ok-response.ts
|
1910
|
+
var import_zod31 = require("zod");
|
1911
|
+
|
1912
|
+
// src/services/e-sim/models/get-esim-history-ok-response-esim.ts
|
1913
|
+
var import_zod30 = require("zod");
|
1914
|
+
|
1915
|
+
// src/services/e-sim/models/history.ts
|
1916
|
+
var import_zod29 = require("zod");
|
1917
|
+
var history = import_zod29.z.lazy(() => {
|
1918
|
+
return import_zod29.z.object({
|
1919
|
+
status: import_zod29.z.string().optional(),
|
1920
|
+
statusDate: import_zod29.z.string().optional(),
|
1921
|
+
date: import_zod29.z.number().optional()
|
1922
|
+
});
|
1923
|
+
});
|
1924
|
+
var historyResponse = import_zod29.z.lazy(() => {
|
1925
|
+
return import_zod29.z.object({
|
1926
|
+
status: import_zod29.z.string().optional(),
|
1927
|
+
statusDate: import_zod29.z.string().optional(),
|
1928
|
+
date: import_zod29.z.number().optional()
|
1929
|
+
}).transform((data) => ({
|
1930
|
+
status: data["status"],
|
1931
|
+
statusDate: data["statusDate"],
|
1932
|
+
date: data["date"]
|
1933
|
+
}));
|
1934
|
+
});
|
1935
|
+
var historyRequest = import_zod29.z.lazy(() => {
|
1936
|
+
return import_zod29.z.object({ status: import_zod29.z.string().nullish(), statusDate: import_zod29.z.string().nullish(), date: import_zod29.z.number().nullish() }).transform((data) => ({
|
1937
|
+
status: data["status"],
|
1938
|
+
statusDate: data["statusDate"],
|
1939
|
+
date: data["date"]
|
1940
|
+
}));
|
1941
|
+
});
|
1942
|
+
|
1943
|
+
// src/services/e-sim/models/get-esim-history-ok-response-esim.ts
|
1944
|
+
var getEsimHistoryOkResponseEsim = import_zod30.z.lazy(() => {
|
1945
|
+
return import_zod30.z.object({
|
1946
|
+
iccid: import_zod30.z.string().min(18).max(22).optional(),
|
1947
|
+
history: import_zod30.z.array(history).optional()
|
1948
|
+
});
|
1949
|
+
});
|
1950
|
+
var getEsimHistoryOkResponseEsimResponse = import_zod30.z.lazy(() => {
|
1951
|
+
return import_zod30.z.object({
|
1952
|
+
iccid: import_zod30.z.string().min(18).max(22).optional(),
|
1953
|
+
history: import_zod30.z.array(historyResponse).optional()
|
1954
|
+
}).transform((data) => ({
|
1955
|
+
iccid: data["iccid"],
|
1956
|
+
history: data["history"]
|
1957
|
+
}));
|
1958
|
+
});
|
1959
|
+
var getEsimHistoryOkResponseEsimRequest = import_zod30.z.lazy(() => {
|
1960
|
+
return import_zod30.z.object({ iccid: import_zod30.z.string().nullish(), history: import_zod30.z.array(historyRequest).nullish() }).transform((data) => ({
|
1961
|
+
iccid: data["iccid"],
|
1962
|
+
history: data["history"]
|
1963
|
+
}));
|
1964
|
+
});
|
1965
|
+
|
1966
|
+
// src/services/e-sim/models/get-esim-history-ok-response.ts
|
1967
|
+
var getEsimHistoryOkResponse = import_zod31.z.lazy(() => {
|
1968
|
+
return import_zod31.z.object({
|
1969
|
+
esim: getEsimHistoryOkResponseEsim.optional()
|
1970
|
+
});
|
1971
|
+
});
|
1972
|
+
var getEsimHistoryOkResponseResponse = import_zod31.z.lazy(() => {
|
1973
|
+
return import_zod31.z.object({
|
1974
|
+
esim: getEsimHistoryOkResponseEsimResponse.optional()
|
1975
|
+
}).transform((data) => ({
|
1976
|
+
esim: data["esim"]
|
1977
|
+
}));
|
1978
|
+
});
|
1979
|
+
var getEsimHistoryOkResponseRequest = import_zod31.z.lazy(() => {
|
1980
|
+
return import_zod31.z.object({ esim: getEsimHistoryOkResponseEsimRequest.nullish() }).transform((data) => ({
|
1981
|
+
esim: data["esim"]
|
1982
|
+
}));
|
1983
|
+
});
|
1984
|
+
|
1985
|
+
// src/services/e-sim/models/get-esim-mac-ok-response.ts
|
1986
|
+
var import_zod33 = require("zod");
|
1987
|
+
|
1988
|
+
// src/services/e-sim/models/get-esim-mac-ok-response-esim.ts
|
1989
|
+
var import_zod32 = require("zod");
|
1990
|
+
var getEsimMacOkResponseEsim = import_zod32.z.lazy(() => {
|
1991
|
+
return import_zod32.z.object({
|
1992
|
+
iccid: import_zod32.z.string().min(18).max(22).optional(),
|
1993
|
+
smdpAddress: import_zod32.z.string().optional(),
|
1994
|
+
manualActivationCode: import_zod32.z.string().optional()
|
1995
|
+
});
|
1996
|
+
});
|
1997
|
+
var getEsimMacOkResponseEsimResponse = import_zod32.z.lazy(() => {
|
1998
|
+
return import_zod32.z.object({
|
1999
|
+
iccid: import_zod32.z.string().min(18).max(22).optional(),
|
2000
|
+
smdpAddress: import_zod32.z.string().optional(),
|
2001
|
+
manualActivationCode: import_zod32.z.string().optional()
|
2002
|
+
}).transform((data) => ({
|
2003
|
+
iccid: data["iccid"],
|
2004
|
+
smdpAddress: data["smdpAddress"],
|
2005
|
+
manualActivationCode: data["manualActivationCode"]
|
2006
|
+
}));
|
2007
|
+
});
|
2008
|
+
var getEsimMacOkResponseEsimRequest = import_zod32.z.lazy(() => {
|
2009
|
+
return import_zod32.z.object({
|
2010
|
+
iccid: import_zod32.z.string().nullish(),
|
2011
|
+
smdpAddress: import_zod32.z.string().nullish(),
|
2012
|
+
manualActivationCode: import_zod32.z.string().nullish()
|
2013
|
+
}).transform((data) => ({
|
2014
|
+
iccid: data["iccid"],
|
2015
|
+
smdpAddress: data["smdpAddress"],
|
2016
|
+
manualActivationCode: data["manualActivationCode"]
|
2017
|
+
}));
|
2018
|
+
});
|
2019
|
+
|
2020
|
+
// src/services/e-sim/models/get-esim-mac-ok-response.ts
|
2021
|
+
var getEsimMacOkResponse = import_zod33.z.lazy(() => {
|
2022
|
+
return import_zod33.z.object({
|
2023
|
+
esim: getEsimMacOkResponseEsim.optional()
|
2024
|
+
});
|
2025
|
+
});
|
2026
|
+
var getEsimMacOkResponseResponse = import_zod33.z.lazy(() => {
|
2027
|
+
return import_zod33.z.object({
|
2028
|
+
esim: getEsimMacOkResponseEsimResponse.optional()
|
2029
|
+
}).transform((data) => ({
|
2030
|
+
esim: data["esim"]
|
2031
|
+
}));
|
2032
|
+
});
|
2033
|
+
var getEsimMacOkResponseRequest = import_zod33.z.lazy(() => {
|
2034
|
+
return import_zod33.z.object({ esim: getEsimMacOkResponseEsimRequest.nullish() }).transform((data) => ({
|
2035
|
+
esim: data["esim"]
|
2036
|
+
}));
|
2037
|
+
});
|
2038
|
+
|
2039
|
+
// src/services/e-sim/e-sim.ts
|
2040
|
+
var ESimService = class extends BaseService {
|
2041
|
+
/**
|
2042
|
+
* Get eSIM Status
|
2043
|
+
* @param {string} iccid - ID of the eSIM
|
2044
|
+
* @returns {Promise<HttpResponse<GetEsimOkResponse>>} Successful Response
|
2045
|
+
*/
|
2046
|
+
async getEsim(params, requestConfig) {
|
2047
|
+
const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim").setRequestSchema(import_zod34.z.any()).setResponseSchema(getEsimOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
|
2048
|
+
key: "iccid",
|
2049
|
+
value: params == null ? void 0 : params.iccid
|
2050
|
+
}).build();
|
2051
|
+
return this.client.call(request);
|
2052
|
+
}
|
2053
|
+
/**
|
2054
|
+
* Get eSIM Device
|
2055
|
+
* @param {string} iccid - ID of the eSIM
|
2056
|
+
* @returns {Promise<HttpResponse<GetEsimDeviceOkResponse>>} Successful Response
|
2057
|
+
*/
|
2058
|
+
async getEsimDevice(iccid, requestConfig) {
|
2059
|
+
const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(import_zod34.z.any()).setResponseSchema(getEsimDeviceOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2060
|
+
key: "iccid",
|
2061
|
+
value: iccid
|
2062
|
+
}).build();
|
2063
|
+
return this.client.call(request);
|
2064
|
+
}
|
2065
|
+
/**
|
2066
|
+
* Get eSIM History
|
2067
|
+
* @param {string} iccid - ID of the eSIM
|
2068
|
+
* @returns {Promise<HttpResponse<GetEsimHistoryOkResponse>>} Successful Response
|
2069
|
+
*/
|
2070
|
+
async getEsimHistory(iccid, requestConfig) {
|
2071
|
+
const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(import_zod34.z.any()).setResponseSchema(getEsimHistoryOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2072
|
+
key: "iccid",
|
2073
|
+
value: iccid
|
2074
|
+
}).build();
|
2075
|
+
return this.client.call(request);
|
2076
|
+
}
|
2077
|
+
/**
|
2078
|
+
* Get eSIM MAC
|
2079
|
+
* @param {string} iccid - ID of the eSIM
|
2080
|
+
* @returns {Promise<HttpResponse<GetEsimMacOkResponse>>} Successful Response
|
2081
|
+
*/
|
2082
|
+
async getEsimMac(iccid, requestConfig) {
|
2083
|
+
const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim/{iccid}/mac").setRequestSchema(import_zod34.z.any()).setResponseSchema(getEsimMacOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
|
2084
|
+
key: "iccid",
|
2085
|
+
value: iccid
|
2086
|
+
}).build();
|
2087
|
+
return this.client.call(request);
|
2088
|
+
}
|
2089
|
+
};
|
2090
|
+
|
2091
|
+
// src/index.ts
|
2092
|
+
var Celitech = class {
|
2093
|
+
constructor(config) {
|
2094
|
+
this.config = config;
|
2095
|
+
const baseUrl = config.environment || config.baseUrl || "https://api.celitech.net/v1" /* DEFAULT */;
|
2096
|
+
this.config = {
|
2097
|
+
...config,
|
2098
|
+
baseUrl
|
2099
|
+
};
|
2100
|
+
this.destinations = new DestinationsService(this.config);
|
2101
|
+
this.packages = new PackagesService(this.config);
|
2102
|
+
this.purchases = new PurchasesService(this.config);
|
2103
|
+
this.eSim = new ESimService(this.config);
|
2104
|
+
}
|
2105
|
+
set baseUrl(baseUrl) {
|
2106
|
+
this.destinations.baseUrl = baseUrl;
|
2107
|
+
this.packages.baseUrl = baseUrl;
|
2108
|
+
this.purchases.baseUrl = baseUrl;
|
2109
|
+
this.eSim.baseUrl = baseUrl;
|
2110
|
+
}
|
2111
|
+
set environment(environment) {
|
2112
|
+
this.destinations.baseUrl = environment;
|
2113
|
+
this.packages.baseUrl = environment;
|
2114
|
+
this.purchases.baseUrl = environment;
|
2115
|
+
this.eSim.baseUrl = environment;
|
2116
|
+
}
|
2117
|
+
set timeout(timeout) {
|
2118
|
+
this.destinations.timeout = timeout;
|
2119
|
+
this.packages.timeout = timeout;
|
2120
|
+
this.purchases.timeout = timeout;
|
2121
|
+
this.eSim.timeout = timeout;
|
2122
|
+
}
|
2123
|
+
set clientId(clientId) {
|
2124
|
+
this.destinations.clientId = clientId;
|
2125
|
+
this.packages.clientId = clientId;
|
2126
|
+
this.purchases.clientId = clientId;
|
2127
|
+
this.eSim.clientId = clientId;
|
2128
|
+
}
|
2129
|
+
set clientSecret(clientSecret) {
|
2130
|
+
this.destinations.clientSecret = clientSecret;
|
2131
|
+
this.packages.clientSecret = clientSecret;
|
2132
|
+
this.purchases.clientSecret = clientSecret;
|
2133
|
+
this.eSim.clientSecret = clientSecret;
|
2134
|
+
}
|
2135
|
+
};
|
2136
|
+
// Annotate the CommonJS export names for ESM import in node:
|
2137
|
+
0 && (module.exports = {
|
2138
|
+
Celitech,
|
2139
|
+
DestinationsService,
|
2140
|
+
ESimService,
|
2141
|
+
PackagesService,
|
2142
|
+
PurchasesService
|
2143
|
+
});
|