orb-billing 1.20.2 → 1.22.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 +19 -0
- package/LICENSE +201 -0
- package/README.md +190 -178
- package/_shims/MultipartBody.d.ts +9 -0
- package/_shims/MultipartBody.d.ts.map +1 -0
- package/_shims/MultipartBody.js +16 -0
- package/_shims/MultipartBody.js.map +1 -0
- package/_shims/MultipartBody.mjs +12 -0
- package/_shims/MultipartBody.mjs.map +1 -0
- package/_shims/README.md +46 -0
- package/_shims/auto/runtime-bun.d.ts +5 -0
- package/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/_shims/auto/runtime-bun.js +21 -0
- package/_shims/auto/runtime-bun.js.map +1 -0
- package/_shims/auto/runtime-bun.mjs +2 -0
- package/_shims/auto/runtime-bun.mjs.map +1 -0
- package/_shims/auto/runtime-node.d.ts +5 -0
- package/_shims/auto/runtime-node.d.ts.map +1 -0
- package/_shims/auto/runtime-node.js +21 -0
- package/_shims/auto/runtime-node.js.map +1 -0
- package/_shims/auto/runtime-node.mjs +2 -0
- package/_shims/auto/runtime-node.mjs.map +1 -0
- package/_shims/auto/runtime.d.ts +5 -0
- package/_shims/auto/runtime.d.ts.map +1 -0
- package/_shims/auto/runtime.js +21 -0
- package/_shims/auto/runtime.js.map +1 -0
- package/_shims/auto/runtime.mjs +2 -0
- package/_shims/auto/runtime.mjs.map +1 -0
- package/_shims/auto/types-node.d.ts +5 -0
- package/_shims/auto/types-node.d.ts.map +1 -0
- package/_shims/auto/types-node.js +21 -0
- package/_shims/auto/types-node.js.map +1 -0
- package/_shims/auto/types-node.mjs +2 -0
- package/_shims/auto/types-node.mjs.map +1 -0
- package/_shims/auto/types.d.ts +101 -0
- package/_shims/auto/types.js +3 -0
- package/_shims/auto/types.mjs +3 -0
- package/_shims/bun-runtime.d.ts +6 -0
- package/_shims/bun-runtime.d.ts.map +1 -0
- package/_shims/bun-runtime.js +14 -0
- package/_shims/bun-runtime.js.map +1 -0
- package/_shims/bun-runtime.mjs +10 -0
- package/_shims/bun-runtime.mjs.map +1 -0
- package/_shims/index.d.ts +81 -0
- package/_shims/index.js +13 -0
- package/_shims/index.mjs +7 -0
- package/_shims/manual-types.d.ts +12 -0
- package/_shims/manual-types.js +3 -0
- package/_shims/manual-types.mjs +3 -0
- package/_shims/node-runtime.d.ts +3 -0
- package/_shims/node-runtime.d.ts.map +1 -0
- package/_shims/node-runtime.js +90 -0
- package/_shims/node-runtime.js.map +1 -0
- package/_shims/node-runtime.mjs +56 -0
- package/_shims/node-runtime.mjs.map +1 -0
- package/_shims/node-types.d.ts +42 -0
- package/_shims/node-types.js +3 -0
- package/_shims/node-types.mjs +3 -0
- package/_shims/registry.d.ts +37 -0
- package/_shims/registry.d.ts.map +1 -0
- package/_shims/registry.js +41 -0
- package/_shims/registry.js.map +1 -0
- package/_shims/registry.mjs +37 -0
- package/_shims/registry.mjs.map +1 -0
- package/_shims/web-runtime.d.ts +5 -0
- package/_shims/web-runtime.d.ts.map +1 -0
- package/_shims/web-runtime.js +78 -0
- package/_shims/web-runtime.js.map +1 -0
- package/_shims/web-runtime.mjs +71 -0
- package/_shims/web-runtime.mjs.map +1 -0
- package/_shims/web-types.d.ts +83 -0
- package/_shims/web-types.js +3 -0
- package/_shims/web-types.mjs +3 -0
- package/core.d.ts +239 -0
- package/core.d.ts.map +1 -0
- package/core.js +832 -0
- package/core.js.map +1 -0
- package/core.mjs +801 -0
- package/core.mjs.map +1 -0
- package/error.d.ts +131 -0
- package/error.d.ts.map +1 -0
- package/error.js +298 -0
- package/error.js.map +1 -0
- package/error.mjs +271 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +210 -0
- package/index.d.ts +210 -0
- package/index.d.ts.map +1 -0
- package/index.js +153 -0
- package/index.js.map +1 -0
- package/index.mjs +125 -0
- package/index.mjs.map +1 -0
- package/package.json +90 -27
- package/pagination.d.ts +31 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +34 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +30 -0
- package/pagination.mjs.map +1 -0
- package/resource.d.ts +12 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +17 -0
- package/resource.js.map +1 -0
- package/resource.mjs +13 -0
- package/resource.mjs.map +1 -0
- package/resources/coupons/coupons.d.ts +114 -0
- package/resources/coupons/coupons.d.ts.map +1 -0
- package/resources/coupons/coupons.js +76 -0
- package/resources/coupons/coupons.js.map +1 -0
- package/resources/coupons/coupons.mjs +48 -0
- package/resources/coupons/coupons.mjs.map +1 -0
- package/resources/coupons/index.d.ts +3 -0
- package/resources/coupons/index.d.ts.map +1 -0
- package/resources/coupons/index.js +10 -0
- package/resources/coupons/index.js.map +1 -0
- package/resources/coupons/index.mjs +4 -0
- package/resources/coupons/index.mjs.map +1 -0
- package/resources/coupons/subscriptions.d.ts +23 -0
- package/resources/coupons/subscriptions.d.ts.map +1 -0
- package/resources/coupons/subscriptions.js +20 -0
- package/resources/coupons/subscriptions.js.map +1 -0
- package/resources/coupons/subscriptions.mjs +16 -0
- package/resources/coupons/subscriptions.mjs.map +1 -0
- package/resources/credit-notes.d.ts +136 -0
- package/resources/credit-notes.d.ts.map +1 -0
- package/resources/credit-notes.js +54 -0
- package/resources/credit-notes.js.map +1 -0
- package/resources/credit-notes.mjs +26 -0
- package/resources/credit-notes.mjs.map +1 -0
- package/resources/customers/balance-transactions.d.ts +159 -0
- package/resources/customers/balance-transactions.d.ts.map +1 -0
- package/resources/customers/balance-transactions.js +54 -0
- package/resources/customers/balance-transactions.js.map +1 -0
- package/resources/customers/balance-transactions.mjs +26 -0
- package/resources/customers/balance-transactions.mjs.map +1 -0
- package/resources/customers/costs.d.ts +915 -0
- package/resources/customers/costs.d.ts.map +1 -0
- package/resources/customers/costs.js +24 -0
- package/resources/customers/costs.js.map +1 -0
- package/resources/customers/costs.mjs +20 -0
- package/resources/customers/costs.mjs.map +1 -0
- package/resources/customers/credits/credits.d.ts +58 -0
- package/resources/customers/credits/credits.d.ts.map +1 -0
- package/resources/customers/credits/credits.js +68 -0
- package/resources/customers/credits/credits.js.map +1 -0
- package/resources/customers/credits/credits.mjs +39 -0
- package/resources/customers/credits/credits.mjs.map +1 -0
- package/resources/customers/credits/index.d.ts +3 -0
- package/resources/customers/credits/index.d.ts.map +1 -0
- package/resources/customers/credits/index.js +13 -0
- package/resources/customers/credits/index.js.map +1 -0
- package/resources/customers/credits/index.mjs +4 -0
- package/resources/customers/credits/index.mjs.map +1 -0
- package/resources/customers/credits/ledger.d.ts +1537 -0
- package/resources/customers/credits/ledger.d.ts.map +1 -0
- package/resources/customers/credits/ledger.js +291 -0
- package/resources/customers/credits/ledger.js.map +1 -0
- package/resources/customers/credits/ledger.mjs +262 -0
- package/resources/customers/credits/ledger.mjs.map +1 -0
- package/resources/customers/customers.d.ts +524 -0
- package/resources/customers/customers.d.ts.map +1 -0
- package/resources/customers/customers.js +135 -0
- package/resources/customers/customers.js.map +1 -0
- package/resources/customers/customers.mjs +107 -0
- package/resources/customers/customers.mjs.map +1 -0
- package/resources/customers/index.d.ts +6 -0
- package/resources/customers/index.d.ts.map +1 -0
- package/resources/customers/index.js +19 -0
- package/resources/customers/index.js.map +1 -0
- package/resources/customers/index.mjs +7 -0
- package/resources/customers/index.mjs.map +1 -0
- package/resources/customers/usage.d.ts +306 -0
- package/resources/customers/usage.d.ts.map +1 -0
- package/resources/customers/usage.js +223 -0
- package/resources/customers/usage.js.map +1 -0
- package/resources/customers/usage.mjs +219 -0
- package/resources/customers/usage.mjs.map +1 -0
- package/resources/events/backfills.d.ts +250 -0
- package/resources/events/backfills.d.ts.map +1 -0
- package/resources/events/backfills.js +104 -0
- package/resources/events/backfills.js.map +1 -0
- package/resources/events/backfills.mjs +76 -0
- package/resources/events/backfills.mjs.map +1 -0
- package/resources/events/events.d.ts +547 -0
- package/resources/events/events.d.ts.map +1 -0
- package/resources/events/events.js +354 -0
- package/resources/events/events.js.map +1 -0
- package/resources/events/events.mjs +327 -0
- package/resources/events/events.mjs.map +1 -0
- package/resources/events/index.d.ts +3 -0
- package/resources/events/index.d.ts.map +1 -0
- package/resources/events/index.js +10 -0
- package/resources/events/index.js.map +1 -0
- package/resources/events/index.mjs +4 -0
- package/resources/events/index.mjs.map +1 -0
- package/resources/index.d.ts +13 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +39 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +14 -0
- package/resources/index.mjs.map +1 -0
- package/resources/invoice-line-items.d.ts +434 -0
- package/resources/invoice-line-items.d.ts.map +1 -0
- package/resources/invoice-line-items.js +18 -0
- package/resources/invoice-line-items.js.map +1 -0
- package/resources/invoice-line-items.mjs +14 -0
- package/resources/invoice-line-items.mjs.map +1 -0
- package/resources/invoices.d.ts +1541 -0
- package/resources/invoices.d.ts.map +1 -0
- package/resources/invoices.js +96 -0
- package/resources/invoices.js.map +1 -0
- package/resources/invoices.mjs +68 -0
- package/resources/invoices.mjs.map +1 -0
- package/resources/items.d.ts +61 -0
- package/resources/items.d.ts.map +1 -0
- package/resources/items.js +53 -0
- package/resources/items.js.map +1 -0
- package/resources/items.mjs +25 -0
- package/resources/items.mjs.map +1 -0
- package/resources/metrics.d.ts +176 -0
- package/resources/metrics.d.ts.map +1 -0
- package/resources/metrics.js +63 -0
- package/resources/metrics.js.map +1 -0
- package/resources/metrics.mjs +35 -0
- package/resources/metrics.mjs.map +1 -0
- package/resources/plans/external-plan-id.d.ts +50 -0
- package/resources/plans/external-plan-id.d.ts.map +1 -0
- package/resources/plans/external-plan-id.js +35 -0
- package/resources/plans/external-plan-id.js.map +1 -0
- package/resources/plans/external-plan-id.mjs +31 -0
- package/resources/plans/external-plan-id.mjs.map +1 -0
- package/resources/plans/index.d.ts +3 -0
- package/resources/plans/index.d.ts.map +1 -0
- package/resources/plans/index.js +10 -0
- package/resources/plans/index.js.map +1 -0
- package/resources/plans/index.mjs +4 -0
- package/resources/plans/index.mjs.map +1 -0
- package/resources/plans/plans.d.ts +256 -0
- package/resources/plans/plans.d.ts.map +1 -0
- package/resources/plans/plans.js +87 -0
- package/resources/plans/plans.js.map +1 -0
- package/resources/plans/plans.mjs +59 -0
- package/resources/plans/plans.mjs.map +1 -0
- package/resources/prices/external-price-id.d.ts +12 -0
- package/resources/prices/external-price-id.d.ts.map +1 -0
- package/resources/prices/external-price-id.js +17 -0
- package/resources/prices/external-price-id.js.map +1 -0
- package/resources/prices/external-price-id.mjs +13 -0
- package/resources/prices/external-price-id.mjs.map +1 -0
- package/resources/prices/index.d.ts +3 -0
- package/resources/prices/index.d.ts.map +1 -0
- package/resources/prices/index.js +10 -0
- package/resources/prices/index.js.map +1 -0
- package/resources/prices/index.mjs +4 -0
- package/resources/prices/index.mjs.map +1 -0
- package/resources/prices/prices.d.ts +1872 -0
- package/resources/prices/prices.d.ts.map +1 -0
- package/resources/prices/prices.js +74 -0
- package/resources/prices/prices.js.map +1 -0
- package/resources/prices/prices.mjs +46 -0
- package/resources/prices/prices.mjs.map +1 -0
- package/resources/subscriptions.d.ts +3752 -0
- package/resources/subscriptions.d.ts.map +1 -0
- package/resources/subscriptions.js +254 -0
- package/resources/subscriptions.js.map +1 -0
- package/resources/subscriptions.mjs +225 -0
- package/resources/subscriptions.mjs.map +1 -0
- package/resources/top-level.d.ts +21 -0
- package/resources/top-level.d.ts.map +1 -0
- package/resources/top-level.js +22 -0
- package/resources/top-level.js.map +1 -0
- package/resources/top-level.mjs +18 -0
- package/resources/top-level.mjs.map +1 -0
- package/shims/node.d.ts +29 -0
- package/shims/node.d.ts.map +1 -0
- package/shims/node.js +31 -0
- package/shims/node.js.map +1 -0
- package/shims/node.mjs +5 -0
- package/shims/node.mjs.map +1 -0
- package/shims/web.d.ts +26 -0
- package/shims/web.d.ts.map +1 -0
- package/shims/web.js +31 -0
- package/shims/web.js.map +1 -0
- package/shims/web.mjs +5 -0
- package/shims/web.mjs.map +1 -0
- package/src/_shims/MultipartBody.ts +9 -0
- package/src/_shims/README.md +46 -0
- package/src/_shims/auto/runtime-bun.ts +4 -0
- package/src/_shims/auto/runtime-node.ts +4 -0
- package/src/_shims/auto/runtime.ts +4 -0
- package/src/_shims/auto/types-node.ts +4 -0
- package/src/_shims/auto/types.d.ts +101 -0
- package/src/_shims/auto/types.js +3 -0
- package/src/_shims/auto/types.mjs +3 -0
- package/src/_shims/bun-runtime.ts +14 -0
- package/src/_shims/index.d.ts +81 -0
- package/src/_shims/index.js +13 -0
- package/src/_shims/index.mjs +7 -0
- package/src/_shims/manual-types.d.ts +12 -0
- package/src/_shims/manual-types.js +3 -0
- package/src/_shims/manual-types.mjs +3 -0
- package/src/_shims/node-runtime.ts +83 -0
- package/src/_shims/node-types.d.ts +42 -0
- package/src/_shims/node-types.js +3 -0
- package/src/_shims/node-types.mjs +3 -0
- package/src/_shims/registry.ts +67 -0
- package/src/_shims/web-runtime.ts +103 -0
- package/src/_shims/web-types.d.ts +83 -0
- package/src/_shims/web-types.js +3 -0
- package/src/_shims/web-types.mjs +3 -0
- package/src/core.ts +1103 -0
- package/src/error.ts +469 -0
- package/src/index.ts +305 -0
- package/src/pagination.ts +63 -0
- package/src/resource.ts +24 -0
- package/src/resources/coupons/coupons.ts +150 -0
- package/src/resources/coupons/index.ts +4 -0
- package/src/resources/coupons/subscriptions.ts +45 -0
- package/src/resources/credit-notes.ts +184 -0
- package/src/resources/customers/balance-transactions.ts +222 -0
- package/src/resources/customers/costs.ts +991 -0
- package/src/resources/customers/credits/credits.ts +113 -0
- package/src/resources/customers/credits/index.ts +24 -0
- package/src/resources/customers/credits/ledger.ts +2254 -0
- package/src/resources/customers/customers.ts +734 -0
- package/src/resources/customers/index.ts +42 -0
- package/src/resources/customers/usage.ts +350 -0
- package/src/resources/events/backfills.ts +324 -0
- package/src/resources/events/events.ts +635 -0
- package/src/resources/events/index.ts +23 -0
- package/src/resources/index.ts +72 -0
- package/src/resources/invoice-line-items.ts +502 -0
- package/src/resources/invoices.ts +1906 -0
- package/src/resources/items.ts +106 -0
- package/src/resources/metrics.ts +264 -0
- package/src/resources/plans/external-plan-id.ts +73 -0
- package/src/resources/plans/index.ts +4 -0
- package/src/resources/plans/plans.ts +350 -0
- package/src/resources/prices/external-price-id.ts +16 -0
- package/src/resources/prices/index.ts +4 -0
- package/src/resources/prices/prices.ts +2466 -0
- package/src/resources/subscriptions.ts +4590 -0
- package/src/resources/top-level.ts +27 -0
- package/src/shims/node.ts +50 -0
- package/src/shims/web.ts +50 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +246 -0
- package/src/version.ts +1 -0
- package/uploads.d.ts +75 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +162 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +149 -0
- package/uploads.mjs.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
- package/LICENSE.md +0 -21
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -20
- package/dist/internal/utils/contenttype.d.ts +0 -1
- package/dist/internal/utils/contenttype.js +0 -33
- package/dist/internal/utils/headers.d.ts +0 -4
- package/dist/internal/utils/headers.js +0 -92
- package/dist/internal/utils/index.d.ts +0 -8
- package/dist/internal/utils/index.js +0 -27
- package/dist/internal/utils/pathparams.d.ts +0 -2
- package/dist/internal/utils/pathparams.js +0 -53
- package/dist/internal/utils/queryparams.d.ts +0 -2
- package/dist/internal/utils/queryparams.js +0 -178
- package/dist/internal/utils/requestbody.d.ts +0 -2
- package/dist/internal/utils/requestbody.js +0 -318
- package/dist/internal/utils/retries.d.ts +0 -20
- package/dist/internal/utils/retries.js +0 -250
- package/dist/internal/utils/security.d.ts +0 -5
- package/dist/internal/utils/security.js +0 -188
- package/dist/internal/utils/utils.d.ts +0 -37
- package/dist/internal/utils/utils.js +0 -370
- package/dist/sdk/availability.d.ts +0 -18
- package/dist/sdk/availability.js +0 -186
- package/dist/sdk/coupon.d.ts +0 -62
- package/dist/sdk/coupon.js +0 -629
- package/dist/sdk/credit.d.ts +0 -348
- package/dist/sdk/credit.js +0 -1020
- package/dist/sdk/creditnote.d.ts +0 -29
- package/dist/sdk/creditnote.js +0 -293
- package/dist/sdk/customer.d.ts +0 -529
- package/dist/sdk/customer.js +0 -1882
- package/dist/sdk/event.d.ts +0 -353
- package/dist/sdk/event.js +0 -1314
- package/dist/sdk/index.d.ts +0 -1
- package/dist/sdk/index.js +0 -20
- package/dist/sdk/invoice.d.ts +0 -89
- package/dist/sdk/invoice.js +0 -945
- package/dist/sdk/item.d.ts +0 -27
- package/dist/sdk/item.js +0 -291
- package/dist/sdk/metric.d.ts +0 -39
- package/dist/sdk/metric.js +0 -418
- package/dist/sdk/models/errors/fivehundrederror.d.ts +0 -11
- package/dist/sdk/models/errors/fivehundrederror.js +0 -88
- package/dist/sdk/models/errors/fourhundredandoneerror.d.ts +0 -11
- package/dist/sdk/models/errors/fourhundredandoneerror.js +0 -88
- package/dist/sdk/models/errors/fourhundredandtwentynineerror.d.ts +0 -11
- package/dist/sdk/models/errors/fourhundredandtwentynineerror.js +0 -88
- package/dist/sdk/models/errors/index.d.ts +0 -4
- package/dist/sdk/models/errors/index.js +0 -23
- package/dist/sdk/models/errors/sdkerror.d.ts +0 -7
- package/dist/sdk/models/errors/sdkerror.js +0 -40
- package/dist/sdk/models/operations/addeditpriceintervals.d.ts +0 -25
- package/dist/sdk/models/operations/addeditpriceintervals.js +0 -95
- package/dist/sdk/models/operations/amendevent.d.ts +0 -25
- package/dist/sdk/models/operations/amendevent.js +0 -95
- package/dist/sdk/models/operations/amendusage.d.ts +0 -27
- package/dist/sdk/models/operations/amendusage.js +0 -103
- package/dist/sdk/models/operations/amendusageexternalcustomerid.d.ts +0 -27
- package/dist/sdk/models/operations/amendusageexternalcustomerid.js +0 -103
- package/dist/sdk/models/operations/archivecoupon.d.ts +0 -24
- package/dist/sdk/models/operations/archivecoupon.js +0 -91
- package/dist/sdk/models/operations/cancelsubscription.d.ts +0 -25
- package/dist/sdk/models/operations/cancelsubscription.js +0 -95
- package/dist/sdk/models/operations/closebackfill.d.ts +0 -24
- package/dist/sdk/models/operations/closebackfill.js +0 -91
- package/dist/sdk/models/operations/createbackfill.d.ts +0 -21
- package/dist/sdk/models/operations/createbackfill.js +0 -79
- package/dist/sdk/models/operations/createcoupon.d.ts +0 -21
- package/dist/sdk/models/operations/createcoupon.js +0 -79
- package/dist/sdk/models/operations/createcustomer.d.ts +0 -21
- package/dist/sdk/models/operations/createcustomer.js +0 -79
- package/dist/sdk/models/operations/createcustomerbalancetransaction.d.ts +0 -25
- package/dist/sdk/models/operations/createcustomerbalancetransaction.js +0 -95
- package/dist/sdk/models/operations/createinvoice.d.ts +0 -21
- package/dist/sdk/models/operations/createinvoice.js +0 -79
- package/dist/sdk/models/operations/createinvoicelineitem.d.ts +0 -21
- package/dist/sdk/models/operations/createinvoicelineitem.js +0 -79
- package/dist/sdk/models/operations/createledgerentry.d.ts +0 -24
- package/dist/sdk/models/operations/createledgerentry.js +0 -71
- package/dist/sdk/models/operations/createledgerentryexternalid.d.ts +0 -24
- package/dist/sdk/models/operations/createledgerentryexternalid.js +0 -71
- package/dist/sdk/models/operations/createmetric.d.ts +0 -21
- package/dist/sdk/models/operations/createmetric.js +0 -79
- package/dist/sdk/models/operations/createplan.d.ts +0 -21
- package/dist/sdk/models/operations/createplan.js +0 -79
- package/dist/sdk/models/operations/createprice.d.ts +0 -20
- package/dist/sdk/models/operations/createprice.js +0 -55
- package/dist/sdk/models/operations/createsubscription.d.ts +0 -21
- package/dist/sdk/models/operations/createsubscription.js +0 -79
- package/dist/sdk/models/operations/deletecustomer.d.ts +0 -24
- package/dist/sdk/models/operations/deletecustomer.js +0 -91
- package/dist/sdk/models/operations/deprecateevent.d.ts +0 -24
- package/dist/sdk/models/operations/deprecateevent.js +0 -91
- package/dist/sdk/models/operations/fetchbackfill.d.ts +0 -24
- package/dist/sdk/models/operations/fetchbackfill.js +0 -91
- package/dist/sdk/models/operations/fetchcoupon.d.ts +0 -24
- package/dist/sdk/models/operations/fetchcoupon.js +0 -91
- package/dist/sdk/models/operations/fetchcreditnote.d.ts +0 -24
- package/dist/sdk/models/operations/fetchcreditnote.js +0 -91
- package/dist/sdk/models/operations/fetchcustomer.d.ts +0 -24
- package/dist/sdk/models/operations/fetchcustomer.js +0 -91
- package/dist/sdk/models/operations/fetchcustomercosts.d.ts +0 -38
- package/dist/sdk/models/operations/fetchcustomercosts.js +0 -115
- package/dist/sdk/models/operations/fetchcustomercostsexternalid.d.ts +0 -38
- package/dist/sdk/models/operations/fetchcustomercostsexternalid.js +0 -115
- package/dist/sdk/models/operations/fetchcustomercredits.d.ts +0 -26
- package/dist/sdk/models/operations/fetchcustomercredits.js +0 -99
- package/dist/sdk/models/operations/fetchcustomercreditsexternalid.d.ts +0 -26
- package/dist/sdk/models/operations/fetchcustomercreditsexternalid.js +0 -99
- package/dist/sdk/models/operations/fetchcustomercreditsledger.d.ts +0 -47
- package/dist/sdk/models/operations/fetchcustomercreditsledger.js +0 -146
- package/dist/sdk/models/operations/fetchcustomercreditsledgerexternalid.d.ts +0 -47
- package/dist/sdk/models/operations/fetchcustomercreditsledgerexternalid.js +0 -146
- package/dist/sdk/models/operations/fetchcustomerexternalid.d.ts +0 -24
- package/dist/sdk/models/operations/fetchcustomerexternalid.js +0 -91
- package/dist/sdk/models/operations/fetchinvoice.d.ts +0 -24
- package/dist/sdk/models/operations/fetchinvoice.js +0 -91
- package/dist/sdk/models/operations/fetchitem.d.ts +0 -24
- package/dist/sdk/models/operations/fetchitem.js +0 -91
- package/dist/sdk/models/operations/fetchmetric.d.ts +0 -24
- package/dist/sdk/models/operations/fetchmetric.js +0 -91
- package/dist/sdk/models/operations/fetchplan.d.ts +0 -24
- package/dist/sdk/models/operations/fetchplan.js +0 -91
- package/dist/sdk/models/operations/fetchplanexternalid.d.ts +0 -24
- package/dist/sdk/models/operations/fetchplanexternalid.js +0 -91
- package/dist/sdk/models/operations/fetchprice.d.ts +0 -23
- package/dist/sdk/models/operations/fetchprice.js +0 -67
- package/dist/sdk/models/operations/fetchpriceexternalid.d.ts +0 -23
- package/dist/sdk/models/operations/fetchpriceexternalid.js +0 -67
- package/dist/sdk/models/operations/fetchsubscription.d.ts +0 -24
- package/dist/sdk/models/operations/fetchsubscription.js +0 -91
- package/dist/sdk/models/operations/fetchsubscriptioncosts.d.ts +0 -38
- package/dist/sdk/models/operations/fetchsubscriptioncosts.js +0 -115
- package/dist/sdk/models/operations/fetchsubscriptionschedule.d.ts +0 -30
- package/dist/sdk/models/operations/fetchsubscriptionschedule.js +0 -115
- package/dist/sdk/models/operations/fetchsubscriptionusage.d.ts +0 -54
- package/dist/sdk/models/operations/fetchsubscriptionusage.js +0 -130
- package/dist/sdk/models/operations/fetchupcominginvoice.d.ts +0 -24
- package/dist/sdk/models/operations/fetchupcominginvoice.js +0 -91
- package/dist/sdk/models/operations/index.d.ts +0 -73
- package/dist/sdk/models/operations/index.js +0 -92
- package/dist/sdk/models/operations/ingest.d.ts +0 -26
- package/dist/sdk/models/operations/ingest.js +0 -99
- package/dist/sdk/models/operations/issueinvoice.d.ts +0 -24
- package/dist/sdk/models/operations/issueinvoice.js +0 -91
- package/dist/sdk/models/operations/listbackfills.d.ts +0 -25
- package/dist/sdk/models/operations/listbackfills.js +0 -95
- package/dist/sdk/models/operations/listbalancetransactions.d.ts +0 -30
- package/dist/sdk/models/operations/listbalancetransactions.js +0 -115
- package/dist/sdk/models/operations/listcoupons.d.ts +0 -27
- package/dist/sdk/models/operations/listcoupons.js +0 -103
- package/dist/sdk/models/operations/listcouponsubscriptions.d.ts +0 -26
- package/dist/sdk/models/operations/listcouponsubscriptions.js +0 -99
- package/dist/sdk/models/operations/listcreditnotes.d.ts +0 -25
- package/dist/sdk/models/operations/listcreditnotes.js +0 -95
- package/dist/sdk/models/operations/listcustomers.d.ts +0 -29
- package/dist/sdk/models/operations/listcustomers.js +0 -111
- package/dist/sdk/models/operations/listinvoices.d.ts +0 -62
- package/dist/sdk/models/operations/listinvoices.js +0 -189
- package/dist/sdk/models/operations/listitems.d.ts +0 -25
- package/dist/sdk/models/operations/listitems.js +0 -95
- package/dist/sdk/models/operations/listmetrics.d.ts +0 -29
- package/dist/sdk/models/operations/listmetrics.js +0 -111
- package/dist/sdk/models/operations/listplans.d.ts +0 -41
- package/dist/sdk/models/operations/listplans.js +0 -124
- package/dist/sdk/models/operations/listprices.d.ts +0 -25
- package/dist/sdk/models/operations/listprices.js +0 -95
- package/dist/sdk/models/operations/listsubscriptions.d.ts +0 -37
- package/dist/sdk/models/operations/listsubscriptions.js +0 -129
- package/dist/sdk/models/operations/markinvoiceaspaid.d.ts +0 -25
- package/dist/sdk/models/operations/markinvoiceaspaid.js +0 -95
- package/dist/sdk/models/operations/ping.d.ts +0 -21
- package/dist/sdk/models/operations/ping.js +0 -79
- package/dist/sdk/models/operations/revertbackfill.d.ts +0 -24
- package/dist/sdk/models/operations/revertbackfill.js +0 -91
- package/dist/sdk/models/operations/scheduleplanchange.d.ts +0 -25
- package/dist/sdk/models/operations/scheduleplanchange.js +0 -95
- package/dist/sdk/models/operations/searchevents.d.ts +0 -30
- package/dist/sdk/models/operations/searchevents.js +0 -115
- package/dist/sdk/models/operations/triggerphase.d.ts +0 -25
- package/dist/sdk/models/operations/triggerphase.js +0 -95
- package/dist/sdk/models/operations/unschedulecancellation.d.ts +0 -24
- package/dist/sdk/models/operations/unschedulecancellation.js +0 -91
- package/dist/sdk/models/operations/unschedulefixedfeequantity.d.ts +0 -25
- package/dist/sdk/models/operations/unschedulefixedfeequantity.js +0 -95
- package/dist/sdk/models/operations/unscheduleplanchange.d.ts +0 -24
- package/dist/sdk/models/operations/unscheduleplanchange.js +0 -91
- package/dist/sdk/models/operations/updatecustomer.d.ts +0 -25
- package/dist/sdk/models/operations/updatecustomer.js +0 -95
- package/dist/sdk/models/operations/updatecustomerexternalid.d.ts +0 -25
- package/dist/sdk/models/operations/updatecustomerexternalid.js +0 -95
- package/dist/sdk/models/operations/updatefixedfeequantity.d.ts +0 -25
- package/dist/sdk/models/operations/updatefixedfeequantity.js +0 -95
- package/dist/sdk/models/operations/updateplan.d.ts +0 -25
- package/dist/sdk/models/operations/updateplan.js +0 -95
- package/dist/sdk/models/operations/updateplanexternal.d.ts +0 -25
- package/dist/sdk/models/operations/updateplanexternal.js +0 -95
- package/dist/sdk/models/operations/voidinvoice.d.ts +0 -24
- package/dist/sdk/models/operations/voidinvoice.js +0 -91
- package/dist/sdk/models/shared/accountingprovider.d.ts +0 -9
- package/dist/sdk/models/shared/accountingprovider.js +0 -55
- package/dist/sdk/models/shared/accountingproviderconfig.d.ts +0 -5
- package/dist/sdk/models/shared/accountingproviderconfig.js +0 -50
- package/dist/sdk/models/shared/accountingsyncconfiguration.d.ts +0 -6
- package/dist/sdk/models/shared/accountingsyncconfiguration.js +0 -52
- package/dist/sdk/models/shared/addeditpriceintervalparams.d.ts +0 -13
- package/dist/sdk/models/shared/addeditpriceintervalparams.js +0 -54
- package/dist/sdk/models/shared/addpriceintervalparams.d.ts +0 -40
- package/dist/sdk/models/shared/addpriceintervalparams.js +0 -87
- package/dist/sdk/models/shared/address.d.ts +0 -9
- package/dist/sdk/models/shared/address.js +0 -70
- package/dist/sdk/models/shared/addressinput.d.ts +0 -9
- package/dist/sdk/models/shared/addressinput.js +0 -70
- package/dist/sdk/models/shared/aggregatedcost.d.ts +0 -15
- package/dist/sdk/models/shared/aggregatedcost.js +0 -75
- package/dist/sdk/models/shared/amendedevent.d.ts +0 -28
- package/dist/sdk/models/shared/amendedevent.js +0 -81
- package/dist/sdk/models/shared/amendedusage.d.ts +0 -11
- package/dist/sdk/models/shared/amendedusage.js +0 -50
- package/dist/sdk/models/shared/amendeventresult.d.ts +0 -7
- package/dist/sdk/models/shared/amendeventresult.js +0 -45
- package/dist/sdk/models/shared/autocollection.d.ts +0 -15
- package/dist/sdk/models/shared/autocollection.js +0 -63
- package/dist/sdk/models/shared/backfill.d.ts +0 -27
- package/dist/sdk/models/shared/backfill.js +0 -104
- package/dist/sdk/models/shared/backfills.d.ts +0 -7
- package/dist/sdk/models/shared/backfills.js +0 -54
- package/dist/sdk/models/shared/backfillstatus.d.ts +0 -9
- package/dist/sdk/models/shared/backfillstatus.js +0 -16
- package/dist/sdk/models/shared/billablemetric.d.ts +0 -27
- package/dist/sdk/models/shared/billablemetric.js +0 -84
- package/dist/sdk/models/shared/billablemetrics.d.ts +0 -7
- package/dist/sdk/models/shared/billablemetrics.js +0 -54
- package/dist/sdk/models/shared/billingcyclealignment.d.ts +0 -8
- package/dist/sdk/models/shared/billingcyclealignment.js +0 -15
- package/dist/sdk/models/shared/cancelsubscriptionparams.d.ts +0 -19
- package/dist/sdk/models/shared/cancelsubscriptionparams.js +0 -63
- package/dist/sdk/models/shared/changeoption.d.ts +0 -5
- package/dist/sdk/models/shared/changeoption.js +0 -12
- package/dist/sdk/models/shared/coupon.d.ts +0 -40
- package/dist/sdk/models/shared/coupon.js +0 -98
- package/dist/sdk/models/shared/couponredemption.d.ts +0 -6
- package/dist/sdk/models/shared/couponredemption.js +0 -63
- package/dist/sdk/models/shared/coupons.d.ts +0 -7
- package/dist/sdk/models/shared/coupons.js +0 -54
- package/dist/sdk/models/shared/createinvoicelineitemparams.d.ts +0 -28
- package/dist/sdk/models/shared/createinvoicelineitemparams.js +0 -81
- package/dist/sdk/models/shared/createoneoffinvoiceparams.d.ts +0 -33
- package/dist/sdk/models/shared/createoneoffinvoiceparams.js +0 -86
- package/dist/sdk/models/shared/creditledgerentries.d.ts +0 -6
- package/dist/sdk/models/shared/creditledgerentries.js +0 -52
- package/dist/sdk/models/shared/creditnote.d.ts +0 -83
- package/dist/sdk/models/shared/creditnote.js +0 -171
- package/dist/sdk/models/shared/creditnotelineitem.d.ts +0 -40
- package/dist/sdk/models/shared/creditnotelineitem.js +0 -100
- package/dist/sdk/models/shared/creditnoteminified.d.ts +0 -7
- package/dist/sdk/models/shared/creditnoteminified.js +0 -45
- package/dist/sdk/models/shared/creditnotes.d.ts +0 -7
- package/dist/sdk/models/shared/creditnotes.js +0 -54
- package/dist/sdk/models/shared/creditnotesublineitem.d.ts +0 -6
- package/dist/sdk/models/shared/creditnotesublineitem.js +0 -55
- package/dist/sdk/models/shared/creditnotesummary.d.ts +0 -12
- package/dist/sdk/models/shared/creditnotesummary.js +0 -74
- package/dist/sdk/models/shared/customer.d.ts +0 -76
- package/dist/sdk/models/shared/customer.js +0 -182
- package/dist/sdk/models/shared/customerbalancetransaction.d.ts +0 -42
- package/dist/sdk/models/shared/customerbalancetransaction.js +0 -109
- package/dist/sdk/models/shared/customerbalancetransactions.d.ts +0 -7
- package/dist/sdk/models/shared/customerbalancetransactions.js +0 -54
- package/dist/sdk/models/shared/customercosts.d.ts +0 -5
- package/dist/sdk/models/shared/customercosts.js +0 -47
- package/dist/sdk/models/shared/customercreditbalance.d.ts +0 -7
- package/dist/sdk/models/shared/customercreditbalance.js +0 -64
- package/dist/sdk/models/shared/customercreditbalances.d.ts +0 -7
- package/dist/sdk/models/shared/customercreditbalances.js +0 -54
- package/dist/sdk/models/shared/customerminified.d.ts +0 -5
- package/dist/sdk/models/shared/customerminified.js +0 -50
- package/dist/sdk/models/shared/customers.d.ts +0 -7
- package/dist/sdk/models/shared/customers.js +0 -54
- package/dist/sdk/models/shared/customertaxid.d.ts +0 -6
- package/dist/sdk/models/shared/customertaxid.js +0 -55
- package/dist/sdk/models/shared/debug.d.ts +0 -8
- package/dist/sdk/models/shared/debug.js +0 -53
- package/dist/sdk/models/shared/deletecustomerresponse.d.ts +0 -3
- package/dist/sdk/models/shared/deletecustomerresponse.js +0 -30
- package/dist/sdk/models/shared/deprecatedeventresult.d.ts +0 -7
- package/dist/sdk/models/shared/deprecatedeventresult.js +0 -45
- package/dist/sdk/models/shared/discount.d.ts +0 -33
- package/dist/sdk/models/shared/discount.js +0 -80
- package/dist/sdk/models/shared/editcustomer.d.ts +0 -72
- package/dist/sdk/models/shared/editcustomer.js +0 -151
- package/dist/sdk/models/shared/editplan.d.ts +0 -10
- package/dist/sdk/models/shared/editplan.js +0 -59
- package/dist/sdk/models/shared/editpriceintervalparams.d.ts +0 -20
- package/dist/sdk/models/shared/editpriceintervalparams.js +0 -62
- package/dist/sdk/models/shared/event.d.ts +0 -39
- package/dist/sdk/models/shared/event.js +0 -93
- package/dist/sdk/models/shared/events.d.ts +0 -7
- package/dist/sdk/models/shared/events.js +0 -54
- package/dist/sdk/models/shared/eventsearchcriteria.d.ts +0 -11
- package/dist/sdk/models/shared/eventsearchcriteria.js +0 -50
- package/dist/sdk/models/shared/fixedfeequantitychange.d.ts +0 -25
- package/dist/sdk/models/shared/fixedfeequantitychange.js +0 -75
- package/dist/sdk/models/shared/fixedfeequantityscheduleentry.d.ts +0 -7
- package/dist/sdk/models/shared/fixedfeequantityscheduleentry.js +0 -68
- package/dist/sdk/models/shared/fixedfeequantitytransition.d.ts +0 -6
- package/dist/sdk/models/shared/fixedfeequantitytransition.js +0 -59
- package/dist/sdk/models/shared/index.d.ts +0 -109
- package/dist/sdk/models/shared/index.js +0 -128
- package/dist/sdk/models/shared/ingestevent.d.ts +0 -32
- package/dist/sdk/models/shared/ingestevent.js +0 -86
- package/dist/sdk/models/shared/ingestionresponse.d.ts +0 -13
- package/dist/sdk/models/shared/ingestionresponse.js +0 -54
- package/dist/sdk/models/shared/ingestrequestbody.d.ts +0 -5
- package/dist/sdk/models/shared/ingestrequestbody.js +0 -47
- package/dist/sdk/models/shared/invoice.d.ts +0 -138
- package/dist/sdk/models/shared/invoice.js +0 -329
- package/dist/sdk/models/shared/invoicelineitem.d.ts +0 -49
- package/dist/sdk/models/shared/invoicelineitem.js +0 -134
- package/dist/sdk/models/shared/invoicelineitemparams.d.ts +0 -26
- package/dist/sdk/models/shared/invoicelineitemparams.js +0 -90
- package/dist/sdk/models/shared/invoiceminified.d.ts +0 -7
- package/dist/sdk/models/shared/invoiceminified.js +0 -45
- package/dist/sdk/models/shared/invoices.d.ts +0 -7
- package/dist/sdk/models/shared/invoices.js +0 -54
- package/dist/sdk/models/shared/item.d.ts +0 -14
- package/dist/sdk/models/shared/item.js +0 -72
- package/dist/sdk/models/shared/itemexternalconnection.d.ts +0 -5
- package/dist/sdk/models/shared/itemexternalconnection.js +0 -50
- package/dist/sdk/models/shared/items.d.ts +0 -7
- package/dist/sdk/models/shared/items.js +0 -54
- package/dist/sdk/models/shared/markaspaidrequestparams.d.ts +0 -16
- package/dist/sdk/models/shared/markaspaidrequestparams.js +0 -61
- package/dist/sdk/models/shared/maximum.d.ts +0 -11
- package/dist/sdk/models/shared/maximum.js +0 -50
- package/dist/sdk/models/shared/maximuminterval.d.ts +0 -23
- package/dist/sdk/models/shared/maximuminterval.js +0 -73
- package/dist/sdk/models/shared/minimum.d.ts +0 -11
- package/dist/sdk/models/shared/minimum.js +0 -50
- package/dist/sdk/models/shared/minimuminterval.d.ts +0 -23
- package/dist/sdk/models/shared/minimuminterval.js +0 -73
- package/dist/sdk/models/shared/newaccountingsyncconfiguration.d.ts +0 -6
- package/dist/sdk/models/shared/newaccountingsyncconfiguration.js +0 -52
- package/dist/sdk/models/shared/newbackfill.d.ts +0 -27
- package/dist/sdk/models/shared/newbackfill.js +0 -82
- package/dist/sdk/models/shared/newbillablemetric.d.ts +0 -28
- package/dist/sdk/models/shared/newbillablemetric.js +0 -77
- package/dist/sdk/models/shared/newcoupon.d.ts +0 -18
- package/dist/sdk/models/shared/newcoupon.js +0 -69
- package/dist/sdk/models/shared/newcustomer.d.ts +0 -68
- package/dist/sdk/models/shared/newcustomer.js +0 -152
- package/dist/sdk/models/shared/newcustomerbalancetransaction.d.ts +0 -13
- package/dist/sdk/models/shared/newcustomerbalancetransaction.js +0 -60
- package/dist/sdk/models/shared/newplan.d.ts +0 -26
- package/dist/sdk/models/shared/newplan.js +0 -93
- package/dist/sdk/models/shared/newreportingconfiguration.d.ts +0 -4
- package/dist/sdk/models/shared/newreportingconfiguration.js +0 -45
- package/dist/sdk/models/shared/newsubscription.d.ts +0 -54
- package/dist/sdk/models/shared/newsubscription.js +0 -187
- package/dist/sdk/models/shared/paginationmetadata.d.ts +0 -5
- package/dist/sdk/models/shared/paginationmetadata.js +0 -50
- package/dist/sdk/models/shared/perpricecost.d.ts +0 -224
- package/dist/sdk/models/shared/perpricecost.js +0 -67
- package/dist/sdk/models/shared/phaseoverride.d.ts +0 -17
- package/dist/sdk/models/shared/phaseoverride.js +0 -62
- package/dist/sdk/models/shared/pingresponse.d.ts +0 -4
- package/dist/sdk/models/shared/pingresponse.js +0 -45
- package/dist/sdk/models/shared/plan.d.ts +0 -66
- package/dist/sdk/models/shared/plan.js +0 -188
- package/dist/sdk/models/shared/planminified.d.ts +0 -9
- package/dist/sdk/models/shared/planminified.js +0 -55
- package/dist/sdk/models/shared/planphase.d.ts +0 -28
- package/dist/sdk/models/shared/planphase.js +0 -106
- package/dist/sdk/models/shared/plans.d.ts +0 -7
- package/dist/sdk/models/shared/plans.js +0 -54
- package/dist/sdk/models/shared/pricegroup.d.ts +0 -17
- package/dist/sdk/models/shared/pricegroup.js +0 -65
- package/dist/sdk/models/shared/priceinterval.d.ts +0 -239
- package/dist/sdk/models/shared/priceinterval.js +0 -104
- package/dist/sdk/models/shared/priceintervalfixedfeequantitytransitionparams.d.ts +0 -11
- package/dist/sdk/models/shared/priceintervalfixedfeequantitytransitionparams.js +0 -54
- package/dist/sdk/models/shared/prices.d.ts +0 -6
- package/dist/sdk/models/shared/prices.js +0 -52
- package/dist/sdk/models/shared/product.d.ts +0 -6
- package/dist/sdk/models/shared/product.js +0 -59
- package/dist/sdk/models/shared/reportingconfiguration.d.ts +0 -4
- package/dist/sdk/models/shared/reportingconfiguration.js +0 -45
- package/dist/sdk/models/shared/security.d.ts +0 -4
- package/dist/sdk/models/shared/security.js +0 -45
- package/dist/sdk/models/shared/subscription.d.ts +0 -128
- package/dist/sdk/models/shared/subscription.js +0 -226
- package/dist/sdk/models/shared/subscriptioncosts.d.ts +0 -5
- package/dist/sdk/models/shared/subscriptioncosts.js +0 -47
- package/dist/sdk/models/shared/subscriptionminified.d.ts +0 -4
- package/dist/sdk/models/shared/subscriptionminified.js +0 -45
- package/dist/sdk/models/shared/subscriptionplanchange.d.ts +0 -59
- package/dist/sdk/models/shared/subscriptionplanchange.js +0 -126
- package/dist/sdk/models/shared/subscriptions.d.ts +0 -7
- package/dist/sdk/models/shared/subscriptions.js +0 -54
- package/dist/sdk/models/shared/subscriptionscheduleitem.d.ts +0 -7
- package/dist/sdk/models/shared/subscriptionscheduleitem.js +0 -65
- package/dist/sdk/models/shared/subscriptionscheduleitems.d.ts +0 -7
- package/dist/sdk/models/shared/subscriptionscheduleitems.js +0 -54
- package/dist/sdk/models/shared/subscriptiontrialinfo.d.ts +0 -4
- package/dist/sdk/models/shared/subscriptiontrialinfo.js +0 -49
- package/dist/sdk/models/shared/taxamount.d.ts +0 -15
- package/dist/sdk/models/shared/taxamount.js +0 -55
- package/dist/sdk/models/shared/trialconfig.d.ts +0 -8
- package/dist/sdk/models/shared/trialconfig.js +0 -54
- package/dist/sdk/models/shared/triggersubscriptionphaseparams.d.ts +0 -8
- package/dist/sdk/models/shared/triggersubscriptionphaseparams.js +0 -51
- package/dist/sdk/models/shared/unschedulefixedfeequantitychangeparams.d.ts +0 -7
- package/dist/sdk/models/shared/unschedulefixedfeequantitychangeparams.js +0 -45
- package/dist/sdk/models/shared/upcominginvoice.d.ts +0 -130
- package/dist/sdk/models/shared/upcominginvoice.js +0 -321
- package/dist/sdk/models/shared/updateevent.d.ts +0 -28
- package/dist/sdk/models/shared/updateevent.js +0 -81
- package/dist/sdk/models/shared/validationerror.d.ts +0 -11
- package/dist/sdk/models/shared/validationerror.js +0 -50
- package/dist/sdk/plan.d.ts +0 -90
- package/dist/sdk/plan.js +0 -764
- package/dist/sdk/price.d.ts +0 -246
- package/dist/sdk/price.js +0 -715
- package/dist/sdk/priceinterval.d.ts +0 -66
- package/dist/sdk/priceinterval.js +0 -263
- package/dist/sdk/sdk.d.ts +0 -389
- package/dist/sdk/sdk.js +0 -93
- package/dist/sdk/subscription.d.ts +0 -769
- package/dist/sdk/subscription.js +0 -2116
- package/dist/sdk/types/index.d.ts +0 -1
- package/dist/sdk/types/index.js +0 -20
- package/dist/sdk/types/rfcdate.d.ts +0 -9
- package/dist/sdk/types/rfcdate.js +0 -59
- package/docs/models/errors/fivehundrederror.md +0 -12
- package/docs/models/errors/fivehundrederrorheaders.md +0 -7
- package/docs/models/errors/fourhundredandoneerror.md +0 -12
- package/docs/models/errors/fourhundredandoneerrorheaders.md +0 -7
- package/docs/models/errors/fourhundredandtwentynineerror.md +0 -12
- package/docs/models/errors/fourhundredandtwentynineerrorheaders.md +0 -7
- package/docs/models/operations/addeditpriceintervalsrequest.md +0 -9
- package/docs/models/operations/addeditpriceintervalsresponse.md +0 -11
- package/docs/models/operations/amendeventrequest.md +0 -9
- package/docs/models/operations/amendeventresponse.md +0 -11
- package/docs/models/operations/amendusageexternalcustomeridrequest.md +0 -11
- package/docs/models/operations/amendusageexternalcustomeridresponse.md +0 -11
- package/docs/models/operations/amendusagerequest.md +0 -11
- package/docs/models/operations/amendusageresponse.md +0 -11
- package/docs/models/operations/archivecouponrequest.md +0 -8
- package/docs/models/operations/archivecouponresponse.md +0 -11
- package/docs/models/operations/cancelsubscriptionrequest.md +0 -9
- package/docs/models/operations/cancelsubscriptionresponse.md +0 -11
- package/docs/models/operations/closebackfillrequest.md +0 -8
- package/docs/models/operations/closebackfillresponse.md +0 -11
- package/docs/models/operations/createbackfillresponse.md +0 -11
- package/docs/models/operations/createcouponresponse.md +0 -11
- package/docs/models/operations/createcustomerbalancetransactionrequest.md +0 -9
- package/docs/models/operations/createcustomerbalancetransactionresponse.md +0 -11
- package/docs/models/operations/createcustomerresponse.md +0 -11
- package/docs/models/operations/createinvoicelineitemresponse.md +0 -11
- package/docs/models/operations/createinvoiceresponse.md +0 -11
- package/docs/models/operations/createledgerentryexternalidrequest.md +0 -9
- package/docs/models/operations/createledgerentryexternalidresponse.md +0 -11
- package/docs/models/operations/createledgerentryrequest.md +0 -9
- package/docs/models/operations/createledgerentryresponse.md +0 -11
- package/docs/models/operations/createmetricresponse.md +0 -11
- package/docs/models/operations/createplanresponse.md +0 -11
- package/docs/models/operations/createpriceresponse.md +0 -11
- package/docs/models/operations/createsubscriptionresponse.md +0 -11
- package/docs/models/operations/deletecustomerrequest.md +0 -8
- package/docs/models/operations/deletecustomerresponse.md +0 -11
- package/docs/models/operations/deprecateeventrequest.md +0 -8
- package/docs/models/operations/deprecateeventresponse.md +0 -11
- package/docs/models/operations/fetchbackfillrequest.md +0 -8
- package/docs/models/operations/fetchbackfillresponse.md +0 -11
- package/docs/models/operations/fetchcouponrequest.md +0 -8
- package/docs/models/operations/fetchcouponresponse.md +0 -11
- package/docs/models/operations/fetchcreditnoterequest.md +0 -8
- package/docs/models/operations/fetchcreditnoteresponse.md +0 -11
- package/docs/models/operations/fetchcustomercostsexternalidrequest.md +0 -12
- package/docs/models/operations/fetchcustomercostsexternalidresponse.md +0 -11
- package/docs/models/operations/fetchcustomercostsexternalidviewmodeviewmode.md +0 -11
- package/docs/models/operations/fetchcustomercostsrequest.md +0 -12
- package/docs/models/operations/fetchcustomercostsresponse.md +0 -11
- package/docs/models/operations/fetchcustomercostsviewmodeviewmode.md +0 -11
- package/docs/models/operations/fetchcustomercreditsexternalidrequest.md +0 -10
- package/docs/models/operations/fetchcustomercreditsexternalidresponse.md +0 -11
- package/docs/models/operations/fetchcustomercreditsledgerentrystatusentrystatus.md +0 -9
- package/docs/models/operations/fetchcustomercreditsledgerentrytypeentrytype.md +0 -14
- package/docs/models/operations/fetchcustomercreditsledgerexternalidentrystatusentrystatus.md +0 -9
- package/docs/models/operations/fetchcustomercreditsledgerexternalidentrytypeentrytype.md +0 -14
- package/docs/models/operations/fetchcustomercreditsledgerexternalidrequest.md +0 -18
- package/docs/models/operations/fetchcustomercreditsledgerexternalidresponse.md +0 -11
- package/docs/models/operations/fetchcustomercreditsledgerrequest.md +0 -18
- package/docs/models/operations/fetchcustomercreditsledgerresponse.md +0 -11
- package/docs/models/operations/fetchcustomercreditsrequest.md +0 -10
- package/docs/models/operations/fetchcustomercreditsresponse.md +0 -11
- package/docs/models/operations/fetchcustomerexternalidrequest.md +0 -8
- package/docs/models/operations/fetchcustomerexternalidresponse.md +0 -11
- package/docs/models/operations/fetchcustomerrequest.md +0 -8
- package/docs/models/operations/fetchcustomerresponse.md +0 -11
- package/docs/models/operations/fetchinvoicerequest.md +0 -8
- package/docs/models/operations/fetchinvoiceresponse.md +0 -11
- package/docs/models/operations/fetchitemrequest.md +0 -8
- package/docs/models/operations/fetchitemresponse.md +0 -11
- package/docs/models/operations/fetchmetricrequest.md +0 -8
- package/docs/models/operations/fetchmetricresponse.md +0 -11
- package/docs/models/operations/fetchplanexternalidrequest.md +0 -8
- package/docs/models/operations/fetchplanexternalidresponse.md +0 -11
- package/docs/models/operations/fetchplanrequest.md +0 -8
- package/docs/models/operations/fetchplanresponse.md +0 -11
- package/docs/models/operations/fetchpriceexternalidrequest.md +0 -8
- package/docs/models/operations/fetchpriceexternalidresponse.md +0 -11
- package/docs/models/operations/fetchpricerequest.md +0 -8
- package/docs/models/operations/fetchpriceresponse.md +0 -11
- package/docs/models/operations/fetchsubscriptioncostsrequest.md +0 -12
- package/docs/models/operations/fetchsubscriptioncostsresponse.md +0 -11
- package/docs/models/operations/fetchsubscriptioncostsviewmodeviewmode.md +0 -11
- package/docs/models/operations/fetchsubscriptionrequest.md +0 -8
- package/docs/models/operations/fetchsubscriptionresponse.md +0 -11
- package/docs/models/operations/fetchsubscriptionschedulerequest.md +0 -14
- package/docs/models/operations/fetchsubscriptionscheduleresponse.md +0 -11
- package/docs/models/operations/fetchsubscriptionusagegranularitygranularity.md +0 -10
- package/docs/models/operations/fetchsubscriptionusagerequest.md +0 -20
- package/docs/models/operations/fetchsubscriptionusageresponse.md +0 -11
- package/docs/models/operations/fetchsubscriptionusageviewmodeviewmode.md +0 -11
- package/docs/models/operations/fetchupcominginvoicerequest.md +0 -8
- package/docs/models/operations/fetchupcominginvoiceresponse.md +0 -11
- package/docs/models/operations/ingestrequest.md +0 -10
- package/docs/models/operations/ingestresponse.md +0 -11
- package/docs/models/operations/issueinvoicerequest.md +0 -8
- package/docs/models/operations/issueinvoiceresponse.md +0 -11
- package/docs/models/operations/listbackfillsrequest.md +0 -9
- package/docs/models/operations/listbackfillsresponse.md +0 -11
- package/docs/models/operations/listbalancetransactionsrequest.md +0 -14
- package/docs/models/operations/listbalancetransactionsresponse.md +0 -11
- package/docs/models/operations/listcouponsrequest.md +0 -11
- package/docs/models/operations/listcouponsresponse.md +0 -11
- package/docs/models/operations/listcouponsubscriptionsrequest.md +0 -10
- package/docs/models/operations/listcouponsubscriptionsresponse.md +0 -11
- package/docs/models/operations/listcreditnotesrequest.md +0 -9
- package/docs/models/operations/listcreditnotesresponse.md +0 -11
- package/docs/models/operations/listcustomersrequest.md +0 -13
- package/docs/models/operations/listcustomersresponse.md +0 -11
- package/docs/models/operations/listinvoicesdatetypedatetype.md +0 -9
- package/docs/models/operations/listinvoicesrequest.md +0 -27
- package/docs/models/operations/listinvoicesresponse.md +0 -11
- package/docs/models/operations/listinvoicesstatus.md +0 -12
- package/docs/models/operations/listinvoicesstatusstatus.md +0 -12
- package/docs/models/operations/listitemsrequest.md +0 -9
- package/docs/models/operations/listitemsresponse.md +0 -11
- package/docs/models/operations/listmetricsrequest.md +0 -13
- package/docs/models/operations/listmetricsresponse.md +0 -11
- package/docs/models/operations/listplansrequest.md +0 -14
- package/docs/models/operations/listplansresponse.md +0 -11
- package/docs/models/operations/listplansstatusstatus.md +0 -12
- package/docs/models/operations/listpricesrequest.md +0 -9
- package/docs/models/operations/listpricesresponse.md +0 -11
- package/docs/models/operations/listsubscriptionsrequest.md +0 -16
- package/docs/models/operations/listsubscriptionsresponse.md +0 -11
- package/docs/models/operations/listsubscriptionsstatusstatus.md +0 -10
- package/docs/models/operations/markinvoiceaspaidrequest.md +0 -9
- package/docs/models/operations/markinvoiceaspaidresponse.md +0 -11
- package/docs/models/operations/pingresponse.md +0 -11
- package/docs/models/operations/revertbackfillrequest.md +0 -8
- package/docs/models/operations/revertbackfillresponse.md +0 -11
- package/docs/models/operations/scheduleplanchangerequest.md +0 -9
- package/docs/models/operations/scheduleplanchangeresponse.md +0 -11
- package/docs/models/operations/searcheventsrequest.md +0 -14
- package/docs/models/operations/searcheventsresponse.md +0 -11
- package/docs/models/operations/triggerphaserequest.md +0 -9
- package/docs/models/operations/triggerphaseresponse.md +0 -11
- package/docs/models/operations/unschedulecancellationrequest.md +0 -8
- package/docs/models/operations/unschedulecancellationresponse.md +0 -11
- package/docs/models/operations/unschedulefixedfeequantityrequest.md +0 -9
- package/docs/models/operations/unschedulefixedfeequantityresponse.md +0 -11
- package/docs/models/operations/unscheduleplanchangerequest.md +0 -8
- package/docs/models/operations/unscheduleplanchangeresponse.md +0 -11
- package/docs/models/operations/updatecustomerexternalidrequest.md +0 -9
- package/docs/models/operations/updatecustomerexternalidresponse.md +0 -11
- package/docs/models/operations/updatecustomerrequest.md +0 -9
- package/docs/models/operations/updatecustomerresponse.md +0 -11
- package/docs/models/operations/updatefixedfeequantityrequest.md +0 -9
- package/docs/models/operations/updatefixedfeequantityresponse.md +0 -11
- package/docs/models/operations/updateplanexternalrequest.md +0 -9
- package/docs/models/operations/updateplanexternalresponse.md +0 -11
- package/docs/models/operations/updateplanrequest.md +0 -9
- package/docs/models/operations/updateplanresponse.md +0 -11
- package/docs/models/operations/voidinvoicerequest.md +0 -8
- package/docs/models/operations/voidinvoiceresponse.md +0 -11
- package/docs/models/shared/accountingprovider.md +0 -9
- package/docs/models/shared/accountingproviderconfig.md +0 -9
- package/docs/models/shared/accountingproviderprovidertype.md +0 -9
- package/docs/models/shared/accountingsyncconfiguration.md +0 -9
- package/docs/models/shared/addeditpriceintervalparams.md +0 -9
- package/docs/models/shared/addpriceintervalparams.md +0 -16
- package/docs/models/shared/address.md +0 -13
- package/docs/models/shared/addressinput.md +0 -13
- package/docs/models/shared/aggregatedcost.md +0 -12
- package/docs/models/shared/amendedevent.md +0 -12
- package/docs/models/shared/amendedeventproperties.md +0 -9
- package/docs/models/shared/amendedusage.md +0 -9
- package/docs/models/shared/amendeventresult.md +0 -8
- package/docs/models/shared/autocollection.md +0 -10
- package/docs/models/shared/backfill.md +0 -17
- package/docs/models/shared/backfills.md +0 -9
- package/docs/models/shared/backfillstatus.md +0 -13
- package/docs/models/shared/billablemetric.md +0 -16
- package/docs/models/shared/billablemetrics.md +0 -9
- package/docs/models/shared/billablemetricstatus.md +0 -10
- package/docs/models/shared/billingcyclealignment.md +0 -12
- package/docs/models/shared/cancelsubscriptionparams.md +0 -9
- package/docs/models/shared/cancelsubscriptionparamscanceloption.md +0 -12
- package/docs/models/shared/changeoption.md +0 -10
- package/docs/models/shared/coupon.md +0 -21
- package/docs/models/shared/coupondiscount.md +0 -7
- package/docs/models/shared/couponredemption.md +0 -10
- package/docs/models/shared/coupons.md +0 -9
- package/docs/models/shared/createinvoicelineitemparams.md +0 -13
- package/docs/models/shared/createoneoffinvoiceparams.md +0 -15
- package/docs/models/shared/creditledgerentries.md +0 -9
- package/docs/models/shared/creditnote.md +0 -26
- package/docs/models/shared/creditnotediscounts.md +0 -7
- package/docs/models/shared/creditnotelineitem.md +0 -15
- package/docs/models/shared/creditnotelineitemdiscounts.md +0 -7
- package/docs/models/shared/creditnotelineitemtaxamounts.md +0 -7
- package/docs/models/shared/creditnotemaximumamountadjustment.md +0 -9
- package/docs/models/shared/creditnoteminified.md +0 -8
- package/docs/models/shared/creditnotereason.md +0 -11
- package/docs/models/shared/creditnotes.md +0 -9
- package/docs/models/shared/creditnotesublineitem.md +0 -10
- package/docs/models/shared/creditnotesummary.md +0 -13
- package/docs/models/shared/creditnotetype.md +0 -9
- package/docs/models/shared/customer.md +0 -42
- package/docs/models/shared/customerbalancetransaction.md +0 -17
- package/docs/models/shared/customerbalancetransactionaction.md +0 -10
- package/docs/models/shared/customerbalancetransactions.md +0 -9
- package/docs/models/shared/customerbalancetransactiontype.md +0 -9
- package/docs/models/shared/customercosts.md +0 -8
- package/docs/models/shared/customercreditbalance.md +0 -11
- package/docs/models/shared/customercreditbalances.md +0 -9
- package/docs/models/shared/customerminified.md +0 -9
- package/docs/models/shared/customerpaymentprovider.md +0 -14
- package/docs/models/shared/customers.md +0 -9
- package/docs/models/shared/customertaxid.md +0 -10
- package/docs/models/shared/debug.md +0 -11
- package/docs/models/shared/deletecustomerresponse.md +0 -7
- package/docs/models/shared/deprecatedeventresult.md +0 -8
- package/docs/models/shared/discount.md +0 -15
- package/docs/models/shared/discountdiscounttype.md +0 -11
- package/docs/models/shared/editcustomer.md +0 -22
- package/docs/models/shared/editcustomermetadata.md +0 -9
- package/docs/models/shared/editcustomerpaymentprovider.md +0 -16
- package/docs/models/shared/editplan.md +0 -9
- package/docs/models/shared/editplanmetadata.md +0 -7
- package/docs/models/shared/editpriceintervalparams.md +0 -11
- package/docs/models/shared/event.md +0 -17
- package/docs/models/shared/eventproperties.md +0 -9
- package/docs/models/shared/events.md +0 -9
- package/docs/models/shared/eventsearchcriteria.md +0 -9
- package/docs/models/shared/fixedfeequantitychange.md +0 -11
- package/docs/models/shared/fixedfeequantitychangechangeoption.md +0 -12
- package/docs/models/shared/fixedfeequantityscheduleentry.md +0 -11
- package/docs/models/shared/fixedfeequantitytransition.md +0 -10
- package/docs/models/shared/ingestevent.md +0 -13
- package/docs/models/shared/ingesteventproperties.md +0 -9
- package/docs/models/shared/ingestionresponse.md +0 -9
- package/docs/models/shared/ingestrequestbody.md +0 -8
- package/docs/models/shared/invoice.md +0 -51
- package/docs/models/shared/invoicelineitem.md +0 -23
- package/docs/models/shared/invoicelineitemparams.md +0 -14
- package/docs/models/shared/invoicelineitemparamsmodeltype.md +0 -8
- package/docs/models/shared/invoicemetadata.md +0 -7
- package/docs/models/shared/invoiceminified.md +0 -8
- package/docs/models/shared/invoices.md +0 -9
- package/docs/models/shared/invoicestatus.md +0 -12
- package/docs/models/shared/item.md +0 -14
- package/docs/models/shared/itemexternalconnection.md +0 -9
- package/docs/models/shared/items.md +0 -9
- package/docs/models/shared/markaspaidrequestparams.md +0 -10
- package/docs/models/shared/maximum.md +0 -9
- package/docs/models/shared/maximuminterval.md +0 -12
- package/docs/models/shared/minimum.md +0 -9
- package/docs/models/shared/minimuminterval.md +0 -12
- package/docs/models/shared/newaccountingsyncconfiguration.md +0 -9
- package/docs/models/shared/newbackfill.md +0 -13
- package/docs/models/shared/newbillablemetric.md +0 -12
- package/docs/models/shared/newbillablemetricmetadata.md +0 -9
- package/docs/models/shared/newcoupon.md +0 -11
- package/docs/models/shared/newcoupondiscount.md +0 -7
- package/docs/models/shared/newcustomer.md +0 -23
- package/docs/models/shared/newcustomerbalancetransaction.md +0 -10
- package/docs/models/shared/newcustomerbalancetransactiontype.md +0 -9
- package/docs/models/shared/newcustomermetadata.md +0 -9
- package/docs/models/shared/newcustomerpaymentprovider.md +0 -14
- package/docs/models/shared/newplan.md +0 -14
- package/docs/models/shared/newplanmetadata.md +0 -7
- package/docs/models/shared/newplanprices.md +0 -7
- package/docs/models/shared/newreportingconfiguration.md +0 -8
- package/docs/models/shared/newsubscription.md +0 -31
- package/docs/models/shared/newsubscriptionexternalmarketplace.md +0 -10
- package/docs/models/shared/newsubscriptionmetadata.md +0 -7
- package/docs/models/shared/paginationmetadata.md +0 -9
- package/docs/models/shared/perpricecost.md +0 -12
- package/docs/models/shared/phaseoverride.md +0 -11
- package/docs/models/shared/pingresponse.md +0 -8
- package/docs/models/shared/plan.md +0 -33
- package/docs/models/shared/planmetadata.md +0 -7
- package/docs/models/shared/planminified.md +0 -10
- package/docs/models/shared/planphase.md +0 -18
- package/docs/models/shared/planphasedurationunit.md +0 -11
- package/docs/models/shared/plans.md +0 -9
- package/docs/models/shared/planstatus.md +0 -10
- package/docs/models/shared/pricegroup.md +0 -12
- package/docs/models/shared/priceinterval.md +0 -18
- package/docs/models/shared/priceintervalfixedfeequantitytransitionparams.md +0 -9
- package/docs/models/shared/prices.md +0 -9
- package/docs/models/shared/product.md +0 -10
- package/docs/models/shared/reportingconfiguration.md +0 -8
- package/docs/models/shared/security.md +0 -8
- package/docs/models/shared/subscription.md +0 -44
- package/docs/models/shared/subscriptioncosts.md +0 -8
- package/docs/models/shared/subscriptionmetadata.md +0 -9
- package/docs/models/shared/subscriptionminified.md +0 -8
- package/docs/models/shared/subscriptionplanchange.md +0 -23
- package/docs/models/shared/subscriptions.md +0 -9
- package/docs/models/shared/subscriptionscheduleitem.md +0 -10
- package/docs/models/shared/subscriptionscheduleitems.md +0 -9
- package/docs/models/shared/subscriptionstatus.md +0 -10
- package/docs/models/shared/subscriptiontrialinfo.md +0 -8
- package/docs/models/shared/taxamount.md +0 -10
- package/docs/models/shared/trialconfig.md +0 -9
- package/docs/models/shared/trialconfigtrialperiodunit.md +0 -8
- package/docs/models/shared/triggersubscriptionphaseparams.md +0 -8
- package/docs/models/shared/unschedulefixedfeequantitychangeparams.md +0 -8
- package/docs/models/shared/upcominginvoice.md +0 -46
- package/docs/models/shared/upcominginvoicemetadata.md +0 -7
- package/docs/models/shared/upcominginvoicestatus.md +0 -12
- package/docs/models/shared/updateevent.md +0 -12
- package/docs/models/shared/updateeventproperties.md +0 -9
- package/docs/models/shared/validationerror.md +0 -9
- package/docs/sdks/availability/README.md +0 -46
- package/docs/sdks/coupon/README.md +0 -235
- package/docs/sdks/credit/README.md +0 -565
- package/docs/sdks/creditnote/README.md +0 -94
- package/docs/sdks/customer/README.md +0 -1080
- package/docs/sdks/event/README.md +0 -674
- package/docs/sdks/invoice/README.md +0 -388
- package/docs/sdks/item/README.md +0 -92
- package/docs/sdks/metric/README.md +0 -136
- package/docs/sdks/orb/README.md +0 -21
- package/docs/sdks/plan/README.md +0 -298
- package/docs/sdks/price/README.md +0 -375
- package/docs/sdks/priceinterval/README.md +0 -137
- package/docs/sdks/subscription/README.md +0 -1306
- package/docs/types/rfcdate.md +0 -11
package/dist/sdk/customer.js
DELETED
|
@@ -1,1882 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
4
|
-
*/
|
|
5
|
-
var __assign = (this && this.__assign) || function () {
|
|
6
|
-
__assign = Object.assign || function(t) {
|
|
7
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
-
s = arguments[i];
|
|
9
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
-
t[p] = s[p];
|
|
11
|
-
}
|
|
12
|
-
return t;
|
|
13
|
-
};
|
|
14
|
-
return __assign.apply(this, arguments);
|
|
15
|
-
};
|
|
16
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
-
}
|
|
22
|
-
Object.defineProperty(o, k2, desc);
|
|
23
|
-
}) : (function(o, m, k, k2) {
|
|
24
|
-
if (k2 === undefined) k2 = k;
|
|
25
|
-
o[k2] = m[k];
|
|
26
|
-
}));
|
|
27
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
-
}) : function(o, v) {
|
|
30
|
-
o["default"] = v;
|
|
31
|
-
});
|
|
32
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
33
|
-
if (mod && mod.__esModule) return mod;
|
|
34
|
-
var result = {};
|
|
35
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
36
|
-
__setModuleDefault(result, mod);
|
|
37
|
-
return result;
|
|
38
|
-
};
|
|
39
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
40
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
41
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
42
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
43
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
44
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
45
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
49
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
50
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
51
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
52
|
-
function step(op) {
|
|
53
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
54
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
55
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
56
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
57
|
-
switch (op[0]) {
|
|
58
|
-
case 0: case 1: t = op; break;
|
|
59
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
60
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
61
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
62
|
-
default:
|
|
63
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
64
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
65
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
66
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
67
|
-
if (t[2]) _.ops.pop();
|
|
68
|
-
_.trys.pop(); continue;
|
|
69
|
-
}
|
|
70
|
-
op = body.call(thisArg, _);
|
|
71
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
72
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
76
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
77
|
-
if (!m) return o;
|
|
78
|
-
var i = m.call(o), r, ar = [], e;
|
|
79
|
-
try {
|
|
80
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
81
|
-
}
|
|
82
|
-
catch (error) { e = { error: error }; }
|
|
83
|
-
finally {
|
|
84
|
-
try {
|
|
85
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
86
|
-
}
|
|
87
|
-
finally { if (e) throw e.error; }
|
|
88
|
-
}
|
|
89
|
-
return ar;
|
|
90
|
-
};
|
|
91
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
92
|
-
exports.Customer = void 0;
|
|
93
|
-
var utils = __importStar(require("../internal/utils"));
|
|
94
|
-
var errors = __importStar(require("./models/errors"));
|
|
95
|
-
var operations = __importStar(require("./models/operations"));
|
|
96
|
-
var shared = __importStar(require("./models/shared"));
|
|
97
|
-
/**
|
|
98
|
-
* A customer is a buyer of your products, and the other party to the billing relationship.
|
|
99
|
-
*
|
|
100
|
-
* @remarks
|
|
101
|
-
*
|
|
102
|
-
* In Orb, customers are assigned system generated identifiers automatically, but it's often desirable to have these
|
|
103
|
-
* match existing identifiers in your system. To avoid having to denormalize Orb ID information, you can pass in an
|
|
104
|
-
* `external_customer_id` with your own identifier. See
|
|
105
|
-
* [Customer ID Aliases](../guides/events-and-metrics/customer-aliases) for further information about how these
|
|
106
|
-
* aliases work in Orb.
|
|
107
|
-
*
|
|
108
|
-
* In addition to having an identifier in your system, a customer may exist in a payment provider solution like
|
|
109
|
-
* Stripe. Use the `payment_provider_id` and the `payment_provider` enum field to express this mapping.
|
|
110
|
-
*
|
|
111
|
-
* A customer also has a timezone (from the standard [IANA timezone database](https://www.iana.org/time-zones)), which
|
|
112
|
-
* defaults to your account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) for
|
|
113
|
-
* information on what this timezone parameter influences within Orb.
|
|
114
|
-
*/
|
|
115
|
-
var Customer = /** @class */ (function () {
|
|
116
|
-
function Customer(sdkConfig) {
|
|
117
|
-
this.sdkConfiguration = sdkConfig;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Amend usage
|
|
121
|
-
*
|
|
122
|
-
* @remarks
|
|
123
|
-
* This endpoint is used to amend usage within a timeframe for a customer that has an active subscription.
|
|
124
|
-
*
|
|
125
|
-
* This endpoint will mark _all_ existing events within `[timeframe_start, timeframe_end)` as _ignored_ for billing purpo
|
|
126
|
-
* ses, and Orb will only use the _new_ events passed in the body of this request as the source of truth for that timeframe
|
|
127
|
-
* moving forwards.
|
|
128
|
-
* Note that a given time period can be amended any number of times, so events can be overwritten in subsequent calls to th
|
|
129
|
-
* is endpoint.
|
|
130
|
-
*
|
|
131
|
-
* This is a powerful and audit-safe mechanism to retroactively change usage data in cases where you need to:
|
|
132
|
-
* - decrease historical usage consumption because of degraded service availability in your systems
|
|
133
|
-
* - account for gaps from your usage reporting mechanism
|
|
134
|
-
* - make point-in-time fixes for specific event records, while ret
|
|
135
|
-
* aining the original time of usage and associated metadata.
|
|
136
|
-
* This amendment API is designed with two explicit goals:
|
|
137
|
-
* 1. Amendments are **always audit-safe**. The amendment process
|
|
138
|
-
* will still retain original events in the timeframe, though they will be ignored for billing calculations. For auditing a
|
|
139
|
-
* nd data fidelity purposes, Orb never overwrites or permanently deletes ingested usage data.
|
|
140
|
-
* 2. Amendments always preser
|
|
141
|
-
* ve data **consistency**. In other words, either an amendment is fully processed by the system (and the new events for th
|
|
142
|
-
* e timeframe are honored rather than the existing ones) or the amendment request fails. To maintain this important proper
|
|
143
|
-
* ty, Orb prevents _partial event ingestion_ on this endpoint.
|
|
144
|
-
*
|
|
145
|
-
* ## Response semantics
|
|
146
|
-
* - Either all events are ingested successfully, or all fail to ingest (returning a `4xx` or `5xx` response code).
|
|
147
|
-
* - Any event that fails schema validation will lead to a `4xx` response. In this case, to maintain data consistency,
|
|
148
|
-
* Orb will not ingest any events and will
|
|
149
|
-
* also not deprecate existing events in the time period.
|
|
150
|
-
* - You can assume that the amendment is successful on receipt of
|
|
151
|
-
* a `2xx` response.While a successful response from this endpoint indicates that the new events have been ingested, updati
|
|
152
|
-
* ng usage totals happens asynchronously and may be delayed by a few minutes.
|
|
153
|
-
*
|
|
154
|
-
* As emphasized above, Orb will never show
|
|
155
|
-
* an inconsistent state (e.g. in invoice previews or dashboards); either it will show the existing state (before the amend
|
|
156
|
-
* ment) or the new state (with new events in the requested timeframe).
|
|
157
|
-
*
|
|
158
|
-
* ## Sample request body
|
|
159
|
-
* ```json
|
|
160
|
-
* {
|
|
161
|
-
* "events": [{
|
|
162
|
-
* "event_name": "payment_processed",
|
|
163
|
-
* "timestamp": "2022-03-24T07:15:00Z",
|
|
164
|
-
* "properties": {
|
|
165
|
-
* "amount": 100
|
|
166
|
-
* }
|
|
167
|
-
* }, {
|
|
168
|
-
* "event_name": "payment_failed",
|
|
169
|
-
* "timestamp": "2022-03-24T07:15:00Z",
|
|
170
|
-
* "properties": {
|
|
171
|
-
* "amount": 100
|
|
172
|
-
* }
|
|
173
|
-
* }]
|
|
174
|
-
* }
|
|
175
|
-
* ```
|
|
176
|
-
*
|
|
177
|
-
* ## Request Validation
|
|
178
|
-
* - The `timestamp` of
|
|
179
|
-
* each event reported must fall within the bounds of `timeframe_start` and `timeframe_end`. As with ingestion, all timesta
|
|
180
|
-
* mps must be sent in ISO8601 format with UTC timezone offset.
|
|
181
|
-
* - Orb **does not accept an `idempotency_key`** with each
|
|
182
|
-
* event in this endpoint, since the entirety of the event list must be ingested to ensure consistency. On retryable errors
|
|
183
|
-
* , you should retry the request in its entirety, and assume that the amendment operation has not succeeded until receipt
|
|
184
|
-
* of a `2xx`.
|
|
185
|
-
*
|
|
186
|
-
* - Both `timeframe_start` and `timeframe_end` must be timestamps in the past. Furthermore, Orb will genera
|
|
187
|
-
* lly validate that the `timeframe_start` and `timeframe_end` fall within the customer's _current_ subscription billing pe
|
|
188
|
-
* riod. However, Orb does allow amendments while in the grace period of the previous billing period; in this instance, the
|
|
189
|
-
* timeframe can start before the current period.
|
|
190
|
-
*
|
|
191
|
-
* ## API Limits
|
|
192
|
-
* Note that Orb does not currently enforce a hard rate-
|
|
193
|
-
* limit for API usage or a maximum request payload size. Similar to the event ingestion API, this API is architected for h
|
|
194
|
-
* igh-throughput ingestion. It is also safe to _programmatically_ call this endpoint if your system can automatically dete
|
|
195
|
-
* ct a need for historical amendment.
|
|
196
|
-
*
|
|
197
|
-
* In order to overwrite timeframes with a very large number of events, we suggest using multiple calls with small adjacent
|
|
198
|
-
* (e.g. every hour) timeframes.
|
|
199
|
-
*/
|
|
200
|
-
Customer.prototype.amend = function (customerId, updateEvent, timeframeEnd, timeframeStart, config) {
|
|
201
|
-
var _a, _b;
|
|
202
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
203
|
-
var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
|
|
204
|
-
var _d;
|
|
205
|
-
return __generator(this, function (_e) {
|
|
206
|
-
switch (_e.label) {
|
|
207
|
-
case 0:
|
|
208
|
-
req = new operations.AmendUsageRequest({
|
|
209
|
-
customerId: customerId,
|
|
210
|
-
updateEvent: updateEvent,
|
|
211
|
-
timeframeEnd: timeframeEnd,
|
|
212
|
-
timeframeStart: timeframeStart,
|
|
213
|
-
});
|
|
214
|
-
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
215
|
-
url = utils.generateURL(baseURL, "/customers/{customer_id}/usage", req);
|
|
216
|
-
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
217
|
-
try {
|
|
218
|
-
_d = __read(utils.serializeRequestBody(req, "updateEvent", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
219
|
-
}
|
|
220
|
-
catch (e) {
|
|
221
|
-
if (e instanceof Error) {
|
|
222
|
-
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
client = this.sdkConfiguration.defaultClient;
|
|
226
|
-
globalSecurity = this.sdkConfiguration.security;
|
|
227
|
-
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
228
|
-
return [4 /*yield*/, globalSecurity()];
|
|
229
|
-
case 1:
|
|
230
|
-
globalSecurity = _e.sent();
|
|
231
|
-
_e.label = 2;
|
|
232
|
-
case 2:
|
|
233
|
-
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
234
|
-
globalSecurity = new shared.Security(globalSecurity);
|
|
235
|
-
}
|
|
236
|
-
properties = utils.parseSecurityProperties(globalSecurity);
|
|
237
|
-
headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
238
|
-
queryParams = utils.serializeQueryParams(req);
|
|
239
|
-
headers["Accept"] = "application/json";
|
|
240
|
-
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
241
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "patch", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
|
|
242
|
-
case 3:
|
|
243
|
-
httpRes = _e.sent();
|
|
244
|
-
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
245
|
-
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
246
|
-
throw new Error("status code not found in response: ".concat(httpRes));
|
|
247
|
-
}
|
|
248
|
-
res = new operations.AmendUsageResponse({
|
|
249
|
-
statusCode: httpRes.status,
|
|
250
|
-
contentType: contentType,
|
|
251
|
-
rawResponse: httpRes,
|
|
252
|
-
});
|
|
253
|
-
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
254
|
-
switch (true) {
|
|
255
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
256
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
257
|
-
res.amendedUsage = utils.objectToClass(JSON.parse(decodedRes), shared.AmendedUsage);
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
261
|
-
}
|
|
262
|
-
break;
|
|
263
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
|
|
264
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
|
|
265
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
|
|
266
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
|
|
267
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
268
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
269
|
-
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
270
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
|
|
271
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
272
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
|
|
273
|
-
err.rawResponse = httpRes;
|
|
274
|
-
throw new errors.FourHundredAndOneError(err);
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
278
|
-
}
|
|
279
|
-
break;
|
|
280
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
|
|
281
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
282
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
|
|
283
|
-
err.rawResponse = httpRes;
|
|
284
|
-
throw new errors.FourHundredAndTwentyNineError(err);
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
288
|
-
}
|
|
289
|
-
break;
|
|
290
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
|
|
291
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
292
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
|
|
293
|
-
err.rawResponse = httpRes;
|
|
294
|
-
throw new errors.FiveHundredError(err);
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
298
|
-
}
|
|
299
|
-
break;
|
|
300
|
-
}
|
|
301
|
-
return [2 /*return*/, res];
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
* Amend usage by external ID
|
|
308
|
-
*
|
|
309
|
-
* @remarks
|
|
310
|
-
* This endpoint is used to amend usage within a timeframe for a customer that has an active subscription.
|
|
311
|
-
*
|
|
312
|
-
* This endpoint will mark _all_ existing events within `[timeframe_start, timeframe_end)` as _ignored_ for billing purpo
|
|
313
|
-
* ses, and Orb will only use the _new_ events passed in the body of this request as the source of truth for that timeframe
|
|
314
|
-
* moving forwards.
|
|
315
|
-
* Note that a given time period can be amended any number of times, so events can be overwritten in subsequent calls to th
|
|
316
|
-
* is endpoint.
|
|
317
|
-
*
|
|
318
|
-
* This is a powerful and audit-safe mechanism to retroactively change usage data in cases where you need to:
|
|
319
|
-
* - decrease historical usage consumption because of degraded service availability in your systems
|
|
320
|
-
* - account for gaps from your usage reporting mechanism
|
|
321
|
-
* - make point-in-time fixes for specific event records, while ret
|
|
322
|
-
* aining the original time of usage and associated metadata.
|
|
323
|
-
* This amendment API is designed with two explicit goals:
|
|
324
|
-
* 1. Amendments are **always audit-safe**. The amendment process
|
|
325
|
-
* will still retain original events in the timeframe, though they will be ignored for billing calculations. For auditing a
|
|
326
|
-
* nd data fidelity purposes, Orb never overwrites or permanently deletes ingested usage data.
|
|
327
|
-
* 2. Amendments always preser
|
|
328
|
-
* ve data **consistency**. In other words, either an amendment is fully processed by the system (and the new events for th
|
|
329
|
-
* e timeframe are honored rather than the existing ones) or the amendment request fails. To maintain this important proper
|
|
330
|
-
* ty, Orb prevents _partial event ingestion_ on this endpoint.
|
|
331
|
-
*
|
|
332
|
-
* ## Response semantics
|
|
333
|
-
* - Either all events are ingested successfully, or all fail to ingest (returning a `4xx` or `5xx` response code).
|
|
334
|
-
* - Any event that fails schema validation will lead to a `4xx` response. In this case, to maintain data consistency,
|
|
335
|
-
* Orb will not ingest any events and will
|
|
336
|
-
* also not deprecate existing events in the time period.
|
|
337
|
-
* - You can assume that the amendment is successful on receipt of
|
|
338
|
-
* a `2xx` response.While a successful response from this endpoint indicates that the new events have been ingested, updati
|
|
339
|
-
* ng usage totals happens asynchronously and may be delayed by a few minutes.
|
|
340
|
-
*
|
|
341
|
-
* As emphasized above, Orb will never show
|
|
342
|
-
* an inconsistent state (e.g. in invoice previews or dashboards); either it will show the existing state (before the amend
|
|
343
|
-
* ment) or the new state (with new events in the requested timeframe).
|
|
344
|
-
*
|
|
345
|
-
* ## Sample request body
|
|
346
|
-
* ```json
|
|
347
|
-
* {
|
|
348
|
-
* "events": [{
|
|
349
|
-
* "event_name": "payment_processed",
|
|
350
|
-
* "timestamp": "2022-03-24T07:15:00Z",
|
|
351
|
-
* "properties": {
|
|
352
|
-
* "amount": 100
|
|
353
|
-
* }
|
|
354
|
-
* }, {
|
|
355
|
-
* "event_name": "payment_failed",
|
|
356
|
-
* "timestamp": "2022-03-24T07:15:00Z",
|
|
357
|
-
* "properties": {
|
|
358
|
-
* "amount": 100
|
|
359
|
-
* }
|
|
360
|
-
* }]
|
|
361
|
-
* }
|
|
362
|
-
* ```
|
|
363
|
-
*
|
|
364
|
-
* ## Request Validation
|
|
365
|
-
* - The `timestamp` of
|
|
366
|
-
* each event reported must fall within the bounds of `timeframe_start` and `timeframe_end`. As with ingestion, all timesta
|
|
367
|
-
* mps must be sent in ISO8601 format with UTC timezone offset.
|
|
368
|
-
* - Orb **does not accept an `idempotency_key`** with each
|
|
369
|
-
* event in this endpoint, since the entirety of the event list must be ingested to ensure consistency. On retryable errors
|
|
370
|
-
* , you should retry the request in its entirety, and assume that the amendment operation has not succeeded until receipt
|
|
371
|
-
* of a `2xx`.
|
|
372
|
-
*
|
|
373
|
-
* - Both `timeframe_start` and `timeframe_end` must be timestamps in the past. Furthermore, Orb will genera
|
|
374
|
-
* lly validate that the `timeframe_start` and `timeframe_end` fall within the customer's _current_ subscription billing pe
|
|
375
|
-
* riod. However, Orb does allow amendments while in the grace period of the previous billing period; in this instance, the
|
|
376
|
-
* timeframe can start before the current period.
|
|
377
|
-
*
|
|
378
|
-
* ## API Limits
|
|
379
|
-
* Note that Orb does not currently enforce a hard rate-
|
|
380
|
-
* limit for API usage or a maximum request payload size. Similar to the event ingestion API, this API is architected for h
|
|
381
|
-
* igh-throughput ingestion. It is also safe to _programmatically_ call this endpoint if your system can automatically dete
|
|
382
|
-
* ct a need for historical amendment.
|
|
383
|
-
*
|
|
384
|
-
* In order to overwrite timeframes with a very large number of events, we suggest using multiple calls with small adjacent
|
|
385
|
-
* (e.g. every hour) timeframes.
|
|
386
|
-
*/
|
|
387
|
-
Customer.prototype.amendByExternalId = function (externalCustomerId, updateEvent, timeframeEnd, timeframeStart, config) {
|
|
388
|
-
var _a, _b;
|
|
389
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
390
|
-
var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
|
|
391
|
-
var _d;
|
|
392
|
-
return __generator(this, function (_e) {
|
|
393
|
-
switch (_e.label) {
|
|
394
|
-
case 0:
|
|
395
|
-
req = new operations.AmendUsageExternalCustomerIdRequest({
|
|
396
|
-
externalCustomerId: externalCustomerId,
|
|
397
|
-
updateEvent: updateEvent,
|
|
398
|
-
timeframeEnd: timeframeEnd,
|
|
399
|
-
timeframeStart: timeframeStart,
|
|
400
|
-
});
|
|
401
|
-
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
402
|
-
url = utils.generateURL(baseURL, "/customers/external_customer_id/{external_customer_id}/usage", req);
|
|
403
|
-
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
404
|
-
try {
|
|
405
|
-
_d = __read(utils.serializeRequestBody(req, "updateEvent", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
406
|
-
}
|
|
407
|
-
catch (e) {
|
|
408
|
-
if (e instanceof Error) {
|
|
409
|
-
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
client = this.sdkConfiguration.defaultClient;
|
|
413
|
-
globalSecurity = this.sdkConfiguration.security;
|
|
414
|
-
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
415
|
-
return [4 /*yield*/, globalSecurity()];
|
|
416
|
-
case 1:
|
|
417
|
-
globalSecurity = _e.sent();
|
|
418
|
-
_e.label = 2;
|
|
419
|
-
case 2:
|
|
420
|
-
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
421
|
-
globalSecurity = new shared.Security(globalSecurity);
|
|
422
|
-
}
|
|
423
|
-
properties = utils.parseSecurityProperties(globalSecurity);
|
|
424
|
-
headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
425
|
-
queryParams = utils.serializeQueryParams(req);
|
|
426
|
-
headers["Accept"] = "application/json";
|
|
427
|
-
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
428
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "patch", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
|
|
429
|
-
case 3:
|
|
430
|
-
httpRes = _e.sent();
|
|
431
|
-
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
432
|
-
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
433
|
-
throw new Error("status code not found in response: ".concat(httpRes));
|
|
434
|
-
}
|
|
435
|
-
res = new operations.AmendUsageExternalCustomerIdResponse({
|
|
436
|
-
statusCode: httpRes.status,
|
|
437
|
-
contentType: contentType,
|
|
438
|
-
rawResponse: httpRes,
|
|
439
|
-
});
|
|
440
|
-
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
441
|
-
switch (true) {
|
|
442
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
443
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
444
|
-
res.amendedUsage = utils.objectToClass(JSON.parse(decodedRes), shared.AmendedUsage);
|
|
445
|
-
}
|
|
446
|
-
else {
|
|
447
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
448
|
-
}
|
|
449
|
-
break;
|
|
450
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
|
|
451
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
|
|
452
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
|
|
453
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
|
|
454
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
455
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
456
|
-
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
457
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
|
|
458
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
459
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
|
|
460
|
-
err.rawResponse = httpRes;
|
|
461
|
-
throw new errors.FourHundredAndOneError(err);
|
|
462
|
-
}
|
|
463
|
-
else {
|
|
464
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
465
|
-
}
|
|
466
|
-
break;
|
|
467
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
|
|
468
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
469
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
|
|
470
|
-
err.rawResponse = httpRes;
|
|
471
|
-
throw new errors.FourHundredAndTwentyNineError(err);
|
|
472
|
-
}
|
|
473
|
-
else {
|
|
474
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
475
|
-
}
|
|
476
|
-
break;
|
|
477
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
|
|
478
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
479
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
|
|
480
|
-
err.rawResponse = httpRes;
|
|
481
|
-
throw new errors.FiveHundredError(err);
|
|
482
|
-
}
|
|
483
|
-
else {
|
|
484
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
485
|
-
}
|
|
486
|
-
break;
|
|
487
|
-
}
|
|
488
|
-
return [2 /*return*/, res];
|
|
489
|
-
}
|
|
490
|
-
});
|
|
491
|
-
});
|
|
492
|
-
};
|
|
493
|
-
/**
|
|
494
|
-
* Create customer
|
|
495
|
-
*
|
|
496
|
-
* @remarks
|
|
497
|
-
* This operation is used to create an Orb customer, who is party to the core billing relationship. See
|
|
498
|
-
* [Customer](../guides/concepts#customer) for an overview of the customer resource.
|
|
499
|
-
*
|
|
500
|
-
* This endpoint is critical in the following Orb functionality:
|
|
501
|
-
* * Automated charges can be configured by setting `payment_provider` and `payment_provider_id` to automatically
|
|
502
|
-
* issue invoices
|
|
503
|
-
* * [Customer ID Aliases](../guides/events-and-metrics/customer-aliases) can be configured by setting
|
|
504
|
-
* `external_customer_id`
|
|
505
|
-
* * [Timezone localization](../guides/product-catalog/timezones.md) can be configured on a per-customer basis by
|
|
506
|
-
* setting the `timezone` parameter
|
|
507
|
-
*/
|
|
508
|
-
Customer.prototype.create = function (req, config) {
|
|
509
|
-
var _a, _b;
|
|
510
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
511
|
-
var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
|
|
512
|
-
var _d;
|
|
513
|
-
return __generator(this, function (_e) {
|
|
514
|
-
switch (_e.label) {
|
|
515
|
-
case 0:
|
|
516
|
-
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
517
|
-
req = new shared.NewCustomer(req);
|
|
518
|
-
}
|
|
519
|
-
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
520
|
-
url = baseURL.replace(/\/$/, "") + "/customers";
|
|
521
|
-
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
522
|
-
try {
|
|
523
|
-
_d = __read(utils.serializeRequestBody(req, "request", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
524
|
-
}
|
|
525
|
-
catch (e) {
|
|
526
|
-
if (e instanceof Error) {
|
|
527
|
-
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
client = this.sdkConfiguration.defaultClient;
|
|
531
|
-
globalSecurity = this.sdkConfiguration.security;
|
|
532
|
-
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
533
|
-
return [4 /*yield*/, globalSecurity()];
|
|
534
|
-
case 1:
|
|
535
|
-
globalSecurity = _e.sent();
|
|
536
|
-
_e.label = 2;
|
|
537
|
-
case 2:
|
|
538
|
-
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
539
|
-
globalSecurity = new shared.Security(globalSecurity);
|
|
540
|
-
}
|
|
541
|
-
properties = utils.parseSecurityProperties(globalSecurity);
|
|
542
|
-
headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
543
|
-
headers["Accept"] = "application/json";
|
|
544
|
-
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
545
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
|
|
546
|
-
case 3:
|
|
547
|
-
httpRes = _e.sent();
|
|
548
|
-
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
549
|
-
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
550
|
-
throw new Error("status code not found in response: ".concat(httpRes));
|
|
551
|
-
}
|
|
552
|
-
res = new operations.CreateCustomerResponse({
|
|
553
|
-
statusCode: httpRes.status,
|
|
554
|
-
contentType: contentType,
|
|
555
|
-
rawResponse: httpRes,
|
|
556
|
-
});
|
|
557
|
-
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
558
|
-
switch (true) {
|
|
559
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 201:
|
|
560
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
561
|
-
res.customer = utils.objectToClass(JSON.parse(decodedRes), shared.Customer);
|
|
562
|
-
}
|
|
563
|
-
else {
|
|
564
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
565
|
-
}
|
|
566
|
-
break;
|
|
567
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
|
|
568
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
|
|
569
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
|
|
570
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
|
|
571
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
572
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
573
|
-
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
574
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
|
|
575
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
576
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
|
|
577
|
-
err.rawResponse = httpRes;
|
|
578
|
-
throw new errors.FourHundredAndOneError(err);
|
|
579
|
-
}
|
|
580
|
-
else {
|
|
581
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
582
|
-
}
|
|
583
|
-
break;
|
|
584
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
|
|
585
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
586
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
|
|
587
|
-
err.rawResponse = httpRes;
|
|
588
|
-
throw new errors.FourHundredAndTwentyNineError(err);
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
592
|
-
}
|
|
593
|
-
break;
|
|
594
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
|
|
595
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
596
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
|
|
597
|
-
err.rawResponse = httpRes;
|
|
598
|
-
throw new errors.FiveHundredError(err);
|
|
599
|
-
}
|
|
600
|
-
else {
|
|
601
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
602
|
-
}
|
|
603
|
-
break;
|
|
604
|
-
}
|
|
605
|
-
return [2 /*return*/, res];
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
});
|
|
609
|
-
};
|
|
610
|
-
/**
|
|
611
|
-
* Create customer balance transaction
|
|
612
|
-
*
|
|
613
|
-
* @remarks
|
|
614
|
-
* Creates an immutable balance transaction that updates the customer's balance and returns back the newly created
|
|
615
|
-
* transaction.
|
|
616
|
-
*/
|
|
617
|
-
Customer.prototype.createBalanceTransaction = function (customerId, newCustomerBalanceTransaction, config) {
|
|
618
|
-
var _a, _b;
|
|
619
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
620
|
-
var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
|
|
621
|
-
var _d;
|
|
622
|
-
return __generator(this, function (_e) {
|
|
623
|
-
switch (_e.label) {
|
|
624
|
-
case 0:
|
|
625
|
-
req = new operations.CreateCustomerBalanceTransactionRequest({
|
|
626
|
-
customerId: customerId,
|
|
627
|
-
newCustomerBalanceTransaction: newCustomerBalanceTransaction,
|
|
628
|
-
});
|
|
629
|
-
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
630
|
-
url = utils.generateURL(baseURL, "/customers/{customer_id}/balance_transactions", req);
|
|
631
|
-
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
632
|
-
try {
|
|
633
|
-
_d = __read(utils.serializeRequestBody(req, "newCustomerBalanceTransaction", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
634
|
-
}
|
|
635
|
-
catch (e) {
|
|
636
|
-
if (e instanceof Error) {
|
|
637
|
-
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
client = this.sdkConfiguration.defaultClient;
|
|
641
|
-
globalSecurity = this.sdkConfiguration.security;
|
|
642
|
-
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
643
|
-
return [4 /*yield*/, globalSecurity()];
|
|
644
|
-
case 1:
|
|
645
|
-
globalSecurity = _e.sent();
|
|
646
|
-
_e.label = 2;
|
|
647
|
-
case 2:
|
|
648
|
-
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
649
|
-
globalSecurity = new shared.Security(globalSecurity);
|
|
650
|
-
}
|
|
651
|
-
properties = utils.parseSecurityProperties(globalSecurity);
|
|
652
|
-
headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
653
|
-
headers["Accept"] = "application/json";
|
|
654
|
-
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
655
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
|
|
656
|
-
case 3:
|
|
657
|
-
httpRes = _e.sent();
|
|
658
|
-
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
659
|
-
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
660
|
-
throw new Error("status code not found in response: ".concat(httpRes));
|
|
661
|
-
}
|
|
662
|
-
res = new operations.CreateCustomerBalanceTransactionResponse({
|
|
663
|
-
statusCode: httpRes.status,
|
|
664
|
-
contentType: contentType,
|
|
665
|
-
rawResponse: httpRes,
|
|
666
|
-
});
|
|
667
|
-
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
668
|
-
switch (true) {
|
|
669
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
670
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
671
|
-
res.customerBalanceTransaction = utils.objectToClass(JSON.parse(decodedRes), shared.CustomerBalanceTransaction);
|
|
672
|
-
}
|
|
673
|
-
else {
|
|
674
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
675
|
-
}
|
|
676
|
-
break;
|
|
677
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
|
|
678
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
|
|
679
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
|
|
680
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
|
|
681
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
682
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
683
|
-
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
684
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
|
|
685
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
686
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
|
|
687
|
-
err.rawResponse = httpRes;
|
|
688
|
-
throw new errors.FourHundredAndOneError(err);
|
|
689
|
-
}
|
|
690
|
-
else {
|
|
691
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
692
|
-
}
|
|
693
|
-
break;
|
|
694
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
|
|
695
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
696
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
|
|
697
|
-
err.rawResponse = httpRes;
|
|
698
|
-
throw new errors.FourHundredAndTwentyNineError(err);
|
|
699
|
-
}
|
|
700
|
-
else {
|
|
701
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
702
|
-
}
|
|
703
|
-
break;
|
|
704
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
|
|
705
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
706
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
|
|
707
|
-
err.rawResponse = httpRes;
|
|
708
|
-
throw new errors.FiveHundredError(err);
|
|
709
|
-
}
|
|
710
|
-
else {
|
|
711
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
712
|
-
}
|
|
713
|
-
break;
|
|
714
|
-
}
|
|
715
|
-
return [2 /*return*/, res];
|
|
716
|
-
}
|
|
717
|
-
});
|
|
718
|
-
});
|
|
719
|
-
};
|
|
720
|
-
/**
|
|
721
|
-
* Delete customer
|
|
722
|
-
*
|
|
723
|
-
* @remarks
|
|
724
|
-
* This performs a deletion of this customer, its subscriptions, and its invoices.
|
|
725
|
-
* This operation is irreversible. Note that this is a _soft_ deletion, but the data
|
|
726
|
-
* will be inaccessible through the API and Orb dashboard. For hard-deletion, please
|
|
727
|
-
* reach out to the Orb team directly.
|
|
728
|
-
*
|
|
729
|
-
* **Note**: This operation happens asynchronously and can be expected to take a
|
|
730
|
-
* few minutes to propagate to related resources. However, querying for the customer on
|
|
731
|
-
* subsequent GET requests while deletion is in process will reflect its deletion with
|
|
732
|
-
* a `deleted: true` property. Once the customer deletion has been fully processed,
|
|
733
|
-
* the customer will not be returned in the API.
|
|
734
|
-
*
|
|
735
|
-
*
|
|
736
|
-
* On successful processing, this returns an empty dictionary (`{}`) in the API.
|
|
737
|
-
*/
|
|
738
|
-
Customer.prototype.delete = function (customerId, config) {
|
|
739
|
-
var _a, _b;
|
|
740
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
741
|
-
var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
|
|
742
|
-
return __generator(this, function (_c) {
|
|
743
|
-
switch (_c.label) {
|
|
744
|
-
case 0:
|
|
745
|
-
req = new operations.DeleteCustomerRequest({
|
|
746
|
-
customerId: customerId,
|
|
747
|
-
});
|
|
748
|
-
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
749
|
-
url = utils.generateURL(baseURL, "/customers/{customer_id}", req);
|
|
750
|
-
client = this.sdkConfiguration.defaultClient;
|
|
751
|
-
globalSecurity = this.sdkConfiguration.security;
|
|
752
|
-
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
753
|
-
return [4 /*yield*/, globalSecurity()];
|
|
754
|
-
case 1:
|
|
755
|
-
globalSecurity = _c.sent();
|
|
756
|
-
_c.label = 2;
|
|
757
|
-
case 2:
|
|
758
|
-
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
759
|
-
globalSecurity = new shared.Security(globalSecurity);
|
|
760
|
-
}
|
|
761
|
-
properties = utils.parseSecurityProperties(globalSecurity);
|
|
762
|
-
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
763
|
-
headers["Accept"] = "application/json";
|
|
764
|
-
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
765
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "delete", headers: headers, responseType: "arraybuffer" }, config))];
|
|
766
|
-
case 3:
|
|
767
|
-
httpRes = _c.sent();
|
|
768
|
-
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
769
|
-
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
770
|
-
throw new Error("status code not found in response: ".concat(httpRes));
|
|
771
|
-
}
|
|
772
|
-
res = new operations.DeleteCustomerResponse({
|
|
773
|
-
statusCode: httpRes.status,
|
|
774
|
-
contentType: contentType,
|
|
775
|
-
rawResponse: httpRes,
|
|
776
|
-
});
|
|
777
|
-
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
778
|
-
switch (true) {
|
|
779
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 204:
|
|
780
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
781
|
-
res.deleteCustomerResponse = utils.objectToClass(JSON.parse(decodedRes), shared.DeleteCustomerResponse);
|
|
782
|
-
}
|
|
783
|
-
else {
|
|
784
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
785
|
-
}
|
|
786
|
-
break;
|
|
787
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
|
|
788
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
|
|
789
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
|
|
790
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
|
|
791
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
792
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
793
|
-
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
794
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
|
|
795
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
796
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
|
|
797
|
-
err.rawResponse = httpRes;
|
|
798
|
-
throw new errors.FourHundredAndOneError(err);
|
|
799
|
-
}
|
|
800
|
-
else {
|
|
801
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
802
|
-
}
|
|
803
|
-
break;
|
|
804
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
|
|
805
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
806
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
|
|
807
|
-
err.rawResponse = httpRes;
|
|
808
|
-
throw new errors.FourHundredAndTwentyNineError(err);
|
|
809
|
-
}
|
|
810
|
-
else {
|
|
811
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
812
|
-
}
|
|
813
|
-
break;
|
|
814
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
|
|
815
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
816
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
|
|
817
|
-
err.rawResponse = httpRes;
|
|
818
|
-
throw new errors.FiveHundredError(err);
|
|
819
|
-
}
|
|
820
|
-
else {
|
|
821
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
822
|
-
}
|
|
823
|
-
break;
|
|
824
|
-
}
|
|
825
|
-
return [2 /*return*/, res];
|
|
826
|
-
}
|
|
827
|
-
});
|
|
828
|
-
});
|
|
829
|
-
};
|
|
830
|
-
/**
|
|
831
|
-
* Fetch customer
|
|
832
|
-
*
|
|
833
|
-
* @remarks
|
|
834
|
-
* This endpoint is used to fetch customer details given an identifier. If the `Customer` is in the process of being deleted,
|
|
835
|
-
* only the properties `id` and `deleted: true` will be returned.
|
|
836
|
-
*
|
|
837
|
-
* See the [Customer resource](../guides/core-concepts.mdx#customer) for a full discussion of the Customer model.
|
|
838
|
-
*/
|
|
839
|
-
Customer.prototype.fetch = function (customerId, config) {
|
|
840
|
-
var _a, _b;
|
|
841
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
842
|
-
var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
|
|
843
|
-
return __generator(this, function (_c) {
|
|
844
|
-
switch (_c.label) {
|
|
845
|
-
case 0:
|
|
846
|
-
req = new operations.FetchCustomerRequest({
|
|
847
|
-
customerId: customerId,
|
|
848
|
-
});
|
|
849
|
-
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
850
|
-
url = utils.generateURL(baseURL, "/customers/{customer_id}", req);
|
|
851
|
-
client = this.sdkConfiguration.defaultClient;
|
|
852
|
-
globalSecurity = this.sdkConfiguration.security;
|
|
853
|
-
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
854
|
-
return [4 /*yield*/, globalSecurity()];
|
|
855
|
-
case 1:
|
|
856
|
-
globalSecurity = _c.sent();
|
|
857
|
-
_c.label = 2;
|
|
858
|
-
case 2:
|
|
859
|
-
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
860
|
-
globalSecurity = new shared.Security(globalSecurity);
|
|
861
|
-
}
|
|
862
|
-
properties = utils.parseSecurityProperties(globalSecurity);
|
|
863
|
-
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
864
|
-
headers["Accept"] = "application/json";
|
|
865
|
-
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
866
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
867
|
-
case 3:
|
|
868
|
-
httpRes = _c.sent();
|
|
869
|
-
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
870
|
-
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
871
|
-
throw new Error("status code not found in response: ".concat(httpRes));
|
|
872
|
-
}
|
|
873
|
-
res = new operations.FetchCustomerResponse({
|
|
874
|
-
statusCode: httpRes.status,
|
|
875
|
-
contentType: contentType,
|
|
876
|
-
rawResponse: httpRes,
|
|
877
|
-
});
|
|
878
|
-
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
879
|
-
switch (true) {
|
|
880
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
881
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
882
|
-
res.customer = utils.objectToClass(JSON.parse(decodedRes), shared.Customer);
|
|
883
|
-
}
|
|
884
|
-
else {
|
|
885
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
886
|
-
}
|
|
887
|
-
break;
|
|
888
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
|
|
889
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
|
|
890
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
|
|
891
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
|
|
892
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
893
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
894
|
-
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
895
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
|
|
896
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
897
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
|
|
898
|
-
err.rawResponse = httpRes;
|
|
899
|
-
throw new errors.FourHundredAndOneError(err);
|
|
900
|
-
}
|
|
901
|
-
else {
|
|
902
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
903
|
-
}
|
|
904
|
-
break;
|
|
905
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
|
|
906
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
907
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
|
|
908
|
-
err.rawResponse = httpRes;
|
|
909
|
-
throw new errors.FourHundredAndTwentyNineError(err);
|
|
910
|
-
}
|
|
911
|
-
else {
|
|
912
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
913
|
-
}
|
|
914
|
-
break;
|
|
915
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
|
|
916
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
917
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
|
|
918
|
-
err.rawResponse = httpRes;
|
|
919
|
-
throw new errors.FiveHundredError(err);
|
|
920
|
-
}
|
|
921
|
-
else {
|
|
922
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
923
|
-
}
|
|
924
|
-
break;
|
|
925
|
-
}
|
|
926
|
-
return [2 /*return*/, res];
|
|
927
|
-
}
|
|
928
|
-
});
|
|
929
|
-
});
|
|
930
|
-
};
|
|
931
|
-
/**
|
|
932
|
-
* Fetch customer by external ID
|
|
933
|
-
*
|
|
934
|
-
* @remarks
|
|
935
|
-
* This endpoint is used to fetch customer details given an `external_customer_id` (see
|
|
936
|
-
* [Customer ID Aliases](../guides/events-and-metrics/customer-aliases)).
|
|
937
|
-
*
|
|
938
|
-
* Note that the resource and semantics of this endpoint exactly mirror [Get Customer](fetch-customer).
|
|
939
|
-
*/
|
|
940
|
-
Customer.prototype.fetchByExternalId = function (externalCustomerId, config) {
|
|
941
|
-
var _a, _b;
|
|
942
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
943
|
-
var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
|
|
944
|
-
return __generator(this, function (_c) {
|
|
945
|
-
switch (_c.label) {
|
|
946
|
-
case 0:
|
|
947
|
-
req = new operations.FetchCustomerExternalIdRequest({
|
|
948
|
-
externalCustomerId: externalCustomerId,
|
|
949
|
-
});
|
|
950
|
-
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
951
|
-
url = utils.generateURL(baseURL, "/customers/external_customer_id/{external_customer_id}", req);
|
|
952
|
-
client = this.sdkConfiguration.defaultClient;
|
|
953
|
-
globalSecurity = this.sdkConfiguration.security;
|
|
954
|
-
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
955
|
-
return [4 /*yield*/, globalSecurity()];
|
|
956
|
-
case 1:
|
|
957
|
-
globalSecurity = _c.sent();
|
|
958
|
-
_c.label = 2;
|
|
959
|
-
case 2:
|
|
960
|
-
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
961
|
-
globalSecurity = new shared.Security(globalSecurity);
|
|
962
|
-
}
|
|
963
|
-
properties = utils.parseSecurityProperties(globalSecurity);
|
|
964
|
-
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
965
|
-
headers["Accept"] = "application/json";
|
|
966
|
-
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
967
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
968
|
-
case 3:
|
|
969
|
-
httpRes = _c.sent();
|
|
970
|
-
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
971
|
-
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
972
|
-
throw new Error("status code not found in response: ".concat(httpRes));
|
|
973
|
-
}
|
|
974
|
-
res = new operations.FetchCustomerExternalIdResponse({
|
|
975
|
-
statusCode: httpRes.status,
|
|
976
|
-
contentType: contentType,
|
|
977
|
-
rawResponse: httpRes,
|
|
978
|
-
});
|
|
979
|
-
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
980
|
-
switch (true) {
|
|
981
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
982
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
983
|
-
res.customer = utils.objectToClass(JSON.parse(decodedRes), shared.Customer);
|
|
984
|
-
}
|
|
985
|
-
else {
|
|
986
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
987
|
-
}
|
|
988
|
-
break;
|
|
989
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
|
|
990
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
|
|
991
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
|
|
992
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
|
|
993
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
994
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
995
|
-
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
996
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
|
|
997
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
998
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
|
|
999
|
-
err.rawResponse = httpRes;
|
|
1000
|
-
throw new errors.FourHundredAndOneError(err);
|
|
1001
|
-
}
|
|
1002
|
-
else {
|
|
1003
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1004
|
-
}
|
|
1005
|
-
break;
|
|
1006
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
|
|
1007
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1008
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
|
|
1009
|
-
err.rawResponse = httpRes;
|
|
1010
|
-
throw new errors.FourHundredAndTwentyNineError(err);
|
|
1011
|
-
}
|
|
1012
|
-
else {
|
|
1013
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1014
|
-
}
|
|
1015
|
-
break;
|
|
1016
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
|
|
1017
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1018
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
|
|
1019
|
-
err.rawResponse = httpRes;
|
|
1020
|
-
throw new errors.FiveHundredError(err);
|
|
1021
|
-
}
|
|
1022
|
-
else {
|
|
1023
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1024
|
-
}
|
|
1025
|
-
break;
|
|
1026
|
-
}
|
|
1027
|
-
return [2 /*return*/, res];
|
|
1028
|
-
}
|
|
1029
|
-
});
|
|
1030
|
-
});
|
|
1031
|
-
};
|
|
1032
|
-
/**
|
|
1033
|
-
* Fetch customer costs
|
|
1034
|
-
*
|
|
1035
|
-
* @remarks
|
|
1036
|
-
* This endpoint is used to fetch a day-by-day snapshot of a customer's costs in Orb, calculated by applying pricing
|
|
1037
|
-
* information to the underlying usage (see the [subscription usage endpoint](fetch-subscription-usage.api.mdx) to
|
|
1038
|
-
* fetch usage per metric, in usage units rather than a currency).
|
|
1039
|
-
*
|
|
1040
|
-
* This endpoint can be leveraged for internal tooling and to provide a more transparent billing experience for your
|
|
1041
|
-
* end users:
|
|
1042
|
-
*
|
|
1043
|
-
* 1. Understand the cost breakdown per line item historically and in real-time for the current billing period.
|
|
1044
|
-
* 2. Provide customer visibility into how different services are contributing to the overall invoice with a per-day
|
|
1045
|
-
* timeseries (as compared to the [upcoming invoice](fetch-upcoming-invoice) resource, which represents a snapshot
|
|
1046
|
-
* for the current period).
|
|
1047
|
-
* 3. Assess how minimums and discounts affect your customers by teasing apart costs directly as a result of usage,
|
|
1048
|
-
* as opposed to minimums and discounts at the plan and price level.
|
|
1049
|
-
* 4. Gain insight into key customer health metrics, such as the percent utilization of the minimum committed spend.
|
|
1050
|
-
*
|
|
1051
|
-
* ## Fetching subscriptions
|
|
1052
|
-
* By default, this endpoint fetches the currently active subscription for the customer, and returns cost information
|
|
1053
|
-
* for the subscription's current billing period, broken down by each participating price. If there are no currently
|
|
1054
|
-
* active subscriptions, this will instead default to the most recently active subscription or return an empty series
|
|
1055
|
-
* if none are found. For example, if your plan charges for compute hours, job runs, and data syncs, then this endpoint
|
|
1056
|
-
* would provide a daily breakdown of your customer's cost for each of those axes.
|
|
1057
|
-
*
|
|
1058
|
-
* If timeframe bounds are specified, Orb fetches all subscriptions that were active in that timeframe. If two
|
|
1059
|
-
* subscriptions overlap on a single day, costs from each price will be summed, and prices for both subscriptions will
|
|
1060
|
-
* be included in the breakdown.
|
|
1061
|
-
*
|
|
1062
|
-
* ## Prepaid plans
|
|
1063
|
-
* For plans that include prices which deduct credits rather than accrue in-arrears charges in a billable currency,
|
|
1064
|
-
* this endpoint will return the total deduction amount, in credits, for the specified timeframe.
|
|
1065
|
-
*
|
|
1066
|
-
* ## Cumulative subtotals and totals
|
|
1067
|
-
* Since the subtotal and total must factor in any billing-period level discounts and minimums, it's most meaningful
|
|
1068
|
-
* to consider costs relative to the start of the subscription's billing period. As a result, by default this endpoint
|
|
1069
|
-
* returns cumulative totals since the beginning of the billing period. In particular, the `timeframe_start` of a
|
|
1070
|
-
* returned timeframe window is *always* the beginning of the billing period and `timeframe_end` is incremented one day
|
|
1071
|
-
* at a time to build the result.
|
|
1072
|
-
*
|
|
1073
|
-
* A customer that uses a few API calls a day but has a minimum commitment might exhibit the following pattern for
|
|
1074
|
-
* their subtotal and total in the first few days of the month. Here, we assume that each API call is $2.50, the
|
|
1075
|
-
* customer's plan has a monthly minimum of $50 for this price, and that the subscription's billing period bounds are
|
|
1076
|
-
* aligned to the first of the month:
|
|
1077
|
-
*
|
|
1078
|
-
* | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
|
|
1079
|
-
* | -----------| ----------- | ----------- | ----------- |----------- |
|
|
1080
|
-
* | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
|
|
1081
|
-
* | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
|
|
1082
|
-
* | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
|
|
1083
|
-
* | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
|
|
1084
|
-
* | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
|
|
1085
|
-
*
|
|
1086
|
-
* ### Periodic values
|
|
1087
|
-
* When the query parameter `view_mode=periodic` is specified, Orb will return an incremental day-by-day view of costs.
|
|
1088
|
-
* In this case, there will always be a one-day difference between `timeframe_start` and `timeframe_end` for the
|
|
1089
|
-
* timeframes returned. This is a transform on top of the cumulative costs, calculated by taking the difference of each
|
|
1090
|
-
* timeframe with the last. Note that in the above example, the `Total` value would be 0 for the second two data
|
|
1091
|
-
* points, since the minimum commitment has not yet been hit and each day is not contributing anything to the total
|
|
1092
|
-
* cost.
|
|
1093
|
-
*
|
|
1094
|
-
* ## Timeframe bounds
|
|
1095
|
-
* If no timeframe bounds are specified, the response will default to the current billing period for the customer's
|
|
1096
|
-
* subscription. For subscriptions that have ended, this will be the billing period when they were last active. If the
|
|
1097
|
-
* subscription starts or ends within the timeframe, the response will only include windows where the subscription is
|
|
1098
|
-
* active.
|
|
1099
|
-
*
|
|
1100
|
-
* As noted above, `timeframe_start` for a given cumulative datapoint is always the beginning of the billing period,
|
|
1101
|
-
* and `timeframe_end` is incremented one day at a time to construct the response. When a timeframe is passed in that
|
|
1102
|
-
* is not aligned to the current subscription's billing period, the response will contain cumulative totals from
|
|
1103
|
-
* multiple billing periods.
|
|
1104
|
-
*
|
|
1105
|
-
* Suppose the queried customer has a subscription aligned to the 15th of every month. If this endpoint is queried with
|
|
1106
|
-
* the date range `2023-06-01` - `2023-07-01`, the first data point will represent about half a billing period's worth
|
|
1107
|
-
* of costs, accounting for accruals from the start of the billing period and inclusive of the first day of the
|
|
1108
|
-
* timeframe (`timeframe_start = 2023-05-15 00:00:00`, `timeframe_end = 2023-06-02 00:00:00`)
|
|
1109
|
-
*
|
|
1110
|
-
* | datapoint index | timeframe_start | timeframe_end |
|
|
1111
|
-
* | ----------- | -----------| ----------- |
|
|
1112
|
-
* | 0 | 2023-05-15 | 2023-06-02 |
|
|
1113
|
-
* | 1 | 2023-05-15 | 2023-06-03 |
|
|
1114
|
-
* | 2 | ... | ... |
|
|
1115
|
-
* | 3 | 2023-05-15 | 2023-06-14 |
|
|
1116
|
-
* | 4 | 2023-06-15 | 2023-06-16 |
|
|
1117
|
-
* | 5 | 2023-06-15 | 2023-06-17 |
|
|
1118
|
-
* | 6 | ... | ... |
|
|
1119
|
-
* | 7 | 2023-06-15 | 2023-07-01 |
|
|
1120
|
-
*
|
|
1121
|
-
* You can see this sliced timeframe visualized [here](https://i.imgur.com/TXhYgme.png).
|
|
1122
|
-
*
|
|
1123
|
-
* ## Grouping by custom attributes
|
|
1124
|
-
* In order to view costs grouped by a specific _attribute_ that each event is tagged with (i.e. `cluster`), you can
|
|
1125
|
-
* additionally specify a `group_by` key. The `group_by` key denotes the event property on which to group.
|
|
1126
|
-
*
|
|
1127
|
-
* When returning grouped costs, a separate `price_group` object in the `per_price_costs` array is returned for each
|
|
1128
|
-
* value of the `group_by` key present in your events. The `subtotal` value of the `per_price_costs` object is the sum
|
|
1129
|
-
* of each `price_group`'s total.
|
|
1130
|
-
*
|
|
1131
|
-
* Orb expects events will contain values in the `properties` dictionary that correspond to the `group_by` key
|
|
1132
|
-
* specified. By default, Orb will return a `null` group (i.e. events that match the metric but do not have the key
|
|
1133
|
-
* set). Currently, it is only possible to view costs grouped by a single attribute at a time.
|
|
1134
|
-
*
|
|
1135
|
-
* ### Matrix prices
|
|
1136
|
-
* When a price uses matrix pricing, it's important to view costs grouped by those matrix dimensions. Orb will return
|
|
1137
|
-
* `price_groups` with the `grouping_key` and `secondary_grouping_key` based on the matrix price definition, for each
|
|
1138
|
-
* `grouping_value` and `secondary_grouping_value` available.
|
|
1139
|
-
*/
|
|
1140
|
-
Customer.prototype.fetchCosts = function (req, config) {
|
|
1141
|
-
var _a, _b;
|
|
1142
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1143
|
-
var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
|
|
1144
|
-
return __generator(this, function (_c) {
|
|
1145
|
-
switch (_c.label) {
|
|
1146
|
-
case 0:
|
|
1147
|
-
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
1148
|
-
req = new operations.FetchCustomerCostsRequest(req);
|
|
1149
|
-
}
|
|
1150
|
-
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
1151
|
-
url = utils.generateURL(baseURL, "/customers/{customer_id}/costs", req);
|
|
1152
|
-
client = this.sdkConfiguration.defaultClient;
|
|
1153
|
-
globalSecurity = this.sdkConfiguration.security;
|
|
1154
|
-
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
1155
|
-
return [4 /*yield*/, globalSecurity()];
|
|
1156
|
-
case 1:
|
|
1157
|
-
globalSecurity = _c.sent();
|
|
1158
|
-
_c.label = 2;
|
|
1159
|
-
case 2:
|
|
1160
|
-
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
1161
|
-
globalSecurity = new shared.Security(globalSecurity);
|
|
1162
|
-
}
|
|
1163
|
-
properties = utils.parseSecurityProperties(globalSecurity);
|
|
1164
|
-
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
1165
|
-
queryParams = utils.serializeQueryParams(req);
|
|
1166
|
-
headers["Accept"] = "application/json";
|
|
1167
|
-
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
1168
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
1169
|
-
case 3:
|
|
1170
|
-
httpRes = _c.sent();
|
|
1171
|
-
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
1172
|
-
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
1173
|
-
throw new Error("status code not found in response: ".concat(httpRes));
|
|
1174
|
-
}
|
|
1175
|
-
res = new operations.FetchCustomerCostsResponse({
|
|
1176
|
-
statusCode: httpRes.status,
|
|
1177
|
-
contentType: contentType,
|
|
1178
|
-
rawResponse: httpRes,
|
|
1179
|
-
});
|
|
1180
|
-
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
1181
|
-
switch (true) {
|
|
1182
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
1183
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1184
|
-
res.customerCosts = utils.objectToClass(JSON.parse(decodedRes), shared.CustomerCosts);
|
|
1185
|
-
}
|
|
1186
|
-
else {
|
|
1187
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1188
|
-
}
|
|
1189
|
-
break;
|
|
1190
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
|
|
1191
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
|
|
1192
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
|
|
1193
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
|
|
1194
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
1195
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
1196
|
-
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
1197
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
|
|
1198
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1199
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
|
|
1200
|
-
err.rawResponse = httpRes;
|
|
1201
|
-
throw new errors.FourHundredAndOneError(err);
|
|
1202
|
-
}
|
|
1203
|
-
else {
|
|
1204
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1205
|
-
}
|
|
1206
|
-
break;
|
|
1207
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
|
|
1208
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1209
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
|
|
1210
|
-
err.rawResponse = httpRes;
|
|
1211
|
-
throw new errors.FourHundredAndTwentyNineError(err);
|
|
1212
|
-
}
|
|
1213
|
-
else {
|
|
1214
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1215
|
-
}
|
|
1216
|
-
break;
|
|
1217
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
|
|
1218
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1219
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
|
|
1220
|
-
err.rawResponse = httpRes;
|
|
1221
|
-
throw new errors.FiveHundredError(err);
|
|
1222
|
-
}
|
|
1223
|
-
else {
|
|
1224
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1225
|
-
}
|
|
1226
|
-
break;
|
|
1227
|
-
}
|
|
1228
|
-
return [2 /*return*/, res];
|
|
1229
|
-
}
|
|
1230
|
-
});
|
|
1231
|
-
});
|
|
1232
|
-
};
|
|
1233
|
-
/**
|
|
1234
|
-
* Fetch customer costs by external ID
|
|
1235
|
-
*
|
|
1236
|
-
* @remarks
|
|
1237
|
-
* This endpoint is used to fetch a day-by-day snapshot of a customer's costs in Orb, calculated by applying pricing
|
|
1238
|
-
* information to the underlying usage (see the [subscription usage endpoint](fetch-subscription-usage.api.mdx) to
|
|
1239
|
-
* fetch usage per metric, in usage units rather than a currency).
|
|
1240
|
-
*
|
|
1241
|
-
* This endpoint can be leveraged for internal tooling and to provide a more transparent billing experience for your
|
|
1242
|
-
* end users:
|
|
1243
|
-
*
|
|
1244
|
-
* 1. Understand the cost breakdown per line item historically and in real-time for the current billing period.
|
|
1245
|
-
* 2. Provide customer visibility into how different services are contributing to the overall invoice with a per-day
|
|
1246
|
-
* timeseries (as compared to the [upcoming invoice](fetch-upcoming-invoice) resource, which represents a snapshot
|
|
1247
|
-
* for the current period).
|
|
1248
|
-
* 3. Assess how minimums and discounts affect your customers by teasing apart costs directly as a result of usage,
|
|
1249
|
-
* as opposed to minimums and discounts at the plan and price level.
|
|
1250
|
-
* 4. Gain insight into key customer health metrics, such as the percent utilization of the minimum committed spend.
|
|
1251
|
-
*
|
|
1252
|
-
* ## Fetching subscriptions
|
|
1253
|
-
* By default, this endpoint fetches the currently active subscription for the customer, and returns cost information
|
|
1254
|
-
* for the subscription's current billing period, broken down by each participating price. If there are no currently
|
|
1255
|
-
* active subscriptions, this will instead default to the most recently active subscription or return an empty series
|
|
1256
|
-
* if none are found. For example, if your plan charges for compute hours, job runs, and data syncs, then this endpoint
|
|
1257
|
-
* would provide a daily breakdown of your customer's cost for each of those axes.
|
|
1258
|
-
*
|
|
1259
|
-
* If timeframe bounds are specified, Orb fetches all subscriptions that were active in that timeframe. If two
|
|
1260
|
-
* subscriptions overlap on a single day, costs from each price will be summed, and prices for both subscriptions will
|
|
1261
|
-
* be included in the breakdown.
|
|
1262
|
-
*
|
|
1263
|
-
* ## Prepaid plans
|
|
1264
|
-
* For plans that include prices which deduct credits rather than accrue in-arrears charges in a billable currency,
|
|
1265
|
-
* this endpoint will return the total deduction amount, in credits, for the specified timeframe.
|
|
1266
|
-
*
|
|
1267
|
-
* ## Cumulative subtotals and totals
|
|
1268
|
-
* Since the subtotal and total must factor in any billing-period level discounts and minimums, it's most meaningful
|
|
1269
|
-
* to consider costs relative to the start of the subscription's billing period. As a result, by default this endpoint
|
|
1270
|
-
* returns cumulative totals since the beginning of the billing period. In particular, the `timeframe_start` of a
|
|
1271
|
-
* returned timeframe window is *always* the beginning of the billing period and `timeframe_end` is incremented one day
|
|
1272
|
-
* at a time to build the result.
|
|
1273
|
-
*
|
|
1274
|
-
* A customer that uses a few API calls a day but has a minimum commitment might exhibit the following pattern for
|
|
1275
|
-
* their subtotal and total in the first few days of the month. Here, we assume that each API call is $2.50, the
|
|
1276
|
-
* customer's plan has a monthly minimum of $50 for this price, and that the subscription's billing period bounds are
|
|
1277
|
-
* aligned to the first of the month:
|
|
1278
|
-
*
|
|
1279
|
-
* | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
|
|
1280
|
-
* | -----------| ----------- | ----------- | ----------- |----------- |
|
|
1281
|
-
* | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
|
|
1282
|
-
* | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
|
|
1283
|
-
* | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
|
|
1284
|
-
* | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
|
|
1285
|
-
* | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
|
|
1286
|
-
*
|
|
1287
|
-
* ### Periodic values
|
|
1288
|
-
* When the query parameter `view_mode=periodic` is specified, Orb will return an incremental day-by-day view of costs.
|
|
1289
|
-
* In this case, there will always be a one-day difference between `timeframe_start` and `timeframe_end` for the
|
|
1290
|
-
* timeframes returned. This is a transform on top of the cumulative costs, calculated by taking the difference of each
|
|
1291
|
-
* timeframe with the last. Note that in the above example, the `Total` value would be 0 for the second two data
|
|
1292
|
-
* points, since the minimum commitment has not yet been hit and each day is not contributing anything to the total
|
|
1293
|
-
* cost.
|
|
1294
|
-
*
|
|
1295
|
-
* ## Timeframe bounds
|
|
1296
|
-
* If no timeframe bounds are specified, the response will default to the current billing period for the customer's
|
|
1297
|
-
* subscription. For subscriptions that have ended, this will be the billing period when they were last active. If the
|
|
1298
|
-
* subscription starts or ends within the timeframe, the response will only include windows where the subscription is
|
|
1299
|
-
* active.
|
|
1300
|
-
*
|
|
1301
|
-
* As noted above, `timeframe_start` for a given cumulative datapoint is always the beginning of the billing period,
|
|
1302
|
-
* and `timeframe_end` is incremented one day at a time to construct the response. When a timeframe is passed in that
|
|
1303
|
-
* is not aligned to the current subscription's billing period, the response will contain cumulative totals from
|
|
1304
|
-
* multiple billing periods.
|
|
1305
|
-
*
|
|
1306
|
-
* Suppose the queried customer has a subscription aligned to the 15th of every month. If this endpoint is queried with
|
|
1307
|
-
* the date range `2023-06-01` - `2023-07-01`, the first data point will represent about half a billing period's worth
|
|
1308
|
-
* of costs, accounting for accruals from the start of the billing period and inclusive of the first day of the
|
|
1309
|
-
* timeframe (`timeframe_start = 2023-05-15 00:00:00`, `timeframe_end = 2023-06-02 00:00:00`)
|
|
1310
|
-
*
|
|
1311
|
-
* | datapoint index | timeframe_start | timeframe_end |
|
|
1312
|
-
* | ----------- | -----------| ----------- |
|
|
1313
|
-
* | 0 | 2023-05-15 | 2023-06-02 |
|
|
1314
|
-
* | 1 | 2023-05-15 | 2023-06-03 |
|
|
1315
|
-
* | 2 | ... | ... |
|
|
1316
|
-
* | 3 | 2023-05-15 | 2023-06-14 |
|
|
1317
|
-
* | 4 | 2023-06-15 | 2023-06-16 |
|
|
1318
|
-
* | 5 | 2023-06-15 | 2023-06-17 |
|
|
1319
|
-
* | 6 | ... | ... |
|
|
1320
|
-
* | 7 | 2023-06-15 | 2023-07-01 |
|
|
1321
|
-
*
|
|
1322
|
-
* You can see this sliced timeframe visualized [here](https://i.imgur.com/TXhYgme.png).
|
|
1323
|
-
*
|
|
1324
|
-
* ## Grouping by custom attributes
|
|
1325
|
-
* In order to view costs grouped by a specific _attribute_ that each event is tagged with (i.e. `cluster`), you can
|
|
1326
|
-
* additionally specify a `group_by` key. The `group_by` key denotes the event property on which to group.
|
|
1327
|
-
*
|
|
1328
|
-
* When returning grouped costs, a separate `price_group` object in the `per_price_costs` array is returned for each
|
|
1329
|
-
* value of the `group_by` key present in your events. The `subtotal` value of the `per_price_costs` object is the sum
|
|
1330
|
-
* of each `price_group`'s total.
|
|
1331
|
-
*
|
|
1332
|
-
* Orb expects events will contain values in the `properties` dictionary that correspond to the `group_by` key
|
|
1333
|
-
* specified. By default, Orb will return a `null` group (i.e. events that match the metric but do not have the key
|
|
1334
|
-
* set). Currently, it is only possible to view costs grouped by a single attribute at a time.
|
|
1335
|
-
*
|
|
1336
|
-
* ### Matrix prices
|
|
1337
|
-
* When a price uses matrix pricing, it's important to view costs grouped by those matrix dimensions. Orb will return
|
|
1338
|
-
* `price_groups` with the `grouping_key` and `secondary_grouping_key` based on the matrix price definition, for each
|
|
1339
|
-
* `grouping_value` and `secondary_grouping_value` available.
|
|
1340
|
-
*/
|
|
1341
|
-
Customer.prototype.fetchCostsByExternalId = function (req, config) {
|
|
1342
|
-
var _a, _b;
|
|
1343
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1344
|
-
var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
|
|
1345
|
-
return __generator(this, function (_c) {
|
|
1346
|
-
switch (_c.label) {
|
|
1347
|
-
case 0:
|
|
1348
|
-
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
1349
|
-
req = new operations.FetchCustomerCostsExternalIdRequest(req);
|
|
1350
|
-
}
|
|
1351
|
-
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
1352
|
-
url = utils.generateURL(baseURL, "/customers/external_customer_id/{external_customer_id}/costs", req);
|
|
1353
|
-
client = this.sdkConfiguration.defaultClient;
|
|
1354
|
-
globalSecurity = this.sdkConfiguration.security;
|
|
1355
|
-
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
1356
|
-
return [4 /*yield*/, globalSecurity()];
|
|
1357
|
-
case 1:
|
|
1358
|
-
globalSecurity = _c.sent();
|
|
1359
|
-
_c.label = 2;
|
|
1360
|
-
case 2:
|
|
1361
|
-
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
1362
|
-
globalSecurity = new shared.Security(globalSecurity);
|
|
1363
|
-
}
|
|
1364
|
-
properties = utils.parseSecurityProperties(globalSecurity);
|
|
1365
|
-
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
1366
|
-
queryParams = utils.serializeQueryParams(req);
|
|
1367
|
-
headers["Accept"] = "application/json";
|
|
1368
|
-
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
1369
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
1370
|
-
case 3:
|
|
1371
|
-
httpRes = _c.sent();
|
|
1372
|
-
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
1373
|
-
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
1374
|
-
throw new Error("status code not found in response: ".concat(httpRes));
|
|
1375
|
-
}
|
|
1376
|
-
res = new operations.FetchCustomerCostsExternalIdResponse({
|
|
1377
|
-
statusCode: httpRes.status,
|
|
1378
|
-
contentType: contentType,
|
|
1379
|
-
rawResponse: httpRes,
|
|
1380
|
-
});
|
|
1381
|
-
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
1382
|
-
switch (true) {
|
|
1383
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
1384
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1385
|
-
res.customerCosts = utils.objectToClass(JSON.parse(decodedRes), shared.CustomerCosts);
|
|
1386
|
-
}
|
|
1387
|
-
else {
|
|
1388
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1389
|
-
}
|
|
1390
|
-
break;
|
|
1391
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
|
|
1392
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
|
|
1393
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
|
|
1394
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
|
|
1395
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
1396
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
1397
|
-
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
1398
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
|
|
1399
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1400
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
|
|
1401
|
-
err.rawResponse = httpRes;
|
|
1402
|
-
throw new errors.FourHundredAndOneError(err);
|
|
1403
|
-
}
|
|
1404
|
-
else {
|
|
1405
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1406
|
-
}
|
|
1407
|
-
break;
|
|
1408
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
|
|
1409
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1410
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
|
|
1411
|
-
err.rawResponse = httpRes;
|
|
1412
|
-
throw new errors.FourHundredAndTwentyNineError(err);
|
|
1413
|
-
}
|
|
1414
|
-
else {
|
|
1415
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1416
|
-
}
|
|
1417
|
-
break;
|
|
1418
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
|
|
1419
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1420
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
|
|
1421
|
-
err.rawResponse = httpRes;
|
|
1422
|
-
throw new errors.FiveHundredError(err);
|
|
1423
|
-
}
|
|
1424
|
-
else {
|
|
1425
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1426
|
-
}
|
|
1427
|
-
break;
|
|
1428
|
-
}
|
|
1429
|
-
return [2 /*return*/, res];
|
|
1430
|
-
}
|
|
1431
|
-
});
|
|
1432
|
-
});
|
|
1433
|
-
};
|
|
1434
|
-
/**
|
|
1435
|
-
* List customers
|
|
1436
|
-
*
|
|
1437
|
-
* @remarks
|
|
1438
|
-
* This endpoint returns a list of all customers for an account.
|
|
1439
|
-
* The list of customers is ordered starting from the most recently created customer.
|
|
1440
|
-
* This endpoint follows Orb's [standardized pagination format](../reference/pagination).
|
|
1441
|
-
*
|
|
1442
|
-
* See [Customer](../guides/concepts#customer) for an overview of the customer model.
|
|
1443
|
-
*/
|
|
1444
|
-
Customer.prototype.list = function (req, config) {
|
|
1445
|
-
var _a, _b;
|
|
1446
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1447
|
-
var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
|
|
1448
|
-
return __generator(this, function (_c) {
|
|
1449
|
-
switch (_c.label) {
|
|
1450
|
-
case 0:
|
|
1451
|
-
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
1452
|
-
req = new operations.ListCustomersRequest(req);
|
|
1453
|
-
}
|
|
1454
|
-
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
1455
|
-
url = baseURL.replace(/\/$/, "") + "/customers";
|
|
1456
|
-
client = this.sdkConfiguration.defaultClient;
|
|
1457
|
-
globalSecurity = this.sdkConfiguration.security;
|
|
1458
|
-
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
1459
|
-
return [4 /*yield*/, globalSecurity()];
|
|
1460
|
-
case 1:
|
|
1461
|
-
globalSecurity = _c.sent();
|
|
1462
|
-
_c.label = 2;
|
|
1463
|
-
case 2:
|
|
1464
|
-
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
1465
|
-
globalSecurity = new shared.Security(globalSecurity);
|
|
1466
|
-
}
|
|
1467
|
-
properties = utils.parseSecurityProperties(globalSecurity);
|
|
1468
|
-
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
1469
|
-
queryParams = utils.serializeQueryParams(req);
|
|
1470
|
-
headers["Accept"] = "application/json";
|
|
1471
|
-
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
1472
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
1473
|
-
case 3:
|
|
1474
|
-
httpRes = _c.sent();
|
|
1475
|
-
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
1476
|
-
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
1477
|
-
throw new Error("status code not found in response: ".concat(httpRes));
|
|
1478
|
-
}
|
|
1479
|
-
res = new operations.ListCustomersResponse({
|
|
1480
|
-
statusCode: httpRes.status,
|
|
1481
|
-
contentType: contentType,
|
|
1482
|
-
rawResponse: httpRes,
|
|
1483
|
-
});
|
|
1484
|
-
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
1485
|
-
switch (true) {
|
|
1486
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
1487
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1488
|
-
res.customers = utils.objectToClass(JSON.parse(decodedRes), shared.Customers);
|
|
1489
|
-
}
|
|
1490
|
-
else {
|
|
1491
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1492
|
-
}
|
|
1493
|
-
break;
|
|
1494
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
|
|
1495
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
|
|
1496
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
|
|
1497
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
|
|
1498
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
1499
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
1500
|
-
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
1501
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
|
|
1502
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1503
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
|
|
1504
|
-
err.rawResponse = httpRes;
|
|
1505
|
-
throw new errors.FourHundredAndOneError(err);
|
|
1506
|
-
}
|
|
1507
|
-
else {
|
|
1508
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1509
|
-
}
|
|
1510
|
-
break;
|
|
1511
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
|
|
1512
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1513
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
|
|
1514
|
-
err.rawResponse = httpRes;
|
|
1515
|
-
throw new errors.FourHundredAndTwentyNineError(err);
|
|
1516
|
-
}
|
|
1517
|
-
else {
|
|
1518
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1519
|
-
}
|
|
1520
|
-
break;
|
|
1521
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
|
|
1522
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1523
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
|
|
1524
|
-
err.rawResponse = httpRes;
|
|
1525
|
-
throw new errors.FiveHundredError(err);
|
|
1526
|
-
}
|
|
1527
|
-
else {
|
|
1528
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1529
|
-
}
|
|
1530
|
-
break;
|
|
1531
|
-
}
|
|
1532
|
-
return [2 /*return*/, res];
|
|
1533
|
-
}
|
|
1534
|
-
});
|
|
1535
|
-
});
|
|
1536
|
-
};
|
|
1537
|
-
/**
|
|
1538
|
-
* List balance transactions
|
|
1539
|
-
*
|
|
1540
|
-
* @remarks
|
|
1541
|
-
* ## The customer balance
|
|
1542
|
-
*
|
|
1543
|
-
* The customer balance is an amount in the customer's currency, which Orb automatically applies to subsequent
|
|
1544
|
-
* invoices. This balance can be adjusted manually via Orb's webapp on the customer details page. You can use this
|
|
1545
|
-
* balance to provide a fixed mid-period credit to the customer. Commonly, this is done due to system downtime/SLA
|
|
1546
|
-
* violation, or an adhoc adjustment discussed with the customer.
|
|
1547
|
-
*
|
|
1548
|
-
* If the balance is a positive value at the time of invoicing, it represents that the customer has credit that should
|
|
1549
|
-
* be used to offset the amount due on the next issued invoice. In this case, Orb will automatically reduce the next
|
|
1550
|
-
* invoice by the balance amount, and roll over any remaining balance if the invoice is fully discounted.
|
|
1551
|
-
*
|
|
1552
|
-
* If the balance is a negative value at the time of invoicing, Orb will increase the invoice's amount due with a
|
|
1553
|
-
* positive adjustment, and reset the balance to 0.
|
|
1554
|
-
*
|
|
1555
|
-
* This endpoint retrieves all customer balance transactions in reverse chronological order for a single customer,
|
|
1556
|
-
* providing a complete audit trail of all adjustments and invoice applications.
|
|
1557
|
-
*
|
|
1558
|
-
* ## Eligibility
|
|
1559
|
-
*
|
|
1560
|
-
* The customer balance can only be applied to invoices or adjusted manually if invoices are not synced to a separate
|
|
1561
|
-
* invoicing provider. If a payment gateway such as Stripe is used, the balance will be applied to the invoice before
|
|
1562
|
-
* forwarding payment to the gateway.
|
|
1563
|
-
*/
|
|
1564
|
-
Customer.prototype.listBalanceTransactions = function (req, config) {
|
|
1565
|
-
var _a, _b;
|
|
1566
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1567
|
-
var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
|
|
1568
|
-
return __generator(this, function (_c) {
|
|
1569
|
-
switch (_c.label) {
|
|
1570
|
-
case 0:
|
|
1571
|
-
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
1572
|
-
req = new operations.ListBalanceTransactionsRequest(req);
|
|
1573
|
-
}
|
|
1574
|
-
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
1575
|
-
url = utils.generateURL(baseURL, "/customers/{customer_id}/balance_transactions", req);
|
|
1576
|
-
client = this.sdkConfiguration.defaultClient;
|
|
1577
|
-
globalSecurity = this.sdkConfiguration.security;
|
|
1578
|
-
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
1579
|
-
return [4 /*yield*/, globalSecurity()];
|
|
1580
|
-
case 1:
|
|
1581
|
-
globalSecurity = _c.sent();
|
|
1582
|
-
_c.label = 2;
|
|
1583
|
-
case 2:
|
|
1584
|
-
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
1585
|
-
globalSecurity = new shared.Security(globalSecurity);
|
|
1586
|
-
}
|
|
1587
|
-
properties = utils.parseSecurityProperties(globalSecurity);
|
|
1588
|
-
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
1589
|
-
queryParams = utils.serializeQueryParams(req);
|
|
1590
|
-
headers["Accept"] = "application/json";
|
|
1591
|
-
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
1592
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
|
|
1593
|
-
case 3:
|
|
1594
|
-
httpRes = _c.sent();
|
|
1595
|
-
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
1596
|
-
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
1597
|
-
throw new Error("status code not found in response: ".concat(httpRes));
|
|
1598
|
-
}
|
|
1599
|
-
res = new operations.ListBalanceTransactionsResponse({
|
|
1600
|
-
statusCode: httpRes.status,
|
|
1601
|
-
contentType: contentType,
|
|
1602
|
-
rawResponse: httpRes,
|
|
1603
|
-
});
|
|
1604
|
-
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
1605
|
-
switch (true) {
|
|
1606
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
1607
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1608
|
-
res.customerBalanceTransactions = utils.objectToClass(JSON.parse(decodedRes), shared.CustomerBalanceTransactions);
|
|
1609
|
-
}
|
|
1610
|
-
else {
|
|
1611
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1612
|
-
}
|
|
1613
|
-
break;
|
|
1614
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
|
|
1615
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
|
|
1616
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
|
|
1617
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
|
|
1618
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
1619
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
1620
|
-
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
1621
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
|
|
1622
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1623
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
|
|
1624
|
-
err.rawResponse = httpRes;
|
|
1625
|
-
throw new errors.FourHundredAndOneError(err);
|
|
1626
|
-
}
|
|
1627
|
-
else {
|
|
1628
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1629
|
-
}
|
|
1630
|
-
break;
|
|
1631
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
|
|
1632
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1633
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
|
|
1634
|
-
err.rawResponse = httpRes;
|
|
1635
|
-
throw new errors.FourHundredAndTwentyNineError(err);
|
|
1636
|
-
}
|
|
1637
|
-
else {
|
|
1638
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1639
|
-
}
|
|
1640
|
-
break;
|
|
1641
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
|
|
1642
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1643
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
|
|
1644
|
-
err.rawResponse = httpRes;
|
|
1645
|
-
throw new errors.FiveHundredError(err);
|
|
1646
|
-
}
|
|
1647
|
-
else {
|
|
1648
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1649
|
-
}
|
|
1650
|
-
break;
|
|
1651
|
-
}
|
|
1652
|
-
return [2 /*return*/, res];
|
|
1653
|
-
}
|
|
1654
|
-
});
|
|
1655
|
-
});
|
|
1656
|
-
};
|
|
1657
|
-
/**
|
|
1658
|
-
* Update customer by external ID
|
|
1659
|
-
*
|
|
1660
|
-
* @remarks
|
|
1661
|
-
* This endpoint is used to update customer details given an `external_customer_id`
|
|
1662
|
-
* (see [Customer ID Aliases](../guides/events-and-metrics/customer-aliases)).
|
|
1663
|
-
* Note that the resource and semantics of this
|
|
1664
|
-
* endpoint exactly mirror [Update Customer](update-customer).
|
|
1665
|
-
*/
|
|
1666
|
-
Customer.prototype.updateByExternalId = function (externalCustomerId, editCustomer, config) {
|
|
1667
|
-
var _a, _b;
|
|
1668
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1669
|
-
var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
|
|
1670
|
-
var _d;
|
|
1671
|
-
return __generator(this, function (_e) {
|
|
1672
|
-
switch (_e.label) {
|
|
1673
|
-
case 0:
|
|
1674
|
-
req = new operations.UpdateCustomerExternalIdRequest({
|
|
1675
|
-
externalCustomerId: externalCustomerId,
|
|
1676
|
-
editCustomer: editCustomer,
|
|
1677
|
-
});
|
|
1678
|
-
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
1679
|
-
url = utils.generateURL(baseURL, "/customers/external_customer_id/{external_customer_id}", req);
|
|
1680
|
-
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
1681
|
-
try {
|
|
1682
|
-
_d = __read(utils.serializeRequestBody(req, "editCustomer", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
1683
|
-
}
|
|
1684
|
-
catch (e) {
|
|
1685
|
-
if (e instanceof Error) {
|
|
1686
|
-
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
client = this.sdkConfiguration.defaultClient;
|
|
1690
|
-
globalSecurity = this.sdkConfiguration.security;
|
|
1691
|
-
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
1692
|
-
return [4 /*yield*/, globalSecurity()];
|
|
1693
|
-
case 1:
|
|
1694
|
-
globalSecurity = _e.sent();
|
|
1695
|
-
_e.label = 2;
|
|
1696
|
-
case 2:
|
|
1697
|
-
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
1698
|
-
globalSecurity = new shared.Security(globalSecurity);
|
|
1699
|
-
}
|
|
1700
|
-
properties = utils.parseSecurityProperties(globalSecurity);
|
|
1701
|
-
headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
1702
|
-
headers["Accept"] = "application/json";
|
|
1703
|
-
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
1704
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "put", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
|
|
1705
|
-
case 3:
|
|
1706
|
-
httpRes = _e.sent();
|
|
1707
|
-
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
1708
|
-
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
1709
|
-
throw new Error("status code not found in response: ".concat(httpRes));
|
|
1710
|
-
}
|
|
1711
|
-
res = new operations.UpdateCustomerExternalIdResponse({
|
|
1712
|
-
statusCode: httpRes.status,
|
|
1713
|
-
contentType: contentType,
|
|
1714
|
-
rawResponse: httpRes,
|
|
1715
|
-
});
|
|
1716
|
-
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
1717
|
-
switch (true) {
|
|
1718
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
1719
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1720
|
-
res.customer = utils.objectToClass(JSON.parse(decodedRes), shared.Customer);
|
|
1721
|
-
}
|
|
1722
|
-
else {
|
|
1723
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1724
|
-
}
|
|
1725
|
-
break;
|
|
1726
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
|
|
1727
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
|
|
1728
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
|
|
1729
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
|
|
1730
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
1731
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
1732
|
-
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
1733
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
|
|
1734
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1735
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
|
|
1736
|
-
err.rawResponse = httpRes;
|
|
1737
|
-
throw new errors.FourHundredAndOneError(err);
|
|
1738
|
-
}
|
|
1739
|
-
else {
|
|
1740
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1741
|
-
}
|
|
1742
|
-
break;
|
|
1743
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
|
|
1744
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1745
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
|
|
1746
|
-
err.rawResponse = httpRes;
|
|
1747
|
-
throw new errors.FourHundredAndTwentyNineError(err);
|
|
1748
|
-
}
|
|
1749
|
-
else {
|
|
1750
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1751
|
-
}
|
|
1752
|
-
break;
|
|
1753
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
|
|
1754
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1755
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
|
|
1756
|
-
err.rawResponse = httpRes;
|
|
1757
|
-
throw new errors.FiveHundredError(err);
|
|
1758
|
-
}
|
|
1759
|
-
else {
|
|
1760
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1761
|
-
}
|
|
1762
|
-
break;
|
|
1763
|
-
}
|
|
1764
|
-
return [2 /*return*/, res];
|
|
1765
|
-
}
|
|
1766
|
-
});
|
|
1767
|
-
});
|
|
1768
|
-
};
|
|
1769
|
-
/**
|
|
1770
|
-
* Update customer
|
|
1771
|
-
*
|
|
1772
|
-
* @remarks
|
|
1773
|
-
* This endpoint can be used to update the `payment_provider`, `payment_provider_id`, `name`, `email`, `email_delivery`, `tax_id`,
|
|
1774
|
-
* `auto_collection`, `metadata`, `shipping_address`, `billing_address`, and `additional_emails` of an existing customer.
|
|
1775
|
-
* "Other fields on a customer are currently immutable.
|
|
1776
|
-
*/
|
|
1777
|
-
Customer.prototype.updateCustomer = function (customerId, editCustomer, config) {
|
|
1778
|
-
var _a, _b;
|
|
1779
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1780
|
-
var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
|
|
1781
|
-
var _d;
|
|
1782
|
-
return __generator(this, function (_e) {
|
|
1783
|
-
switch (_e.label) {
|
|
1784
|
-
case 0:
|
|
1785
|
-
req = new operations.UpdateCustomerRequest({
|
|
1786
|
-
customerId: customerId,
|
|
1787
|
-
editCustomer: editCustomer,
|
|
1788
|
-
});
|
|
1789
|
-
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
1790
|
-
url = utils.generateURL(baseURL, "/customers/{customer_id}", req);
|
|
1791
|
-
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
1792
|
-
try {
|
|
1793
|
-
_d = __read(utils.serializeRequestBody(req, "editCustomer", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
1794
|
-
}
|
|
1795
|
-
catch (e) {
|
|
1796
|
-
if (e instanceof Error) {
|
|
1797
|
-
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
client = this.sdkConfiguration.defaultClient;
|
|
1801
|
-
globalSecurity = this.sdkConfiguration.security;
|
|
1802
|
-
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
1803
|
-
return [4 /*yield*/, globalSecurity()];
|
|
1804
|
-
case 1:
|
|
1805
|
-
globalSecurity = _e.sent();
|
|
1806
|
-
_e.label = 2;
|
|
1807
|
-
case 2:
|
|
1808
|
-
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
1809
|
-
globalSecurity = new shared.Security(globalSecurity);
|
|
1810
|
-
}
|
|
1811
|
-
properties = utils.parseSecurityProperties(globalSecurity);
|
|
1812
|
-
headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
1813
|
-
headers["Accept"] = "application/json";
|
|
1814
|
-
headers["user-agent"] = this.sdkConfiguration.userAgent;
|
|
1815
|
-
return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "put", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
|
|
1816
|
-
case 3:
|
|
1817
|
-
httpRes = _e.sent();
|
|
1818
|
-
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
1819
|
-
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
1820
|
-
throw new Error("status code not found in response: ".concat(httpRes));
|
|
1821
|
-
}
|
|
1822
|
-
res = new operations.UpdateCustomerResponse({
|
|
1823
|
-
statusCode: httpRes.status,
|
|
1824
|
-
contentType: contentType,
|
|
1825
|
-
rawResponse: httpRes,
|
|
1826
|
-
});
|
|
1827
|
-
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
1828
|
-
switch (true) {
|
|
1829
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
1830
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1831
|
-
res.customer = utils.objectToClass(JSON.parse(decodedRes), shared.Customer);
|
|
1832
|
-
}
|
|
1833
|
-
else {
|
|
1834
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1835
|
-
}
|
|
1836
|
-
break;
|
|
1837
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
|
|
1838
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
|
|
1839
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
|
|
1840
|
-
(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
|
|
1841
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
|
|
1842
|
-
((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
|
|
1843
|
-
throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
|
|
1844
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
|
|
1845
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1846
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
|
|
1847
|
-
err.rawResponse = httpRes;
|
|
1848
|
-
throw new errors.FourHundredAndOneError(err);
|
|
1849
|
-
}
|
|
1850
|
-
else {
|
|
1851
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1852
|
-
}
|
|
1853
|
-
break;
|
|
1854
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
|
|
1855
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1856
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
|
|
1857
|
-
err.rawResponse = httpRes;
|
|
1858
|
-
throw new errors.FourHundredAndTwentyNineError(err);
|
|
1859
|
-
}
|
|
1860
|
-
else {
|
|
1861
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1862
|
-
}
|
|
1863
|
-
break;
|
|
1864
|
-
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
|
|
1865
|
-
if (utils.matchContentType(contentType, "application/json")) {
|
|
1866
|
-
err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
|
|
1867
|
-
err.rawResponse = httpRes;
|
|
1868
|
-
throw new errors.FiveHundredError(err);
|
|
1869
|
-
}
|
|
1870
|
-
else {
|
|
1871
|
-
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
1872
|
-
}
|
|
1873
|
-
break;
|
|
1874
|
-
}
|
|
1875
|
-
return [2 /*return*/, res];
|
|
1876
|
-
}
|
|
1877
|
-
});
|
|
1878
|
-
});
|
|
1879
|
-
};
|
|
1880
|
-
return Customer;
|
|
1881
|
-
}());
|
|
1882
|
-
exports.Customer = Customer;
|