orb-billing 5.76.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +118 -45
- package/api-promise.d.mts +3 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +3 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +3 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +474 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +474 -0
- package/client.d.ts.map +1 -0
- package/client.js +650 -0
- package/client.js.map +1 -0
- package/client.mjs +645 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +131 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +131 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +294 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +266 -0
- package/core/error.mjs.map +1 -0
- package/core/pagination.d.mts +67 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +67 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +101 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +95 -0
- package/core/pagination.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +3 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +2 -131
- package/error.d.ts.map +1 -1
- package/error.js +3 -291
- package/error.js.map +1 -1
- package/error.mjs +2 -265
- package/error.mjs.map +1 -1
- package/index.d.mts +7 -401
- package/index.d.mts.map +1 -0
- package/index.d.ts +6 -400
- package/index.d.ts.map +1 -1
- package/index.js +15 -286
- package/index.js.map +1 -1
- package/index.mjs +6 -259
- package/index.mjs.map +1 -1
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +20 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +20 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +40 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +37 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +1 -0
- package/internal/qs/formats.d.ts.map +1 -1
- package/internal/qs/formats.js +4 -2
- package/internal/qs/formats.js.map +1 -1
- package/internal/qs/formats.mjs +2 -1
- package/internal/qs/formats.mjs.map +1 -1
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +2 -2
- package/internal/qs/index.d.ts.map +1 -1
- package/internal/qs/index.mjs.map +1 -1
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts.map +1 -1
- package/internal/qs/stringify.js +16 -19
- package/internal/qs/stringify.js.map +1 -1
- package/internal/qs/stringify.mjs +17 -19
- package/internal/qs/stringify.mjs.map +1 -1
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +1 -0
- package/internal/qs/utils.d.ts.map +1 -1
- package/internal/qs/utils.js +22 -21
- package/internal/qs/utils.js.map +1 -1
- package/internal/qs/utils.mjs +12 -12
- package/internal/qs/utils.mjs.map +1 -1
- package/internal/request-options.d.mts +75 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +75 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +26 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +26 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +92 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +87 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +81 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.js +3 -26
- package/internal/utils/query.js.map +1 -1
- package/internal/utils/query.mjs.map +1 -1
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +8 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +8 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +12 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +9 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +122 -65
- package/pagination.d.mts +3 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +2 -30
- package/pagination.d.ts.map +1 -1
- package/pagination.js +3 -37
- package/pagination.js.map +1 -1
- package/pagination.mjs +2 -35
- package/pagination.mjs.map +1 -1
- package/resource.d.mts +3 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -5
- package/resource.d.ts.map +1 -1
- package/resource.js +3 -8
- package/resource.js.map +1 -1
- package/resource.mjs +2 -6
- package/resource.mjs.map +1 -1
- package/resources/alerts.d.mts +430 -0
- package/resources/alerts.d.mts.map +1 -0
- package/resources/alerts.d.ts +14 -17
- package/resources/alerts.d.ts.map +1 -1
- package/resources/alerts.js +37 -27
- package/resources/alerts.js.map +1 -1
- package/resources/alerts.mjs +36 -25
- package/resources/alerts.mjs.map +1 -1
- package/resources/beta/beta.d.mts +2826 -0
- package/resources/beta/beta.d.mts.map +1 -0
- package/resources/beta/beta.d.ts +13 -9
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +10 -30
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +8 -6
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/external-plan-id.d.mts +2713 -0
- package/resources/beta/external-plan-id.d.mts.map +1 -0
- package/resources/beta/external-plan-id.d.ts +10 -6
- package/resources/beta/external-plan-id.d.ts.map +1 -1
- package/resources/beta/external-plan-id.js +7 -5
- package/resources/beta/external-plan-id.js.map +1 -1
- package/resources/beta/external-plan-id.mjs +7 -5
- package/resources/beta/external-plan-id.mjs.map +1 -1
- package/resources/beta/index.d.mts +3 -0
- package/resources/beta/index.d.mts.map +1 -0
- package/resources/beta/index.d.ts +2 -2
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta.d.mts +2 -0
- package/resources/beta.d.mts.map +1 -0
- package/resources/beta.d.ts.map +1 -1
- package/resources/beta.js +2 -15
- package/resources/beta.js.map +1 -1
- package/resources/beta.mjs.map +1 -1
- package/resources/coupons/coupons.d.mts +148 -0
- package/resources/coupons/coupons.d.mts.map +1 -0
- package/resources/coupons/coupons.d.ts +10 -11
- package/resources/coupons/coupons.d.ts.map +1 -1
- package/resources/coupons/coupons.js +24 -38
- package/resources/coupons/coupons.js.map +1 -1
- package/resources/coupons/coupons.mjs +21 -12
- package/resources/coupons/coupons.mjs.map +1 -1
- package/resources/coupons/index.d.mts +3 -0
- package/resources/coupons/index.d.mts.map +1 -0
- package/resources/coupons/index.d.ts +1 -1
- package/resources/coupons/index.d.ts.map +1 -1
- package/resources/coupons/index.js +1 -2
- package/resources/coupons/index.js.map +1 -1
- package/resources/coupons/index.mjs +1 -1
- package/resources/coupons/index.mjs.map +1 -1
- package/resources/coupons/subscriptions.d.mts +34 -0
- package/resources/coupons/subscriptions.d.mts.map +1 -0
- package/resources/coupons/subscriptions.d.ts +5 -6
- package/resources/coupons/subscriptions.d.ts.map +1 -1
- package/resources/coupons/subscriptions.js +21 -12
- package/resources/coupons/subscriptions.js.map +1 -1
- package/resources/coupons/subscriptions.mjs +20 -11
- package/resources/coupons/subscriptions.mjs.map +1 -1
- package/resources/coupons.d.mts +2 -0
- package/resources/coupons.d.mts.map +1 -0
- package/resources/coupons.d.ts.map +1 -1
- package/resources/coupons.js +2 -15
- package/resources/coupons.js.map +1 -1
- package/resources/coupons.mjs.map +1 -1
- package/resources/credit-blocks.d.mts +275 -0
- package/resources/credit-blocks.d.mts.map +1 -0
- package/resources/credit-blocks.d.ts +6 -5
- package/resources/credit-blocks.d.ts.map +1 -1
- package/resources/credit-blocks.js +7 -5
- package/resources/credit-blocks.js.map +1 -1
- package/resources/credit-blocks.mjs +7 -5
- package/resources/credit-blocks.mjs.map +1 -1
- package/resources/credit-notes.d.mts +144 -0
- package/resources/credit-notes.d.mts.map +1 -0
- package/resources/credit-notes.d.ts +8 -8
- package/resources/credit-notes.d.ts.map +1 -1
- package/resources/credit-notes.js +19 -10
- package/resources/credit-notes.js.map +1 -1
- package/resources/credit-notes.mjs +18 -9
- package/resources/credit-notes.mjs.map +1 -1
- package/resources/customers/balance-transactions.d.mts +135 -0
- package/resources/customers/balance-transactions.d.mts.map +1 -0
- package/resources/customers/balance-transactions.d.ts +8 -9
- package/resources/customers/balance-transactions.d.ts.map +1 -1
- package/resources/customers/balance-transactions.js +29 -13
- package/resources/customers/balance-transactions.js.map +1 -1
- package/resources/customers/balance-transactions.mjs +28 -11
- package/resources/customers/balance-transactions.mjs.map +1 -1
- package/resources/customers/costs.d.mts +314 -0
- package/resources/customers/costs.d.mts.map +1 -0
- package/resources/customers/costs.d.ts +5 -6
- package/resources/customers/costs.d.ts.map +1 -1
- package/resources/customers/costs.js +243 -11
- package/resources/customers/costs.js.map +1 -1
- package/resources/customers/costs.mjs +243 -11
- package/resources/customers/costs.mjs.map +1 -1
- package/resources/customers/credits/credits.d.mts +287 -0
- package/resources/customers/credits/credits.d.mts.map +1 -0
- package/resources/customers/credits/credits.d.ts +11 -15
- package/resources/customers/credits/credits.d.ts.map +1 -1
- package/resources/customers/credits/credits.js +38 -50
- package/resources/customers/credits/credits.js.map +1 -1
- package/resources/customers/credits/credits.mjs +36 -24
- package/resources/customers/credits/credits.mjs.map +1 -1
- package/resources/customers/credits/index.d.mts +4 -0
- package/resources/customers/credits/index.d.mts.map +1 -0
- package/resources/customers/credits/index.d.ts +3 -3
- package/resources/customers/credits/index.d.ts.map +1 -1
- package/resources/customers/credits/index.js +1 -7
- package/resources/customers/credits/index.js.map +1 -1
- package/resources/customers/credits/index.mjs +3 -3
- package/resources/customers/credits/index.mjs.map +1 -1
- package/resources/customers/credits/ledger.d.mts +1202 -0
- package/resources/customers/credits/ledger.d.mts.map +1 -0
- package/resources/customers/credits/ledger.d.ts +11 -14
- package/resources/customers/credits/ledger.d.ts.map +1 -1
- package/resources/customers/credits/ledger.js +172 -27
- package/resources/customers/credits/ledger.js.map +1 -1
- package/resources/customers/credits/ledger.mjs +171 -24
- package/resources/customers/credits/ledger.mjs.map +1 -1
- package/resources/customers/credits/top-ups.d.mts +357 -0
- package/resources/customers/credits/top-ups.d.mts.map +1 -0
- package/resources/customers/credits/top-ups.d.ts +19 -16
- package/resources/customers/credits/top-ups.d.ts.map +1 -1
- package/resources/customers/credits/top-ups.js +24 -29
- package/resources/customers/credits/top-ups.js.map +1 -1
- package/resources/customers/credits/top-ups.mjs +23 -26
- package/resources/customers/credits/top-ups.mjs.map +1 -1
- package/resources/customers/credits.d.mts +2 -0
- package/resources/customers/credits.d.mts.map +1 -0
- package/resources/customers/credits.d.ts.map +1 -1
- package/resources/customers/credits.js +2 -15
- package/resources/customers/credits.js.map +1 -1
- package/resources/customers/credits.mjs.map +1 -1
- package/resources/customers/customers.d.mts +1453 -0
- package/resources/customers/customers.d.mts.map +1 -0
- package/resources/customers/customers.d.ts +17 -18
- package/resources/customers/customers.d.ts.map +1 -1
- package/resources/customers/customers.js +30 -53
- package/resources/customers/customers.js.map +1 -1
- package/resources/customers/customers.mjs +27 -27
- package/resources/customers/customers.mjs.map +1 -1
- package/resources/customers/index.d.mts +5 -0
- package/resources/customers/index.d.mts.map +1 -0
- package/resources/customers/index.d.ts +3 -3
- package/resources/customers/index.d.ts.map +1 -1
- package/resources/customers/index.js +1 -5
- package/resources/customers/index.js.map +1 -1
- package/resources/customers/index.mjs +3 -3
- package/resources/customers/index.mjs.map +1 -1
- package/resources/customers.d.mts +2 -0
- package/resources/customers.d.mts.map +1 -0
- package/resources/customers.d.ts.map +1 -1
- package/resources/customers.js +2 -15
- package/resources/customers.js.map +1 -1
- package/resources/customers.mjs.map +1 -1
- package/resources/dimensional-price-groups/dimensional-price-groups.d.mts +150 -0
- package/resources/dimensional-price-groups/dimensional-price-groups.d.mts.map +1 -0
- package/resources/dimensional-price-groups/dimensional-price-groups.d.ts +11 -12
- package/resources/dimensional-price-groups/dimensional-price-groups.d.ts.map +1 -1
- package/resources/dimensional-price-groups/dimensional-price-groups.js +21 -39
- package/resources/dimensional-price-groups/dimensional-price-groups.js.map +1 -1
- package/resources/dimensional-price-groups/dimensional-price-groups.mjs +18 -13
- package/resources/dimensional-price-groups/dimensional-price-groups.mjs.map +1 -1
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.mts +53 -0
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.mts.map +1 -0
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.ts +7 -6
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.ts.map +1 -1
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.js +6 -5
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.js.map +1 -1
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.mjs +6 -5
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.mjs.map +1 -1
- package/resources/dimensional-price-groups/index.d.mts +3 -0
- package/resources/dimensional-price-groups/index.d.mts.map +1 -0
- package/resources/dimensional-price-groups/index.d.ts +1 -1
- package/resources/dimensional-price-groups/index.d.ts.map +1 -1
- package/resources/dimensional-price-groups/index.js +1 -2
- package/resources/dimensional-price-groups/index.js.map +1 -1
- package/resources/dimensional-price-groups/index.mjs +1 -1
- package/resources/dimensional-price-groups/index.mjs.map +1 -1
- package/resources/dimensional-price-groups.d.mts +2 -0
- package/resources/dimensional-price-groups.d.mts.map +1 -0
- package/resources/dimensional-price-groups.d.ts.map +1 -1
- package/resources/dimensional-price-groups.js +2 -15
- package/resources/dimensional-price-groups.js.map +1 -1
- package/resources/dimensional-price-groups.mjs.map +1 -1
- package/resources/events/backfills.d.mts +389 -0
- package/resources/events/backfills.d.mts.map +1 -0
- package/resources/events/backfills.d.ts +11 -12
- package/resources/events/backfills.d.ts.map +1 -1
- package/resources/events/backfills.js +24 -15
- package/resources/events/backfills.js.map +1 -1
- package/resources/events/backfills.mjs +23 -13
- package/resources/events/backfills.mjs.map +1 -1
- package/resources/events/events.d.mts +536 -0
- package/resources/events/events.d.mts.map +1 -0
- package/resources/events/events.d.ts +10 -11
- package/resources/events/events.d.ts.map +1 -1
- package/resources/events/events.js +7 -29
- package/resources/events/events.js.map +1 -1
- package/resources/events/events.mjs +5 -5
- package/resources/events/events.mjs.map +1 -1
- package/resources/events/index.d.mts +4 -0
- package/resources/events/index.d.mts.map +1 -0
- package/resources/events/index.d.ts +1 -1
- package/resources/events/index.d.ts.map +1 -1
- package/resources/events/index.js +1 -2
- package/resources/events/index.js.map +1 -1
- package/resources/events/index.mjs +1 -1
- package/resources/events/index.mjs.map +1 -1
- package/resources/events/volume.d.mts +79 -0
- package/resources/events/volume.d.mts.map +1 -0
- package/resources/events/volume.d.ts +4 -3
- package/resources/events/volume.d.ts.map +1 -1
- package/resources/events/volume.js +1 -1
- package/resources/events/volume.js.map +1 -1
- package/resources/events/volume.mjs +1 -1
- package/resources/events/volume.mjs.map +1 -1
- package/resources/events.d.mts +2 -0
- package/resources/events.d.mts.map +1 -0
- package/resources/events.d.ts.map +1 -1
- package/resources/events.js +2 -15
- package/resources/events.js.map +1 -1
- package/resources/events.mjs.map +1 -1
- package/resources/index.d.mts +22 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +13 -13
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +7 -33
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +12 -12
- package/resources/index.mjs.map +1 -1
- package/resources/invoice-line-items.d.mts +245 -0
- package/resources/invoice-line-items.d.mts.map +1 -0
- package/resources/invoice-line-items.d.ts +4 -3
- package/resources/invoice-line-items.d.ts.map +1 -1
- package/resources/invoice-line-items.js +1 -1
- package/resources/invoice-line-items.js.map +1 -1
- package/resources/invoice-line-items.mjs +1 -1
- package/resources/invoice-line-items.mjs.map +1 -1
- package/resources/invoices.d.mts +1795 -0
- package/resources/invoices.d.mts.map +1 -0
- package/resources/invoices.d.ts +25 -27
- package/resources/invoices.d.ts.map +1 -1
- package/resources/invoices.js +105 -38
- package/resources/invoices.js.map +1 -1
- package/resources/invoices.mjs +104 -36
- package/resources/invoices.mjs.map +1 -1
- package/resources/items.d.mts +163 -0
- package/resources/items.d.mts.map +1 -0
- package/resources/items.d.ts +11 -12
- package/resources/items.d.ts.map +1 -1
- package/resources/items.js +20 -15
- package/resources/items.js.map +1 -1
- package/resources/items.mjs +19 -13
- package/resources/items.mjs.map +1 -1
- package/resources/license-types.d.mts +112 -0
- package/resources/license-types.d.mts.map +1 -0
- package/resources/license-types.d.ts +9 -10
- package/resources/license-types.d.ts.map +1 -1
- package/resources/license-types.js +14 -13
- package/resources/license-types.js.map +1 -1
- package/resources/license-types.mjs +13 -11
- package/resources/license-types.mjs.map +1 -1
- package/resources/licenses/external-licenses.d.mts +127 -0
- package/resources/licenses/external-licenses.d.mts.map +1 -0
- package/resources/licenses/external-licenses.d.ts +4 -3
- package/resources/licenses/external-licenses.d.ts.map +1 -1
- package/resources/licenses/external-licenses.js +6 -2
- package/resources/licenses/external-licenses.js.map +1 -1
- package/resources/licenses/external-licenses.mjs +6 -2
- package/resources/licenses/external-licenses.mjs.map +1 -1
- package/resources/licenses/index.d.mts +4 -0
- package/resources/licenses/index.d.mts.map +1 -0
- package/resources/licenses/index.d.ts +1 -1
- package/resources/licenses/index.d.ts.map +1 -1
- package/resources/licenses/index.js +1 -2
- package/resources/licenses/index.js.map +1 -1
- package/resources/licenses/index.mjs +1 -1
- package/resources/licenses/index.mjs.map +1 -1
- package/resources/licenses/licenses.d.mts +177 -0
- package/resources/licenses/licenses.d.mts.map +1 -0
- package/resources/licenses/licenses.d.ts +12 -12
- package/resources/licenses/licenses.d.ts.map +1 -1
- package/resources/licenses/licenses.js +13 -38
- package/resources/licenses/licenses.js.map +1 -1
- package/resources/licenses/licenses.mjs +9 -11
- package/resources/licenses/licenses.mjs.map +1 -1
- package/resources/licenses/usage.d.mts +226 -0
- package/resources/licenses/usage.d.mts.map +1 -0
- package/resources/licenses/usage.d.ts +5 -5
- package/resources/licenses/usage.d.ts.map +1 -1
- package/resources/licenses/usage.js +15 -6
- package/resources/licenses/usage.js.map +1 -1
- package/resources/licenses/usage.mjs +15 -6
- package/resources/licenses/usage.mjs.map +1 -1
- package/resources/licenses.d.mts +2 -0
- package/resources/licenses.d.mts.map +1 -0
- package/resources/licenses.d.ts.map +1 -1
- package/resources/licenses.js +2 -15
- package/resources/licenses.js.map +1 -1
- package/resources/licenses.mjs.map +1 -1
- package/resources/metrics.d.mts +147 -0
- package/resources/metrics.d.mts.map +1 -0
- package/resources/metrics.d.ts +10 -11
- package/resources/metrics.d.ts.map +1 -1
- package/resources/metrics.js +19 -14
- package/resources/metrics.js.map +1 -1
- package/resources/metrics.mjs +18 -12
- package/resources/metrics.mjs.map +1 -1
- package/resources/plans/external-plan-id.d.mts +61 -0
- package/resources/plans/external-plan-id.d.mts.map +1 -0
- package/resources/plans/external-plan-id.d.ts +5 -4
- package/resources/plans/external-plan-id.d.ts.map +1 -1
- package/resources/plans/external-plan-id.js +4 -3
- package/resources/plans/external-plan-id.js.map +1 -1
- package/resources/plans/external-plan-id.mjs +4 -3
- package/resources/plans/external-plan-id.mjs.map +1 -1
- package/resources/plans/index.d.mts +4 -0
- package/resources/plans/index.d.mts.map +1 -0
- package/resources/plans/index.d.ts +2 -2
- package/resources/plans/index.d.ts.map +1 -1
- package/resources/plans/index.js +1 -3
- package/resources/plans/index.js.map +1 -1
- package/resources/plans/index.mjs +2 -2
- package/resources/plans/index.mjs.map +1 -1
- package/resources/plans/migrations.d.mts +99 -0
- package/resources/plans/migrations.d.mts.map +1 -0
- package/resources/plans/migrations.d.ts +15 -10
- package/resources/plans/migrations.d.ts.map +1 -1
- package/resources/plans/migrations.js +17 -16
- package/resources/plans/migrations.js.map +1 -1
- package/resources/plans/migrations.mjs +16 -14
- package/resources/plans/migrations.mjs.map +1 -1
- package/resources/plans/plans.d.mts +1682 -0
- package/resources/plans/plans.d.mts.map +1 -0
- package/resources/plans/plans.d.ts +13 -14
- package/resources/plans/plans.d.ts.map +1 -1
- package/resources/plans/plans.js +18 -41
- package/resources/plans/plans.js.map +1 -1
- package/resources/plans/plans.mjs +15 -15
- package/resources/plans/plans.mjs.map +1 -1
- package/resources/plans.d.mts +2 -0
- package/resources/plans.d.mts.map +1 -0
- package/resources/plans.d.ts.map +1 -1
- package/resources/plans.js +2 -15
- package/resources/plans.js.map +1 -1
- package/resources/plans.mjs.map +1 -1
- package/resources/prices/external-price-id.d.mts +55 -0
- package/resources/prices/external-price-id.d.mts.map +1 -0
- package/resources/prices/external-price-id.d.ts +7 -6
- package/resources/prices/external-price-id.d.ts.map +1 -1
- package/resources/prices/external-price-id.js +6 -5
- package/resources/prices/external-price-id.js.map +1 -1
- package/resources/prices/external-price-id.mjs +6 -5
- package/resources/prices/external-price-id.mjs.map +1 -1
- package/resources/prices/index.d.mts +3 -0
- package/resources/prices/index.d.mts.map +1 -0
- package/resources/prices/index.d.ts.map +1 -1
- package/resources/prices/index.mjs.map +1 -1
- package/resources/prices/prices.d.mts +5950 -0
- package/resources/prices/prices.d.mts.map +1 -0
- package/resources/prices/prices.d.ts +13 -13
- package/resources/prices/prices.d.ts.map +1 -1
- package/resources/prices/prices.js +23 -37
- package/resources/prices/prices.js.map +1 -1
- package/resources/prices/prices.mjs +20 -12
- package/resources/prices/prices.mjs.map +1 -1
- package/resources/prices.d.mts +2 -0
- package/resources/prices.d.mts.map +1 -0
- package/resources/prices.d.ts.map +1 -1
- package/resources/prices.js +2 -15
- package/resources/prices.js.map +1 -1
- package/resources/prices.mjs.map +1 -1
- package/resources/shared.d.mts +13354 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/shared.d.ts +4 -7
- package/resources/shared.d.ts.map +1 -1
- package/resources/shared.js +0 -11
- package/resources/shared.js.map +1 -1
- package/resources/shared.mjs +1 -7
- package/resources/shared.mjs.map +1 -1
- package/resources/subscription-changes.d.mts +434 -0
- package/resources/subscription-changes.d.mts.map +1 -0
- package/resources/subscription-changes.d.ts +10 -12
- package/resources/subscription-changes.d.ts.map +1 -1
- package/resources/subscription-changes.js +18 -18
- package/resources/subscription-changes.js.map +1 -1
- package/resources/subscription-changes.mjs +17 -16
- package/resources/subscription-changes.mjs.map +1 -1
- package/resources/subscriptions.d.mts +10821 -0
- package/resources/subscriptions.d.mts.map +1 -0
- package/resources/subscriptions.d.ts +24 -29
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/subscriptions.js +284 -40
- package/resources/subscriptions.js.map +1 -1
- package/resources/subscriptions.mjs +283 -37
- package/resources/subscriptions.mjs.map +1 -1
- package/resources/top-level.d.mts +21 -0
- package/resources/top-level.d.mts.map +1 -0
- package/resources/top-level.d.ts +4 -3
- package/resources/top-level.d.ts.map +1 -1
- package/resources/top-level.js +1 -1
- package/resources/top-level.js.map +1 -1
- package/resources/top-level.mjs +1 -1
- package/resources/top-level.mjs.map +1 -1
- package/resources/webhooks.d.mts +24 -0
- package/resources/webhooks.d.mts.map +1 -0
- package/resources/webhooks.d.ts +2 -2
- package/resources/webhooks.d.ts.map +1 -1
- package/resources/webhooks.js +18 -5
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs +16 -3
- package/resources/webhooks.mjs.map +1 -1
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts.map +1 -1
- package/resources.js +2 -15
- package/resources.js.map +1 -1
- package/resources.mjs.map +1 -1
- package/src/api-promise.ts +2 -0
- package/src/client.ts +1499 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +92 -0
- package/src/core/error.ts +456 -0
- package/src/core/pagination.ts +167 -0
- package/src/core/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -456
- package/src/index.ts +6 -923
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +97 -0
- package/src/internal/parse.ts +56 -0
- package/src/internal/qs/formats.ts +2 -1
- package/src/internal/qs/stringify.ts +17 -20
- package/src/internal/qs/utils.ts +14 -14
- package/src/internal/request-options.ts +91 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +93 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +128 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +9 -0
- package/src/pagination.ts +2 -70
- package/src/resource.ts +2 -11
- package/src/resources/alerts.ts +34 -62
- package/src/resources/beta/beta.ts +23 -13
- package/src/resources/beta/external-plan-id.ts +20 -12
- package/src/resources/beta/index.ts +2 -0
- package/src/resources/coupons/coupons.ts +16 -21
- package/src/resources/coupons/index.ts +7 -1
- package/src/resources/coupons/subscriptions.ts +13 -24
- package/src/resources/credit-blocks.ts +12 -12
- package/src/resources/credit-notes.ts +13 -20
- package/src/resources/customers/balance-transactions.ts +15 -28
- package/src/resources/customers/costs.ts +13 -33
- package/src/resources/customers/credits/credits.ts +26 -52
- package/src/resources/customers/credits/index.ts +8 -6
- package/src/resources/customers/credits/ledger.ts +29 -55
- package/src/resources/customers/credits/top-ups.ts +48 -61
- package/src/resources/customers/customers.ts +37 -48
- package/src/resources/customers/index.ts +4 -4
- package/src/resources/dimensional-price-groups/dimensional-price-groups.ts +19 -30
- package/src/resources/dimensional-price-groups/external-dimensional-price-group-id.ts +12 -10
- package/src/resources/dimensional-price-groups/index.ts +1 -1
- package/src/resources/events/backfills.ts +18 -27
- package/src/resources/events/events.ts +14 -15
- package/src/resources/events/index.ts +1 -1
- package/src/resources/events/volume.ts +4 -3
- package/src/resources/index.ts +29 -28
- package/src/resources/invoice-line-items.ts +5 -4
- package/src/resources/invoices.ts +53 -95
- package/src/resources/items.ts +18 -24
- package/src/resources/license-types.ts +14 -31
- package/src/resources/licenses/external-licenses.ts +10 -5
- package/src/resources/licenses/index.ts +1 -1
- package/src/resources/licenses/licenses.ts +21 -20
- package/src/resources/licenses/usage.ts +9 -20
- package/src/resources/metrics.ts +16 -29
- package/src/resources/plans/external-plan-id.ts +9 -7
- package/src/resources/plans/index.ts +4 -2
- package/src/resources/plans/migrations.ts +30 -31
- package/src/resources/plans/plans.ts +22 -24
- package/src/resources/prices/external-price-id.ts +11 -9
- package/src/resources/prices/prices.ts +23 -31
- package/src/resources/shared.ts +4 -4
- package/src/resources/subscription-changes.ts +21 -44
- package/src/resources/subscriptions.ts +66 -106
- package/src/resources/top-level.ts +4 -3
- package/src/resources/webhooks.ts +17 -3
- package/src/tsconfig.json +2 -2
- package/src/uploads.ts +2 -255
- package/src/version.ts +1 -1
- package/uploads.d.mts +3 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -74
- package/uploads.d.ts.map +1 -1
- package/uploads.js +3 -168
- package/uploads.js.map +1 -1
- package/uploads.mjs +2 -157
- package/uploads.mjs.map +1 -1
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/_shims/MultipartBody.d.ts +0 -9
- package/_shims/MultipartBody.d.ts.map +0 -1
- package/_shims/MultipartBody.js +0 -16
- package/_shims/MultipartBody.js.map +0 -1
- package/_shims/MultipartBody.mjs +0 -12
- package/_shims/MultipartBody.mjs.map +0 -1
- package/_shims/README.md +0 -46
- package/_shims/auto/runtime-bun.d.ts +0 -5
- package/_shims/auto/runtime-bun.d.ts.map +0 -1
- package/_shims/auto/runtime-bun.js +0 -21
- package/_shims/auto/runtime-bun.js.map +0 -1
- package/_shims/auto/runtime-bun.mjs +0 -2
- package/_shims/auto/runtime-bun.mjs.map +0 -1
- package/_shims/auto/runtime-node.d.ts +0 -5
- package/_shims/auto/runtime-node.d.ts.map +0 -1
- package/_shims/auto/runtime-node.js +0 -21
- package/_shims/auto/runtime-node.js.map +0 -1
- package/_shims/auto/runtime-node.mjs +0 -2
- package/_shims/auto/runtime-node.mjs.map +0 -1
- package/_shims/auto/runtime.d.ts +0 -5
- package/_shims/auto/runtime.d.ts.map +0 -1
- package/_shims/auto/runtime.js +0 -21
- package/_shims/auto/runtime.js.map +0 -1
- package/_shims/auto/runtime.mjs +0 -2
- package/_shims/auto/runtime.mjs.map +0 -1
- package/_shims/auto/types-node.d.ts +0 -5
- package/_shims/auto/types-node.d.ts.map +0 -1
- package/_shims/auto/types-node.js +0 -21
- package/_shims/auto/types-node.js.map +0 -1
- package/_shims/auto/types-node.mjs +0 -2
- package/_shims/auto/types-node.mjs.map +0 -1
- package/_shims/auto/types.d.ts +0 -101
- package/_shims/auto/types.js +0 -3
- package/_shims/auto/types.mjs +0 -3
- package/_shims/bun-runtime.d.ts +0 -6
- package/_shims/bun-runtime.d.ts.map +0 -1
- package/_shims/bun-runtime.js +0 -14
- package/_shims/bun-runtime.js.map +0 -1
- package/_shims/bun-runtime.mjs +0 -10
- package/_shims/bun-runtime.mjs.map +0 -1
- package/_shims/index.d.ts +0 -83
- package/_shims/index.js +0 -17
- package/_shims/index.mjs +0 -11
- package/_shims/manual-types.d.ts +0 -12
- package/_shims/manual-types.js +0 -3
- package/_shims/manual-types.mjs +0 -3
- package/_shims/node-runtime.d.ts +0 -3
- package/_shims/node-runtime.d.ts.map +0 -1
- package/_shims/node-runtime.js +0 -89
- package/_shims/node-runtime.js.map +0 -1
- package/_shims/node-runtime.mjs +0 -56
- package/_shims/node-runtime.mjs.map +0 -1
- package/_shims/node-types.d.ts +0 -42
- package/_shims/node-types.js +0 -3
- package/_shims/node-types.mjs +0 -3
- package/_shims/registry.d.ts +0 -37
- package/_shims/registry.d.ts.map +0 -1
- package/_shims/registry.js +0 -41
- package/_shims/registry.js.map +0 -1
- package/_shims/registry.mjs +0 -37
- package/_shims/registry.mjs.map +0 -1
- package/_shims/web-runtime.d.ts +0 -5
- package/_shims/web-runtime.d.ts.map +0 -1
- package/_shims/web-runtime.js +0 -78
- package/_shims/web-runtime.js.map +0 -1
- package/_shims/web-runtime.mjs +0 -71
- package/_shims/web-runtime.mjs.map +0 -1
- package/_shims/web-types.d.ts +0 -83
- package/_shims/web-types.js +0 -3
- package/_shims/web-types.mjs +0 -3
- package/core.d.ts +0 -255
- package/core.d.ts.map +0 -1
- package/core.js +0 -920
- package/core.js.map +0 -1
- package/core.mjs +0 -888
- package/core.mjs.map +0 -1
- package/shims/node.d.ts +0 -30
- package/shims/node.d.ts.map +0 -1
- package/shims/node.js +0 -31
- package/shims/node.js.map +0 -1
- package/shims/node.mjs +0 -5
- package/shims/node.mjs.map +0 -1
- package/shims/web.d.ts +0 -26
- package/shims/web.d.ts.map +0 -1
- package/shims/web.js +0 -31
- package/shims/web.js.map +0 -1
- package/shims/web.mjs +0 -5
- package/shims/web.mjs.map +0 -1
- package/src/_shims/MultipartBody.ts +0 -9
- package/src/_shims/README.md +0 -46
- package/src/_shims/auto/runtime-bun.ts +0 -4
- package/src/_shims/auto/runtime-node.ts +0 -4
- package/src/_shims/auto/runtime.ts +0 -4
- package/src/_shims/auto/types-node.ts +0 -4
- package/src/_shims/auto/types.d.ts +0 -101
- package/src/_shims/auto/types.js +0 -3
- package/src/_shims/auto/types.mjs +0 -3
- package/src/_shims/bun-runtime.ts +0 -14
- package/src/_shims/index.d.ts +0 -83
- package/src/_shims/index.js +0 -17
- package/src/_shims/index.mjs +0 -11
- package/src/_shims/manual-types.d.ts +0 -12
- package/src/_shims/manual-types.js +0 -3
- package/src/_shims/manual-types.mjs +0 -3
- package/src/_shims/node-runtime.ts +0 -81
- package/src/_shims/node-types.d.ts +0 -42
- package/src/_shims/node-types.js +0 -3
- package/src/_shims/node-types.mjs +0 -3
- package/src/_shims/registry.ts +0 -67
- package/src/_shims/web-runtime.ts +0 -103
- package/src/_shims/web-types.d.ts +0 -83
- package/src/_shims/web-types.js +0 -3
- package/src/_shims/web-types.mjs +0 -3
- package/src/core.ts +0 -1231
- package/src/shims/node.ts +0 -50
- package/src/shims/web.ts +0 -50
package/src/client.ts
ADDED
|
@@ -0,0 +1,1499 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import type { RequestInit, RequestInfo, BodyInit } from './internal/builtin-types';
|
|
4
|
+
import type { HTTPMethod, PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from './internal/types';
|
|
5
|
+
import { uuid4 } from './internal/utils/uuid';
|
|
6
|
+
import { validatePositiveInteger, isAbsoluteURL, safeJSON } from './internal/utils/values';
|
|
7
|
+
import { sleep } from './internal/utils/sleep';
|
|
8
|
+
export type { Logger, LogLevel } from './internal/utils/log';
|
|
9
|
+
import { castToError, isAbortError } from './internal/errors';
|
|
10
|
+
import type { APIResponseProps } from './internal/parse';
|
|
11
|
+
import { getPlatformHeaders } from './internal/detect-platform';
|
|
12
|
+
import * as Shims from './internal/shims';
|
|
13
|
+
import * as Opts from './internal/request-options';
|
|
14
|
+
import { stringifyQuery } from './internal/utils/query';
|
|
15
|
+
import { VERSION } from './version';
|
|
16
|
+
import * as Errors from './core/error';
|
|
17
|
+
import * as Pagination from './core/pagination';
|
|
18
|
+
import { AbstractPage, type PageParams, PageResponse } from './core/pagination';
|
|
19
|
+
import * as Uploads from './core/uploads';
|
|
20
|
+
import * as API from './resources/index';
|
|
21
|
+
import { APIPromise } from './core/api-promise';
|
|
22
|
+
import {
|
|
23
|
+
Alert,
|
|
24
|
+
AlertCreateForCustomerParams,
|
|
25
|
+
AlertCreateForExternalCustomerParams,
|
|
26
|
+
AlertCreateForSubscriptionParams,
|
|
27
|
+
AlertDisableParams,
|
|
28
|
+
AlertEnableParams,
|
|
29
|
+
AlertListParams,
|
|
30
|
+
AlertUpdateParams,
|
|
31
|
+
Alerts,
|
|
32
|
+
AlertsPage,
|
|
33
|
+
Threshold,
|
|
34
|
+
} from './resources/alerts';
|
|
35
|
+
import {
|
|
36
|
+
CreditBlockListInvoicesResponse,
|
|
37
|
+
CreditBlockRetrieveResponse,
|
|
38
|
+
CreditBlocks,
|
|
39
|
+
} from './resources/credit-blocks';
|
|
40
|
+
import { CreditNoteCreateParams, CreditNoteListParams, CreditNotes } from './resources/credit-notes';
|
|
41
|
+
import {
|
|
42
|
+
InvoiceLineItemCreateParams,
|
|
43
|
+
InvoiceLineItemCreateResponse,
|
|
44
|
+
InvoiceLineItems,
|
|
45
|
+
} from './resources/invoice-line-items';
|
|
46
|
+
import {
|
|
47
|
+
InvoiceCreateParams,
|
|
48
|
+
InvoiceDeleteLineItemParams,
|
|
49
|
+
InvoiceFetchUpcomingParams,
|
|
50
|
+
InvoiceFetchUpcomingResponse,
|
|
51
|
+
InvoiceIssueParams,
|
|
52
|
+
InvoiceIssueSummaryParams,
|
|
53
|
+
InvoiceIssueSummaryResponse,
|
|
54
|
+
InvoiceListParams,
|
|
55
|
+
InvoiceListSummaryParams,
|
|
56
|
+
InvoiceListSummaryResponse,
|
|
57
|
+
InvoiceListSummaryResponsesPage,
|
|
58
|
+
InvoiceMarkPaidParams,
|
|
59
|
+
InvoicePayParams,
|
|
60
|
+
InvoiceUpdateParams,
|
|
61
|
+
Invoices,
|
|
62
|
+
} from './resources/invoices';
|
|
63
|
+
import {
|
|
64
|
+
Item,
|
|
65
|
+
ItemCreateParams,
|
|
66
|
+
ItemListParams,
|
|
67
|
+
ItemUpdateParams,
|
|
68
|
+
Items,
|
|
69
|
+
ItemsPage,
|
|
70
|
+
} from './resources/items';
|
|
71
|
+
import {
|
|
72
|
+
LicenseTypeCreateParams,
|
|
73
|
+
LicenseTypeCreateResponse,
|
|
74
|
+
LicenseTypeListParams,
|
|
75
|
+
LicenseTypeListResponse,
|
|
76
|
+
LicenseTypeListResponsesPage,
|
|
77
|
+
LicenseTypeRetrieveResponse,
|
|
78
|
+
LicenseTypes,
|
|
79
|
+
} from './resources/license-types';
|
|
80
|
+
import {
|
|
81
|
+
BillableMetric,
|
|
82
|
+
BillableMetricsPage,
|
|
83
|
+
MetricCreateParams,
|
|
84
|
+
MetricListParams,
|
|
85
|
+
MetricUpdateParams,
|
|
86
|
+
Metrics,
|
|
87
|
+
} from './resources/metrics';
|
|
88
|
+
import {
|
|
89
|
+
MutatedSubscription,
|
|
90
|
+
SubscriptionChangeApplyParams,
|
|
91
|
+
SubscriptionChangeApplyResponse,
|
|
92
|
+
SubscriptionChangeCancelResponse,
|
|
93
|
+
SubscriptionChangeListParams,
|
|
94
|
+
SubscriptionChangeListResponse,
|
|
95
|
+
SubscriptionChangeListResponsesPage,
|
|
96
|
+
SubscriptionChangeRetrieveResponse,
|
|
97
|
+
SubscriptionChanges,
|
|
98
|
+
} from './resources/subscription-changes';
|
|
99
|
+
import {
|
|
100
|
+
DiscountOverride,
|
|
101
|
+
NewSubscriptionBulkPrice,
|
|
102
|
+
NewSubscriptionBulkWithProrationPrice,
|
|
103
|
+
NewSubscriptionCumulativeGroupedBulkPrice,
|
|
104
|
+
NewSubscriptionGroupedAllocationPrice,
|
|
105
|
+
NewSubscriptionGroupedTieredPackagePrice,
|
|
106
|
+
NewSubscriptionGroupedTieredPrice,
|
|
107
|
+
NewSubscriptionGroupedWithMeteredMinimumPrice,
|
|
108
|
+
NewSubscriptionGroupedWithProratedMinimumPrice,
|
|
109
|
+
NewSubscriptionMatrixPrice,
|
|
110
|
+
NewSubscriptionMatrixWithAllocationPrice,
|
|
111
|
+
NewSubscriptionMatrixWithDisplayNamePrice,
|
|
112
|
+
NewSubscriptionMaxGroupTieredPackagePrice,
|
|
113
|
+
NewSubscriptionMinimumCompositePrice,
|
|
114
|
+
NewSubscriptionPackagePrice,
|
|
115
|
+
NewSubscriptionPackageWithAllocationPrice,
|
|
116
|
+
NewSubscriptionScalableMatrixWithTieredPricingPrice,
|
|
117
|
+
NewSubscriptionScalableMatrixWithUnitPricingPrice,
|
|
118
|
+
NewSubscriptionThresholdTotalAmountPrice,
|
|
119
|
+
NewSubscriptionTieredPackagePrice,
|
|
120
|
+
NewSubscriptionTieredPackageWithMinimumPrice,
|
|
121
|
+
NewSubscriptionTieredPrice,
|
|
122
|
+
NewSubscriptionTieredWithMinimumPrice,
|
|
123
|
+
NewSubscriptionUnitPrice,
|
|
124
|
+
NewSubscriptionUnitWithPercentPrice,
|
|
125
|
+
NewSubscriptionUnitWithProrationPrice,
|
|
126
|
+
Subscription,
|
|
127
|
+
SubscriptionCancelParams,
|
|
128
|
+
SubscriptionCreateParams,
|
|
129
|
+
SubscriptionFetchCostsParams,
|
|
130
|
+
SubscriptionFetchCostsResponse,
|
|
131
|
+
SubscriptionFetchScheduleParams,
|
|
132
|
+
SubscriptionFetchScheduleResponse,
|
|
133
|
+
SubscriptionFetchScheduleResponsesPage,
|
|
134
|
+
SubscriptionFetchUsageParams,
|
|
135
|
+
SubscriptionListParams,
|
|
136
|
+
SubscriptionPriceIntervalsParams,
|
|
137
|
+
SubscriptionRedeemCouponParams,
|
|
138
|
+
SubscriptionSchedulePlanChangeParams,
|
|
139
|
+
SubscriptionTriggerPhaseParams,
|
|
140
|
+
SubscriptionUnscheduleFixedFeeQuantityUpdatesParams,
|
|
141
|
+
SubscriptionUpdateFixedFeeQuantityParams,
|
|
142
|
+
SubscriptionUpdateParams,
|
|
143
|
+
SubscriptionUpdateTrialParams,
|
|
144
|
+
SubscriptionUsage,
|
|
145
|
+
Subscriptions,
|
|
146
|
+
SubscriptionsPage,
|
|
147
|
+
} from './resources/subscriptions';
|
|
148
|
+
import { TopLevel, TopLevelPingResponse } from './resources/top-level';
|
|
149
|
+
import { Webhooks } from './resources/webhooks';
|
|
150
|
+
import {
|
|
151
|
+
Beta,
|
|
152
|
+
BetaCreatePlanVersionParams,
|
|
153
|
+
BetaFetchPlanVersionParams,
|
|
154
|
+
BetaSetDefaultPlanVersionParams,
|
|
155
|
+
PlanVersion,
|
|
156
|
+
PlanVersionPhase,
|
|
157
|
+
} from './resources/beta/beta';
|
|
158
|
+
import {
|
|
159
|
+
Coupon,
|
|
160
|
+
CouponCreateParams,
|
|
161
|
+
CouponListParams,
|
|
162
|
+
Coupons,
|
|
163
|
+
CouponsPage,
|
|
164
|
+
} from './resources/coupons/coupons';
|
|
165
|
+
import {
|
|
166
|
+
AccountingProviderConfig,
|
|
167
|
+
AddressInput,
|
|
168
|
+
Customer,
|
|
169
|
+
CustomerCreateParams,
|
|
170
|
+
CustomerHierarchyConfig,
|
|
171
|
+
CustomerListParams,
|
|
172
|
+
CustomerUpdateByExternalIDParams,
|
|
173
|
+
CustomerUpdateParams,
|
|
174
|
+
Customers,
|
|
175
|
+
CustomersPage,
|
|
176
|
+
NewAccountingSyncConfiguration,
|
|
177
|
+
NewAvalaraTaxConfiguration,
|
|
178
|
+
NewReportingConfiguration,
|
|
179
|
+
NewSphereConfiguration,
|
|
180
|
+
NewTaxJarConfiguration,
|
|
181
|
+
} from './resources/customers/customers';
|
|
182
|
+
import {
|
|
183
|
+
DimensionalPriceGroup,
|
|
184
|
+
DimensionalPriceGroupCreateParams,
|
|
185
|
+
DimensionalPriceGroupListParams,
|
|
186
|
+
DimensionalPriceGroupUpdateParams,
|
|
187
|
+
DimensionalPriceGroups,
|
|
188
|
+
DimensionalPriceGroupsPage,
|
|
189
|
+
} from './resources/dimensional-price-groups/dimensional-price-groups';
|
|
190
|
+
import {
|
|
191
|
+
EventDeprecateResponse,
|
|
192
|
+
EventIngestParams,
|
|
193
|
+
EventIngestResponse,
|
|
194
|
+
EventSearchParams,
|
|
195
|
+
EventSearchResponse,
|
|
196
|
+
EventUpdateParams,
|
|
197
|
+
EventUpdateResponse,
|
|
198
|
+
Events,
|
|
199
|
+
} from './resources/events/events';
|
|
200
|
+
import {
|
|
201
|
+
LicenseCreateParams,
|
|
202
|
+
LicenseCreateResponse,
|
|
203
|
+
LicenseDeactivateParams,
|
|
204
|
+
LicenseDeactivateResponse,
|
|
205
|
+
LicenseListParams,
|
|
206
|
+
LicenseListResponse,
|
|
207
|
+
LicenseListResponsesPage,
|
|
208
|
+
LicenseRetrieveByExternalIDParams,
|
|
209
|
+
LicenseRetrieveByExternalIDResponse,
|
|
210
|
+
LicenseRetrieveResponse,
|
|
211
|
+
Licenses,
|
|
212
|
+
} from './resources/licenses/licenses';
|
|
213
|
+
import {
|
|
214
|
+
Plan,
|
|
215
|
+
PlanCreateParams,
|
|
216
|
+
PlanListParams,
|
|
217
|
+
PlanUpdateParams,
|
|
218
|
+
Plans,
|
|
219
|
+
PlansPage,
|
|
220
|
+
} from './resources/plans/plans';
|
|
221
|
+
import {
|
|
222
|
+
EvaluatePriceGroup,
|
|
223
|
+
PriceCreateParams,
|
|
224
|
+
PriceEvaluateMultipleParams,
|
|
225
|
+
PriceEvaluateMultipleResponse,
|
|
226
|
+
PriceEvaluateParams,
|
|
227
|
+
PriceEvaluatePreviewEventsParams,
|
|
228
|
+
PriceEvaluatePreviewEventsResponse,
|
|
229
|
+
PriceEvaluateResponse,
|
|
230
|
+
PriceListParams,
|
|
231
|
+
PriceUpdateParams,
|
|
232
|
+
Prices,
|
|
233
|
+
} from './resources/prices/prices';
|
|
234
|
+
import { type Fetch } from './internal/builtin-types';
|
|
235
|
+
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
236
|
+
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
|
237
|
+
import { readEnv } from './internal/utils/env';
|
|
238
|
+
import {
|
|
239
|
+
type LogLevel,
|
|
240
|
+
type Logger,
|
|
241
|
+
formatRequestDetails,
|
|
242
|
+
loggerFor,
|
|
243
|
+
parseLogLevel,
|
|
244
|
+
} from './internal/utils/log';
|
|
245
|
+
import { isEmptyObj } from './internal/utils/values';
|
|
246
|
+
|
|
247
|
+
export interface ClientOptions {
|
|
248
|
+
/**
|
|
249
|
+
* Defaults to process.env['ORB_API_KEY'].
|
|
250
|
+
*/
|
|
251
|
+
apiKey?: string | undefined;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Defaults to process.env['ORB_WEBHOOK_SECRET'].
|
|
255
|
+
*/
|
|
256
|
+
webhookSecret?: string | null | undefined;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
260
|
+
*
|
|
261
|
+
* Defaults to process.env['ORB_BASE_URL'].
|
|
262
|
+
*/
|
|
263
|
+
baseURL?: string | null | undefined;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* The maximum amount of time (in milliseconds) that the client should wait for a response
|
|
267
|
+
* from the server before timing out a single request.
|
|
268
|
+
*
|
|
269
|
+
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
270
|
+
* much longer than this timeout before the promise succeeds or fails.
|
|
271
|
+
*
|
|
272
|
+
* @unit milliseconds
|
|
273
|
+
*/
|
|
274
|
+
timeout?: number | undefined;
|
|
275
|
+
/**
|
|
276
|
+
* Additional `RequestInit` options to be passed to `fetch` calls.
|
|
277
|
+
* Properties will be overridden by per-request `fetchOptions`.
|
|
278
|
+
*/
|
|
279
|
+
fetchOptions?: MergedRequestInit | undefined;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Specify a custom `fetch` function implementation.
|
|
283
|
+
*
|
|
284
|
+
* If not provided, we expect that `fetch` is defined globally.
|
|
285
|
+
*/
|
|
286
|
+
fetch?: Fetch | undefined;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* The maximum number of times that the client will retry a request in case of a
|
|
290
|
+
* temporary failure, like a network error or a 5XX error from the server.
|
|
291
|
+
*
|
|
292
|
+
* @default 2
|
|
293
|
+
*/
|
|
294
|
+
maxRetries?: number | undefined;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Default headers to include with every request to the API.
|
|
298
|
+
*
|
|
299
|
+
* These can be removed in individual requests by explicitly setting the
|
|
300
|
+
* header to `null` in request options.
|
|
301
|
+
*/
|
|
302
|
+
defaultHeaders?: HeadersLike | undefined;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Default query parameters to include with every request to the API.
|
|
306
|
+
*
|
|
307
|
+
* These can be removed in individual requests by explicitly setting the
|
|
308
|
+
* param to `undefined` in request options.
|
|
309
|
+
*/
|
|
310
|
+
defaultQuery?: Record<string, string | undefined> | undefined;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Set the log level.
|
|
314
|
+
*
|
|
315
|
+
* Defaults to process.env['ORB_LOG'] or 'warn' if it isn't set.
|
|
316
|
+
*/
|
|
317
|
+
logLevel?: LogLevel | undefined;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Set the logger.
|
|
321
|
+
*
|
|
322
|
+
* Defaults to globalThis.console.
|
|
323
|
+
*/
|
|
324
|
+
logger?: Logger | undefined;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Base class for Orb API clients.
|
|
329
|
+
*/
|
|
330
|
+
export class BaseOrb {
|
|
331
|
+
apiKey: string;
|
|
332
|
+
webhookSecret: string | null;
|
|
333
|
+
|
|
334
|
+
baseURL: string;
|
|
335
|
+
maxRetries: number;
|
|
336
|
+
timeout: number;
|
|
337
|
+
logger: Logger;
|
|
338
|
+
logLevel: LogLevel | undefined;
|
|
339
|
+
fetchOptions: MergedRequestInit | undefined;
|
|
340
|
+
|
|
341
|
+
private fetch: Fetch;
|
|
342
|
+
#encoder: Opts.RequestEncoder;
|
|
343
|
+
protected idempotencyHeader?: string;
|
|
344
|
+
private _options: ClientOptions;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* API Client for interfacing with the Orb API.
|
|
348
|
+
*
|
|
349
|
+
* @param {string | undefined} [opts.apiKey=process.env['ORB_API_KEY'] ?? undefined]
|
|
350
|
+
* @param {string | null | undefined} [opts.webhookSecret=process.env['ORB_WEBHOOK_SECRET'] ?? null]
|
|
351
|
+
* @param {string} [opts.baseURL=process.env['ORB_BASE_URL'] ?? https://api.withorb.com/v1] - Override the default base URL for the API.
|
|
352
|
+
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
353
|
+
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
354
|
+
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
355
|
+
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
356
|
+
* @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
357
|
+
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
358
|
+
*/
|
|
359
|
+
constructor({
|
|
360
|
+
baseURL = readEnv('ORB_BASE_URL'),
|
|
361
|
+
apiKey = readEnv('ORB_API_KEY'),
|
|
362
|
+
webhookSecret = readEnv('ORB_WEBHOOK_SECRET') ?? null,
|
|
363
|
+
...opts
|
|
364
|
+
}: ClientOptions = {}) {
|
|
365
|
+
if (apiKey === undefined) {
|
|
366
|
+
throw new Errors.OrbError(
|
|
367
|
+
"The ORB_API_KEY environment variable is missing or empty; either provide it, or instantiate the Orb client with an apiKey option, like new Orb({ apiKey: 'My API Key' }).",
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const options: ClientOptions = {
|
|
372
|
+
apiKey,
|
|
373
|
+
webhookSecret,
|
|
374
|
+
...opts,
|
|
375
|
+
baseURL: baseURL || `https://api.withorb.com/v1`,
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
this.baseURL = options.baseURL!;
|
|
379
|
+
this.timeout = options.timeout ?? BaseOrb.DEFAULT_TIMEOUT /* 1 minute */;
|
|
380
|
+
this.logger = options.logger ?? console;
|
|
381
|
+
const defaultLogLevel = 'warn';
|
|
382
|
+
// Set default logLevel early so that we can log a warning in parseLogLevel.
|
|
383
|
+
this.logLevel = defaultLogLevel;
|
|
384
|
+
this.logLevel =
|
|
385
|
+
parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ??
|
|
386
|
+
parseLogLevel(readEnv('ORB_LOG'), "process.env['ORB_LOG']", this) ??
|
|
387
|
+
defaultLogLevel;
|
|
388
|
+
this.fetchOptions = options.fetchOptions;
|
|
389
|
+
this.maxRetries = options.maxRetries ?? 2;
|
|
390
|
+
this.fetch = options.fetch ?? Shims.getDefaultFetch();
|
|
391
|
+
this.#encoder = Opts.FallbackEncoder;
|
|
392
|
+
|
|
393
|
+
const customHeadersEnv = readEnv('ORB_CUSTOM_HEADERS');
|
|
394
|
+
if (customHeadersEnv) {
|
|
395
|
+
const parsed: Record<string, string> = {};
|
|
396
|
+
for (const line of customHeadersEnv.split('\n')) {
|
|
397
|
+
const colon = line.indexOf(':');
|
|
398
|
+
if (colon >= 0) {
|
|
399
|
+
parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
this._options = options;
|
|
406
|
+
this.idempotencyHeader = 'Idempotency-Key';
|
|
407
|
+
|
|
408
|
+
this.apiKey = apiKey;
|
|
409
|
+
this.webhookSecret = webhookSecret;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Create a new client instance re-using the same options given to the current client with optional overriding.
|
|
414
|
+
*/
|
|
415
|
+
withOptions(options: Partial<ClientOptions>): this {
|
|
416
|
+
const client = new (this.constructor as any as new (props: ClientOptions) => typeof this)({
|
|
417
|
+
...this._options,
|
|
418
|
+
baseURL: this.baseURL,
|
|
419
|
+
maxRetries: this.maxRetries,
|
|
420
|
+
timeout: this.timeout,
|
|
421
|
+
logger: this.logger,
|
|
422
|
+
logLevel: this.logLevel,
|
|
423
|
+
fetch: this.fetch,
|
|
424
|
+
fetchOptions: this.fetchOptions,
|
|
425
|
+
apiKey: this.apiKey,
|
|
426
|
+
webhookSecret: this.webhookSecret,
|
|
427
|
+
...options,
|
|
428
|
+
});
|
|
429
|
+
return client;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Check whether the base URL is set to its default.
|
|
434
|
+
*/
|
|
435
|
+
#baseURLOverridden(): boolean {
|
|
436
|
+
return this.baseURL !== 'https://api.withorb.com/v1';
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
protected defaultQuery(): Record<string, string | undefined> | undefined {
|
|
440
|
+
return this._options.defaultQuery;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
protected validateHeaders({ values, nulls }: NullableHeaders) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
protected async authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
|
|
448
|
+
return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
protected stringifyQuery(query: object | Record<string, unknown>): string {
|
|
452
|
+
return stringifyQuery(query);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
private getUserAgent(): string {
|
|
456
|
+
return `${this.constructor.name}/JS ${VERSION}`;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
protected defaultIdempotencyKey(): string {
|
|
460
|
+
return `stainless-node-retry-${uuid4()}`;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
protected makeStatusError(
|
|
464
|
+
status: number,
|
|
465
|
+
error: Object,
|
|
466
|
+
message: string | undefined,
|
|
467
|
+
headers: Headers,
|
|
468
|
+
): Errors.APIError {
|
|
469
|
+
return Errors.APIError.generate(status, error, message, headers);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
buildURL(
|
|
473
|
+
path: string,
|
|
474
|
+
query: Record<string, unknown> | null | undefined,
|
|
475
|
+
defaultBaseURL?: string | undefined,
|
|
476
|
+
): string {
|
|
477
|
+
const baseURL = (!this.#baseURLOverridden() && defaultBaseURL) || this.baseURL;
|
|
478
|
+
const url =
|
|
479
|
+
isAbsoluteURL(path) ?
|
|
480
|
+
new URL(path)
|
|
481
|
+
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
482
|
+
|
|
483
|
+
const defaultQuery = this.defaultQuery();
|
|
484
|
+
const pathQuery = Object.fromEntries(url.searchParams);
|
|
485
|
+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
|
|
486
|
+
query = { ...pathQuery, ...defaultQuery, ...query };
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
if (typeof query === 'object' && query && !Array.isArray(query)) {
|
|
490
|
+
url.search = this.stringifyQuery(query);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
return url.toString();
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
498
|
+
*/
|
|
499
|
+
protected async prepareOptions(options: FinalRequestOptions): Promise<void> {}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Used as a callback for mutating the given `RequestInit` object.
|
|
503
|
+
*
|
|
504
|
+
* This is useful for cases where you want to add certain headers based off of
|
|
505
|
+
* the request properties, e.g. `method` or `url`.
|
|
506
|
+
*/
|
|
507
|
+
protected async prepareRequest(
|
|
508
|
+
request: RequestInit,
|
|
509
|
+
{ url, options }: { url: string; options: FinalRequestOptions },
|
|
510
|
+
): Promise<void> {}
|
|
511
|
+
|
|
512
|
+
get<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
|
|
513
|
+
return this.methodRequest('get', path, opts);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
post<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
|
|
517
|
+
return this.methodRequest('post', path, opts);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
patch<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
|
|
521
|
+
return this.methodRequest('patch', path, opts);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
put<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
|
|
525
|
+
return this.methodRequest('put', path, opts);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
delete<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
|
|
529
|
+
return this.methodRequest('delete', path, opts);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
private methodRequest<Rsp>(
|
|
533
|
+
method: HTTPMethod,
|
|
534
|
+
path: string,
|
|
535
|
+
opts?: PromiseOrValue<RequestOptions>,
|
|
536
|
+
): APIPromise<Rsp> {
|
|
537
|
+
return this.request(
|
|
538
|
+
Promise.resolve(opts).then((opts) => {
|
|
539
|
+
return { method, path, ...opts };
|
|
540
|
+
}),
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
request<Rsp>(
|
|
545
|
+
options: PromiseOrValue<FinalRequestOptions>,
|
|
546
|
+
remainingRetries: number | null = null,
|
|
547
|
+
): APIPromise<Rsp> {
|
|
548
|
+
return new APIPromise(this, this.makeRequest(options, remainingRetries, undefined));
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
private async makeRequest(
|
|
552
|
+
optionsInput: PromiseOrValue<FinalRequestOptions>,
|
|
553
|
+
retriesRemaining: number | null,
|
|
554
|
+
retryOfRequestLogID: string | undefined,
|
|
555
|
+
): Promise<APIResponseProps> {
|
|
556
|
+
const options = await optionsInput;
|
|
557
|
+
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
558
|
+
if (retriesRemaining == null) {
|
|
559
|
+
retriesRemaining = maxRetries;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
await this.prepareOptions(options);
|
|
563
|
+
|
|
564
|
+
const { req, url, timeout } = await this.buildRequest(options, {
|
|
565
|
+
retryCount: maxRetries - retriesRemaining,
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
await this.prepareRequest(req, { url, options });
|
|
569
|
+
|
|
570
|
+
/** Not an API request ID, just for correlating local log entries. */
|
|
571
|
+
const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0');
|
|
572
|
+
const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`;
|
|
573
|
+
const startTime = Date.now();
|
|
574
|
+
|
|
575
|
+
loggerFor(this).debug(
|
|
576
|
+
`[${requestLogID}] sending request`,
|
|
577
|
+
formatRequestDetails({
|
|
578
|
+
retryOfRequestLogID,
|
|
579
|
+
method: options.method,
|
|
580
|
+
url,
|
|
581
|
+
options,
|
|
582
|
+
headers: req.headers,
|
|
583
|
+
}),
|
|
584
|
+
);
|
|
585
|
+
|
|
586
|
+
if (options.signal?.aborted) {
|
|
587
|
+
throw new Errors.APIUserAbortError();
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
const controller = new AbortController();
|
|
591
|
+
const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
|
|
592
|
+
const headersTime = Date.now();
|
|
593
|
+
|
|
594
|
+
if (response instanceof globalThis.Error) {
|
|
595
|
+
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
596
|
+
if (options.signal?.aborted) {
|
|
597
|
+
throw new Errors.APIUserAbortError();
|
|
598
|
+
}
|
|
599
|
+
// detect native connection timeout errors
|
|
600
|
+
// deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)"
|
|
601
|
+
// undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)"
|
|
602
|
+
// others do not provide enough information to distinguish timeouts from other connection errors
|
|
603
|
+
const isTimeout =
|
|
604
|
+
isAbortError(response) ||
|
|
605
|
+
/timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''));
|
|
606
|
+
if (retriesRemaining) {
|
|
607
|
+
loggerFor(this).info(
|
|
608
|
+
`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`,
|
|
609
|
+
);
|
|
610
|
+
loggerFor(this).debug(
|
|
611
|
+
`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`,
|
|
612
|
+
formatRequestDetails({
|
|
613
|
+
retryOfRequestLogID,
|
|
614
|
+
url,
|
|
615
|
+
durationMs: headersTime - startTime,
|
|
616
|
+
message: response.message,
|
|
617
|
+
}),
|
|
618
|
+
);
|
|
619
|
+
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID);
|
|
620
|
+
}
|
|
621
|
+
loggerFor(this).info(
|
|
622
|
+
`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`,
|
|
623
|
+
);
|
|
624
|
+
loggerFor(this).debug(
|
|
625
|
+
`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`,
|
|
626
|
+
formatRequestDetails({
|
|
627
|
+
retryOfRequestLogID,
|
|
628
|
+
url,
|
|
629
|
+
durationMs: headersTime - startTime,
|
|
630
|
+
message: response.message,
|
|
631
|
+
}),
|
|
632
|
+
);
|
|
633
|
+
if (isTimeout) {
|
|
634
|
+
throw new Errors.APIConnectionTimeoutError();
|
|
635
|
+
}
|
|
636
|
+
throw new Errors.APIConnectionError({ cause: response });
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${
|
|
640
|
+
response.ok ? 'succeeded' : 'failed'
|
|
641
|
+
} with status ${response.status} in ${headersTime - startTime}ms`;
|
|
642
|
+
|
|
643
|
+
if (!response.ok) {
|
|
644
|
+
const shouldRetry = await this.shouldRetry(response);
|
|
645
|
+
if (retriesRemaining && shouldRetry) {
|
|
646
|
+
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
647
|
+
|
|
648
|
+
// We don't need the body of this response.
|
|
649
|
+
await Shims.CancelReadableStream(response.body);
|
|
650
|
+
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
|
|
651
|
+
loggerFor(this).debug(
|
|
652
|
+
`[${requestLogID}] response error (${retryMessage})`,
|
|
653
|
+
formatRequestDetails({
|
|
654
|
+
retryOfRequestLogID,
|
|
655
|
+
url: response.url,
|
|
656
|
+
status: response.status,
|
|
657
|
+
headers: response.headers,
|
|
658
|
+
durationMs: headersTime - startTime,
|
|
659
|
+
}),
|
|
660
|
+
);
|
|
661
|
+
return this.retryRequest(
|
|
662
|
+
options,
|
|
663
|
+
retriesRemaining,
|
|
664
|
+
retryOfRequestLogID ?? requestLogID,
|
|
665
|
+
response.headers,
|
|
666
|
+
);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`;
|
|
670
|
+
|
|
671
|
+
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
|
|
672
|
+
|
|
673
|
+
const errText = await response.text().catch((err: any) => castToError(err).message);
|
|
674
|
+
const errJSON = safeJSON(errText) as any;
|
|
675
|
+
const errMessage = errJSON ? undefined : errText;
|
|
676
|
+
|
|
677
|
+
loggerFor(this).debug(
|
|
678
|
+
`[${requestLogID}] response error (${retryMessage})`,
|
|
679
|
+
formatRequestDetails({
|
|
680
|
+
retryOfRequestLogID,
|
|
681
|
+
url: response.url,
|
|
682
|
+
status: response.status,
|
|
683
|
+
headers: response.headers,
|
|
684
|
+
message: errMessage,
|
|
685
|
+
durationMs: Date.now() - startTime,
|
|
686
|
+
}),
|
|
687
|
+
);
|
|
688
|
+
|
|
689
|
+
const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers);
|
|
690
|
+
throw err;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
loggerFor(this).info(responseInfo);
|
|
694
|
+
loggerFor(this).debug(
|
|
695
|
+
`[${requestLogID}] response start`,
|
|
696
|
+
formatRequestDetails({
|
|
697
|
+
retryOfRequestLogID,
|
|
698
|
+
url: response.url,
|
|
699
|
+
status: response.status,
|
|
700
|
+
headers: response.headers,
|
|
701
|
+
durationMs: headersTime - startTime,
|
|
702
|
+
}),
|
|
703
|
+
);
|
|
704
|
+
|
|
705
|
+
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
|
|
709
|
+
path: string,
|
|
710
|
+
Page: new (...args: any[]) => PageClass,
|
|
711
|
+
opts?: PromiseOrValue<RequestOptions>,
|
|
712
|
+
): Pagination.PagePromise<PageClass, Item> {
|
|
713
|
+
return this.requestAPIList(
|
|
714
|
+
Page,
|
|
715
|
+
opts && 'then' in opts ?
|
|
716
|
+
opts.then((opts) => ({ method: 'get', path, ...opts }))
|
|
717
|
+
: { method: 'get', path, ...opts },
|
|
718
|
+
);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
requestAPIList<
|
|
722
|
+
Item = unknown,
|
|
723
|
+
PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
|
|
724
|
+
>(
|
|
725
|
+
Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
|
|
726
|
+
options: PromiseOrValue<FinalRequestOptions>,
|
|
727
|
+
): Pagination.PagePromise<PageClass, Item> {
|
|
728
|
+
const request = this.makeRequest(options, null, undefined);
|
|
729
|
+
return new Pagination.PagePromise<PageClass, Item>(this as any as Orb, request, Page);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
async fetchWithTimeout(
|
|
733
|
+
url: RequestInfo,
|
|
734
|
+
init: RequestInit | undefined,
|
|
735
|
+
ms: number,
|
|
736
|
+
controller: AbortController,
|
|
737
|
+
): Promise<Response> {
|
|
738
|
+
const { signal, method, ...options } = init || {};
|
|
739
|
+
const abort = this._makeAbort(controller);
|
|
740
|
+
if (signal) signal.addEventListener('abort', abort, { once: true });
|
|
741
|
+
|
|
742
|
+
const timeout = setTimeout(abort, ms);
|
|
743
|
+
|
|
744
|
+
const isReadableBody =
|
|
745
|
+
((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
|
|
746
|
+
(typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
|
|
747
|
+
|
|
748
|
+
const fetchOptions: RequestInit = {
|
|
749
|
+
signal: controller.signal as any,
|
|
750
|
+
...(isReadableBody ? { duplex: 'half' } : {}),
|
|
751
|
+
method: 'GET',
|
|
752
|
+
...options,
|
|
753
|
+
};
|
|
754
|
+
if (method) {
|
|
755
|
+
// Custom methods like 'patch' need to be uppercased
|
|
756
|
+
// See https://github.com/nodejs/undici/issues/2294
|
|
757
|
+
fetchOptions.method = method.toUpperCase();
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
try {
|
|
761
|
+
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
|
|
762
|
+
return await this.fetch.call(undefined, url, fetchOptions);
|
|
763
|
+
} finally {
|
|
764
|
+
clearTimeout(timeout);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
private async shouldRetry(response: Response): Promise<boolean> {
|
|
769
|
+
// Note this is not a standard header.
|
|
770
|
+
const shouldRetryHeader = response.headers.get('x-should-retry');
|
|
771
|
+
|
|
772
|
+
// If the server explicitly says whether or not to retry, obey.
|
|
773
|
+
if (shouldRetryHeader === 'true') return true;
|
|
774
|
+
if (shouldRetryHeader === 'false') return false;
|
|
775
|
+
|
|
776
|
+
// Retry on request timeouts.
|
|
777
|
+
if (response.status === 408) return true;
|
|
778
|
+
|
|
779
|
+
// Retry on lock timeouts.
|
|
780
|
+
if (response.status === 409) return true;
|
|
781
|
+
|
|
782
|
+
// Retry on rate limits.
|
|
783
|
+
if (response.status === 429) return true;
|
|
784
|
+
|
|
785
|
+
// Retry internal errors.
|
|
786
|
+
if (response.status >= 500) return true;
|
|
787
|
+
|
|
788
|
+
return false;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
private async retryRequest(
|
|
792
|
+
options: FinalRequestOptions,
|
|
793
|
+
retriesRemaining: number,
|
|
794
|
+
requestLogID: string,
|
|
795
|
+
responseHeaders?: Headers | undefined,
|
|
796
|
+
): Promise<APIResponseProps> {
|
|
797
|
+
let timeoutMillis: number | undefined;
|
|
798
|
+
|
|
799
|
+
// Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it.
|
|
800
|
+
const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms');
|
|
801
|
+
if (retryAfterMillisHeader) {
|
|
802
|
+
const timeoutMs = parseFloat(retryAfterMillisHeader);
|
|
803
|
+
if (!Number.isNaN(timeoutMs)) {
|
|
804
|
+
timeoutMillis = timeoutMs;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
809
|
+
const retryAfterHeader = responseHeaders?.get('retry-after');
|
|
810
|
+
if (retryAfterHeader && !timeoutMillis) {
|
|
811
|
+
const timeoutSeconds = parseFloat(retryAfterHeader);
|
|
812
|
+
if (!Number.isNaN(timeoutSeconds)) {
|
|
813
|
+
timeoutMillis = timeoutSeconds * 1000;
|
|
814
|
+
} else {
|
|
815
|
+
timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
// If the API asks us to wait a certain amount of time, just do what it
|
|
820
|
+
// says, but otherwise calculate a default
|
|
821
|
+
if (timeoutMillis === undefined) {
|
|
822
|
+
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
823
|
+
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
|
|
824
|
+
}
|
|
825
|
+
await sleep(timeoutMillis);
|
|
826
|
+
|
|
827
|
+
return this.makeRequest(options, retriesRemaining - 1, requestLogID);
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
private calculateDefaultRetryTimeoutMillis(retriesRemaining: number, maxRetries: number): number {
|
|
831
|
+
const initialRetryDelay = 0.5;
|
|
832
|
+
const maxRetryDelay = 8.0;
|
|
833
|
+
|
|
834
|
+
const numRetries = maxRetries - retriesRemaining;
|
|
835
|
+
|
|
836
|
+
// Apply exponential backoff, but not more than the max.
|
|
837
|
+
const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay);
|
|
838
|
+
|
|
839
|
+
// Apply some jitter, take up to at most 25 percent of the retry time.
|
|
840
|
+
const jitter = 1 - Math.random() * 0.25;
|
|
841
|
+
|
|
842
|
+
return sleepSeconds * jitter * 1000;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
async buildRequest(
|
|
846
|
+
inputOptions: FinalRequestOptions,
|
|
847
|
+
{ retryCount = 0 }: { retryCount?: number } = {},
|
|
848
|
+
): Promise<{ req: FinalizedRequestInit; url: string; timeout: number }> {
|
|
849
|
+
const options = { ...inputOptions };
|
|
850
|
+
const { method, path, query, defaultBaseURL } = options;
|
|
851
|
+
|
|
852
|
+
const url = this.buildURL(path!, query as Record<string, unknown>, defaultBaseURL);
|
|
853
|
+
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
|
|
854
|
+
options.timeout = options.timeout ?? this.timeout;
|
|
855
|
+
const { bodyHeaders, body } = this.buildBody({ options });
|
|
856
|
+
const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
|
|
857
|
+
|
|
858
|
+
const req: FinalizedRequestInit = {
|
|
859
|
+
method,
|
|
860
|
+
headers: reqHeaders,
|
|
861
|
+
...(options.signal && { signal: options.signal }),
|
|
862
|
+
...((globalThis as any).ReadableStream &&
|
|
863
|
+
body instanceof (globalThis as any).ReadableStream && { duplex: 'half' }),
|
|
864
|
+
...(body && { body }),
|
|
865
|
+
...((this.fetchOptions as any) ?? {}),
|
|
866
|
+
...((options.fetchOptions as any) ?? {}),
|
|
867
|
+
};
|
|
868
|
+
|
|
869
|
+
return { req, url, timeout: options.timeout };
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
private async buildHeaders({
|
|
873
|
+
options,
|
|
874
|
+
method,
|
|
875
|
+
bodyHeaders,
|
|
876
|
+
retryCount,
|
|
877
|
+
}: {
|
|
878
|
+
options: FinalRequestOptions;
|
|
879
|
+
method: HTTPMethod;
|
|
880
|
+
bodyHeaders: HeadersLike;
|
|
881
|
+
retryCount: number;
|
|
882
|
+
}): Promise<Headers> {
|
|
883
|
+
let idempotencyHeaders: HeadersLike = {};
|
|
884
|
+
if (this.idempotencyHeader && method !== 'get') {
|
|
885
|
+
if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey();
|
|
886
|
+
idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
const headers = buildHeaders([
|
|
890
|
+
idempotencyHeaders,
|
|
891
|
+
{
|
|
892
|
+
Accept: 'application/json',
|
|
893
|
+
'User-Agent': this.getUserAgent(),
|
|
894
|
+
'X-Stainless-Retry-Count': String(retryCount),
|
|
895
|
+
...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
|
|
896
|
+
...getPlatformHeaders(),
|
|
897
|
+
},
|
|
898
|
+
await this.authHeaders(options),
|
|
899
|
+
this._options.defaultHeaders,
|
|
900
|
+
bodyHeaders,
|
|
901
|
+
options.headers,
|
|
902
|
+
]);
|
|
903
|
+
|
|
904
|
+
this.validateHeaders(headers);
|
|
905
|
+
|
|
906
|
+
return headers.values;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
private _makeAbort(controller: AbortController) {
|
|
910
|
+
// note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
|
|
911
|
+
// would capture all request options, and cause a memory leak.
|
|
912
|
+
return () => controller.abort();
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
private buildBody({ options }: { options: FinalRequestOptions }): {
|
|
916
|
+
bodyHeaders: HeadersLike;
|
|
917
|
+
body: BodyInit | undefined;
|
|
918
|
+
} {
|
|
919
|
+
const { body, headers: rawHeaders } = options;
|
|
920
|
+
if (!body) {
|
|
921
|
+
// A resource method always passes a `body` key when its operation defines a
|
|
922
|
+
// request body, even if the caller omitted an optional body param. Keep the
|
|
923
|
+
// content-type for those, and only elide it for operations with no body at
|
|
924
|
+
// all (e.g. GET/DELETE).
|
|
925
|
+
if (body == null && 'body' in options) {
|
|
926
|
+
return this.#encoder({ body, headers: buildHeaders([rawHeaders]) });
|
|
927
|
+
}
|
|
928
|
+
return { bodyHeaders: undefined, body: undefined };
|
|
929
|
+
}
|
|
930
|
+
const headers = buildHeaders([rawHeaders]);
|
|
931
|
+
if (
|
|
932
|
+
// Pass raw type verbatim
|
|
933
|
+
ArrayBuffer.isView(body) ||
|
|
934
|
+
body instanceof ArrayBuffer ||
|
|
935
|
+
body instanceof DataView ||
|
|
936
|
+
(typeof body === 'string' &&
|
|
937
|
+
// Preserve legacy string encoding behavior for now
|
|
938
|
+
headers.values.has('content-type')) ||
|
|
939
|
+
// `Blob` is superset of `File`
|
|
940
|
+
((globalThis as any).Blob && body instanceof (globalThis as any).Blob) ||
|
|
941
|
+
// `FormData` -> `multipart/form-data`
|
|
942
|
+
body instanceof FormData ||
|
|
943
|
+
// `URLSearchParams` -> `application/x-www-form-urlencoded`
|
|
944
|
+
body instanceof URLSearchParams ||
|
|
945
|
+
// Send chunked stream (each chunk has own `length`)
|
|
946
|
+
((globalThis as any).ReadableStream && body instanceof (globalThis as any).ReadableStream)
|
|
947
|
+
) {
|
|
948
|
+
return { bodyHeaders: undefined, body: body as BodyInit };
|
|
949
|
+
} else if (
|
|
950
|
+
typeof body === 'object' &&
|
|
951
|
+
(Symbol.asyncIterator in body ||
|
|
952
|
+
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
|
|
953
|
+
) {
|
|
954
|
+
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
|
|
955
|
+
} else if (
|
|
956
|
+
typeof body === 'object' &&
|
|
957
|
+
headers.values.get('content-type') === 'application/x-www-form-urlencoded'
|
|
958
|
+
) {
|
|
959
|
+
return {
|
|
960
|
+
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
961
|
+
body: this.stringifyQuery(body),
|
|
962
|
+
};
|
|
963
|
+
} else {
|
|
964
|
+
return this.#encoder({ body, headers });
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
static Orb = this;
|
|
969
|
+
static DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
970
|
+
|
|
971
|
+
static OrbError = Errors.OrbError;
|
|
972
|
+
static APIError = Errors.APIError;
|
|
973
|
+
static APIConnectionError = Errors.APIConnectionError;
|
|
974
|
+
static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
|
|
975
|
+
static APIUserAbortError = Errors.APIUserAbortError;
|
|
976
|
+
static URLNotFound = Errors.URLNotFound;
|
|
977
|
+
static NotFoundError = Errors.NotFoundError;
|
|
978
|
+
static ConflictError = Errors.ConflictError;
|
|
979
|
+
static RateLimitError = Errors.RateLimitError;
|
|
980
|
+
static BadRequestError = Errors.BadRequestError;
|
|
981
|
+
static RequestTooLarge = Errors.RequestTooLarge;
|
|
982
|
+
static TooManyRequests = Errors.TooManyRequests;
|
|
983
|
+
static ResourceNotFound = Errors.ResourceNotFound;
|
|
984
|
+
static ResourceConflict = Errors.ResourceConflict;
|
|
985
|
+
static ResourceTooLarge = Errors.ResourceTooLarge;
|
|
986
|
+
static AuthenticationError = Errors.AuthenticationError;
|
|
987
|
+
static InternalServerError = Errors.InternalServerError;
|
|
988
|
+
static ConstraintViolation = Errors.ConstraintViolation;
|
|
989
|
+
static FeatureNotAvailable = Errors.FeatureNotAvailable;
|
|
990
|
+
static PermissionDeniedError = Errors.PermissionDeniedError;
|
|
991
|
+
static RequestValidationError = Errors.RequestValidationError;
|
|
992
|
+
static OrbAuthenticationError = Errors.OrbAuthenticationError;
|
|
993
|
+
static OrbInternalServerError = Errors.OrbInternalServerError;
|
|
994
|
+
static UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
995
|
+
static DuplicateResourceCreation = Errors.DuplicateResourceCreation;
|
|
996
|
+
|
|
997
|
+
static toFile = Uploads.toFile;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
/**
|
|
1001
|
+
* API Client for interfacing with the Orb API.
|
|
1002
|
+
*/
|
|
1003
|
+
export class Orb extends BaseOrb {
|
|
1004
|
+
topLevel: API.TopLevel = new API.TopLevel(this);
|
|
1005
|
+
/**
|
|
1006
|
+
* The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be subscribed to by a
|
|
1007
|
+
* customer. Plans define the billing behavior of the subscription. You can see more about how to configure prices
|
|
1008
|
+
* in the [Price resource](/reference/price).
|
|
1009
|
+
*/
|
|
1010
|
+
beta: API.Beta = new API.Beta(this);
|
|
1011
|
+
/**
|
|
1012
|
+
* A coupon represents a reusable discount configuration that can be applied either as a fixed or percentage amount to an invoice or subscription. Coupons are activated using a redemption code, which applies the discount to a subscription or invoice. The duration of a coupon determines how long it remains available for use by end users.
|
|
1013
|
+
*/
|
|
1014
|
+
coupons: API.Coupons = new API.Coupons(this);
|
|
1015
|
+
/**
|
|
1016
|
+
* The [Credit Note](/invoicing/credit-notes) resource represents a credit that has been applied to a
|
|
1017
|
+
* particular invoice.
|
|
1018
|
+
*/
|
|
1019
|
+
creditNotes: API.CreditNotes = new API.CreditNotes(this);
|
|
1020
|
+
/**
|
|
1021
|
+
* A customer is a buyer of your products, and the other party to the billing relationship.
|
|
1022
|
+
*
|
|
1023
|
+
* In Orb, customers are assigned system generated identifiers automatically, but it's often desirable to have these
|
|
1024
|
+
* match existing identifiers in your system. To avoid having to denormalize Orb ID information, you can pass in an
|
|
1025
|
+
* `external_customer_id` with your own identifier. See
|
|
1026
|
+
* [Customer ID Aliases](/events-and-metrics/customer-aliases) for further information about how these
|
|
1027
|
+
* aliases work in Orb.
|
|
1028
|
+
*
|
|
1029
|
+
* In addition to having an identifier in your system, a customer may exist in a payment provider solution like
|
|
1030
|
+
* Stripe. Use the `payment_provider_id` and the `payment_provider` enum field to express this mapping.
|
|
1031
|
+
*
|
|
1032
|
+
* A customer also has a timezone (from the standard [IANA timezone database](https://www.iana.org/time-zones)), which
|
|
1033
|
+
* defaults to your account's timezone. See [Timezone localization](/essentials/timezones) for
|
|
1034
|
+
* information on what this timezone parameter influences within Orb.
|
|
1035
|
+
*/
|
|
1036
|
+
customers: API.Customers = new API.Customers(this);
|
|
1037
|
+
/**
|
|
1038
|
+
* The [Event](/core-concepts#event) resource represents a usage event that has been created for a
|
|
1039
|
+
* customer. Events are the core of Orb's usage-based billing model, and are used to calculate the usage charges for
|
|
1040
|
+
* a given billing period.
|
|
1041
|
+
*/
|
|
1042
|
+
events: API.Events = new API.Events(this);
|
|
1043
|
+
/**
|
|
1044
|
+
* An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the request for payment for
|
|
1045
|
+
* a single subscription. This includes a set of line items, which correspond to prices in the subscription's plan and
|
|
1046
|
+
* can represent fixed recurring fees or usage-based fees. They are generated at the end of a billing period, or as
|
|
1047
|
+
* the result of an action, such as a cancellation.
|
|
1048
|
+
*/
|
|
1049
|
+
invoiceLineItems: API.InvoiceLineItems = new API.InvoiceLineItems(this);
|
|
1050
|
+
/**
|
|
1051
|
+
* An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the request for payment for
|
|
1052
|
+
* a single subscription. This includes a set of line items, which correspond to prices in the subscription's plan and
|
|
1053
|
+
* can represent fixed recurring fees or usage-based fees. They are generated at the end of a billing period, or as
|
|
1054
|
+
* the result of an action, such as a cancellation.
|
|
1055
|
+
*/
|
|
1056
|
+
invoices: API.Invoices = new API.Invoices(this);
|
|
1057
|
+
/**
|
|
1058
|
+
* The Item resource represents a sellable product or good. Items are associated with all line items, billable metrics,
|
|
1059
|
+
* and prices and are used for defining external sync behavior for invoices and tax calculation purposes.
|
|
1060
|
+
*/
|
|
1061
|
+
items: API.Items = new API.Items(this);
|
|
1062
|
+
/**
|
|
1063
|
+
* The Metric resource represents a calculation of a quantity based on events.
|
|
1064
|
+
* Metrics are defined by the query that transforms raw usage events into meaningful values for your customers.
|
|
1065
|
+
*/
|
|
1066
|
+
metrics: API.Metrics = new API.Metrics(this);
|
|
1067
|
+
/**
|
|
1068
|
+
* The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be subscribed to by a
|
|
1069
|
+
* customer. Plans define the billing behavior of the subscription. You can see more about how to configure prices
|
|
1070
|
+
* in the [Price resource](/reference/price).
|
|
1071
|
+
*/
|
|
1072
|
+
plans: API.Plans = new API.Plans(this);
|
|
1073
|
+
/**
|
|
1074
|
+
* The Price resource represents a price that can be billed on a subscription, resulting in a charge on an invoice in
|
|
1075
|
+
* the form of an invoice line item. Prices take a quantity and determine an amount to bill.
|
|
1076
|
+
*
|
|
1077
|
+
* Orb supports a few different pricing models out of the box. Each of these models is serialized differently in a
|
|
1078
|
+
* given Price object. The model_type field determines the key for the configuration object that is present.
|
|
1079
|
+
*
|
|
1080
|
+
* For more on the types of prices, see [the core concepts documentation](/core-concepts#plan-and-price)
|
|
1081
|
+
*/
|
|
1082
|
+
prices: API.Prices = new API.Prices(this);
|
|
1083
|
+
subscriptions: API.Subscriptions = new API.Subscriptions(this);
|
|
1084
|
+
/**
|
|
1085
|
+
* [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending,
|
|
1086
|
+
* usage, or credit balance and trigger webhooks when a threshold is exceeded.
|
|
1087
|
+
*
|
|
1088
|
+
* Alerts created through the API can be scoped to either customers or subscriptions.
|
|
1089
|
+
*/
|
|
1090
|
+
alerts: API.Alerts = new API.Alerts(this);
|
|
1091
|
+
dimensionalPriceGroups: API.DimensionalPriceGroups = new API.DimensionalPriceGroups(this);
|
|
1092
|
+
subscriptionChanges: API.SubscriptionChanges = new API.SubscriptionChanges(this);
|
|
1093
|
+
/**
|
|
1094
|
+
* The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits within Orb.
|
|
1095
|
+
*/
|
|
1096
|
+
creditBlocks: API.CreditBlocks = new API.CreditBlocks(this);
|
|
1097
|
+
/**
|
|
1098
|
+
* The LicenseType resource represents a type of license that can be assigned to users.
|
|
1099
|
+
* License types are used during billing by grouping metrics on the configured grouping key.
|
|
1100
|
+
*/
|
|
1101
|
+
licenseTypes: API.LicenseTypes = new API.LicenseTypes(this);
|
|
1102
|
+
licenses: API.Licenses = new API.Licenses(this);
|
|
1103
|
+
webhooks: API.Webhooks = new API.Webhooks(this);
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
Orb.TopLevel = TopLevel;
|
|
1107
|
+
Orb.Beta = Beta;
|
|
1108
|
+
Orb.Coupons = Coupons;
|
|
1109
|
+
Orb.CreditNotes = CreditNotes;
|
|
1110
|
+
Orb.Customers = Customers;
|
|
1111
|
+
Orb.Events = Events;
|
|
1112
|
+
Orb.InvoiceLineItems = InvoiceLineItems;
|
|
1113
|
+
Orb.Invoices = Invoices;
|
|
1114
|
+
Orb.Items = Items;
|
|
1115
|
+
Orb.Metrics = Metrics;
|
|
1116
|
+
Orb.Plans = Plans;
|
|
1117
|
+
Orb.Prices = Prices;
|
|
1118
|
+
Orb.Alerts = Alerts;
|
|
1119
|
+
Orb.SubscriptionChanges = SubscriptionChanges;
|
|
1120
|
+
Orb.CreditBlocks = CreditBlocks;
|
|
1121
|
+
Orb.LicenseTypes = LicenseTypes;
|
|
1122
|
+
Orb.Licenses = Licenses;
|
|
1123
|
+
Orb.Webhooks = Webhooks;
|
|
1124
|
+
|
|
1125
|
+
export declare namespace Orb {
|
|
1126
|
+
export type RequestOptions = Opts.RequestOptions;
|
|
1127
|
+
|
|
1128
|
+
export import Page = Pagination.Page;
|
|
1129
|
+
export { type PageParams as PageParams, type PageResponse as PageResponse };
|
|
1130
|
+
|
|
1131
|
+
export { TopLevel as TopLevel, type TopLevelPingResponse as TopLevelPingResponse };
|
|
1132
|
+
|
|
1133
|
+
export {
|
|
1134
|
+
Beta as Beta,
|
|
1135
|
+
type PlanVersion as PlanVersion,
|
|
1136
|
+
type PlanVersionPhase as PlanVersionPhase,
|
|
1137
|
+
type BetaCreatePlanVersionParams as BetaCreatePlanVersionParams,
|
|
1138
|
+
type BetaFetchPlanVersionParams as BetaFetchPlanVersionParams,
|
|
1139
|
+
type BetaSetDefaultPlanVersionParams as BetaSetDefaultPlanVersionParams,
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
export {
|
|
1143
|
+
Coupons as Coupons,
|
|
1144
|
+
type Coupon as Coupon,
|
|
1145
|
+
type CouponsPage as CouponsPage,
|
|
1146
|
+
type CouponCreateParams as CouponCreateParams,
|
|
1147
|
+
type CouponListParams as CouponListParams,
|
|
1148
|
+
};
|
|
1149
|
+
|
|
1150
|
+
export {
|
|
1151
|
+
CreditNotes as CreditNotes,
|
|
1152
|
+
type CreditNoteCreateParams as CreditNoteCreateParams,
|
|
1153
|
+
type CreditNoteListParams as CreditNoteListParams,
|
|
1154
|
+
};
|
|
1155
|
+
|
|
1156
|
+
export {
|
|
1157
|
+
Customers as Customers,
|
|
1158
|
+
type AccountingProviderConfig as AccountingProviderConfig,
|
|
1159
|
+
type AddressInput as AddressInput,
|
|
1160
|
+
type Customer as Customer,
|
|
1161
|
+
type CustomerHierarchyConfig as CustomerHierarchyConfig,
|
|
1162
|
+
type NewAccountingSyncConfiguration as NewAccountingSyncConfiguration,
|
|
1163
|
+
type NewAvalaraTaxConfiguration as NewAvalaraTaxConfiguration,
|
|
1164
|
+
type NewReportingConfiguration as NewReportingConfiguration,
|
|
1165
|
+
type NewSphereConfiguration as NewSphereConfiguration,
|
|
1166
|
+
type NewTaxJarConfiguration as NewTaxJarConfiguration,
|
|
1167
|
+
type CustomersPage as CustomersPage,
|
|
1168
|
+
type CustomerCreateParams as CustomerCreateParams,
|
|
1169
|
+
type CustomerUpdateParams as CustomerUpdateParams,
|
|
1170
|
+
type CustomerListParams as CustomerListParams,
|
|
1171
|
+
type CustomerUpdateByExternalIDParams as CustomerUpdateByExternalIDParams,
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
export {
|
|
1175
|
+
Events as Events,
|
|
1176
|
+
type EventUpdateResponse as EventUpdateResponse,
|
|
1177
|
+
type EventDeprecateResponse as EventDeprecateResponse,
|
|
1178
|
+
type EventIngestResponse as EventIngestResponse,
|
|
1179
|
+
type EventSearchResponse as EventSearchResponse,
|
|
1180
|
+
type EventUpdateParams as EventUpdateParams,
|
|
1181
|
+
type EventIngestParams as EventIngestParams,
|
|
1182
|
+
type EventSearchParams as EventSearchParams,
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
export {
|
|
1186
|
+
InvoiceLineItems as InvoiceLineItems,
|
|
1187
|
+
type InvoiceLineItemCreateResponse as InvoiceLineItemCreateResponse,
|
|
1188
|
+
type InvoiceLineItemCreateParams as InvoiceLineItemCreateParams,
|
|
1189
|
+
};
|
|
1190
|
+
|
|
1191
|
+
export {
|
|
1192
|
+
Invoices as Invoices,
|
|
1193
|
+
type InvoiceFetchUpcomingResponse as InvoiceFetchUpcomingResponse,
|
|
1194
|
+
type InvoiceIssueSummaryResponse as InvoiceIssueSummaryResponse,
|
|
1195
|
+
type InvoiceListSummaryResponse as InvoiceListSummaryResponse,
|
|
1196
|
+
type InvoiceListSummaryResponsesPage as InvoiceListSummaryResponsesPage,
|
|
1197
|
+
type InvoiceCreateParams as InvoiceCreateParams,
|
|
1198
|
+
type InvoiceUpdateParams as InvoiceUpdateParams,
|
|
1199
|
+
type InvoiceListParams as InvoiceListParams,
|
|
1200
|
+
type InvoiceDeleteLineItemParams as InvoiceDeleteLineItemParams,
|
|
1201
|
+
type InvoiceFetchUpcomingParams as InvoiceFetchUpcomingParams,
|
|
1202
|
+
type InvoiceIssueParams as InvoiceIssueParams,
|
|
1203
|
+
type InvoiceIssueSummaryParams as InvoiceIssueSummaryParams,
|
|
1204
|
+
type InvoiceListSummaryParams as InvoiceListSummaryParams,
|
|
1205
|
+
type InvoiceMarkPaidParams as InvoiceMarkPaidParams,
|
|
1206
|
+
type InvoicePayParams as InvoicePayParams,
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1209
|
+
export {
|
|
1210
|
+
Items as Items,
|
|
1211
|
+
type Item as Item,
|
|
1212
|
+
type ItemsPage as ItemsPage,
|
|
1213
|
+
type ItemCreateParams as ItemCreateParams,
|
|
1214
|
+
type ItemUpdateParams as ItemUpdateParams,
|
|
1215
|
+
type ItemListParams as ItemListParams,
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
export {
|
|
1219
|
+
Metrics as Metrics,
|
|
1220
|
+
type BillableMetric as BillableMetric,
|
|
1221
|
+
type BillableMetricsPage as BillableMetricsPage,
|
|
1222
|
+
type MetricCreateParams as MetricCreateParams,
|
|
1223
|
+
type MetricUpdateParams as MetricUpdateParams,
|
|
1224
|
+
type MetricListParams as MetricListParams,
|
|
1225
|
+
};
|
|
1226
|
+
|
|
1227
|
+
export {
|
|
1228
|
+
Plans as Plans,
|
|
1229
|
+
type Plan as Plan,
|
|
1230
|
+
type PlansPage as PlansPage,
|
|
1231
|
+
type PlanCreateParams as PlanCreateParams,
|
|
1232
|
+
type PlanUpdateParams as PlanUpdateParams,
|
|
1233
|
+
type PlanListParams as PlanListParams,
|
|
1234
|
+
};
|
|
1235
|
+
|
|
1236
|
+
export {
|
|
1237
|
+
Prices as Prices,
|
|
1238
|
+
type EvaluatePriceGroup as EvaluatePriceGroup,
|
|
1239
|
+
type PriceEvaluateResponse as PriceEvaluateResponse,
|
|
1240
|
+
type PriceEvaluateMultipleResponse as PriceEvaluateMultipleResponse,
|
|
1241
|
+
type PriceEvaluatePreviewEventsResponse as PriceEvaluatePreviewEventsResponse,
|
|
1242
|
+
type PriceCreateParams as PriceCreateParams,
|
|
1243
|
+
type PriceUpdateParams as PriceUpdateParams,
|
|
1244
|
+
type PriceListParams as PriceListParams,
|
|
1245
|
+
type PriceEvaluateParams as PriceEvaluateParams,
|
|
1246
|
+
type PriceEvaluateMultipleParams as PriceEvaluateMultipleParams,
|
|
1247
|
+
type PriceEvaluatePreviewEventsParams as PriceEvaluatePreviewEventsParams,
|
|
1248
|
+
};
|
|
1249
|
+
|
|
1250
|
+
export {
|
|
1251
|
+
type Subscriptions as Subscriptions,
|
|
1252
|
+
type DiscountOverride as DiscountOverride,
|
|
1253
|
+
type NewSubscriptionBulkPrice as NewSubscriptionBulkPrice,
|
|
1254
|
+
type NewSubscriptionBulkWithProrationPrice as NewSubscriptionBulkWithProrationPrice,
|
|
1255
|
+
type NewSubscriptionCumulativeGroupedBulkPrice as NewSubscriptionCumulativeGroupedBulkPrice,
|
|
1256
|
+
type NewSubscriptionGroupedAllocationPrice as NewSubscriptionGroupedAllocationPrice,
|
|
1257
|
+
type NewSubscriptionGroupedTieredPackagePrice as NewSubscriptionGroupedTieredPackagePrice,
|
|
1258
|
+
type NewSubscriptionGroupedTieredPrice as NewSubscriptionGroupedTieredPrice,
|
|
1259
|
+
type NewSubscriptionGroupedWithMeteredMinimumPrice as NewSubscriptionGroupedWithMeteredMinimumPrice,
|
|
1260
|
+
type NewSubscriptionGroupedWithProratedMinimumPrice as NewSubscriptionGroupedWithProratedMinimumPrice,
|
|
1261
|
+
type NewSubscriptionMatrixPrice as NewSubscriptionMatrixPrice,
|
|
1262
|
+
type NewSubscriptionMatrixWithAllocationPrice as NewSubscriptionMatrixWithAllocationPrice,
|
|
1263
|
+
type NewSubscriptionMatrixWithDisplayNamePrice as NewSubscriptionMatrixWithDisplayNamePrice,
|
|
1264
|
+
type NewSubscriptionMaxGroupTieredPackagePrice as NewSubscriptionMaxGroupTieredPackagePrice,
|
|
1265
|
+
type NewSubscriptionMinimumCompositePrice as NewSubscriptionMinimumCompositePrice,
|
|
1266
|
+
type NewSubscriptionPackagePrice as NewSubscriptionPackagePrice,
|
|
1267
|
+
type NewSubscriptionPackageWithAllocationPrice as NewSubscriptionPackageWithAllocationPrice,
|
|
1268
|
+
type NewSubscriptionScalableMatrixWithTieredPricingPrice as NewSubscriptionScalableMatrixWithTieredPricingPrice,
|
|
1269
|
+
type NewSubscriptionScalableMatrixWithUnitPricingPrice as NewSubscriptionScalableMatrixWithUnitPricingPrice,
|
|
1270
|
+
type NewSubscriptionThresholdTotalAmountPrice as NewSubscriptionThresholdTotalAmountPrice,
|
|
1271
|
+
type NewSubscriptionTieredPackagePrice as NewSubscriptionTieredPackagePrice,
|
|
1272
|
+
type NewSubscriptionTieredPackageWithMinimumPrice as NewSubscriptionTieredPackageWithMinimumPrice,
|
|
1273
|
+
type NewSubscriptionTieredPrice as NewSubscriptionTieredPrice,
|
|
1274
|
+
type NewSubscriptionTieredWithMinimumPrice as NewSubscriptionTieredWithMinimumPrice,
|
|
1275
|
+
type NewSubscriptionUnitPrice as NewSubscriptionUnitPrice,
|
|
1276
|
+
type NewSubscriptionUnitWithPercentPrice as NewSubscriptionUnitWithPercentPrice,
|
|
1277
|
+
type NewSubscriptionUnitWithProrationPrice as NewSubscriptionUnitWithProrationPrice,
|
|
1278
|
+
type Subscription as Subscription,
|
|
1279
|
+
type SubscriptionUsage as SubscriptionUsage,
|
|
1280
|
+
type SubscriptionFetchCostsResponse as SubscriptionFetchCostsResponse,
|
|
1281
|
+
type SubscriptionFetchScheduleResponse as SubscriptionFetchScheduleResponse,
|
|
1282
|
+
type SubscriptionsPage as SubscriptionsPage,
|
|
1283
|
+
type SubscriptionFetchScheduleResponsesPage as SubscriptionFetchScheduleResponsesPage,
|
|
1284
|
+
type SubscriptionCreateParams as SubscriptionCreateParams,
|
|
1285
|
+
type SubscriptionUpdateParams as SubscriptionUpdateParams,
|
|
1286
|
+
type SubscriptionListParams as SubscriptionListParams,
|
|
1287
|
+
type SubscriptionCancelParams as SubscriptionCancelParams,
|
|
1288
|
+
type SubscriptionFetchCostsParams as SubscriptionFetchCostsParams,
|
|
1289
|
+
type SubscriptionFetchScheduleParams as SubscriptionFetchScheduleParams,
|
|
1290
|
+
type SubscriptionFetchUsageParams as SubscriptionFetchUsageParams,
|
|
1291
|
+
type SubscriptionPriceIntervalsParams as SubscriptionPriceIntervalsParams,
|
|
1292
|
+
type SubscriptionRedeemCouponParams as SubscriptionRedeemCouponParams,
|
|
1293
|
+
type SubscriptionSchedulePlanChangeParams as SubscriptionSchedulePlanChangeParams,
|
|
1294
|
+
type SubscriptionTriggerPhaseParams as SubscriptionTriggerPhaseParams,
|
|
1295
|
+
type SubscriptionUnscheduleFixedFeeQuantityUpdatesParams as SubscriptionUnscheduleFixedFeeQuantityUpdatesParams,
|
|
1296
|
+
type SubscriptionUpdateFixedFeeQuantityParams as SubscriptionUpdateFixedFeeQuantityParams,
|
|
1297
|
+
type SubscriptionUpdateTrialParams as SubscriptionUpdateTrialParams,
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1300
|
+
export {
|
|
1301
|
+
Alerts as Alerts,
|
|
1302
|
+
type Alert as Alert,
|
|
1303
|
+
type Threshold as Threshold,
|
|
1304
|
+
type AlertsPage as AlertsPage,
|
|
1305
|
+
type AlertUpdateParams as AlertUpdateParams,
|
|
1306
|
+
type AlertListParams as AlertListParams,
|
|
1307
|
+
type AlertCreateForCustomerParams as AlertCreateForCustomerParams,
|
|
1308
|
+
type AlertCreateForExternalCustomerParams as AlertCreateForExternalCustomerParams,
|
|
1309
|
+
type AlertCreateForSubscriptionParams as AlertCreateForSubscriptionParams,
|
|
1310
|
+
type AlertDisableParams as AlertDisableParams,
|
|
1311
|
+
type AlertEnableParams as AlertEnableParams,
|
|
1312
|
+
};
|
|
1313
|
+
|
|
1314
|
+
export {
|
|
1315
|
+
type DimensionalPriceGroups as DimensionalPriceGroups,
|
|
1316
|
+
type DimensionalPriceGroup as DimensionalPriceGroup,
|
|
1317
|
+
type DimensionalPriceGroupsPage as DimensionalPriceGroupsPage,
|
|
1318
|
+
type DimensionalPriceGroupCreateParams as DimensionalPriceGroupCreateParams,
|
|
1319
|
+
type DimensionalPriceGroupUpdateParams as DimensionalPriceGroupUpdateParams,
|
|
1320
|
+
type DimensionalPriceGroupListParams as DimensionalPriceGroupListParams,
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
export {
|
|
1324
|
+
SubscriptionChanges as SubscriptionChanges,
|
|
1325
|
+
type MutatedSubscription as MutatedSubscription,
|
|
1326
|
+
type SubscriptionChangeRetrieveResponse as SubscriptionChangeRetrieveResponse,
|
|
1327
|
+
type SubscriptionChangeListResponse as SubscriptionChangeListResponse,
|
|
1328
|
+
type SubscriptionChangeApplyResponse as SubscriptionChangeApplyResponse,
|
|
1329
|
+
type SubscriptionChangeCancelResponse as SubscriptionChangeCancelResponse,
|
|
1330
|
+
type SubscriptionChangeListResponsesPage as SubscriptionChangeListResponsesPage,
|
|
1331
|
+
type SubscriptionChangeListParams as SubscriptionChangeListParams,
|
|
1332
|
+
type SubscriptionChangeApplyParams as SubscriptionChangeApplyParams,
|
|
1333
|
+
};
|
|
1334
|
+
|
|
1335
|
+
export {
|
|
1336
|
+
CreditBlocks as CreditBlocks,
|
|
1337
|
+
type CreditBlockRetrieveResponse as CreditBlockRetrieveResponse,
|
|
1338
|
+
type CreditBlockListInvoicesResponse as CreditBlockListInvoicesResponse,
|
|
1339
|
+
};
|
|
1340
|
+
|
|
1341
|
+
export {
|
|
1342
|
+
LicenseTypes as LicenseTypes,
|
|
1343
|
+
type LicenseTypeCreateResponse as LicenseTypeCreateResponse,
|
|
1344
|
+
type LicenseTypeRetrieveResponse as LicenseTypeRetrieveResponse,
|
|
1345
|
+
type LicenseTypeListResponse as LicenseTypeListResponse,
|
|
1346
|
+
type LicenseTypeListResponsesPage as LicenseTypeListResponsesPage,
|
|
1347
|
+
type LicenseTypeCreateParams as LicenseTypeCreateParams,
|
|
1348
|
+
type LicenseTypeListParams as LicenseTypeListParams,
|
|
1349
|
+
};
|
|
1350
|
+
|
|
1351
|
+
export {
|
|
1352
|
+
Licenses as Licenses,
|
|
1353
|
+
type LicenseCreateResponse as LicenseCreateResponse,
|
|
1354
|
+
type LicenseRetrieveResponse as LicenseRetrieveResponse,
|
|
1355
|
+
type LicenseListResponse as LicenseListResponse,
|
|
1356
|
+
type LicenseDeactivateResponse as LicenseDeactivateResponse,
|
|
1357
|
+
type LicenseRetrieveByExternalIDResponse as LicenseRetrieveByExternalIDResponse,
|
|
1358
|
+
type LicenseListResponsesPage as LicenseListResponsesPage,
|
|
1359
|
+
type LicenseCreateParams as LicenseCreateParams,
|
|
1360
|
+
type LicenseListParams as LicenseListParams,
|
|
1361
|
+
type LicenseDeactivateParams as LicenseDeactivateParams,
|
|
1362
|
+
type LicenseRetrieveByExternalIDParams as LicenseRetrieveByExternalIDParams,
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1365
|
+
export { Webhooks as Webhooks };
|
|
1366
|
+
|
|
1367
|
+
export type Address = API.Address;
|
|
1368
|
+
export type AdjustmentInterval = API.AdjustmentInterval;
|
|
1369
|
+
export type AggregatedCost = API.AggregatedCost;
|
|
1370
|
+
export type Allocation = API.Allocation;
|
|
1371
|
+
export type AmountDiscount = API.AmountDiscount;
|
|
1372
|
+
export type AmountDiscountInterval = API.AmountDiscountInterval;
|
|
1373
|
+
export type BillableMetricTiny = API.BillableMetricTiny;
|
|
1374
|
+
export type BillingCycleAnchorConfiguration = API.BillingCycleAnchorConfiguration;
|
|
1375
|
+
export type BillingCycleConfiguration = API.BillingCycleConfiguration;
|
|
1376
|
+
export type BillingCycleRelativeDate = API.BillingCycleRelativeDate;
|
|
1377
|
+
export type BulkConfig = API.BulkConfig;
|
|
1378
|
+
export type BulkTier = API.BulkTier;
|
|
1379
|
+
export type ChangedSubscriptionResources = API.ChangedSubscriptionResources;
|
|
1380
|
+
export type ConversionRateTier = API.ConversionRateTier;
|
|
1381
|
+
export type ConversionRateTieredConfig = API.ConversionRateTieredConfig;
|
|
1382
|
+
export type ConversionRateUnitConfig = API.ConversionRateUnitConfig;
|
|
1383
|
+
export type CouponRedemption = API.CouponRedemption;
|
|
1384
|
+
export type CreditNote = API.CreditNote;
|
|
1385
|
+
export type CreditNoteTiny = API.CreditNoteTiny;
|
|
1386
|
+
export type CustomExpiration = API.CustomExpiration;
|
|
1387
|
+
export type CustomerMinified = API.CustomerMinified;
|
|
1388
|
+
export type CustomerTaxID = API.CustomerTaxID;
|
|
1389
|
+
export type DimensionalPriceConfiguration = API.DimensionalPriceConfiguration;
|
|
1390
|
+
export type Discount = API.Discount;
|
|
1391
|
+
export type FixedFeeQuantityScheduleEntry = API.FixedFeeQuantityScheduleEntry;
|
|
1392
|
+
export type FixedFeeQuantityTransition = API.FixedFeeQuantityTransition;
|
|
1393
|
+
export type Invoice = API.Invoice;
|
|
1394
|
+
export type InvoiceLevelDiscount = API.InvoiceLevelDiscount;
|
|
1395
|
+
export type InvoiceTiny = API.InvoiceTiny;
|
|
1396
|
+
export type ItemSlim = API.ItemSlim;
|
|
1397
|
+
export type MatrixConfig = API.MatrixConfig;
|
|
1398
|
+
export type MatrixSubLineItem = API.MatrixSubLineItem;
|
|
1399
|
+
export type MatrixValue = API.MatrixValue;
|
|
1400
|
+
export type MatrixWithAllocationConfig = API.MatrixWithAllocationConfig;
|
|
1401
|
+
export type Maximum = API.Maximum;
|
|
1402
|
+
export type MaximumInterval = API.MaximumInterval;
|
|
1403
|
+
export type Minimum = API.Minimum;
|
|
1404
|
+
export type MinimumInterval = API.MinimumInterval;
|
|
1405
|
+
export type MonetaryAmountDiscountAdjustment = API.MonetaryAmountDiscountAdjustment;
|
|
1406
|
+
export type MonetaryMaximumAdjustment = API.MonetaryMaximumAdjustment;
|
|
1407
|
+
export type MonetaryMinimumAdjustment = API.MonetaryMinimumAdjustment;
|
|
1408
|
+
export type MonetaryPercentageDiscountAdjustment = API.MonetaryPercentageDiscountAdjustment;
|
|
1409
|
+
export type MonetaryUsageDiscountAdjustment = API.MonetaryUsageDiscountAdjustment;
|
|
1410
|
+
export type NewAllocationPrice = API.NewAllocationPrice;
|
|
1411
|
+
export type NewAmountDiscount = API.NewAmountDiscount;
|
|
1412
|
+
export type NewBillingCycleConfiguration = API.NewBillingCycleConfiguration;
|
|
1413
|
+
export type NewDimensionalPriceConfiguration = API.NewDimensionalPriceConfiguration;
|
|
1414
|
+
export type NewFloatingBulkPrice = API.NewFloatingBulkPrice;
|
|
1415
|
+
export type NewFloatingBulkWithProrationPrice = API.NewFloatingBulkWithProrationPrice;
|
|
1416
|
+
export type NewFloatingCumulativeGroupedBulkPrice = API.NewFloatingCumulativeGroupedBulkPrice;
|
|
1417
|
+
export type NewFloatingGroupedAllocationPrice = API.NewFloatingGroupedAllocationPrice;
|
|
1418
|
+
export type NewFloatingGroupedTieredPackagePrice = API.NewFloatingGroupedTieredPackagePrice;
|
|
1419
|
+
export type NewFloatingGroupedTieredPrice = API.NewFloatingGroupedTieredPrice;
|
|
1420
|
+
export type NewFloatingGroupedWithMeteredMinimumPrice = API.NewFloatingGroupedWithMeteredMinimumPrice;
|
|
1421
|
+
export type NewFloatingGroupedWithProratedMinimumPrice = API.NewFloatingGroupedWithProratedMinimumPrice;
|
|
1422
|
+
export type NewFloatingMatrixPrice = API.NewFloatingMatrixPrice;
|
|
1423
|
+
export type NewFloatingMatrixWithAllocationPrice = API.NewFloatingMatrixWithAllocationPrice;
|
|
1424
|
+
export type NewFloatingMatrixWithDisplayNamePrice = API.NewFloatingMatrixWithDisplayNamePrice;
|
|
1425
|
+
export type NewFloatingMaxGroupTieredPackagePrice = API.NewFloatingMaxGroupTieredPackagePrice;
|
|
1426
|
+
export type NewFloatingMinimumCompositePrice = API.NewFloatingMinimumCompositePrice;
|
|
1427
|
+
export type NewFloatingPackagePrice = API.NewFloatingPackagePrice;
|
|
1428
|
+
export type NewFloatingPackageWithAllocationPrice = API.NewFloatingPackageWithAllocationPrice;
|
|
1429
|
+
export type NewFloatingScalableMatrixWithTieredPricingPrice =
|
|
1430
|
+
API.NewFloatingScalableMatrixWithTieredPricingPrice;
|
|
1431
|
+
export type NewFloatingScalableMatrixWithUnitPricingPrice =
|
|
1432
|
+
API.NewFloatingScalableMatrixWithUnitPricingPrice;
|
|
1433
|
+
export type NewFloatingThresholdTotalAmountPrice = API.NewFloatingThresholdTotalAmountPrice;
|
|
1434
|
+
export type NewFloatingTieredPackagePrice = API.NewFloatingTieredPackagePrice;
|
|
1435
|
+
export type NewFloatingTieredPackageWithMinimumPrice = API.NewFloatingTieredPackageWithMinimumPrice;
|
|
1436
|
+
export type NewFloatingTieredPrice = API.NewFloatingTieredPrice;
|
|
1437
|
+
export type NewFloatingTieredWithMinimumPrice = API.NewFloatingTieredWithMinimumPrice;
|
|
1438
|
+
export type NewFloatingTieredWithProrationPrice = API.NewFloatingTieredWithProrationPrice;
|
|
1439
|
+
export type NewFloatingUnitPrice = API.NewFloatingUnitPrice;
|
|
1440
|
+
export type NewFloatingUnitWithPercentPrice = API.NewFloatingUnitWithPercentPrice;
|
|
1441
|
+
export type NewFloatingUnitWithProrationPrice = API.NewFloatingUnitWithProrationPrice;
|
|
1442
|
+
export type NewMaximum = API.NewMaximum;
|
|
1443
|
+
export type NewMinimum = API.NewMinimum;
|
|
1444
|
+
export type NewPercentageDiscount = API.NewPercentageDiscount;
|
|
1445
|
+
export type NewPlanBulkPrice = API.NewPlanBulkPrice;
|
|
1446
|
+
export type NewPlanBulkWithProrationPrice = API.NewPlanBulkWithProrationPrice;
|
|
1447
|
+
export type NewPlanCumulativeGroupedBulkPrice = API.NewPlanCumulativeGroupedBulkPrice;
|
|
1448
|
+
export type NewPlanGroupedAllocationPrice = API.NewPlanGroupedAllocationPrice;
|
|
1449
|
+
export type NewPlanGroupedTieredPackagePrice = API.NewPlanGroupedTieredPackagePrice;
|
|
1450
|
+
export type NewPlanGroupedTieredPrice = API.NewPlanGroupedTieredPrice;
|
|
1451
|
+
export type NewPlanGroupedWithMeteredMinimumPrice = API.NewPlanGroupedWithMeteredMinimumPrice;
|
|
1452
|
+
export type NewPlanGroupedWithProratedMinimumPrice = API.NewPlanGroupedWithProratedMinimumPrice;
|
|
1453
|
+
export type NewPlanMatrixPrice = API.NewPlanMatrixPrice;
|
|
1454
|
+
export type NewPlanMatrixWithAllocationPrice = API.NewPlanMatrixWithAllocationPrice;
|
|
1455
|
+
export type NewPlanMatrixWithDisplayNamePrice = API.NewPlanMatrixWithDisplayNamePrice;
|
|
1456
|
+
export type NewPlanMaxGroupTieredPackagePrice = API.NewPlanMaxGroupTieredPackagePrice;
|
|
1457
|
+
export type NewPlanMinimumCompositePrice = API.NewPlanMinimumCompositePrice;
|
|
1458
|
+
export type NewPlanPackagePrice = API.NewPlanPackagePrice;
|
|
1459
|
+
export type NewPlanPackageWithAllocationPrice = API.NewPlanPackageWithAllocationPrice;
|
|
1460
|
+
export type NewPlanScalableMatrixWithTieredPricingPrice = API.NewPlanScalableMatrixWithTieredPricingPrice;
|
|
1461
|
+
export type NewPlanScalableMatrixWithUnitPricingPrice = API.NewPlanScalableMatrixWithUnitPricingPrice;
|
|
1462
|
+
export type NewPlanThresholdTotalAmountPrice = API.NewPlanThresholdTotalAmountPrice;
|
|
1463
|
+
export type NewPlanTieredPackagePrice = API.NewPlanTieredPackagePrice;
|
|
1464
|
+
export type NewPlanTieredPackageWithMinimumPrice = API.NewPlanTieredPackageWithMinimumPrice;
|
|
1465
|
+
export type NewPlanTieredPrice = API.NewPlanTieredPrice;
|
|
1466
|
+
export type NewPlanTieredWithMinimumPrice = API.NewPlanTieredWithMinimumPrice;
|
|
1467
|
+
export type NewPlanUnitPrice = API.NewPlanUnitPrice;
|
|
1468
|
+
export type NewPlanUnitWithPercentPrice = API.NewPlanUnitWithPercentPrice;
|
|
1469
|
+
export type NewPlanUnitWithProrationPrice = API.NewPlanUnitWithProrationPrice;
|
|
1470
|
+
export type NewUsageDiscount = API.NewUsageDiscount;
|
|
1471
|
+
export type OtherSubLineItem = API.OtherSubLineItem;
|
|
1472
|
+
export type PackageConfig = API.PackageConfig;
|
|
1473
|
+
export type PaginationMetadata = API.PaginationMetadata;
|
|
1474
|
+
export type PerPriceCost = API.PerPriceCost;
|
|
1475
|
+
export type PercentageDiscount = API.PercentageDiscount;
|
|
1476
|
+
export type PercentageDiscountInterval = API.PercentageDiscountInterval;
|
|
1477
|
+
export type PlanPhaseAmountDiscountAdjustment = API.PlanPhaseAmountDiscountAdjustment;
|
|
1478
|
+
export type PlanPhaseMaximumAdjustment = API.PlanPhaseMaximumAdjustment;
|
|
1479
|
+
export type PlanPhaseMinimumAdjustment = API.PlanPhaseMinimumAdjustment;
|
|
1480
|
+
export type PlanPhasePercentageDiscountAdjustment = API.PlanPhasePercentageDiscountAdjustment;
|
|
1481
|
+
export type PlanPhaseUsageDiscountAdjustment = API.PlanPhaseUsageDiscountAdjustment;
|
|
1482
|
+
export type Price = API.Price;
|
|
1483
|
+
export type PriceInterval = API.PriceInterval;
|
|
1484
|
+
export type SubLineItemGrouping = API.SubLineItemGrouping;
|
|
1485
|
+
export type SubLineItemMatrixConfig = API.SubLineItemMatrixConfig;
|
|
1486
|
+
export type SubscriptionChangeMinified = API.SubscriptionChangeMinified;
|
|
1487
|
+
export type SubscriptionMinified = API.SubscriptionMinified;
|
|
1488
|
+
export type SubscriptionTrialInfo = API.SubscriptionTrialInfo;
|
|
1489
|
+
export type TaxAmount = API.TaxAmount;
|
|
1490
|
+
export type Tier = API.Tier;
|
|
1491
|
+
export type TierSubLineItem = API.TierSubLineItem;
|
|
1492
|
+
export type TieredConfig = API.TieredConfig;
|
|
1493
|
+
export type TieredConversionRateConfig = API.TieredConversionRateConfig;
|
|
1494
|
+
export type TrialDiscount = API.TrialDiscount;
|
|
1495
|
+
export type UnitConfig = API.UnitConfig;
|
|
1496
|
+
export type UnitConversionRateConfig = API.UnitConversionRateConfig;
|
|
1497
|
+
export type UsageDiscount = API.UsageDiscount;
|
|
1498
|
+
export type UsageDiscountInterval = API.UsageDiscountInterval;
|
|
1499
|
+
}
|