@stigg/typescript 0.1.0-alpha.2 → 0.1.0-alpha.21
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 +270 -0
- package/README.md +9 -0
- package/client.d.mts +7 -9
- package/client.d.mts.map +1 -1
- package/client.d.ts +7 -9
- package/client.d.ts.map +1 -1
- package/client.js +29 -26
- package/client.js.map +1 -1
- package/client.mjs +30 -27
- package/client.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.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 +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/tslib.js +17 -17
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +10 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +12 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/v1/addons/addons.d.mts +1305 -0
- package/resources/v1/addons/addons.d.mts.map +1 -0
- package/resources/v1/addons/addons.d.ts +1305 -0
- package/resources/v1/addons/addons.d.ts.map +1 -0
- package/resources/v1/addons/addons.js +81 -0
- package/resources/v1/addons/addons.js.map +1 -0
- package/resources/v1/addons/addons.mjs +76 -0
- package/resources/v1/addons/addons.mjs.map +1 -0
- package/resources/v1/addons/entitlements.d.mts +860 -0
- package/resources/v1/addons/entitlements.d.mts.map +1 -0
- package/resources/v1/addons/entitlements.d.ts +860 -0
- package/resources/v1/addons/entitlements.d.ts.map +1 -0
- package/resources/v1/addons/entitlements.js +36 -0
- package/resources/v1/addons/entitlements.js.map +1 -0
- package/resources/v1/addons/entitlements.mjs +32 -0
- package/resources/v1/addons/entitlements.mjs.map +1 -0
- package/resources/v1/addons/index.d.mts +3 -0
- package/resources/v1/addons/index.d.mts.map +1 -0
- package/resources/v1/addons/index.d.ts +3 -0
- package/resources/v1/addons/index.d.ts.map +1 -0
- package/resources/v1/addons/index.js +9 -0
- package/resources/v1/addons/index.js.map +1 -0
- package/resources/v1/addons/index.mjs +4 -0
- package/resources/v1/addons/index.mjs.map +1 -0
- package/resources/v1/addons.d.mts +2 -0
- package/resources/v1/addons.d.mts.map +1 -0
- package/resources/v1/addons.d.ts +2 -0
- package/resources/v1/addons.d.ts.map +1 -0
- package/resources/v1/addons.js +6 -0
- package/resources/v1/addons.js.map +1 -0
- package/resources/v1/addons.mjs +3 -0
- package/resources/v1/addons.mjs.map +1 -0
- package/resources/v1/coupons.d.mts +113 -82
- package/resources/v1/coupons.d.mts.map +1 -1
- package/resources/v1/coupons.d.ts +113 -82
- package/resources/v1/coupons.d.ts.map +1 -1
- package/resources/v1/coupons.js +19 -3
- package/resources/v1/coupons.js.map +1 -1
- package/resources/v1/coupons.mjs +19 -3
- package/resources/v1/coupons.mjs.map +1 -1
- package/resources/v1/customers/customers.d.mts +221 -45
- package/resources/v1/customers/customers.d.mts.map +1 -1
- package/resources/v1/customers/customers.d.ts +221 -45
- package/resources/v1/customers/customers.d.ts.map +1 -1
- package/resources/v1/customers/customers.js +32 -15
- package/resources/v1/customers/customers.js.map +1 -1
- package/resources/v1/customers/customers.mjs +32 -15
- package/resources/v1/customers/customers.mjs.map +1 -1
- package/resources/v1/customers/index.d.mts +2 -2
- package/resources/v1/customers/index.d.mts.map +1 -1
- package/resources/v1/customers/index.d.ts +2 -2
- package/resources/v1/customers/index.d.ts.map +1 -1
- package/resources/v1/customers/index.js +3 -3
- package/resources/v1/customers/index.js.map +1 -1
- package/resources/v1/customers/index.mjs +1 -1
- package/resources/v1/customers/index.mjs.map +1 -1
- package/resources/v1/customers/payment-method.d.mts +10 -2
- package/resources/v1/customers/payment-method.d.mts.map +1 -1
- package/resources/v1/customers/payment-method.d.ts +10 -2
- package/resources/v1/customers/payment-method.d.ts.map +1 -1
- package/resources/v1/customers/payment-method.js +7 -2
- package/resources/v1/customers/payment-method.js.map +1 -1
- package/resources/v1/customers/payment-method.mjs +7 -2
- package/resources/v1/customers/payment-method.mjs.map +1 -1
- package/resources/v1/customers/promotional-entitlements.d.mts +501 -0
- package/resources/v1/customers/promotional-entitlements.d.mts.map +1 -0
- package/resources/v1/customers/promotional-entitlements.d.ts +501 -0
- package/resources/v1/customers/promotional-entitlements.d.ts.map +1 -0
- package/resources/v1/customers/promotional-entitlements.js +35 -0
- package/resources/v1/customers/promotional-entitlements.js.map +1 -0
- package/resources/v1/customers/promotional-entitlements.mjs +31 -0
- package/resources/v1/customers/promotional-entitlements.mjs.map +1 -0
- package/resources/v1/events/credits/credits.d.mts +260 -0
- package/resources/v1/events/credits/credits.d.mts.map +1 -0
- package/resources/v1/events/credits/credits.d.ts +260 -0
- package/resources/v1/events/credits/credits.d.ts.map +1 -0
- package/resources/v1/events/credits/credits.js +41 -0
- package/resources/v1/events/credits/credits.js.map +1 -0
- package/resources/v1/events/credits/credits.mjs +36 -0
- package/resources/v1/events/credits/credits.mjs.map +1 -0
- package/resources/v1/events/credits/grants.d.mts +549 -0
- package/resources/v1/events/credits/grants.d.mts.map +1 -0
- package/resources/v1/events/credits/grants.d.ts +549 -0
- package/resources/v1/events/credits/grants.d.ts.map +1 -0
- package/resources/v1/events/credits/grants.js +37 -0
- package/resources/v1/events/credits/grants.js.map +1 -0
- package/resources/v1/events/credits/grants.mjs +33 -0
- package/resources/v1/events/credits/grants.mjs.map +1 -0
- package/resources/v1/events/credits/index.d.mts +3 -0
- package/resources/v1/events/credits/index.d.mts.map +1 -0
- package/resources/v1/events/credits/index.d.ts +3 -0
- package/resources/v1/events/credits/index.d.ts.map +1 -0
- package/resources/v1/events/credits/index.js +9 -0
- package/resources/v1/events/credits/index.js.map +1 -0
- package/resources/v1/events/credits/index.mjs +4 -0
- package/resources/v1/events/credits/index.mjs.map +1 -0
- package/resources/v1/events/credits.d.mts +2 -0
- package/resources/v1/events/credits.d.mts.map +1 -0
- package/resources/v1/events/credits.d.ts +2 -0
- package/resources/v1/events/credits.d.ts.map +1 -0
- package/resources/v1/events/credits.js +6 -0
- package/resources/v1/events/credits.js.map +1 -0
- package/resources/v1/events/credits.mjs +3 -0
- package/resources/v1/events/credits.mjs.map +1 -0
- package/resources/v1/events/events.d.mts +70 -0
- package/resources/v1/events/events.d.mts.map +1 -0
- package/resources/v1/events/events.d.ts +70 -0
- package/resources/v1/events/events.d.ts.map +1 -0
- package/resources/v1/events/events.js +27 -0
- package/resources/v1/events/events.js.map +1 -0
- package/resources/v1/events/events.mjs +22 -0
- package/resources/v1/events/events.mjs.map +1 -0
- package/resources/v1/events/index.d.mts +3 -0
- package/resources/v1/events/index.d.mts.map +1 -0
- package/resources/v1/events/index.d.ts +3 -0
- package/resources/v1/events/index.d.ts.map +1 -0
- package/resources/v1/events/index.js +9 -0
- package/resources/v1/events/index.js.map +1 -0
- package/resources/v1/events/index.mjs +4 -0
- package/resources/v1/events/index.mjs.map +1 -0
- package/resources/v1/events.d.mts +2 -0
- package/resources/v1/events.d.mts.map +1 -0
- package/resources/v1/events.d.ts +2 -0
- package/resources/v1/events.d.ts.map +1 -0
- package/resources/v1/events.js +6 -0
- package/resources/v1/events.js.map +1 -0
- package/resources/v1/events.mjs +3 -0
- package/resources/v1/events.mjs.map +1 -0
- package/resources/v1/features.d.mts +447 -0
- package/resources/v1/features.d.mts.map +1 -0
- package/resources/v1/features.d.ts +447 -0
- package/resources/v1/features.d.ts.map +1 -0
- package/resources/v1/features.js +54 -0
- package/resources/v1/features.js.map +1 -0
- package/resources/v1/features.mjs +50 -0
- package/resources/v1/features.mjs.map +1 -0
- package/resources/v1/index.d.mts +10 -4
- package/resources/v1/index.d.mts.map +1 -1
- package/resources/v1/index.d.ts +10 -4
- package/resources/v1/index.d.ts.map +1 -1
- package/resources/v1/index.js +17 -5
- package/resources/v1/index.js.map +1 -1
- package/resources/v1/index.mjs +7 -1
- package/resources/v1/index.mjs.map +1 -1
- package/resources/v1/plans/entitlements.d.mts +860 -0
- package/resources/v1/plans/entitlements.d.mts.map +1 -0
- package/resources/v1/plans/entitlements.d.ts +860 -0
- package/resources/v1/plans/entitlements.d.ts.map +1 -0
- package/resources/v1/plans/entitlements.js +36 -0
- package/resources/v1/plans/entitlements.js.map +1 -0
- package/resources/v1/plans/entitlements.mjs +32 -0
- package/resources/v1/plans/entitlements.mjs.map +1 -0
- package/resources/v1/plans/index.d.mts +3 -0
- package/resources/v1/plans/index.d.mts.map +1 -0
- package/resources/v1/plans/index.d.ts +3 -0
- package/resources/v1/plans/index.d.ts.map +1 -0
- package/resources/v1/plans/index.js +9 -0
- package/resources/v1/plans/index.js.map +1 -0
- package/resources/v1/plans/index.mjs +4 -0
- package/resources/v1/plans/index.mjs.map +1 -0
- package/resources/v1/plans/plans.d.mts +976 -0
- package/resources/v1/plans/plans.d.mts.map +1 -0
- package/resources/v1/plans/plans.d.ts +976 -0
- package/resources/v1/plans/plans.d.ts.map +1 -0
- package/resources/v1/plans/plans.js +79 -0
- package/resources/v1/plans/plans.js.map +1 -0
- package/resources/v1/plans/plans.mjs +74 -0
- package/resources/v1/plans/plans.mjs.map +1 -0
- package/resources/v1/plans.d.mts +2 -0
- package/resources/v1/plans.d.mts.map +1 -0
- package/resources/v1/plans.d.ts +2 -0
- package/resources/v1/plans.d.ts.map +1 -0
- package/resources/v1/plans.js +6 -0
- package/resources/v1/plans.js.map +1 -0
- package/resources/v1/plans.mjs +3 -0
- package/resources/v1/plans.mjs.map +1 -0
- package/resources/v1/products.d.mts +335 -0
- package/resources/v1/products.d.mts.map +1 -0
- package/resources/v1/products.d.ts +335 -0
- package/resources/v1/products.d.ts.map +1 -0
- package/resources/v1/products.js +55 -0
- package/resources/v1/products.js.map +1 -0
- package/resources/v1/products.mjs +51 -0
- package/resources/v1/products.mjs.map +1 -0
- package/resources/v1/subscriptions/future-update.d.mts +15 -19
- package/resources/v1/subscriptions/future-update.d.mts.map +1 -1
- package/resources/v1/subscriptions/future-update.d.ts +15 -19
- package/resources/v1/subscriptions/future-update.d.ts.map +1 -1
- package/resources/v1/subscriptions/future-update.js +6 -2
- package/resources/v1/subscriptions/future-update.js.map +1 -1
- package/resources/v1/subscriptions/future-update.mjs +6 -2
- package/resources/v1/subscriptions/future-update.mjs.map +1 -1
- package/resources/v1/subscriptions/index.d.mts +4 -2
- package/resources/v1/subscriptions/index.d.mts.map +1 -1
- package/resources/v1/subscriptions/index.d.ts +4 -2
- package/resources/v1/subscriptions/index.d.ts.map +1 -1
- package/resources/v1/subscriptions/index.js +5 -1
- package/resources/v1/subscriptions/index.js.map +1 -1
- package/resources/v1/subscriptions/index.mjs +3 -1
- package/resources/v1/subscriptions/index.mjs.map +1 -1
- package/resources/v1/subscriptions/invoice.d.mts +37 -0
- package/resources/v1/subscriptions/invoice.d.mts.map +1 -0
- package/resources/v1/subscriptions/invoice.d.ts +37 -0
- package/resources/v1/subscriptions/invoice.d.ts.map +1 -0
- package/resources/v1/subscriptions/invoice.js +20 -0
- package/resources/v1/subscriptions/invoice.js.map +1 -0
- package/resources/v1/subscriptions/invoice.mjs +16 -0
- package/resources/v1/subscriptions/invoice.mjs.map +1 -0
- package/resources/v1/subscriptions/subscriptions.d.mts +2547 -561
- package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
- package/resources/v1/subscriptions/subscriptions.d.ts +2547 -561
- package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
- package/resources/v1/subscriptions/subscriptions.js +47 -11
- package/resources/v1/subscriptions/subscriptions.js.map +1 -1
- package/resources/v1/subscriptions/subscriptions.mjs +49 -13
- package/resources/v1/subscriptions/subscriptions.mjs.map +1 -1
- package/resources/v1/subscriptions/usage.d.mts +101 -0
- package/resources/v1/subscriptions/usage.d.mts.map +1 -0
- package/resources/v1/subscriptions/usage.d.ts +101 -0
- package/resources/v1/subscriptions/usage.d.ts.map +1 -0
- package/resources/v1/subscriptions/usage.js +27 -0
- package/resources/v1/subscriptions/usage.js.map +1 -0
- package/resources/v1/subscriptions/usage.mjs +23 -0
- package/resources/v1/subscriptions/usage.mjs.map +1 -0
- package/resources/v1/usage.d.mts +238 -0
- package/resources/v1/usage.d.mts.map +1 -0
- package/resources/v1/usage.d.ts +238 -0
- package/resources/v1/usage.d.ts.map +1 -0
- package/resources/v1/usage.js +27 -0
- package/resources/v1/usage.js.map +1 -0
- package/resources/v1/usage.mjs +23 -0
- package/resources/v1/usage.mjs.map +1 -0
- package/resources/v1/v1.d.mts +30 -149
- package/resources/v1/v1.d.mts.map +1 -1
- package/resources/v1/v1.d.ts +30 -149
- package/resources/v1/v1.d.ts.map +1 -1
- package/resources/v1/v1.js +24 -12
- package/resources/v1/v1.js.map +1 -1
- package/resources/v1/v1.mjs +24 -12
- package/resources/v1/v1.mjs.map +1 -1
- package/src/client.ts +41 -47
- package/src/internal/parse.ts +6 -0
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/index.ts +1 -7
- package/src/resources/v1/addons/addons.ts +3253 -0
- package/src/resources/v1/addons/entitlements.ts +1120 -0
- package/src/resources/v1/addons/index.ts +26 -0
- package/src/resources/v1/addons.ts +3 -0
- package/src/resources/v1/coupons.ts +126 -216
- package/src/resources/v1/customers/customers.ts +296 -61
- package/src/resources/v1/customers/index.ts +16 -2
- package/src/resources/v1/customers/payment-method.ts +10 -2
- package/src/resources/v1/customers/promotional-entitlements.ts +672 -0
- package/src/resources/v1/events/credits/credits.ts +356 -0
- package/src/resources/v1/events/credits/grants.ts +795 -0
- package/src/resources/v1/events/credits/index.ts +20 -0
- package/src/resources/v1/events/credits.ts +3 -0
- package/src/resources/v1/events/events.ts +103 -0
- package/src/resources/v1/events/index.ts +13 -0
- package/src/resources/v1/events.ts +3 -0
- package/src/resources/v1/features.ts +574 -0
- package/src/resources/v1/index.ts +70 -15
- package/src/resources/v1/plans/entitlements.ts +1112 -0
- package/src/resources/v1/plans/index.ts +24 -0
- package/src/resources/v1/plans/plans.ts +2035 -0
- package/src/resources/v1/plans.ts +3 -0
- package/src/resources/v1/products.ts +426 -0
- package/src/resources/v1/subscriptions/future-update.ts +15 -27
- package/src/resources/v1/subscriptions/index.ts +15 -11
- package/src/resources/v1/subscriptions/invoice.ts +45 -0
- package/src/resources/v1/subscriptions/subscriptions.ts +5836 -777
- package/src/resources/v1/subscriptions/usage.ts +129 -0
- package/src/resources/v1/usage.ts +293 -0
- package/src/resources/v1/v1.ts +168 -197
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/v1/customers/usage.d.mts +0 -98
- package/resources/v1/customers/usage.d.mts.map +0 -1
- package/resources/v1/customers/usage.d.ts +0 -98
- package/resources/v1/customers/usage.d.ts.map +0 -1
- package/resources/v1/customers/usage.js +0 -20
- package/resources/v1/customers/usage.js.map +0 -1
- package/resources/v1/customers/usage.mjs +0 -16
- package/resources/v1/customers/usage.mjs.map +0 -1
- package/src/resources/v1/customers/usage.ts +0 -132
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../../../core/api-promise.js";
|
|
3
|
+
import { RequestOptions } from "../../../internal/request-options.js";
|
|
4
|
+
/**
|
|
5
|
+
* Operations related to subscriptions
|
|
6
|
+
*/
|
|
7
|
+
export declare class Usage extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Immediately charges usage for a subscription via the billing integration.
|
|
10
|
+
* Calculates usage since the last charge and creates an invoice.
|
|
11
|
+
*/
|
|
12
|
+
chargeUsage(id: string, body: UsageChargeUsageParams, options?: RequestOptions): APIPromise<UsageChargeUsageResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Triggers a usage sync for a subscription, reporting current usage to the billing
|
|
15
|
+
* provider.
|
|
16
|
+
*/
|
|
17
|
+
sync(id: string, options?: RequestOptions): APIPromise<UsageSyncResponse>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Response object
|
|
21
|
+
*/
|
|
22
|
+
export interface UsageChargeUsageResponse {
|
|
23
|
+
/**
|
|
24
|
+
* Result of charging subscription usage including the billing period and charged
|
|
25
|
+
* items.
|
|
26
|
+
*/
|
|
27
|
+
data: UsageChargeUsageResponse.Data;
|
|
28
|
+
}
|
|
29
|
+
export declare namespace UsageChargeUsageResponse {
|
|
30
|
+
/**
|
|
31
|
+
* Result of charging subscription usage including the billing period and charged
|
|
32
|
+
* items.
|
|
33
|
+
*/
|
|
34
|
+
interface Data {
|
|
35
|
+
/**
|
|
36
|
+
* The invoice ID in the billing integration
|
|
37
|
+
*/
|
|
38
|
+
invoiceBillingId: string | null;
|
|
39
|
+
/**
|
|
40
|
+
* End of the usage billing period
|
|
41
|
+
*/
|
|
42
|
+
periodEnd: string;
|
|
43
|
+
/**
|
|
44
|
+
* Start of the usage billing period
|
|
45
|
+
*/
|
|
46
|
+
periodStart: string;
|
|
47
|
+
/**
|
|
48
|
+
* The subscription ID for which usage was charged
|
|
49
|
+
*/
|
|
50
|
+
subscriptionId: string;
|
|
51
|
+
/**
|
|
52
|
+
* Usage items that were charged
|
|
53
|
+
*/
|
|
54
|
+
usageCharged: Array<Data.UsageCharged>;
|
|
55
|
+
}
|
|
56
|
+
namespace Data {
|
|
57
|
+
/**
|
|
58
|
+
* A single usage item that was charged.
|
|
59
|
+
*/
|
|
60
|
+
interface UsageCharged {
|
|
61
|
+
/**
|
|
62
|
+
* The feature ID for which usage was charged
|
|
63
|
+
*/
|
|
64
|
+
featureId: string | null;
|
|
65
|
+
/**
|
|
66
|
+
* The number of units charged
|
|
67
|
+
*/
|
|
68
|
+
usageAmount: number;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Response object
|
|
74
|
+
*/
|
|
75
|
+
export interface UsageSyncResponse {
|
|
76
|
+
/**
|
|
77
|
+
* Result of triggering a subscription usage sync.
|
|
78
|
+
*/
|
|
79
|
+
data: UsageSyncResponse.Data;
|
|
80
|
+
}
|
|
81
|
+
export declare namespace UsageSyncResponse {
|
|
82
|
+
/**
|
|
83
|
+
* Result of triggering a subscription usage sync.
|
|
84
|
+
*/
|
|
85
|
+
interface Data {
|
|
86
|
+
/**
|
|
87
|
+
* Whether usage was synced to the billing provider
|
|
88
|
+
*/
|
|
89
|
+
triggered: boolean;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export interface UsageChargeUsageParams {
|
|
93
|
+
/**
|
|
94
|
+
* Cutoff date for usage calculation. If not provided, the current time is used.
|
|
95
|
+
*/
|
|
96
|
+
untilDate?: string;
|
|
97
|
+
}
|
|
98
|
+
export declare namespace Usage {
|
|
99
|
+
export { type UsageChargeUsageResponse as UsageChargeUsageResponse, type UsageSyncResponse as UsageSyncResponse, type UsageChargeUsageParams as UsageChargeUsageParams, };
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/resources/v1/subscriptions/usage.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;OAGG;IACH,WAAW,CACT,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,sBAAsB,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ACtD,CAAC;CACH"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Usage = void 0;
|
|
5
|
+
const resource_1 = require("../../../core/resource.js");
|
|
6
|
+
const path_1 = require("../../../internal/utils/path.js");
|
|
7
|
+
/**
|
|
8
|
+
* Operations related to subscriptions
|
|
9
|
+
*/
|
|
10
|
+
class Usage extends resource_1.APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* Immediately charges usage for a subscription via the billing integration.
|
|
13
|
+
* Calculates usage since the last charge and creates an invoice.
|
|
14
|
+
*/
|
|
15
|
+
chargeUsage(id, body, options) {
|
|
16
|
+
return this._client.post((0, path_1.path) `/api/v1/subscriptions/${id}/usage/charge`, { body, ...options });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Triggers a usage sync for a subscription, reporting current usage to the billing
|
|
20
|
+
* provider.
|
|
21
|
+
*/
|
|
22
|
+
sync(id, options) {
|
|
23
|
+
return this._client.post((0, path_1.path) `/api/v1/subscriptions/${id}/usage/sync`, options);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.Usage = Usage;
|
|
27
|
+
//# sourceMappingURL=usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/resources/v1/subscriptions/usage.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAGrD,0DAAoD;AAEpD;;GAEG;AACH,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;OAGG;IACH,WAAW,CACT,EAAU,EACV,IAA4B,EAC5B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,yBAAyB,EAAE,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjG,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,EAAU,EAAE,OAAwB;QACvC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,yBAAyB,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;CACF;AApBD,sBAoBC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
3
|
+
import { path } from "../../../internal/utils/path.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Operations related to subscriptions
|
|
6
|
+
*/
|
|
7
|
+
export class Usage extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Immediately charges usage for a subscription via the billing integration.
|
|
10
|
+
* Calculates usage since the last charge and creates an invoice.
|
|
11
|
+
*/
|
|
12
|
+
chargeUsage(id, body, options) {
|
|
13
|
+
return this._client.post(path `/api/v1/subscriptions/${id}/usage/charge`, { body, ...options });
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Triggers a usage sync for a subscription, reporting current usage to the billing
|
|
17
|
+
* provider.
|
|
18
|
+
*/
|
|
19
|
+
sync(id, options) {
|
|
20
|
+
return this._client.post(path `/api/v1/subscriptions/${id}/usage/sync`, options);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=usage.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.mjs","sourceRoot":"","sources":["../../../src/resources/v1/subscriptions/usage.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,IAAI,EAAE;AAEf;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;OAGG;IACH,WAAW,CACT,EAAU,EACV,IAA4B,EAC5B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,yBAAyB,EAAE,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjG,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,EAAU,EAAE,OAAwB;QACvC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,yBAAyB,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;CACF"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
+
import { APIPromise } from "../../core/api-promise.mjs";
|
|
3
|
+
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Operations related to usage & metering
|
|
6
|
+
*/
|
|
7
|
+
export declare class Usage extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves historical usage data for a customer's metered feature over time.
|
|
10
|
+
*/
|
|
11
|
+
history(featureID: string, params: UsageHistoryParams, options?: RequestOptions): APIPromise<UsageHistoryResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* Reports usage measurements for metered features. The reported usage is used to
|
|
14
|
+
* track, limit, and bill customer consumption.
|
|
15
|
+
*/
|
|
16
|
+
report(body: UsageReportParams, options?: RequestOptions): APIPromise<UsageReportResponse>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Response object
|
|
20
|
+
*/
|
|
21
|
+
export interface UsageHistoryResponse {
|
|
22
|
+
/**
|
|
23
|
+
* Historical usage time series
|
|
24
|
+
*/
|
|
25
|
+
data: UsageHistoryResponse.Data;
|
|
26
|
+
}
|
|
27
|
+
export declare namespace UsageHistoryResponse {
|
|
28
|
+
/**
|
|
29
|
+
* Historical usage time series
|
|
30
|
+
*/
|
|
31
|
+
interface Data {
|
|
32
|
+
/**
|
|
33
|
+
* Markers for events that affecting feature usage
|
|
34
|
+
*/
|
|
35
|
+
markers: Array<Data.Marker>;
|
|
36
|
+
/**
|
|
37
|
+
* Series of usage history
|
|
38
|
+
*/
|
|
39
|
+
series: Array<Data.Series>;
|
|
40
|
+
}
|
|
41
|
+
namespace Data {
|
|
42
|
+
/**
|
|
43
|
+
* Usage reset or change marker
|
|
44
|
+
*/
|
|
45
|
+
interface Marker {
|
|
46
|
+
/**
|
|
47
|
+
* Timestamp of the marker
|
|
48
|
+
*/
|
|
49
|
+
timestamp: string;
|
|
50
|
+
/**
|
|
51
|
+
* Type of marker for a usage history point
|
|
52
|
+
*/
|
|
53
|
+
type: 'PERIODIC_RESET' | 'SUBSCRIPTION_CHANGE_RESET';
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Usage data points with tags
|
|
57
|
+
*/
|
|
58
|
+
interface Series {
|
|
59
|
+
/**
|
|
60
|
+
* Points in the usage history series
|
|
61
|
+
*/
|
|
62
|
+
points: Array<Series.Point>;
|
|
63
|
+
/**
|
|
64
|
+
* Tags for the usage history series
|
|
65
|
+
*/
|
|
66
|
+
tags: Array<Series.Tag>;
|
|
67
|
+
}
|
|
68
|
+
namespace Series {
|
|
69
|
+
/**
|
|
70
|
+
* Single usage data point
|
|
71
|
+
*/
|
|
72
|
+
interface Point {
|
|
73
|
+
/**
|
|
74
|
+
* Indicates whether there was usage reset in this point, see `markers` for details
|
|
75
|
+
*/
|
|
76
|
+
isResetPoint: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Timestamp of the usage history point
|
|
79
|
+
*/
|
|
80
|
+
timestamp: string;
|
|
81
|
+
/**
|
|
82
|
+
* Value of the usage history point
|
|
83
|
+
*/
|
|
84
|
+
value: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Grouping tag key-value
|
|
88
|
+
*/
|
|
89
|
+
interface Tag {
|
|
90
|
+
/**
|
|
91
|
+
* Key of the tag
|
|
92
|
+
*/
|
|
93
|
+
key: string;
|
|
94
|
+
/**
|
|
95
|
+
* Value of the tag
|
|
96
|
+
*/
|
|
97
|
+
value: string;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Response containing reported usage measurements with current usage values,
|
|
104
|
+
* period information, and reset dates for each measurement.
|
|
105
|
+
*/
|
|
106
|
+
export interface UsageReportResponse {
|
|
107
|
+
/**
|
|
108
|
+
* Array of usage measurements with current values and period info
|
|
109
|
+
*/
|
|
110
|
+
data: Array<UsageReportResponse.Data>;
|
|
111
|
+
}
|
|
112
|
+
export declare namespace UsageReportResponse {
|
|
113
|
+
/**
|
|
114
|
+
* Recorded usage with period info
|
|
115
|
+
*/
|
|
116
|
+
interface Data {
|
|
117
|
+
/**
|
|
118
|
+
* Unique identifier for the entity
|
|
119
|
+
*/
|
|
120
|
+
id: string;
|
|
121
|
+
/**
|
|
122
|
+
* Timestamp of when the record was created
|
|
123
|
+
*/
|
|
124
|
+
createdAt: string;
|
|
125
|
+
/**
|
|
126
|
+
* Customer id
|
|
127
|
+
*/
|
|
128
|
+
customerId: string;
|
|
129
|
+
/**
|
|
130
|
+
* Feature id
|
|
131
|
+
*/
|
|
132
|
+
featureId: string;
|
|
133
|
+
/**
|
|
134
|
+
* Timestamp
|
|
135
|
+
*/
|
|
136
|
+
timestamp: string;
|
|
137
|
+
/**
|
|
138
|
+
* The usage measurement record
|
|
139
|
+
*/
|
|
140
|
+
value: number;
|
|
141
|
+
/**
|
|
142
|
+
* The current measured usage value
|
|
143
|
+
*/
|
|
144
|
+
currentUsage?: number | null;
|
|
145
|
+
/**
|
|
146
|
+
* The date when the next usage reset will occur
|
|
147
|
+
*/
|
|
148
|
+
nextResetDate?: string | null;
|
|
149
|
+
/**
|
|
150
|
+
* Resource id
|
|
151
|
+
*/
|
|
152
|
+
resourceId?: string | null;
|
|
153
|
+
/**
|
|
154
|
+
* The end date of the usage period in which this measurement resides (for
|
|
155
|
+
* entitlements with a reset period)
|
|
156
|
+
*/
|
|
157
|
+
usagePeriodEnd?: string | null;
|
|
158
|
+
/**
|
|
159
|
+
* The start date of the usage period in which this measurement resides (for
|
|
160
|
+
* entitlements with a reset period)
|
|
161
|
+
*/
|
|
162
|
+
usagePeriodStart?: string | null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
export interface UsageHistoryParams {
|
|
166
|
+
/**
|
|
167
|
+
* Path param: Customer id
|
|
168
|
+
*/
|
|
169
|
+
customerId: string;
|
|
170
|
+
/**
|
|
171
|
+
* Query param: The start date of the range
|
|
172
|
+
*/
|
|
173
|
+
startDate: string;
|
|
174
|
+
/**
|
|
175
|
+
* Query param: The end date of the range
|
|
176
|
+
*/
|
|
177
|
+
endDate?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Query param
|
|
180
|
+
*/
|
|
181
|
+
groupBy?: string;
|
|
182
|
+
/**
|
|
183
|
+
* Query param: When true, includes usage data from the most recent cancelled or
|
|
184
|
+
* expired subscription
|
|
185
|
+
*/
|
|
186
|
+
includeInactiveSubscriptions?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Query param: Resource id
|
|
189
|
+
*/
|
|
190
|
+
resourceId?: string | null;
|
|
191
|
+
}
|
|
192
|
+
export interface UsageReportParams {
|
|
193
|
+
/**
|
|
194
|
+
* A list of usage reports to be submitted in bulk
|
|
195
|
+
*/
|
|
196
|
+
usages: Array<UsageReportParams.Usage>;
|
|
197
|
+
}
|
|
198
|
+
export declare namespace UsageReportParams {
|
|
199
|
+
/**
|
|
200
|
+
* Single usage measurement
|
|
201
|
+
*/
|
|
202
|
+
interface Usage {
|
|
203
|
+
/**
|
|
204
|
+
* Customer id
|
|
205
|
+
*/
|
|
206
|
+
customerId: string;
|
|
207
|
+
/**
|
|
208
|
+
* Feature id
|
|
209
|
+
*/
|
|
210
|
+
featureId: string;
|
|
211
|
+
/**
|
|
212
|
+
* The value to report for usage
|
|
213
|
+
*/
|
|
214
|
+
value: number;
|
|
215
|
+
/**
|
|
216
|
+
* Timestamp of when the record was created
|
|
217
|
+
*/
|
|
218
|
+
createdAt?: string;
|
|
219
|
+
/**
|
|
220
|
+
* Additional dimensions for the usage report
|
|
221
|
+
*/
|
|
222
|
+
dimensions?: {
|
|
223
|
+
[key: string]: string | number | boolean;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Resource id
|
|
227
|
+
*/
|
|
228
|
+
resourceId?: string | null;
|
|
229
|
+
/**
|
|
230
|
+
* The method by which the usage value should be updated
|
|
231
|
+
*/
|
|
232
|
+
updateBehavior?: 'DELTA' | 'SET';
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
export declare namespace Usage {
|
|
236
|
+
export { type UsageHistoryResponse as UsageHistoryResponse, type UsageReportResponse as UsageReportResponse, type UsageHistoryParams as UsageHistoryParams, type UsageReportParams as UsageReportParams, };
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=usage.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.d.mts","sourceRoot":"","sources":["../../src/resources/v1/usage.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,KAAM,SAAQ,WAAW;IACpC;;OAEG;IACH,OAAO,CACL,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IAKnC;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;CAG3F;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,IAAI,EAAE,oBAAoB,CAAC,IAAI,CAAC;CACjC;AAED,yBAAiB,oBAAoB,CAAC;IACpC;;OAEG;IACH,UAAiB,IAAI;QACnB;;WAEG;QACH,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAA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AAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../../core/api-promise.js";
|
|
3
|
+
import { RequestOptions } from "../../internal/request-options.js";
|
|
4
|
+
/**
|
|
5
|
+
* Operations related to usage & metering
|
|
6
|
+
*/
|
|
7
|
+
export declare class Usage extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves historical usage data for a customer's metered feature over time.
|
|
10
|
+
*/
|
|
11
|
+
history(featureID: string, params: UsageHistoryParams, options?: RequestOptions): APIPromise<UsageHistoryResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* Reports usage measurements for metered features. The reported usage is used to
|
|
14
|
+
* track, limit, and bill customer consumption.
|
|
15
|
+
*/
|
|
16
|
+
report(body: UsageReportParams, options?: RequestOptions): APIPromise<UsageReportResponse>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Response object
|
|
20
|
+
*/
|
|
21
|
+
export interface UsageHistoryResponse {
|
|
22
|
+
/**
|
|
23
|
+
* Historical usage time series
|
|
24
|
+
*/
|
|
25
|
+
data: UsageHistoryResponse.Data;
|
|
26
|
+
}
|
|
27
|
+
export declare namespace UsageHistoryResponse {
|
|
28
|
+
/**
|
|
29
|
+
* Historical usage time series
|
|
30
|
+
*/
|
|
31
|
+
interface Data {
|
|
32
|
+
/**
|
|
33
|
+
* Markers for events that affecting feature usage
|
|
34
|
+
*/
|
|
35
|
+
markers: Array<Data.Marker>;
|
|
36
|
+
/**
|
|
37
|
+
* Series of usage history
|
|
38
|
+
*/
|
|
39
|
+
series: Array<Data.Series>;
|
|
40
|
+
}
|
|
41
|
+
namespace Data {
|
|
42
|
+
/**
|
|
43
|
+
* Usage reset or change marker
|
|
44
|
+
*/
|
|
45
|
+
interface Marker {
|
|
46
|
+
/**
|
|
47
|
+
* Timestamp of the marker
|
|
48
|
+
*/
|
|
49
|
+
timestamp: string;
|
|
50
|
+
/**
|
|
51
|
+
* Type of marker for a usage history point
|
|
52
|
+
*/
|
|
53
|
+
type: 'PERIODIC_RESET' | 'SUBSCRIPTION_CHANGE_RESET';
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Usage data points with tags
|
|
57
|
+
*/
|
|
58
|
+
interface Series {
|
|
59
|
+
/**
|
|
60
|
+
* Points in the usage history series
|
|
61
|
+
*/
|
|
62
|
+
points: Array<Series.Point>;
|
|
63
|
+
/**
|
|
64
|
+
* Tags for the usage history series
|
|
65
|
+
*/
|
|
66
|
+
tags: Array<Series.Tag>;
|
|
67
|
+
}
|
|
68
|
+
namespace Series {
|
|
69
|
+
/**
|
|
70
|
+
* Single usage data point
|
|
71
|
+
*/
|
|
72
|
+
interface Point {
|
|
73
|
+
/**
|
|
74
|
+
* Indicates whether there was usage reset in this point, see `markers` for details
|
|
75
|
+
*/
|
|
76
|
+
isResetPoint: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Timestamp of the usage history point
|
|
79
|
+
*/
|
|
80
|
+
timestamp: string;
|
|
81
|
+
/**
|
|
82
|
+
* Value of the usage history point
|
|
83
|
+
*/
|
|
84
|
+
value: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Grouping tag key-value
|
|
88
|
+
*/
|
|
89
|
+
interface Tag {
|
|
90
|
+
/**
|
|
91
|
+
* Key of the tag
|
|
92
|
+
*/
|
|
93
|
+
key: string;
|
|
94
|
+
/**
|
|
95
|
+
* Value of the tag
|
|
96
|
+
*/
|
|
97
|
+
value: string;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Response containing reported usage measurements with current usage values,
|
|
104
|
+
* period information, and reset dates for each measurement.
|
|
105
|
+
*/
|
|
106
|
+
export interface UsageReportResponse {
|
|
107
|
+
/**
|
|
108
|
+
* Array of usage measurements with current values and period info
|
|
109
|
+
*/
|
|
110
|
+
data: Array<UsageReportResponse.Data>;
|
|
111
|
+
}
|
|
112
|
+
export declare namespace UsageReportResponse {
|
|
113
|
+
/**
|
|
114
|
+
* Recorded usage with period info
|
|
115
|
+
*/
|
|
116
|
+
interface Data {
|
|
117
|
+
/**
|
|
118
|
+
* Unique identifier for the entity
|
|
119
|
+
*/
|
|
120
|
+
id: string;
|
|
121
|
+
/**
|
|
122
|
+
* Timestamp of when the record was created
|
|
123
|
+
*/
|
|
124
|
+
createdAt: string;
|
|
125
|
+
/**
|
|
126
|
+
* Customer id
|
|
127
|
+
*/
|
|
128
|
+
customerId: string;
|
|
129
|
+
/**
|
|
130
|
+
* Feature id
|
|
131
|
+
*/
|
|
132
|
+
featureId: string;
|
|
133
|
+
/**
|
|
134
|
+
* Timestamp
|
|
135
|
+
*/
|
|
136
|
+
timestamp: string;
|
|
137
|
+
/**
|
|
138
|
+
* The usage measurement record
|
|
139
|
+
*/
|
|
140
|
+
value: number;
|
|
141
|
+
/**
|
|
142
|
+
* The current measured usage value
|
|
143
|
+
*/
|
|
144
|
+
currentUsage?: number | null;
|
|
145
|
+
/**
|
|
146
|
+
* The date when the next usage reset will occur
|
|
147
|
+
*/
|
|
148
|
+
nextResetDate?: string | null;
|
|
149
|
+
/**
|
|
150
|
+
* Resource id
|
|
151
|
+
*/
|
|
152
|
+
resourceId?: string | null;
|
|
153
|
+
/**
|
|
154
|
+
* The end date of the usage period in which this measurement resides (for
|
|
155
|
+
* entitlements with a reset period)
|
|
156
|
+
*/
|
|
157
|
+
usagePeriodEnd?: string | null;
|
|
158
|
+
/**
|
|
159
|
+
* The start date of the usage period in which this measurement resides (for
|
|
160
|
+
* entitlements with a reset period)
|
|
161
|
+
*/
|
|
162
|
+
usagePeriodStart?: string | null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
export interface UsageHistoryParams {
|
|
166
|
+
/**
|
|
167
|
+
* Path param: Customer id
|
|
168
|
+
*/
|
|
169
|
+
customerId: string;
|
|
170
|
+
/**
|
|
171
|
+
* Query param: The start date of the range
|
|
172
|
+
*/
|
|
173
|
+
startDate: string;
|
|
174
|
+
/**
|
|
175
|
+
* Query param: The end date of the range
|
|
176
|
+
*/
|
|
177
|
+
endDate?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Query param
|
|
180
|
+
*/
|
|
181
|
+
groupBy?: string;
|
|
182
|
+
/**
|
|
183
|
+
* Query param: When true, includes usage data from the most recent cancelled or
|
|
184
|
+
* expired subscription
|
|
185
|
+
*/
|
|
186
|
+
includeInactiveSubscriptions?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Query param: Resource id
|
|
189
|
+
*/
|
|
190
|
+
resourceId?: string | null;
|
|
191
|
+
}
|
|
192
|
+
export interface UsageReportParams {
|
|
193
|
+
/**
|
|
194
|
+
* A list of usage reports to be submitted in bulk
|
|
195
|
+
*/
|
|
196
|
+
usages: Array<UsageReportParams.Usage>;
|
|
197
|
+
}
|
|
198
|
+
export declare namespace UsageReportParams {
|
|
199
|
+
/**
|
|
200
|
+
* Single usage measurement
|
|
201
|
+
*/
|
|
202
|
+
interface Usage {
|
|
203
|
+
/**
|
|
204
|
+
* Customer id
|
|
205
|
+
*/
|
|
206
|
+
customerId: string;
|
|
207
|
+
/**
|
|
208
|
+
* Feature id
|
|
209
|
+
*/
|
|
210
|
+
featureId: string;
|
|
211
|
+
/**
|
|
212
|
+
* The value to report for usage
|
|
213
|
+
*/
|
|
214
|
+
value: number;
|
|
215
|
+
/**
|
|
216
|
+
* Timestamp of when the record was created
|
|
217
|
+
*/
|
|
218
|
+
createdAt?: string;
|
|
219
|
+
/**
|
|
220
|
+
* Additional dimensions for the usage report
|
|
221
|
+
*/
|
|
222
|
+
dimensions?: {
|
|
223
|
+
[key: string]: string | number | boolean;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Resource id
|
|
227
|
+
*/
|
|
228
|
+
resourceId?: string | null;
|
|
229
|
+
/**
|
|
230
|
+
* The method by which the usage value should be updated
|
|
231
|
+
*/
|
|
232
|
+
updateBehavior?: 'DELTA' | 'SET';
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
export declare namespace Usage {
|
|
236
|
+
export { type UsageHistoryResponse as UsageHistoryResponse, type UsageReportResponse as UsageReportResponse, type UsageHistoryParams as UsageHistoryParams, type UsageReportParams as UsageReportParams, };
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/resources/v1/usage.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,KAAM,SAAQ,WAAW;IACpC;;OAEG;IACH,OAAO,CACL,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IAKnC;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;CAG3F;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,IAAI,EAAE,oBAAoB,CAAC,IAAI,CAAC;CACjC;AAED,yBAAiB,oBAAoB,CAAC;IACpC;;OAEG;IACH,UAAiB,IAAI;QACnB;;WAEG;QACH,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE5B;;WAEG;QACH,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KAC5B;IAED,UA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IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Usage = void 0;
|
|
5
|
+
const resource_1 = require("../../core/resource.js");
|
|
6
|
+
const path_1 = require("../../internal/utils/path.js");
|
|
7
|
+
/**
|
|
8
|
+
* Operations related to usage & metering
|
|
9
|
+
*/
|
|
10
|
+
class Usage extends resource_1.APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves historical usage data for a customer's metered feature over time.
|
|
13
|
+
*/
|
|
14
|
+
history(featureID, params, options) {
|
|
15
|
+
const { customerId, ...query } = params;
|
|
16
|
+
return this._client.get((0, path_1.path) `/api/v1/usage/${customerId}/history/${featureID}`, { query, ...options });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Reports usage measurements for metered features. The reported usage is used to
|
|
20
|
+
* track, limit, and bill customer consumption.
|
|
21
|
+
*/
|
|
22
|
+
report(body, options) {
|
|
23
|
+
return this._client.post('/api/v1/usage', { body, ...options });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.Usage = Usage;
|
|
27
|
+
//# sourceMappingURL=usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/resources/v1/usage.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,uDAAiD;AAEjD;;GAEG;AACH,MAAa,KAAM,SAAQ,sBAAW;IACpC;;OAEG;IACH,OAAO,CACL,SAAiB,EACjB,MAA0B,EAC1B,OAAwB;QAExB,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,YAAY,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzG,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,IAAuB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;CACF;AApBD,sBAoBC"}
|