celitech-sdk 1.1.85 → 1.1.87
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +24 -18
- package/dist/index.d.ts +1503 -12
- package/dist/index.js +2152 -76
- package/dist/index.mjs +2114 -0
- package/package.json +25 -6
- 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
@@ -1,145 +0,0 @@
|
|
1
|
-
import z, { ZodType } from 'zod';
|
2
|
-
import { Request, CreateRequestParameters } from './request';
|
3
|
-
import { ContentType, HttpMethod, SdkConfig, RequestConfig, RetryOptions, ValidationOptions } from '../types';
|
4
|
-
import { Environment } from '../environment';
|
5
|
-
|
6
|
-
export class RequestBuilder<T> {
|
7
|
-
private params: CreateRequestParameters<T>;
|
8
|
-
|
9
|
-
constructor() {
|
10
|
-
this.params = {
|
11
|
-
baseUrl: Environment.DEFAULT,
|
12
|
-
method: 'GET',
|
13
|
-
path: '',
|
14
|
-
config: {},
|
15
|
-
responseSchema: z.any(),
|
16
|
-
requestSchema: z.any(),
|
17
|
-
requestContentType: ContentType.Json,
|
18
|
-
responseContentType: ContentType.Json,
|
19
|
-
retry: {
|
20
|
-
attempts: 3,
|
21
|
-
delayMs: 150,
|
22
|
-
},
|
23
|
-
validation: {
|
24
|
-
responseValidation: true,
|
25
|
-
},
|
26
|
-
pathParams: new Map(),
|
27
|
-
queryParams: new Map(),
|
28
|
-
headers: new Map(),
|
29
|
-
};
|
30
|
-
}
|
31
|
-
|
32
|
-
setRetryAttempts(sdkConfig?: SdkConfig, requestConfig?: RequestConfig): RequestBuilder<T> {
|
33
|
-
if (requestConfig?.retry?.attempts !== undefined) {
|
34
|
-
this.params.retry.attempts = requestConfig.retry.attempts;
|
35
|
-
} else if (sdkConfig?.retry?.attempts !== undefined) {
|
36
|
-
this.params.retry.attempts = sdkConfig.retry.attempts;
|
37
|
-
}
|
38
|
-
|
39
|
-
return this;
|
40
|
-
}
|
41
|
-
|
42
|
-
setRetryDelayMs(sdkConfig?: SdkConfig, requestConfig?: RequestConfig): RequestBuilder<T> {
|
43
|
-
if (requestConfig?.retry?.delayMs !== undefined) {
|
44
|
-
this.params.retry.delayMs = requestConfig.retry.delayMs;
|
45
|
-
} else if (sdkConfig?.retry?.delayMs !== undefined) {
|
46
|
-
this.params.retry.delayMs = sdkConfig.retry.delayMs;
|
47
|
-
}
|
48
|
-
|
49
|
-
return this;
|
50
|
-
}
|
51
|
-
|
52
|
-
setResponseValidation(sdkConfig: SdkConfig, requestConfig?: RequestConfig): RequestBuilder<T> {
|
53
|
-
if (requestConfig?.validation?.responseValidation !== undefined) {
|
54
|
-
this.params.validation.responseValidation = requestConfig.validation.responseValidation;
|
55
|
-
} else if (sdkConfig?.validation?.responseValidation !== undefined) {
|
56
|
-
this.params.validation.responseValidation = sdkConfig.validation.responseValidation;
|
57
|
-
}
|
58
|
-
|
59
|
-
return this;
|
60
|
-
}
|
61
|
-
|
62
|
-
setBaseUrl(sdkConfig: SdkConfig): RequestBuilder<T> {
|
63
|
-
if (sdkConfig?.baseUrl !== undefined) {
|
64
|
-
this.params.baseUrl = sdkConfig.baseUrl;
|
65
|
-
}
|
66
|
-
|
67
|
-
return this;
|
68
|
-
}
|
69
|
-
|
70
|
-
setMethod(method: HttpMethod): RequestBuilder<T> {
|
71
|
-
this.params.method = method;
|
72
|
-
return this;
|
73
|
-
}
|
74
|
-
|
75
|
-
setPath(path: string): RequestBuilder<T> {
|
76
|
-
this.params.path = path;
|
77
|
-
return this;
|
78
|
-
}
|
79
|
-
|
80
|
-
setConfig(config: SdkConfig): RequestBuilder<T> {
|
81
|
-
this.params.config = config;
|
82
|
-
return this;
|
83
|
-
}
|
84
|
-
|
85
|
-
setRequestContentType(contentType: ContentType): RequestBuilder<T> {
|
86
|
-
this.params.requestContentType = contentType;
|
87
|
-
return this;
|
88
|
-
}
|
89
|
-
|
90
|
-
setResponseContentType(contentType: ContentType): RequestBuilder<T> {
|
91
|
-
this.params.responseContentType = contentType;
|
92
|
-
return this;
|
93
|
-
}
|
94
|
-
|
95
|
-
setRequestSchema(requestSchema: ZodType): RequestBuilder<T> {
|
96
|
-
this.params.requestSchema = requestSchema;
|
97
|
-
return this;
|
98
|
-
}
|
99
|
-
|
100
|
-
setResponseSchema(responseSchema: ZodType): RequestBuilder<T> {
|
101
|
-
this.params.responseSchema = responseSchema;
|
102
|
-
return this;
|
103
|
-
}
|
104
|
-
|
105
|
-
addBody(body?: any): RequestBuilder<T> {
|
106
|
-
if (body !== undefined) {
|
107
|
-
this.params.body = body;
|
108
|
-
}
|
109
|
-
return this;
|
110
|
-
}
|
111
|
-
|
112
|
-
addPathParam(key: string, value: unknown): RequestBuilder<T> {
|
113
|
-
if (value === undefined) {
|
114
|
-
return this;
|
115
|
-
}
|
116
|
-
|
117
|
-
this.params.pathParams.set(key, value);
|
118
|
-
|
119
|
-
return this;
|
120
|
-
}
|
121
|
-
|
122
|
-
addQueryParam(key: string, value: unknown): RequestBuilder<T> {
|
123
|
-
if (value === undefined) {
|
124
|
-
return this;
|
125
|
-
}
|
126
|
-
|
127
|
-
this.params.queryParams.set(key, value);
|
128
|
-
|
129
|
-
return this;
|
130
|
-
}
|
131
|
-
|
132
|
-
addHeaderParam(key: string, value: unknown): RequestBuilder<T> {
|
133
|
-
if (value === undefined) {
|
134
|
-
return this;
|
135
|
-
}
|
136
|
-
|
137
|
-
this.params.headers.set(key, value);
|
138
|
-
|
139
|
-
return this;
|
140
|
-
}
|
141
|
-
|
142
|
-
public build(): Request<T> {
|
143
|
-
return new Request<T>(this.params);
|
144
|
-
}
|
145
|
-
}
|
@@ -1,178 +0,0 @@
|
|
1
|
-
import { ZodType } from 'zod';
|
2
|
-
import { ContentType, HttpMethod, SdkConfig, RetryOptions, RequestConfig, ValidationOptions } from '../types';
|
3
|
-
import { serializeHeader, serializePath, serializeQuery } from '../serializer';
|
4
|
-
import { HttpRequest } from '../hooks/hook';
|
5
|
-
|
6
|
-
export interface CreateRequestParameters<T> {
|
7
|
-
baseUrl: string;
|
8
|
-
method: HttpMethod;
|
9
|
-
body?: any;
|
10
|
-
headers: Map<string, unknown>;
|
11
|
-
queryParams: Map<string, unknown>;
|
12
|
-
pathParams: Map<string, unknown>;
|
13
|
-
path: string;
|
14
|
-
config: SdkConfig;
|
15
|
-
responseSchema: ZodType<T, any, any>;
|
16
|
-
requestSchema: ZodType;
|
17
|
-
requestContentType: ContentType;
|
18
|
-
responseContentType: ContentType;
|
19
|
-
validation: ValidationOptions;
|
20
|
-
retry: RetryOptions;
|
21
|
-
}
|
22
|
-
|
23
|
-
export class Request<T> {
|
24
|
-
public baseUrl: string = '';
|
25
|
-
|
26
|
-
public headers: Map<string, unknown> = new Map();
|
27
|
-
|
28
|
-
public queryParams: Map<string, unknown> = new Map();
|
29
|
-
|
30
|
-
public pathParams: Map<string, unknown> = new Map();
|
31
|
-
|
32
|
-
public body?: any;
|
33
|
-
|
34
|
-
public method: HttpMethod;
|
35
|
-
|
36
|
-
public path: string;
|
37
|
-
|
38
|
-
public config: SdkConfig;
|
39
|
-
|
40
|
-
public responseSchema: ZodType<T, any, any>;
|
41
|
-
|
42
|
-
public requestSchema: ZodType;
|
43
|
-
|
44
|
-
public requestContentType: ContentType;
|
45
|
-
|
46
|
-
public responseContentType: ContentType;
|
47
|
-
|
48
|
-
private readonly pathPattern: string;
|
49
|
-
|
50
|
-
public validation: ValidationOptions = {} as any;
|
51
|
-
|
52
|
-
public retry: RetryOptions = {} as any;
|
53
|
-
|
54
|
-
constructor(params: CreateRequestParameters<T>) {
|
55
|
-
this.baseUrl = params.baseUrl;
|
56
|
-
this.method = params.method;
|
57
|
-
this.pathPattern = params.path;
|
58
|
-
this.body = params.body;
|
59
|
-
this.path = this.constructPath();
|
60
|
-
this.config = params.config;
|
61
|
-
this.pathParams = params.pathParams;
|
62
|
-
this.headers = params.headers;
|
63
|
-
this.queryParams = params.queryParams;
|
64
|
-
this.responseSchema = params.responseSchema;
|
65
|
-
this.requestSchema = params.requestSchema;
|
66
|
-
this.requestContentType = params.requestContentType;
|
67
|
-
this.responseContentType = params.responseContentType;
|
68
|
-
this.retry = params.retry;
|
69
|
-
this.validation = params.validation;
|
70
|
-
}
|
71
|
-
|
72
|
-
addHeaderParam(key: string, value: unknown): void {
|
73
|
-
if (value === undefined) {
|
74
|
-
return;
|
75
|
-
}
|
76
|
-
|
77
|
-
this.headers.set(key, value);
|
78
|
-
}
|
79
|
-
|
80
|
-
addQueryParam(key: string, value: unknown): void {
|
81
|
-
if (value === undefined) {
|
82
|
-
return;
|
83
|
-
}
|
84
|
-
|
85
|
-
this.queryParams.set(key, value);
|
86
|
-
}
|
87
|
-
|
88
|
-
addPathParam(key: string, value: unknown): void {
|
89
|
-
if (value === undefined) {
|
90
|
-
return;
|
91
|
-
}
|
92
|
-
|
93
|
-
this.pathParams.set(key, value);
|
94
|
-
}
|
95
|
-
|
96
|
-
addBody(body: any): void {
|
97
|
-
if (body === undefined) {
|
98
|
-
return;
|
99
|
-
}
|
100
|
-
|
101
|
-
this.body = body;
|
102
|
-
}
|
103
|
-
|
104
|
-
getFetchArgs(): { url: string; requestInit: RequestInit } {
|
105
|
-
const fetchArgs: { url: string; requestInit: RequestInit } = {
|
106
|
-
url: this.constructFullUrl(),
|
107
|
-
requestInit: {
|
108
|
-
method: this.method,
|
109
|
-
body: this.body,
|
110
|
-
},
|
111
|
-
};
|
112
|
-
|
113
|
-
const headersInit = this.constructHeadersInit();
|
114
|
-
if (!!headersInit) {
|
115
|
-
fetchArgs.requestInit['headers'] = headersInit;
|
116
|
-
}
|
117
|
-
|
118
|
-
if (this.config.timeout !== undefined) {
|
119
|
-
fetchArgs.requestInit = {
|
120
|
-
...fetchArgs.requestInit,
|
121
|
-
signal: AbortSignal.timeout(this.config.timeout),
|
122
|
-
};
|
123
|
-
}
|
124
|
-
|
125
|
-
return fetchArgs;
|
126
|
-
}
|
127
|
-
|
128
|
-
public updateFromHookRequest(hookRequest: HttpRequest) {
|
129
|
-
this.baseUrl = hookRequest.baseUrl;
|
130
|
-
this.method = hookRequest.method;
|
131
|
-
this.path = hookRequest.path;
|
132
|
-
this.body = hookRequest.body;
|
133
|
-
this.headers = hookRequest.headers;
|
134
|
-
this.queryParams = hookRequest.queryParams;
|
135
|
-
}
|
136
|
-
|
137
|
-
public toHookRequest(): HttpRequest {
|
138
|
-
return {
|
139
|
-
baseUrl: this.baseUrl,
|
140
|
-
method: this.method,
|
141
|
-
path: this.path,
|
142
|
-
headers: this.headers,
|
143
|
-
body: this.body,
|
144
|
-
queryParams: this.queryParams,
|
145
|
-
};
|
146
|
-
}
|
147
|
-
|
148
|
-
private constructFullUrl(): string {
|
149
|
-
const queryString = this.constructQueryString();
|
150
|
-
return `${this.baseUrl}${this.constructPath()}${queryString}`;
|
151
|
-
}
|
152
|
-
|
153
|
-
private constructPath(): string {
|
154
|
-
const pathParamsRecord: Record<string, unknown> = this.constructParamsRecord(this.pathParams);
|
155
|
-
return serializePath(this.pathPattern, pathParamsRecord);
|
156
|
-
}
|
157
|
-
|
158
|
-
private constructHeadersInit(): HeadersInit | undefined {
|
159
|
-
const headerParamsRecord: Record<string, unknown> = this.constructParamsRecord(this.headers);
|
160
|
-
if (Object.entries(headerParamsRecord).length === 0) {
|
161
|
-
return undefined;
|
162
|
-
}
|
163
|
-
return serializeHeader(headerParamsRecord);
|
164
|
-
}
|
165
|
-
|
166
|
-
private constructQueryString(): string {
|
167
|
-
const queryParamsRecord: Record<string, unknown> = this.constructParamsRecord(this.queryParams);
|
168
|
-
return serializeQuery(queryParamsRecord);
|
169
|
-
}
|
170
|
-
|
171
|
-
private constructParamsRecord(params: Map<string, unknown>): Record<string, unknown> {
|
172
|
-
const record: Record<string, unknown> = {};
|
173
|
-
params.forEach((val, key) => {
|
174
|
-
record[key] = val;
|
175
|
-
});
|
176
|
-
return record;
|
177
|
-
}
|
178
|
-
}
|
package/src/http/types.ts
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
import { ZodType } from 'zod';
|
2
|
-
import { Environment } from './environment';
|
3
|
-
import { Request } from './transport/request';
|
4
|
-
|
5
|
-
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
6
|
-
|
7
|
-
export interface SdkConfig {
|
8
|
-
baseUrl?: string;
|
9
|
-
environment?: Environment;
|
10
|
-
timeout?: number;
|
11
|
-
clientId?: string;
|
12
|
-
clientSecret?: string;
|
13
|
-
retry?: RetryOptions;
|
14
|
-
validation?: ValidationOptions;
|
15
|
-
}
|
16
|
-
|
17
|
-
export interface HttpMetadata {
|
18
|
-
status: number;
|
19
|
-
statusText: string;
|
20
|
-
headers: Record<string, string>;
|
21
|
-
}
|
22
|
-
|
23
|
-
export interface HttpResponse<T> {
|
24
|
-
data?: T;
|
25
|
-
metadata: HttpMetadata;
|
26
|
-
raw: ArrayBuffer;
|
27
|
-
}
|
28
|
-
|
29
|
-
export interface RequestHandler {
|
30
|
-
next?: RequestHandler;
|
31
|
-
|
32
|
-
handle<T>(request: Request<T>): Promise<HttpResponse<T>>;
|
33
|
-
}
|
34
|
-
|
35
|
-
export enum ContentType {
|
36
|
-
Json = 'json',
|
37
|
-
Xml = 'xml',
|
38
|
-
Pdf = 'pdf',
|
39
|
-
Image = 'image',
|
40
|
-
File = 'file',
|
41
|
-
Binary = 'binary',
|
42
|
-
FormUrlEncoded = 'form',
|
43
|
-
Text = 'text',
|
44
|
-
MultipartFormData = 'multipartFormData',
|
45
|
-
}
|
46
|
-
|
47
|
-
export interface Options<T> {
|
48
|
-
responseSchema: ZodType<T, any, any>;
|
49
|
-
requestSchema?: ZodType;
|
50
|
-
body?: any;
|
51
|
-
requestContentType?: ContentType;
|
52
|
-
responseContentType?: ContentType;
|
53
|
-
abortSignal?: AbortSignal;
|
54
|
-
queryParams?: Record<string, unknown>;
|
55
|
-
retry?: RetryOptions;
|
56
|
-
}
|
57
|
-
|
58
|
-
export interface RequestConfig {
|
59
|
-
retry?: RetryOptions;
|
60
|
-
validation?: ValidationOptions;
|
61
|
-
}
|
62
|
-
|
63
|
-
export interface RetryOptions {
|
64
|
-
attempts: number;
|
65
|
-
delayMs?: number;
|
66
|
-
}
|
67
|
-
|
68
|
-
export interface ValidationOptions {
|
69
|
-
responseValidation?: boolean;
|
70
|
-
}
|
package/src/index.ts
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
import { Environment } from './http/environment';
|
2
|
-
import { SdkConfig } from './http/types';
|
3
|
-
import { DestinationsService } from './services/destinations';
|
4
|
-
import { PackagesService } from './services/packages';
|
5
|
-
import { PurchasesService } from './services/purchases';
|
6
|
-
import { ESimService } from './services/e-sim';
|
7
|
-
|
8
|
-
export * as Destinations from './services/destinations';
|
9
|
-
export * as Packages from './services/packages';
|
10
|
-
export * as Purchases from './services/purchases';
|
11
|
-
export * as ESim from './services/e-sim';
|
12
|
-
|
13
|
-
export class Celitech {
|
14
|
-
public readonly destinations: DestinationsService;
|
15
|
-
|
16
|
-
public readonly packages: PackagesService;
|
17
|
-
|
18
|
-
public readonly purchases: PurchasesService;
|
19
|
-
|
20
|
-
public readonly eSim: ESimService;
|
21
|
-
|
22
|
-
constructor(public config: SdkConfig) {
|
23
|
-
const baseUrl = config.environment || config.baseUrl || Environment.DEFAULT;
|
24
|
-
this.config = {
|
25
|
-
...config,
|
26
|
-
baseUrl,
|
27
|
-
};
|
28
|
-
this.destinations = new DestinationsService(this.config);
|
29
|
-
|
30
|
-
this.packages = new PackagesService(this.config);
|
31
|
-
|
32
|
-
this.purchases = new PurchasesService(this.config);
|
33
|
-
|
34
|
-
this.eSim = new ESimService(this.config);
|
35
|
-
}
|
36
|
-
|
37
|
-
set baseUrl(baseUrl: string) {
|
38
|
-
this.destinations.baseUrl = baseUrl;
|
39
|
-
this.packages.baseUrl = baseUrl;
|
40
|
-
this.purchases.baseUrl = baseUrl;
|
41
|
-
this.eSim.baseUrl = baseUrl;
|
42
|
-
}
|
43
|
-
|
44
|
-
set environment(environment: Environment) {
|
45
|
-
this.destinations.baseUrl = environment;
|
46
|
-
this.packages.baseUrl = environment;
|
47
|
-
this.purchases.baseUrl = environment;
|
48
|
-
this.eSim.baseUrl = environment;
|
49
|
-
}
|
50
|
-
|
51
|
-
set timeout(timeout: number) {
|
52
|
-
this.destinations.timeout = timeout;
|
53
|
-
this.packages.timeout = timeout;
|
54
|
-
this.purchases.timeout = timeout;
|
55
|
-
this.eSim.timeout = timeout;
|
56
|
-
}
|
57
|
-
|
58
|
-
set clientId(clientId: string) {
|
59
|
-
this.destinations.clientId = clientId;
|
60
|
-
this.packages.clientId = clientId;
|
61
|
-
this.purchases.clientId = clientId;
|
62
|
-
this.eSim.clientId = clientId;
|
63
|
-
}
|
64
|
-
|
65
|
-
set clientSecret(clientSecret: string) {
|
66
|
-
this.destinations.clientSecret = clientSecret;
|
67
|
-
this.packages.clientSecret = clientSecret;
|
68
|
-
this.purchases.clientSecret = clientSecret;
|
69
|
-
this.eSim.clientSecret = clientSecret;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
|
73
|
-
// c029837e0e474b76bc487506e8799df5e3335891efe4fb02bda7a1441840310c
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { Environment } from '../http/environment';
|
2
|
-
import { HttpClient } from '../http/client';
|
3
|
-
import { SdkConfig } from '../http/types';
|
4
|
-
|
5
|
-
export class BaseService {
|
6
|
-
public client: HttpClient = new HttpClient(this.config);
|
7
|
-
|
8
|
-
constructor(public config: SdkConfig) {}
|
9
|
-
|
10
|
-
set baseUrl(baseUrl: string) {
|
11
|
-
this.config.baseUrl = baseUrl;
|
12
|
-
}
|
13
|
-
|
14
|
-
set environment(environment: Environment) {
|
15
|
-
this.config.environment = environment;
|
16
|
-
}
|
17
|
-
|
18
|
-
set timeout(timeout: number) {
|
19
|
-
this.config.timeout = timeout;
|
20
|
-
}
|
21
|
-
|
22
|
-
set clientId(clientId: string) {
|
23
|
-
this.config.clientId = clientId;
|
24
|
-
}
|
25
|
-
|
26
|
-
set clientSecret(clientSecret: string) {
|
27
|
-
this.config.clientSecret = clientSecret;
|
28
|
-
}
|
29
|
-
}
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import { z } from 'zod';
|
2
|
-
import { BaseService } from '../base-service';
|
3
|
-
import { ContentType, HttpResponse, RequestConfig } from '../../http/types';
|
4
|
-
import { RequestBuilder } from '../../http/transport/request-builder';
|
5
|
-
import { ListDestinationsOkResponse, listDestinationsOkResponseResponse } from './models/list-destinations-ok-response';
|
6
|
-
|
7
|
-
export class DestinationsService extends BaseService {
|
8
|
-
/**
|
9
|
-
* List Destinations
|
10
|
-
* @returns {Promise<HttpResponse<ListDestinationsOkResponse>>} Successful Response
|
11
|
-
*/
|
12
|
-
async listDestinations(requestConfig?: RequestConfig): Promise<HttpResponse<ListDestinationsOkResponse>> {
|
13
|
-
const request = new RequestBuilder<ListDestinationsOkResponse>()
|
14
|
-
.setConfig(this.config)
|
15
|
-
.setBaseUrl(this.config)
|
16
|
-
.setMethod('GET')
|
17
|
-
.setPath('/destinations')
|
18
|
-
.setRequestSchema(z.any())
|
19
|
-
.setResponseSchema(listDestinationsOkResponseResponse)
|
20
|
-
.setRequestContentType(ContentType.Json)
|
21
|
-
.setResponseContentType(ContentType.Json)
|
22
|
-
.setRetryAttempts(this.config, requestConfig)
|
23
|
-
.setRetryDelayMs(this.config, requestConfig)
|
24
|
-
.setResponseValidation(this.config, requestConfig)
|
25
|
-
.build();
|
26
|
-
return this.client.call<ListDestinationsOkResponse>(request);
|
27
|
-
}
|
28
|
-
}
|
@@ -1,57 +0,0 @@
|
|
1
|
-
import { z } from 'zod';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* The shape of the model inside the application code - what the users use
|
5
|
-
*/
|
6
|
-
export const destinations = z.lazy(() => {
|
7
|
-
return z.object({
|
8
|
-
name: z.string().optional(),
|
9
|
-
destination: z.string().optional(),
|
10
|
-
supportedCountries: z.array(z.string()).optional(),
|
11
|
-
});
|
12
|
-
});
|
13
|
-
|
14
|
-
/**
|
15
|
-
*
|
16
|
-
* @typedef {Destinations} destinations
|
17
|
-
* @property {string} - Name of the destination
|
18
|
-
* @property {string} - ISO representation of the destination
|
19
|
-
* @property {string[]} - This array indicates the geographical area covered by a specific destination. If the destination represents a single country, the array will include that country. However, if the destination represents a broader regional scope, the array will be populated with the names of the countries belonging to that region.
|
20
|
-
*/
|
21
|
-
export type Destinations = z.infer<typeof destinations>;
|
22
|
-
|
23
|
-
/**
|
24
|
-
* The shape of the model mapping from the api schema into the application shape.
|
25
|
-
* Is equal to application shape if all property names match the api schema
|
26
|
-
*/
|
27
|
-
export const destinationsResponse = z.lazy(() => {
|
28
|
-
return z
|
29
|
-
.object({
|
30
|
-
name: z.string().optional(),
|
31
|
-
destination: z.string().optional(),
|
32
|
-
supportedCountries: z.array(z.string()).optional(),
|
33
|
-
})
|
34
|
-
.transform((data) => ({
|
35
|
-
name: data['name'],
|
36
|
-
destination: data['destination'],
|
37
|
-
supportedCountries: data['supportedCountries'],
|
38
|
-
}));
|
39
|
-
});
|
40
|
-
|
41
|
-
/**
|
42
|
-
* The shape of the model mapping from the application shape into the api schema.
|
43
|
-
* Is equal to application shape if all property names match the api schema
|
44
|
-
*/
|
45
|
-
export const destinationsRequest = z.lazy(() => {
|
46
|
-
return z
|
47
|
-
.object({
|
48
|
-
name: z.string().nullish(),
|
49
|
-
destination: z.string().nullish(),
|
50
|
-
supportedCountries: z.array(z.string()).nullish(),
|
51
|
-
})
|
52
|
-
.transform((data) => ({
|
53
|
-
name: data['name'],
|
54
|
-
destination: data['destination'],
|
55
|
-
supportedCountries: data['supportedCountries'],
|
56
|
-
}));
|
57
|
-
});
|
@@ -1,42 +0,0 @@
|
|
1
|
-
import { z } from 'zod';
|
2
|
-
import { destinations, destinationsRequest, destinationsResponse } from './destinations';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* The shape of the model inside the application code - what the users use
|
6
|
-
*/
|
7
|
-
export const listDestinationsOkResponse = z.lazy(() => {
|
8
|
-
return z.object({
|
9
|
-
destinations: z.array(destinations).optional(),
|
10
|
-
});
|
11
|
-
});
|
12
|
-
|
13
|
-
/**
|
14
|
-
*
|
15
|
-
* @typedef {ListDestinationsOkResponse} listDestinationsOkResponse
|
16
|
-
* @property {Destinations[]}
|
17
|
-
*/
|
18
|
-
export type ListDestinationsOkResponse = z.infer<typeof listDestinationsOkResponse>;
|
19
|
-
|
20
|
-
/**
|
21
|
-
* The shape of the model mapping from the api schema into the application shape.
|
22
|
-
* Is equal to application shape if all property names match the api schema
|
23
|
-
*/
|
24
|
-
export const listDestinationsOkResponseResponse = z.lazy(() => {
|
25
|
-
return z
|
26
|
-
.object({
|
27
|
-
destinations: z.array(destinationsResponse).optional(),
|
28
|
-
})
|
29
|
-
.transform((data) => ({
|
30
|
-
destinations: data['destinations'],
|
31
|
-
}));
|
32
|
-
});
|
33
|
-
|
34
|
-
/**
|
35
|
-
* The shape of the model mapping from the application shape into the api schema.
|
36
|
-
* Is equal to application shape if all property names match the api schema
|
37
|
-
*/
|
38
|
-
export const listDestinationsOkResponseRequest = z.lazy(() => {
|
39
|
-
return z.object({ destinations: z.array(destinationsRequest).nullish() }).transform((data) => ({
|
40
|
-
destinations: data['destinations'],
|
41
|
-
}));
|
42
|
-
});
|