@metronome/sdk 0.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +113 -28
- package/README.md +123 -51
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/bin/cli +46 -0
- package/bin/migration-config.json +6 -0
- package/client.d.mts +232 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +232 -0
- package/client.d.ts.map +1 -0
- package/client.js +464 -0
- package/client.js.map +1 -0
- package/client.mjs +460 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +46 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +46 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +113 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +97 -0
- package/core/error.mjs.map +1 -0
- package/core/pagination.d.mts +137 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +137 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +158 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +150 -0
- package/core/pagination.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +1 -46
- package/error.d.ts.map +1 -1
- package/error.js +3 -110
- package/error.js.map +1 -1
- package/error.mjs +1 -96
- package/error.mjs.map +1 -1
- package/index.d.mts +7 -144
- package/index.d.mts.map +1 -0
- package/index.d.ts +6 -143
- package/index.d.ts.map +1 -1
- package/index.js +14 -120
- package/index.js.map +1 -1
- package/index.mjs +6 -93
- package/index.mjs.map +1 -1
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +26 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +26 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +120 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +112 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +35 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +32 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +1 -0
- package/internal/qs/formats.d.ts.map +1 -1
- package/internal/qs/formats.js +4 -2
- package/internal/qs/formats.js.map +1 -1
- package/internal/qs/formats.mjs +2 -1
- package/internal/qs/formats.mjs.map +1 -1
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts.map +1 -1
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts.map +1 -1
- package/internal/qs/stringify.js +16 -19
- package/internal/qs/stringify.js.map +1 -1
- package/internal/qs/stringify.mjs +17 -19
- package/internal/qs/stringify.mjs.map +1 -1
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +1 -0
- package/internal/qs/utils.d.ts.map +1 -1
- package/internal/qs/utils.js +22 -21
- package/internal/qs/utils.js.map +1 -1
- package/internal/qs/utils.mjs +12 -12
- package/internal/qs/utils.mjs.map +1 -1
- package/internal/request-options.d.mts +75 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +75 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +92 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +85 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +79 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +7 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +7 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +11 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +113 -64
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +1 -36
- package/pagination.d.ts.map +1 -1
- package/pagination.js +3 -40
- package/pagination.js.map +1 -1
- package/pagination.mjs +1 -38
- package/pagination.mjs.map +1 -1
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +1 -5
- package/resource.d.ts.map +1 -1
- package/resource.js +3 -8
- package/resource.js.map +1 -1
- package/resource.mjs +1 -6
- package/resource.mjs.map +1 -1
- package/resources/index.d.mts +5 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +2 -15
- package/resources/index.js.map +1 -1
- package/resources/shared.d.mts +2363 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/shared.d.ts +1470 -465
- package/resources/shared.d.ts.map +1 -1
- package/resources/v1/alerts.d.mts +207 -0
- package/resources/v1/alerts.d.mts.map +1 -0
- package/resources/v1/alerts.d.ts +107 -32
- package/resources/v1/alerts.d.ts.map +1 -1
- package/resources/v1/alerts.js +74 -3
- package/resources/v1/alerts.js.map +1 -1
- package/resources/v1/alerts.mjs +74 -3
- package/resources/v1/alerts.mjs.map +1 -1
- package/resources/v1/audit-logs.d.mts +108 -0
- package/resources/v1/audit-logs.d.mts.map +1 -0
- package/resources/v1/audit-logs.d.ts +45 -12
- package/resources/v1/audit-logs.d.ts.map +1 -1
- package/resources/v1/audit-logs.js +53 -12
- package/resources/v1/audit-logs.js.map +1 -1
- package/resources/v1/audit-logs.mjs +52 -10
- package/resources/v1/audit-logs.mjs.map +1 -1
- package/resources/v1/billable-metrics.d.mts +293 -0
- package/resources/v1/billable-metrics.d.mts.map +1 -0
- package/resources/v1/billable-metrics.d.ts +70 -15
- package/resources/v1/billable-metrics.d.ts.map +1 -1
- package/resources/v1/billable-metrics.js +70 -16
- package/resources/v1/billable-metrics.js.map +1 -1
- package/resources/v1/billable-metrics.mjs +69 -14
- package/resources/v1/billable-metrics.mjs.map +1 -1
- package/resources/v1/contracts/contracts.d.mts +3006 -0
- package/resources/v1/contracts/contracts.d.mts.map +1 -0
- package/resources/v1/contracts/contracts.d.ts +428 -1299
- package/resources/v1/contracts/contracts.d.ts.map +1 -1
- package/resources/v1/contracts/contracts.js +269 -50
- package/resources/v1/contracts/contracts.js.map +1 -1
- package/resources/v1/contracts/contracts.mjs +267 -26
- package/resources/v1/contracts/contracts.mjs.map +1 -1
- package/resources/v1/contracts/index.d.mts +5 -0
- package/resources/v1/contracts/index.d.mts.map +1 -0
- package/resources/v1/contracts/index.d.ts +3 -3
- package/resources/v1/contracts/index.d.ts.map +1 -1
- package/resources/v1/contracts/index.js +1 -3
- package/resources/v1/contracts/index.js.map +1 -1
- package/resources/v1/contracts/index.mjs +2 -2
- package/resources/v1/contracts/index.mjs.map +1 -1
- package/resources/v1/contracts/named-schedules.d.mts +82 -0
- package/resources/v1/contracts/named-schedules.d.mts.map +1 -0
- package/resources/v1/contracts/named-schedules.d.ts +5 -4
- package/resources/v1/contracts/named-schedules.d.ts.map +1 -1
- package/resources/v1/contracts/named-schedules.js +3 -2
- package/resources/v1/contracts/named-schedules.js.map +1 -1
- package/resources/v1/contracts/named-schedules.mjs +3 -2
- package/resources/v1/contracts/named-schedules.mjs.map +1 -1
- package/resources/v1/contracts/products.d.mts +502 -0
- package/resources/v1/contracts/products.d.mts.map +1 -0
- package/resources/v1/contracts/products.d.ts +44 -17
- package/resources/v1/contracts/products.d.ts.map +1 -1
- package/resources/v1/contracts/products.js +41 -17
- package/resources/v1/contracts/products.js.map +1 -1
- package/resources/v1/contracts/products.mjs +40 -15
- package/resources/v1/contracts/products.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/index.d.mts +5 -0
- package/resources/v1/contracts/rate-cards/index.d.mts.map +1 -0
- package/resources/v1/contracts/rate-cards/index.d.ts +2 -2
- package/resources/v1/contracts/rate-cards/index.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/index.js +1 -3
- package/resources/v1/contracts/rate-cards/index.js.map +1 -1
- package/resources/v1/contracts/rate-cards/index.mjs +2 -2
- package/resources/v1/contracts/rate-cards/index.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/named-schedules.d.mts +94 -0
- package/resources/v1/contracts/rate-cards/named-schedules.d.mts.map +1 -0
- package/resources/v1/contracts/rate-cards/named-schedules.d.ts +5 -4
- package/resources/v1/contracts/rate-cards/named-schedules.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/named-schedules.js +3 -2
- package/resources/v1/contracts/rate-cards/named-schedules.js.map +1 -1
- package/resources/v1/contracts/rate-cards/named-schedules.mjs +3 -2
- package/resources/v1/contracts/rate-cards/named-schedules.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/product-orders.d.mts +85 -0
- package/resources/v1/contracts/rate-cards/product-orders.d.mts.map +1 -0
- package/resources/v1/contracts/rate-cards/product-orders.d.ts +12 -6
- package/resources/v1/contracts/rate-cards/product-orders.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/product-orders.js +8 -3
- package/resources/v1/contracts/rate-cards/product-orders.js.map +1 -1
- package/resources/v1/contracts/rate-cards/product-orders.mjs +8 -3
- package/resources/v1/contracts/rate-cards/product-orders.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/rate-cards.d.mts +452 -0
- package/resources/v1/contracts/rate-cards/rate-cards.d.mts.map +1 -0
- package/resources/v1/contracts/rate-cards/rate-cards.d.ts +134 -41
- package/resources/v1/contracts/rate-cards/rate-cards.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/rate-cards.js +127 -47
- package/resources/v1/contracts/rate-cards/rate-cards.js.map +1 -1
- package/resources/v1/contracts/rate-cards/rate-cards.mjs +123 -20
- package/resources/v1/contracts/rate-cards/rate-cards.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/rates.d.mts +382 -0
- package/resources/v1/contracts/rate-cards/rates.d.mts.map +1 -0
- package/resources/v1/contracts/rate-cards/rates.d.ts +25 -82
- package/resources/v1/contracts/rate-cards/rates.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/rates.js +13 -9
- package/resources/v1/contracts/rate-cards/rates.js.map +1 -1
- package/resources/v1/contracts/rate-cards/rates.mjs +12 -7
- package/resources/v1/contracts/rate-cards/rates.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards.d.mts +2 -0
- package/resources/v1/contracts/rate-cards.d.mts.map +1 -0
- package/resources/v1/contracts/rate-cards.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards.js +2 -15
- package/resources/v1/contracts/rate-cards.js.map +1 -1
- package/resources/v1/contracts.d.mts +2 -0
- package/resources/v1/contracts.d.mts.map +1 -0
- package/resources/v1/contracts.d.ts.map +1 -1
- package/resources/v1/contracts.js +2 -15
- package/resources/v1/contracts.js.map +1 -1
- package/resources/v1/credit-grants.d.mts +505 -0
- package/resources/v1/credit-grants.d.mts.map +1 -0
- package/resources/v1/credit-grants.d.ts +73 -74
- package/resources/v1/credit-grants.d.ts.map +1 -1
- package/resources/v1/credit-grants.js +52 -18
- package/resources/v1/credit-grants.js.map +1 -1
- package/resources/v1/credit-grants.mjs +51 -16
- package/resources/v1/credit-grants.mjs.map +1 -1
- package/resources/v1/custom-fields.d.mts +151 -0
- package/resources/v1/custom-fields.d.mts.map +1 -0
- package/resources/v1/custom-fields.d.ts +69 -38
- package/resources/v1/custom-fields.d.ts.map +1 -1
- package/resources/v1/custom-fields.js +66 -22
- package/resources/v1/custom-fields.js.map +1 -1
- package/resources/v1/custom-fields.mjs +66 -22
- package/resources/v1/custom-fields.mjs.map +1 -1
- package/resources/v1/customers/alerts.d.mts +309 -0
- package/resources/v1/customers/alerts.d.mts.map +1 -0
- package/resources/v1/customers/alerts.d.ts +176 -50
- package/resources/v1/customers/alerts.d.ts.map +1 -1
- package/resources/v1/customers/alerts.js +131 -10
- package/resources/v1/customers/alerts.js.map +1 -1
- package/resources/v1/customers/alerts.mjs +131 -10
- package/resources/v1/customers/alerts.mjs.map +1 -1
- package/resources/v1/customers/billing-config.d.mts +125 -0
- package/resources/v1/customers/billing-config.d.mts.map +1 -0
- package/resources/v1/customers/billing-config.d.ts +8 -7
- package/resources/v1/customers/billing-config.d.ts.map +1 -1
- package/resources/v1/customers/billing-config.js +8 -6
- package/resources/v1/customers/billing-config.js.map +1 -1
- package/resources/v1/customers/billing-config.mjs +8 -6
- package/resources/v1/customers/billing-config.mjs.map +1 -1
- package/resources/v1/customers/commits.d.mts +456 -0
- package/resources/v1/customers/commits.d.mts.map +1 -0
- package/resources/v1/customers/commits.d.ts +139 -47
- package/resources/v1/customers/commits.d.ts.map +1 -1
- package/resources/v1/customers/commits.js +131 -12
- package/resources/v1/customers/commits.js.map +1 -1
- package/resources/v1/customers/commits.mjs +131 -12
- package/resources/v1/customers/commits.mjs.map +1 -1
- package/resources/v1/customers/credits.d.mts +310 -0
- package/resources/v1/customers/credits.d.mts.map +1 -0
- package/resources/v1/customers/credits.d.ts +124 -46
- package/resources/v1/customers/credits.d.ts.map +1 -1
- package/resources/v1/customers/credits.js +116 -11
- package/resources/v1/customers/credits.js.map +1 -1
- package/resources/v1/customers/credits.mjs +116 -11
- package/resources/v1/customers/credits.mjs.map +1 -1
- package/resources/v1/customers/customers.d.mts +819 -0
- package/resources/v1/customers/customers.d.mts.map +1 -0
- package/resources/v1/customers/customers.d.ts +319 -55
- package/resources/v1/customers/customers.d.ts.map +1 -1
- package/resources/v1/customers/customers.js +220 -76
- package/resources/v1/customers/customers.js.map +1 -1
- package/resources/v1/customers/customers.mjs +213 -44
- package/resources/v1/customers/customers.mjs.map +1 -1
- package/resources/v1/customers/index.d.mts +9 -0
- package/resources/v1/customers/index.d.mts.map +1 -0
- package/resources/v1/customers/index.d.ts +6 -6
- package/resources/v1/customers/index.d.ts.map +1 -1
- package/resources/v1/customers/index.js +1 -8
- package/resources/v1/customers/index.js.map +1 -1
- package/resources/v1/customers/index.mjs +3 -3
- package/resources/v1/customers/index.mjs.map +1 -1
- package/resources/v1/customers/invoices.d.mts +825 -0
- package/resources/v1/customers/invoices.d.mts.map +1 -0
- package/resources/v1/customers/invoices.d.ts +309 -25
- package/resources/v1/customers/invoices.d.ts.map +1 -1
- package/resources/v1/customers/invoices.js +180 -22
- package/resources/v1/customers/invoices.js.map +1 -1
- package/resources/v1/customers/invoices.mjs +179 -19
- package/resources/v1/customers/invoices.mjs.map +1 -1
- package/resources/v1/customers/named-schedules.d.mts +82 -0
- package/resources/v1/customers/named-schedules.d.mts.map +1 -0
- package/resources/v1/customers/named-schedules.d.ts +5 -4
- package/resources/v1/customers/named-schedules.d.ts.map +1 -1
- package/resources/v1/customers/named-schedules.js +3 -2
- package/resources/v1/customers/named-schedules.js.map +1 -1
- package/resources/v1/customers/named-schedules.mjs +3 -2
- package/resources/v1/customers/named-schedules.mjs.map +1 -1
- package/resources/v1/customers/plans.d.mts +281 -0
- package/resources/v1/customers/plans.d.mts.map +1 -0
- package/resources/v1/customers/plans.d.ts +14 -12
- package/resources/v1/customers/plans.d.ts.map +1 -1
- package/resources/v1/customers/plans.js +8 -15
- package/resources/v1/customers/plans.js.map +1 -1
- package/resources/v1/customers/plans.mjs +7 -12
- package/resources/v1/customers/plans.mjs.map +1 -1
- package/resources/v1/customers.d.mts +2 -0
- package/resources/v1/customers.d.mts.map +1 -0
- package/resources/v1/customers.d.ts.map +1 -1
- package/resources/v1/customers.js +2 -15
- package/resources/v1/customers.js.map +1 -1
- package/resources/v1/dashboards.d.mts +133 -0
- package/resources/v1/dashboards.d.mts.map +1 -0
- package/resources/v1/dashboards.d.ts +33 -6
- package/resources/v1/dashboards.d.ts.map +1 -1
- package/resources/v1/dashboards.js +30 -4
- package/resources/v1/dashboards.js.map +1 -1
- package/resources/v1/dashboards.mjs +30 -4
- package/resources/v1/dashboards.mjs.map +1 -1
- package/resources/v1/index.d.mts +16 -0
- package/resources/v1/index.d.mts.map +1 -0
- package/resources/v1/index.d.ts +10 -9
- package/resources/v1/index.d.ts.map +1 -1
- package/resources/v1/index.js +3 -12
- package/resources/v1/index.js.map +1 -1
- package/resources/v1/index.mjs +8 -7
- package/resources/v1/index.mjs.map +1 -1
- package/resources/v1/invoices.d.mts +83 -0
- package/resources/v1/invoices.d.mts.map +1 -0
- package/resources/v1/invoices.d.ts +28 -6
- package/resources/v1/invoices.d.ts.map +1 -1
- package/resources/v1/invoices.js +24 -3
- package/resources/v1/invoices.js.map +1 -1
- package/resources/v1/invoices.mjs +24 -3
- package/resources/v1/invoices.mjs.map +1 -1
- package/resources/v1/payments.d.mts +116 -0
- package/resources/v1/payments.d.mts.map +1 -0
- package/resources/v1/payments.d.ts +116 -0
- package/resources/v1/payments.d.ts.map +1 -0
- package/resources/v1/payments.js +71 -0
- package/resources/v1/payments.js.map +1 -0
- package/resources/v1/payments.mjs +67 -0
- package/resources/v1/payments.mjs.map +1 -0
- package/resources/v1/plans.d.mts +240 -0
- package/resources/v1/plans.d.mts.map +1 -0
- package/resources/v1/plans.d.ts +24 -15
- package/resources/v1/plans.d.ts.map +1 -1
- package/resources/v1/plans.js +19 -26
- package/resources/v1/plans.js.map +1 -1
- package/resources/v1/plans.mjs +18 -22
- package/resources/v1/plans.mjs.map +1 -1
- package/resources/v1/pricing-units.d.mts +34 -0
- package/resources/v1/pricing-units.d.mts.map +1 -0
- package/resources/v1/pricing-units.d.ts +12 -9
- package/resources/v1/pricing-units.d.ts.map +1 -1
- package/resources/v1/pricing-units.js +20 -12
- package/resources/v1/pricing-units.js.map +1 -1
- package/resources/v1/pricing-units.mjs +19 -10
- package/resources/v1/pricing-units.mjs.map +1 -1
- package/resources/v1/services.d.mts +33 -0
- package/resources/v1/services.d.mts.map +1 -0
- package/resources/v1/services.d.ts +10 -7
- package/resources/v1/services.d.ts.map +1 -1
- package/resources/v1/services.js +7 -5
- package/resources/v1/services.js.map +1 -1
- package/resources/v1/services.mjs +7 -5
- package/resources/v1/services.mjs.map +1 -1
- package/resources/v1/usage.d.mts +490 -0
- package/resources/v1/usage.d.mts.map +1 -0
- package/resources/v1/usage.d.ts +223 -58
- package/resources/v1/usage.d.ts.map +1 -1
- package/resources/v1/usage.js +214 -26
- package/resources/v1/usage.js.map +1 -1
- package/resources/v1/usage.mjs +213 -24
- package/resources/v1/usage.mjs.map +1 -1
- package/resources/v1/v1.d.mts +62 -0
- package/resources/v1/v1.d.mts.map +1 -0
- package/resources/v1/v1.d.ts +19 -15
- package/resources/v1/v1.d.ts.map +1 -1
- package/resources/v1/v1.js +19 -48
- package/resources/v1/v1.js.map +1 -1
- package/resources/v1/v1.mjs +12 -19
- package/resources/v1/v1.mjs.map +1 -1
- package/resources/v1.d.mts +2 -0
- package/resources/v1.d.mts.map +1 -0
- package/resources/v1.d.ts.map +1 -1
- package/resources/v1.js +2 -15
- package/resources/v1.js.map +1 -1
- package/resources/v2/contracts.d.mts +2900 -0
- package/resources/v2/contracts.d.mts.map +1 -0
- package/resources/v2/contracts.d.ts +399 -3830
- package/resources/v2/contracts.d.ts.map +1 -1
- package/resources/v2/contracts.js +102 -12
- package/resources/v2/contracts.js.map +1 -1
- package/resources/v2/contracts.mjs +102 -12
- package/resources/v2/contracts.mjs.map +1 -1
- package/resources/v2/index.d.mts +3 -0
- package/resources/v2/index.d.mts.map +1 -0
- package/resources/v2/index.d.ts.map +1 -1
- package/resources/v2/v2.d.mts +10 -0
- package/resources/v2/v2.d.mts.map +1 -0
- package/resources/v2/v2.d.ts +1 -1
- package/resources/v2/v2.d.ts.map +1 -1
- package/resources/v2/v2.js +3 -25
- package/resources/v2/v2.js.map +1 -1
- package/resources/v2/v2.mjs +1 -1
- package/resources/v2.d.mts +2 -0
- package/resources/v2.d.mts.map +1 -0
- package/resources/v2.d.ts.map +1 -1
- package/resources/v2.js +2 -15
- package/resources/v2.js.map +1 -1
- package/resources/webhooks.d.mts +22 -0
- package/resources/webhooks.d.mts.map +1 -0
- package/resources/webhooks.d.ts +1 -1
- package/resources/webhooks.d.ts.map +1 -1
- package/resources/webhooks.js +3 -3
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs +1 -1
- package/resources/webhooks.mjs.map +1 -1
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts.map +1 -1
- package/resources.js +2 -15
- package/resources.js.map +1 -1
- package/src/api-promise.ts +2 -0
- package/src/client.ts +809 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +92 -0
- package/src/core/error.ts +130 -0
- package/src/core/pagination.ts +319 -0
- package/src/core/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -130
- package/src/index.ts +6 -221
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +144 -0
- package/src/internal/parse.ts +50 -0
- package/src/internal/qs/formats.ts +3 -2
- package/src/internal/qs/index.ts +3 -3
- package/src/internal/qs/stringify.ts +18 -21
- package/src/internal/qs/utils.ts +16 -16
- package/src/internal/request-options.ts +91 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +126 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +8 -0
- package/src/pagination.ts +2 -82
- package/src/resource.ts +2 -11
- package/src/resources/index.ts +4 -4
- package/src/resources/shared.ts +1921 -506
- package/src/resources/v1/alerts.ts +108 -33
- package/src/resources/v1/audit-logs.ts +48 -26
- package/src/resources/v1/billable-metrics.ts +79 -34
- package/src/resources/v1/contracts/contracts.ts +490 -1632
- package/src/resources/v1/contracts/index.ts +7 -6
- package/src/resources/v1/contracts/named-schedules.ts +8 -6
- package/src/resources/v1/contracts/products.ts +50 -38
- package/src/resources/v1/contracts/rate-cards/index.ts +6 -6
- package/src/resources/v1/contracts/rate-cards/named-schedules.ts +8 -6
- package/src/resources/v1/contracts/rate-cards/product-orders.ts +13 -10
- package/src/resources/v1/contracts/rate-cards/rate-cards.ts +145 -72
- package/src/resources/v1/contracts/rate-cards/rates.ts +28 -98
- package/src/resources/v1/contracts/rate-cards.ts +1 -1
- package/src/resources/v1/contracts.ts +1 -1
- package/src/resources/v1/credit-grants.ts +100 -112
- package/src/resources/v1/custom-fields.ts +106 -74
- package/src/resources/v1/customers/alerts.ts +195 -55
- package/src/resources/v1/customers/billing-config.ts +27 -13
- package/src/resources/v1/customers/commits.ts +146 -54
- package/src/resources/v1/customers/credits.ts +131 -53
- package/src/resources/v1/customers/customers.ts +407 -115
- package/src/resources/v1/customers/index.ts +20 -18
- package/src/resources/v1/customers/invoices.ts +343 -42
- package/src/resources/v1/customers/named-schedules.ts +8 -6
- package/src/resources/v1/customers/plans.ts +24 -22
- package/src/resources/v1/customers.ts +1 -1
- package/src/resources/v1/dashboards.ts +34 -7
- package/src/resources/v1/index.ts +43 -25
- package/src/resources/v1/invoices.ts +28 -9
- package/src/resources/v1/payments.ts +170 -0
- package/src/resources/v1/plans.ts +42 -43
- package/src/resources/v1/pricing-units.ts +15 -23
- package/src/resources/v1/services.ts +10 -7
- package/src/resources/v1/usage.ts +247 -73
- package/src/resources/v1/v1.ts +78 -49
- package/src/resources/v1.ts +1 -1
- package/src/resources/v2/contracts.ts +469 -4930
- package/src/resources/v2/index.ts +2 -2
- package/src/resources/v2/v2.ts +3 -3
- package/src/resources/v2.ts +1 -1
- package/src/resources/webhooks.ts +2 -2
- package/src/resources.ts +1 -1
- package/src/tsconfig.json +2 -2
- package/src/uploads.ts +2 -255
- package/src/version.ts +1 -1
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +1 -74
- package/uploads.d.ts.map +1 -1
- package/uploads.js +3 -168
- package/uploads.js.map +1 -1
- package/uploads.mjs +1 -157
- package/uploads.mjs.map +1 -1
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/_shims/MultipartBody.d.ts +0 -9
- package/_shims/MultipartBody.d.ts.map +0 -1
- package/_shims/MultipartBody.js +0 -16
- package/_shims/MultipartBody.js.map +0 -1
- package/_shims/MultipartBody.mjs +0 -12
- package/_shims/MultipartBody.mjs.map +0 -1
- package/_shims/README.md +0 -46
- package/_shims/auto/runtime-bun.d.ts +0 -5
- package/_shims/auto/runtime-bun.d.ts.map +0 -1
- package/_shims/auto/runtime-bun.js +0 -21
- package/_shims/auto/runtime-bun.js.map +0 -1
- package/_shims/auto/runtime-bun.mjs +0 -2
- package/_shims/auto/runtime-bun.mjs.map +0 -1
- package/_shims/auto/runtime-node.d.ts +0 -5
- package/_shims/auto/runtime-node.d.ts.map +0 -1
- package/_shims/auto/runtime-node.js +0 -21
- package/_shims/auto/runtime-node.js.map +0 -1
- package/_shims/auto/runtime-node.mjs +0 -2
- package/_shims/auto/runtime-node.mjs.map +0 -1
- package/_shims/auto/runtime.d.ts +0 -5
- package/_shims/auto/runtime.d.ts.map +0 -1
- package/_shims/auto/runtime.js +0 -21
- package/_shims/auto/runtime.js.map +0 -1
- package/_shims/auto/runtime.mjs +0 -2
- package/_shims/auto/runtime.mjs.map +0 -1
- package/_shims/auto/types-node.d.ts +0 -5
- package/_shims/auto/types-node.d.ts.map +0 -1
- package/_shims/auto/types-node.js +0 -21
- package/_shims/auto/types-node.js.map +0 -1
- package/_shims/auto/types-node.mjs +0 -2
- package/_shims/auto/types-node.mjs.map +0 -1
- package/_shims/auto/types.d.ts +0 -101
- package/_shims/auto/types.js +0 -3
- package/_shims/auto/types.mjs +0 -3
- package/_shims/bun-runtime.d.ts +0 -6
- package/_shims/bun-runtime.d.ts.map +0 -1
- package/_shims/bun-runtime.js +0 -14
- package/_shims/bun-runtime.js.map +0 -1
- package/_shims/bun-runtime.mjs +0 -10
- package/_shims/bun-runtime.mjs.map +0 -1
- package/_shims/index.d.ts +0 -83
- package/_shims/index.js +0 -17
- package/_shims/index.mjs +0 -11
- package/_shims/manual-types.d.ts +0 -12
- package/_shims/manual-types.js +0 -3
- package/_shims/manual-types.mjs +0 -3
- package/_shims/node-runtime.d.ts +0 -3
- package/_shims/node-runtime.d.ts.map +0 -1
- package/_shims/node-runtime.js +0 -89
- package/_shims/node-runtime.js.map +0 -1
- package/_shims/node-runtime.mjs +0 -56
- package/_shims/node-runtime.mjs.map +0 -1
- package/_shims/node-types.d.ts +0 -42
- package/_shims/node-types.js +0 -3
- package/_shims/node-types.mjs +0 -3
- package/_shims/registry.d.ts +0 -37
- package/_shims/registry.d.ts.map +0 -1
- package/_shims/registry.js +0 -41
- package/_shims/registry.js.map +0 -1
- package/_shims/registry.mjs +0 -37
- package/_shims/registry.mjs.map +0 -1
- package/_shims/web-runtime.d.ts +0 -5
- package/_shims/web-runtime.d.ts.map +0 -1
- package/_shims/web-runtime.js +0 -78
- package/_shims/web-runtime.js.map +0 -1
- package/_shims/web-runtime.mjs +0 -71
- package/_shims/web-runtime.mjs.map +0 -1
- package/_shims/web-types.d.ts +0 -83
- package/_shims/web-types.js +0 -3
- package/_shims/web-types.mjs +0 -3
- package/core.d.ts +0 -255
- package/core.d.ts.map +0 -1
- package/core.js +0 -924
- package/core.js.map +0 -1
- package/core.mjs +0 -892
- package/core.mjs.map +0 -1
- package/shims/node.d.ts +0 -30
- package/shims/node.d.ts.map +0 -1
- package/shims/node.js +0 -31
- package/shims/node.js.map +0 -1
- package/shims/node.mjs +0 -5
- package/shims/node.mjs.map +0 -1
- package/shims/web.d.ts +0 -26
- package/shims/web.d.ts.map +0 -1
- package/shims/web.js +0 -31
- package/shims/web.js.map +0 -1
- package/shims/web.mjs +0 -5
- package/shims/web.mjs.map +0 -1
- package/src/_shims/MultipartBody.ts +0 -9
- package/src/_shims/README.md +0 -46
- package/src/_shims/auto/runtime-bun.ts +0 -4
- package/src/_shims/auto/runtime-node.ts +0 -4
- package/src/_shims/auto/runtime.ts +0 -4
- package/src/_shims/auto/types-node.ts +0 -4
- package/src/_shims/auto/types.d.ts +0 -101
- package/src/_shims/auto/types.js +0 -3
- package/src/_shims/auto/types.mjs +0 -3
- package/src/_shims/bun-runtime.ts +0 -14
- package/src/_shims/index.d.ts +0 -83
- package/src/_shims/index.js +0 -17
- package/src/_shims/index.mjs +0 -11
- package/src/_shims/manual-types.d.ts +0 -12
- package/src/_shims/manual-types.js +0 -3
- package/src/_shims/manual-types.mjs +0 -3
- package/src/_shims/node-runtime.ts +0 -81
- package/src/_shims/node-types.d.ts +0 -42
- package/src/_shims/node-types.js +0 -3
- package/src/_shims/node-types.mjs +0 -3
- package/src/_shims/registry.ts +0 -67
- package/src/_shims/web-runtime.ts +0 -103
- package/src/_shims/web-types.d.ts +0 -83
- package/src/_shims/web-types.js +0 -3
- package/src/_shims/web-types.mjs +0 -3
- package/src/core.ts +0 -1236
- package/src/shims/node.ts +0 -50
- package/src/shims/web.ts +0 -50
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
+
import * as Shared from "../shared.mjs";
|
|
3
|
+
import { APIPromise } from "../../core/api-promise.mjs";
|
|
4
|
+
import { CursorPage, type CursorPageParams, PagePromise } from "../../core/pagination.mjs";
|
|
5
|
+
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
6
|
+
export declare class BillableMetrics extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Create billable metrics programmatically with this endpoint—an essential step in
|
|
9
|
+
* configuring your pricing and packaging in Metronome.
|
|
10
|
+
*
|
|
11
|
+
* A billable metric is a customizable query that filters and aggregates events
|
|
12
|
+
* from your event stream. These metrics are continuously tracked as usage data
|
|
13
|
+
* enters Metronome through the ingestion pipeline. The ingestion process
|
|
14
|
+
* transforms raw usage data into actionable pricing metrics, enabling accurate
|
|
15
|
+
* metering and billing for your products.
|
|
16
|
+
*
|
|
17
|
+
* ### Use this endpoint to:
|
|
18
|
+
*
|
|
19
|
+
* - Create individual or multiple billable metrics as part of a setup workflow.
|
|
20
|
+
* - Automate the entire pricing configuration process, from metric creation to
|
|
21
|
+
* customer contract setup.
|
|
22
|
+
* - Define metrics using either standard filtering/aggregation or a custom SQL
|
|
23
|
+
* query.
|
|
24
|
+
*
|
|
25
|
+
* ### Key response fields:
|
|
26
|
+
*
|
|
27
|
+
* - The ID of the billable metric that was created
|
|
28
|
+
* - The created billable metric will be available to be used in Products, usage
|
|
29
|
+
* endpoints, and alerts.
|
|
30
|
+
*
|
|
31
|
+
* ### Usage guidelines:
|
|
32
|
+
*
|
|
33
|
+
* - Metrics defined using standard filtering and aggregation are Streaming
|
|
34
|
+
* billable metrics, which have been optimized for ultra low latency and high
|
|
35
|
+
* throughput workflows.
|
|
36
|
+
* - Use SQL billable metrics if you require more flexible aggregation options.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const billableMetric =
|
|
41
|
+
* await client.v1.billableMetrics.create({
|
|
42
|
+
* name: 'CPU Hours',
|
|
43
|
+
* aggregation_key: 'cpu_hours',
|
|
44
|
+
* aggregation_type: 'SUM',
|
|
45
|
+
* event_type_filter: { in_values: ['cpu_usage'] },
|
|
46
|
+
* group_keys: [['region'], ['machine_type']],
|
|
47
|
+
* property_filters: [
|
|
48
|
+
* { name: 'cpu_hours', exists: true },
|
|
49
|
+
* {
|
|
50
|
+
* name: 'region',
|
|
51
|
+
* exists: true,
|
|
52
|
+
* in_values: ['EU', 'NA'],
|
|
53
|
+
* },
|
|
54
|
+
* {
|
|
55
|
+
* name: 'machine_type',
|
|
56
|
+
* exists: true,
|
|
57
|
+
* in_values: ['slow', 'fast'],
|
|
58
|
+
* },
|
|
59
|
+
* ],
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
create(body: BillableMetricCreateParams, options?: RequestOptions): APIPromise<BillableMetricCreateResponse>;
|
|
64
|
+
/**
|
|
65
|
+
* Retrieves the complete configuration for a specific billable metric by its ID.
|
|
66
|
+
* Use this to review billable metric setup before associating it with products.
|
|
67
|
+
* Returns the metric's `name`, `event_type_filter`, `property_filters`,
|
|
68
|
+
* `aggregation_type`, `aggregation_key`, `group_keys`, `custom fields`, and
|
|
69
|
+
* `SQL query` (if it's a SQL billable metric).
|
|
70
|
+
*
|
|
71
|
+
* Important:
|
|
72
|
+
*
|
|
73
|
+
* - Archived billable metrics will include an `archived_at` timestamp; they no
|
|
74
|
+
* longer process new usage events but remain accessible for historical
|
|
75
|
+
* reference.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* const billableMetric =
|
|
80
|
+
* await client.v1.billableMetrics.retrieve({
|
|
81
|
+
* billable_metric_id:
|
|
82
|
+
* '13117714-3f05-48e5-a6e9-a66093f13b4d',
|
|
83
|
+
* });
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
retrieve(params: BillableMetricRetrieveParams, options?: RequestOptions): APIPromise<BillableMetricRetrieveResponse>;
|
|
87
|
+
/**
|
|
88
|
+
* Retrieves all billable metrics with their complete configurations. Use this for
|
|
89
|
+
* programmatic discovery and management of billable metrics, such as associating
|
|
90
|
+
* metrics to products and auditing for orphaned or archived metrics. Important:
|
|
91
|
+
* Archived metrics are excluded by default; use `include_archived`=`true`
|
|
92
|
+
* parameter to include them.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* // Automatically fetches more pages as needed.
|
|
97
|
+
* for await (const billableMetricListResponse of client.v1.billableMetrics.list()) {
|
|
98
|
+
* // ...
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
list(query?: BillableMetricListParams | null | undefined, options?: RequestOptions): PagePromise<BillableMetricListResponsesCursorPage, BillableMetricListResponse>;
|
|
103
|
+
/**
|
|
104
|
+
* Use this endpoint to retire billable metrics that are no longer used. After a
|
|
105
|
+
* billable metric is archived, that billable metric can no longer be used in any
|
|
106
|
+
* new Products to define how that product should be metered. If you archive a
|
|
107
|
+
* billable metric that is already associated with a Product, the Product will
|
|
108
|
+
* continue to function as usual, metering based on the definition of the archived
|
|
109
|
+
* billable metric.
|
|
110
|
+
*
|
|
111
|
+
* Archived billable metrics will be returned on the `getBillableMetric` and
|
|
112
|
+
* `listBillableMetrics` endpoints with a populated `archived_at` field.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* const response = await client.v1.billableMetrics.archive({
|
|
117
|
+
* id: '8deed800-1b7a-495d-a207-6c52bac54dc9',
|
|
118
|
+
* });
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
archive(body: BillableMetricArchiveParams, options?: RequestOptions): APIPromise<BillableMetricArchiveResponse>;
|
|
122
|
+
}
|
|
123
|
+
export type BillableMetricListResponsesCursorPage = CursorPage<BillableMetricListResponse>;
|
|
124
|
+
export interface BillableMetricCreateResponse {
|
|
125
|
+
data: Shared.ID;
|
|
126
|
+
}
|
|
127
|
+
export interface BillableMetricRetrieveResponse {
|
|
128
|
+
data: BillableMetricRetrieveResponse.Data;
|
|
129
|
+
}
|
|
130
|
+
export declare namespace BillableMetricRetrieveResponse {
|
|
131
|
+
interface Data {
|
|
132
|
+
/**
|
|
133
|
+
* ID of the billable metric
|
|
134
|
+
*/
|
|
135
|
+
id: string;
|
|
136
|
+
/**
|
|
137
|
+
* The display name of the billable metric.
|
|
138
|
+
*/
|
|
139
|
+
name: string;
|
|
140
|
+
/**
|
|
141
|
+
* A key that specifies which property of the event is used to aggregate data. This
|
|
142
|
+
* key must be one of the property filter names and is not applicable when the
|
|
143
|
+
* aggregation type is 'count'.
|
|
144
|
+
*/
|
|
145
|
+
aggregation_key?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Specifies the type of aggregation performed on matching events.
|
|
148
|
+
*/
|
|
149
|
+
aggregation_type?: 'COUNT' | 'LATEST' | 'MAX' | 'SUM' | 'UNIQUE';
|
|
150
|
+
/**
|
|
151
|
+
* RFC 3339 timestamp indicating when the billable metric was archived. If not
|
|
152
|
+
* provided, the billable metric is not archived.
|
|
153
|
+
*/
|
|
154
|
+
archived_at?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
|
|
157
|
+
*/
|
|
158
|
+
custom_fields?: {
|
|
159
|
+
[key: string]: string;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* An optional filtering rule to match the 'event_type' property of an event.
|
|
163
|
+
*/
|
|
164
|
+
event_type_filter?: Shared.EventTypeFilter;
|
|
165
|
+
/**
|
|
166
|
+
* Property names that are used to group usage costs on an invoice. Each entry
|
|
167
|
+
* represents a set of properties used to slice events into distinct buckets.
|
|
168
|
+
*/
|
|
169
|
+
group_keys?: Array<Array<string>>;
|
|
170
|
+
/**
|
|
171
|
+
* A list of filters to match events to this billable metric. Each filter defines a
|
|
172
|
+
* rule on an event property. All rules must pass for the event to match the
|
|
173
|
+
* billable metric.
|
|
174
|
+
*/
|
|
175
|
+
property_filters?: Array<Shared.PropertyFilter>;
|
|
176
|
+
/**
|
|
177
|
+
* The SQL query associated with the billable metric
|
|
178
|
+
*/
|
|
179
|
+
sql?: string;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
export interface BillableMetricListResponse {
|
|
183
|
+
/**
|
|
184
|
+
* ID of the billable metric
|
|
185
|
+
*/
|
|
186
|
+
id: string;
|
|
187
|
+
/**
|
|
188
|
+
* The display name of the billable metric.
|
|
189
|
+
*/
|
|
190
|
+
name: string;
|
|
191
|
+
/**
|
|
192
|
+
* A key that specifies which property of the event is used to aggregate data. This
|
|
193
|
+
* key must be one of the property filter names and is not applicable when the
|
|
194
|
+
* aggregation type is 'count'.
|
|
195
|
+
*/
|
|
196
|
+
aggregation_key?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Specifies the type of aggregation performed on matching events.
|
|
199
|
+
*/
|
|
200
|
+
aggregation_type?: 'COUNT' | 'LATEST' | 'MAX' | 'SUM' | 'UNIQUE';
|
|
201
|
+
/**
|
|
202
|
+
* RFC 3339 timestamp indicating when the billable metric was archived. If not
|
|
203
|
+
* provided, the billable metric is not archived.
|
|
204
|
+
*/
|
|
205
|
+
archived_at?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
|
|
208
|
+
*/
|
|
209
|
+
custom_fields?: {
|
|
210
|
+
[key: string]: string;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* An optional filtering rule to match the 'event_type' property of an event.
|
|
214
|
+
*/
|
|
215
|
+
event_type_filter?: Shared.EventTypeFilter;
|
|
216
|
+
/**
|
|
217
|
+
* Property names that are used to group usage costs on an invoice. Each entry
|
|
218
|
+
* represents a set of properties used to slice events into distinct buckets.
|
|
219
|
+
*/
|
|
220
|
+
group_keys?: Array<Array<string>>;
|
|
221
|
+
/**
|
|
222
|
+
* A list of filters to match events to this billable metric. Each filter defines a
|
|
223
|
+
* rule on an event property. All rules must pass for the event to match the
|
|
224
|
+
* billable metric.
|
|
225
|
+
*/
|
|
226
|
+
property_filters?: Array<Shared.PropertyFilter>;
|
|
227
|
+
/**
|
|
228
|
+
* The SQL query associated with the billable metric
|
|
229
|
+
*/
|
|
230
|
+
sql?: string;
|
|
231
|
+
}
|
|
232
|
+
export interface BillableMetricArchiveResponse {
|
|
233
|
+
data: Shared.ID;
|
|
234
|
+
}
|
|
235
|
+
export interface BillableMetricCreateParams {
|
|
236
|
+
/**
|
|
237
|
+
* The display name of the billable metric.
|
|
238
|
+
*/
|
|
239
|
+
name: string;
|
|
240
|
+
/**
|
|
241
|
+
* Specifies the type of aggregation performed on matching events. Required if
|
|
242
|
+
* `sql` is not provided.
|
|
243
|
+
*/
|
|
244
|
+
aggregation_key?: string;
|
|
245
|
+
/**
|
|
246
|
+
* Specifies the type of aggregation performed on matching events.
|
|
247
|
+
*/
|
|
248
|
+
aggregation_type?: 'COUNT' | 'LATEST' | 'MAX' | 'SUM' | 'UNIQUE';
|
|
249
|
+
/**
|
|
250
|
+
* Custom fields to attach to the billable metric.
|
|
251
|
+
*/
|
|
252
|
+
custom_fields?: {
|
|
253
|
+
[key: string]: string;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* An optional filtering rule to match the 'event_type' property of an event.
|
|
257
|
+
*/
|
|
258
|
+
event_type_filter?: Shared.EventTypeFilter;
|
|
259
|
+
/**
|
|
260
|
+
* Property names that are used to group usage costs on an invoice. Each entry
|
|
261
|
+
* represents a set of properties used to slice events into distinct buckets.
|
|
262
|
+
*/
|
|
263
|
+
group_keys?: Array<Array<string>>;
|
|
264
|
+
/**
|
|
265
|
+
* A list of filters to match events to this billable metric. Each filter defines a
|
|
266
|
+
* rule on an event property. All rules must pass for the event to match the
|
|
267
|
+
* billable metric.
|
|
268
|
+
*/
|
|
269
|
+
property_filters?: Array<Shared.PropertyFilter>;
|
|
270
|
+
/**
|
|
271
|
+
* The SQL query associated with the billable metric. This field is mutually
|
|
272
|
+
* exclusive with aggregation_type, event_type_filter, property_filters,
|
|
273
|
+
* aggregation_key, and group_keys. If provided, these other fields must be
|
|
274
|
+
* omitted.
|
|
275
|
+
*/
|
|
276
|
+
sql?: string;
|
|
277
|
+
}
|
|
278
|
+
export interface BillableMetricRetrieveParams {
|
|
279
|
+
billable_metric_id: string;
|
|
280
|
+
}
|
|
281
|
+
export interface BillableMetricListParams extends CursorPageParams {
|
|
282
|
+
/**
|
|
283
|
+
* If true, the list of returned metrics will include archived metrics
|
|
284
|
+
*/
|
|
285
|
+
include_archived?: boolean;
|
|
286
|
+
}
|
|
287
|
+
export interface BillableMetricArchiveParams {
|
|
288
|
+
id: string;
|
|
289
|
+
}
|
|
290
|
+
export declare namespace BillableMetrics {
|
|
291
|
+
export { type BillableMetricCreateResponse as BillableMetricCreateResponse, type BillableMetricRetrieveResponse as BillableMetricRetrieveResponse, type BillableMetricListResponse as BillableMetricListResponse, type BillableMetricArchiveResponse as BillableMetricArchiveResponse, type BillableMetricListResponsesCursorPage as BillableMetricListResponsesCursorPage, type BillableMetricCreateParams as BillableMetricCreateParams, type BillableMetricRetrieveParams as BillableMetricRetrieveParams, type BillableMetricListParams as BillableMetricListParams, type BillableMetricArchiveParams as BillableMetricArchiveParams, };
|
|
292
|
+
}
|
|
293
|
+
//# sourceMappingURL=billable-metrics.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billable-metrics.d.mts","sourceRoot":"","sources":["../../src/resources/v1/billable-metrics.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE;OAClD,EAAE,cAAc,EAAE;AAGzB,qBAAa,eAAgB,SAAQ,WAAW;IAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuDG;IACH,MAAM,CACJ,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,4BAA4B,CAAC;IAI3C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CACN,MAAM,EAAE,4BAA4B,EACpC,OAAO,CAAC,EAAE,cAAc,GACvB,UAA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AK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAElC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAEhD;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,4BAA4B;IAC3C,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IAChE;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,CAAC,OAAO,WAAW,eAAe,CAAC;IACvC,OAAO,EACL,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,qCAAqC,IAAI,qCAAqC,EACnF,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,2BAA2B,IAAI,2BAA2B,GAChE,CAAC;CACH"}
|
|
@@ -1,10 +1,39 @@
|
|
|
1
|
-
import { APIResource } from "../../resource.js";
|
|
2
|
-
import * as Core from "../../core.js";
|
|
1
|
+
import { APIResource } from "../../core/resource.js";
|
|
3
2
|
import * as Shared from "../shared.js";
|
|
4
|
-
import {
|
|
3
|
+
import { APIPromise } from "../../core/api-promise.js";
|
|
4
|
+
import { CursorPage, type CursorPageParams, PagePromise } from "../../core/pagination.js";
|
|
5
|
+
import { RequestOptions } from "../../internal/request-options.js";
|
|
5
6
|
export declare class BillableMetrics extends APIResource {
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* Create billable metrics programmatically with this endpoint—an essential step in
|
|
9
|
+
* configuring your pricing and packaging in Metronome.
|
|
10
|
+
*
|
|
11
|
+
* A billable metric is a customizable query that filters and aggregates events
|
|
12
|
+
* from your event stream. These metrics are continuously tracked as usage data
|
|
13
|
+
* enters Metronome through the ingestion pipeline. The ingestion process
|
|
14
|
+
* transforms raw usage data into actionable pricing metrics, enabling accurate
|
|
15
|
+
* metering and billing for your products.
|
|
16
|
+
*
|
|
17
|
+
* ### Use this endpoint to:
|
|
18
|
+
*
|
|
19
|
+
* - Create individual or multiple billable metrics as part of a setup workflow.
|
|
20
|
+
* - Automate the entire pricing configuration process, from metric creation to
|
|
21
|
+
* customer contract setup.
|
|
22
|
+
* - Define metrics using either standard filtering/aggregation or a custom SQL
|
|
23
|
+
* query.
|
|
24
|
+
*
|
|
25
|
+
* ### Key response fields:
|
|
26
|
+
*
|
|
27
|
+
* - The ID of the billable metric that was created
|
|
28
|
+
* - The created billable metric will be available to be used in Products, usage
|
|
29
|
+
* endpoints, and alerts.
|
|
30
|
+
*
|
|
31
|
+
* ### Usage guidelines:
|
|
32
|
+
*
|
|
33
|
+
* - Metrics defined using standard filtering and aggregation are Streaming
|
|
34
|
+
* billable metrics, which have been optimized for ultra low latency and high
|
|
35
|
+
* throughput workflows.
|
|
36
|
+
* - Use SQL billable metrics if you require more flexible aggregation options.
|
|
8
37
|
*
|
|
9
38
|
* @example
|
|
10
39
|
* ```ts
|
|
@@ -31,9 +60,19 @@ export declare class BillableMetrics extends APIResource {
|
|
|
31
60
|
* });
|
|
32
61
|
* ```
|
|
33
62
|
*/
|
|
34
|
-
create(body: BillableMetricCreateParams, options?:
|
|
63
|
+
create(body: BillableMetricCreateParams, options?: RequestOptions): APIPromise<BillableMetricCreateResponse>;
|
|
35
64
|
/**
|
|
36
|
-
*
|
|
65
|
+
* Retrieves the complete configuration for a specific billable metric by its ID.
|
|
66
|
+
* Use this to review billable metric setup before associating it with products.
|
|
67
|
+
* Returns the metric's `name`, `event_type_filter`, `property_filters`,
|
|
68
|
+
* `aggregation_type`, `aggregation_key`, `group_keys`, `custom fields`, and
|
|
69
|
+
* `SQL query` (if it's a SQL billable metric).
|
|
70
|
+
*
|
|
71
|
+
* Important:
|
|
72
|
+
*
|
|
73
|
+
* - Archived billable metrics will include an `archived_at` timestamp; they no
|
|
74
|
+
* longer process new usage events but remain accessible for historical
|
|
75
|
+
* reference.
|
|
37
76
|
*
|
|
38
77
|
* @example
|
|
39
78
|
* ```ts
|
|
@@ -44,9 +83,13 @@ export declare class BillableMetrics extends APIResource {
|
|
|
44
83
|
* });
|
|
45
84
|
* ```
|
|
46
85
|
*/
|
|
47
|
-
retrieve(params: BillableMetricRetrieveParams, options?:
|
|
86
|
+
retrieve(params: BillableMetricRetrieveParams, options?: RequestOptions): APIPromise<BillableMetricRetrieveResponse>;
|
|
48
87
|
/**
|
|
49
|
-
*
|
|
88
|
+
* Retrieves all billable metrics with their complete configurations. Use this for
|
|
89
|
+
* programmatic discovery and management of billable metrics, such as associating
|
|
90
|
+
* metrics to products and auditing for orphaned or archived metrics. Important:
|
|
91
|
+
* Archived metrics are excluded by default; use `include_archived`=`true`
|
|
92
|
+
* parameter to include them.
|
|
50
93
|
*
|
|
51
94
|
* @example
|
|
52
95
|
* ```ts
|
|
@@ -56,10 +99,17 @@ export declare class BillableMetrics extends APIResource {
|
|
|
56
99
|
* }
|
|
57
100
|
* ```
|
|
58
101
|
*/
|
|
59
|
-
list(query?: BillableMetricListParams, options?:
|
|
60
|
-
list(options?: Core.RequestOptions): Core.PagePromise<BillableMetricListResponsesCursorPage, BillableMetricListResponse>;
|
|
102
|
+
list(query?: BillableMetricListParams | null | undefined, options?: RequestOptions): PagePromise<BillableMetricListResponsesCursorPage, BillableMetricListResponse>;
|
|
61
103
|
/**
|
|
62
|
-
*
|
|
104
|
+
* Use this endpoint to retire billable metrics that are no longer used. After a
|
|
105
|
+
* billable metric is archived, that billable metric can no longer be used in any
|
|
106
|
+
* new Products to define how that product should be metered. If you archive a
|
|
107
|
+
* billable metric that is already associated with a Product, the Product will
|
|
108
|
+
* continue to function as usual, metering based on the definition of the archived
|
|
109
|
+
* billable metric.
|
|
110
|
+
*
|
|
111
|
+
* Archived billable metrics will be returned on the `getBillableMetric` and
|
|
112
|
+
* `listBillableMetrics` endpoints with a populated `archived_at` field.
|
|
63
113
|
*
|
|
64
114
|
* @example
|
|
65
115
|
* ```ts
|
|
@@ -68,10 +118,9 @@ export declare class BillableMetrics extends APIResource {
|
|
|
68
118
|
* });
|
|
69
119
|
* ```
|
|
70
120
|
*/
|
|
71
|
-
archive(body: BillableMetricArchiveParams, options?:
|
|
72
|
-
}
|
|
73
|
-
export declare class BillableMetricListResponsesCursorPage extends CursorPage<BillableMetricListResponse> {
|
|
121
|
+
archive(body: BillableMetricArchiveParams, options?: RequestOptions): APIPromise<BillableMetricArchiveResponse>;
|
|
74
122
|
}
|
|
123
|
+
export type BillableMetricListResponsesCursorPage = CursorPage<BillableMetricListResponse>;
|
|
75
124
|
export interface BillableMetricCreateResponse {
|
|
76
125
|
data: Shared.ID;
|
|
77
126
|
}
|
|
@@ -103,6 +152,9 @@ export declare namespace BillableMetricRetrieveResponse {
|
|
|
103
152
|
* provided, the billable metric is not archived.
|
|
104
153
|
*/
|
|
105
154
|
archived_at?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
|
|
157
|
+
*/
|
|
106
158
|
custom_fields?: {
|
|
107
159
|
[key: string]: string;
|
|
108
160
|
};
|
|
@@ -151,6 +203,9 @@ export interface BillableMetricListResponse {
|
|
|
151
203
|
* provided, the billable metric is not archived.
|
|
152
204
|
*/
|
|
153
205
|
archived_at?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
|
|
208
|
+
*/
|
|
154
209
|
custom_fields?: {
|
|
155
210
|
[key: string]: string;
|
|
156
211
|
};
|
|
@@ -233,6 +288,6 @@ export interface BillableMetricArchiveParams {
|
|
|
233
288
|
id: string;
|
|
234
289
|
}
|
|
235
290
|
export declare namespace BillableMetrics {
|
|
236
|
-
export { type BillableMetricCreateResponse as BillableMetricCreateResponse, type BillableMetricRetrieveResponse as BillableMetricRetrieveResponse, type BillableMetricListResponse as BillableMetricListResponse, type BillableMetricArchiveResponse as BillableMetricArchiveResponse, BillableMetricListResponsesCursorPage as BillableMetricListResponsesCursorPage, type BillableMetricCreateParams as BillableMetricCreateParams, type BillableMetricRetrieveParams as BillableMetricRetrieveParams, type BillableMetricListParams as BillableMetricListParams, type BillableMetricArchiveParams as BillableMetricArchiveParams, };
|
|
291
|
+
export { type BillableMetricCreateResponse as BillableMetricCreateResponse, type BillableMetricRetrieveResponse as BillableMetricRetrieveResponse, type BillableMetricListResponse as BillableMetricListResponse, type BillableMetricArchiveResponse as BillableMetricArchiveResponse, type BillableMetricListResponsesCursorPage as BillableMetricListResponsesCursorPage, type BillableMetricCreateParams as BillableMetricCreateParams, type BillableMetricRetrieveParams as BillableMetricRetrieveParams, type BillableMetricListParams as BillableMetricListParams, type BillableMetricArchiveParams as BillableMetricArchiveParams, };
|
|
237
292
|
}
|
|
238
293
|
//# sourceMappingURL=billable-metrics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billable-metrics.d.ts","sourceRoot":"","sources":["../../src/resources/v1/billable-metrics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"billable-metrics.d.ts","sourceRoot":"","sources":["../../src/resources/v1/billable-metrics.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE;OAClD,EAAE,cAAc,EAAE;AAGzB,qBAAa,eAAgB,SAAQ,WAAW;IAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuDG;IACH,MAAM,CACJ,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC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E,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAE1C;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC;IAE3C;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAElC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAEhD;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,4BAA4B;IAC3C,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IAChE;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,CAAC,OAAO,WAAW,eAAe,CAAC;IACvC,OAAO,EACL,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,qCAAqC,IAAI,qCAAqC,EACnF,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,2BAA2B,IAAI,2BAA2B,GAChE,CAAC;CACH"}
|
|
@@ -1,13 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
const resource_1 = require("../../resource.js");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
4
|
+
exports.BillableMetrics = void 0;
|
|
5
|
+
const resource_1 = require("../../core/resource.js");
|
|
6
|
+
const pagination_1 = require("../../core/pagination.js");
|
|
7
|
+
const path_1 = require("../../internal/utils/path.js");
|
|
8
8
|
class BillableMetrics extends resource_1.APIResource {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Create billable metrics programmatically with this endpoint—an essential step in
|
|
11
|
+
* configuring your pricing and packaging in Metronome.
|
|
12
|
+
*
|
|
13
|
+
* A billable metric is a customizable query that filters and aggregates events
|
|
14
|
+
* from your event stream. These metrics are continuously tracked as usage data
|
|
15
|
+
* enters Metronome through the ingestion pipeline. The ingestion process
|
|
16
|
+
* transforms raw usage data into actionable pricing metrics, enabling accurate
|
|
17
|
+
* metering and billing for your products.
|
|
18
|
+
*
|
|
19
|
+
* ### Use this endpoint to:
|
|
20
|
+
*
|
|
21
|
+
* - Create individual or multiple billable metrics as part of a setup workflow.
|
|
22
|
+
* - Automate the entire pricing configuration process, from metric creation to
|
|
23
|
+
* customer contract setup.
|
|
24
|
+
* - Define metrics using either standard filtering/aggregation or a custom SQL
|
|
25
|
+
* query.
|
|
26
|
+
*
|
|
27
|
+
* ### Key response fields:
|
|
28
|
+
*
|
|
29
|
+
* - The ID of the billable metric that was created
|
|
30
|
+
* - The created billable metric will be available to be used in Products, usage
|
|
31
|
+
* endpoints, and alerts.
|
|
32
|
+
*
|
|
33
|
+
* ### Usage guidelines:
|
|
34
|
+
*
|
|
35
|
+
* - Metrics defined using standard filtering and aggregation are Streaming
|
|
36
|
+
* billable metrics, which have been optimized for ultra low latency and high
|
|
37
|
+
* throughput workflows.
|
|
38
|
+
* - Use SQL billable metrics if you require more flexible aggregation options.
|
|
11
39
|
*
|
|
12
40
|
* @example
|
|
13
41
|
* ```ts
|
|
@@ -38,7 +66,17 @@ class BillableMetrics extends resource_1.APIResource {
|
|
|
38
66
|
return this._client.post('/v1/billable-metrics/create', { body, ...options });
|
|
39
67
|
}
|
|
40
68
|
/**
|
|
41
|
-
*
|
|
69
|
+
* Retrieves the complete configuration for a specific billable metric by its ID.
|
|
70
|
+
* Use this to review billable metric setup before associating it with products.
|
|
71
|
+
* Returns the metric's `name`, `event_type_filter`, `property_filters`,
|
|
72
|
+
* `aggregation_type`, `aggregation_key`, `group_keys`, `custom fields`, and
|
|
73
|
+
* `SQL query` (if it's a SQL billable metric).
|
|
74
|
+
*
|
|
75
|
+
* Important:
|
|
76
|
+
*
|
|
77
|
+
* - Archived billable metrics will include an `archived_at` timestamp; they no
|
|
78
|
+
* longer process new usage events but remain accessible for historical
|
|
79
|
+
* reference.
|
|
42
80
|
*
|
|
43
81
|
* @example
|
|
44
82
|
* ```ts
|
|
@@ -51,19 +89,39 @@ class BillableMetrics extends resource_1.APIResource {
|
|
|
51
89
|
*/
|
|
52
90
|
retrieve(params, options) {
|
|
53
91
|
const { billable_metric_id } = params;
|
|
54
|
-
return this._client.get(`/v1/billable-metrics/${billable_metric_id}`, options);
|
|
92
|
+
return this._client.get((0, path_1.path) `/v1/billable-metrics/${billable_metric_id}`, options);
|
|
55
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Retrieves all billable metrics with their complete configurations. Use this for
|
|
96
|
+
* programmatic discovery and management of billable metrics, such as associating
|
|
97
|
+
* metrics to products and auditing for orphaned or archived metrics. Important:
|
|
98
|
+
* Archived metrics are excluded by default; use `include_archived`=`true`
|
|
99
|
+
* parameter to include them.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* // Automatically fetches more pages as needed.
|
|
104
|
+
* for await (const billableMetricListResponse of client.v1.billableMetrics.list()) {
|
|
105
|
+
* // ...
|
|
106
|
+
* }
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
56
109
|
list(query = {}, options) {
|
|
57
|
-
|
|
58
|
-
return this.list({}, query);
|
|
59
|
-
}
|
|
60
|
-
return this._client.getAPIList('/v1/billable-metrics', BillableMetricListResponsesCursorPage, {
|
|
110
|
+
return this._client.getAPIList('/v1/billable-metrics', (pagination_1.CursorPage), {
|
|
61
111
|
query,
|
|
62
112
|
...options,
|
|
63
113
|
});
|
|
64
114
|
}
|
|
65
115
|
/**
|
|
66
|
-
*
|
|
116
|
+
* Use this endpoint to retire billable metrics that are no longer used. After a
|
|
117
|
+
* billable metric is archived, that billable metric can no longer be used in any
|
|
118
|
+
* new Products to define how that product should be metered. If you archive a
|
|
119
|
+
* billable metric that is already associated with a Product, the Product will
|
|
120
|
+
* continue to function as usual, metering based on the definition of the archived
|
|
121
|
+
* billable metric.
|
|
122
|
+
*
|
|
123
|
+
* Archived billable metrics will be returned on the `getBillableMetric` and
|
|
124
|
+
* `listBillableMetrics` endpoints with a populated `archived_at` field.
|
|
67
125
|
*
|
|
68
126
|
* @example
|
|
69
127
|
* ```ts
|
|
@@ -77,8 +135,4 @@ class BillableMetrics extends resource_1.APIResource {
|
|
|
77
135
|
}
|
|
78
136
|
}
|
|
79
137
|
exports.BillableMetrics = BillableMetrics;
|
|
80
|
-
class BillableMetricListResponsesCursorPage extends pagination_1.CursorPage {
|
|
81
|
-
}
|
|
82
|
-
exports.BillableMetricListResponsesCursorPage = BillableMetricListResponsesCursorPage;
|
|
83
|
-
BillableMetrics.BillableMetricListResponsesCursorPage = BillableMetricListResponsesCursorPage;
|
|
84
138
|
//# sourceMappingURL=billable-metrics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billable-metrics.js","sourceRoot":"","sources":["../../src/resources/v1/billable-metrics.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
1
|
+
{"version":3,"file":"billable-metrics.js","sourceRoot":"","sources":["../../src/resources/v1/billable-metrics.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,yDAAuF;AAEvF,uDAAiD;AAEjD,MAAa,eAAgB,SAAQ,sBAAW;IAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuDG;IACH,MAAM,CACJ,IAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CACN,MAAoC,EACpC,OAAwB;QAExB,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,wBAAwB,kBAAkB,EAAE,EAAE,OAAO,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,IAAI,CACF,QAAqD,EAAE,EACvD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAA,uBAAsC,CAAA,EAAE;YAC7F,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CACL,IAAiC,EACjC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjF,CAAC;CACF;AA/ID,0CA+IC"}
|