lark-billing 0.4.0 → 0.6.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 +29 -0
- package/package.json +1 -1
- package/resources/pricing-metrics.d.mts +40 -22
- package/resources/pricing-metrics.d.mts.map +1 -1
- package/resources/pricing-metrics.d.ts +40 -22
- package/resources/pricing-metrics.d.ts.map +1 -1
- package/resources/pricing-metrics.js.map +1 -1
- package/resources/pricing-metrics.mjs.map +1 -1
- package/resources/rate-cards.d.mts +20 -0
- package/resources/rate-cards.d.mts.map +1 -1
- package/resources/rate-cards.d.ts +20 -0
- package/resources/rate-cards.d.ts.map +1 -1
- package/resources/rate-cards.js +2 -0
- package/resources/rate-cards.js.map +1 -1
- package/resources/rate-cards.mjs +2 -0
- package/resources/rate-cards.mjs.map +1 -1
- package/resources/subjects.d.mts +3 -3
- package/resources/subjects.d.mts.map +1 -1
- package/resources/subjects.d.ts +3 -3
- package/resources/subjects.d.ts.map +1 -1
- package/resources/subscriptions.d.mts +47 -13
- package/resources/subscriptions.d.mts.map +1 -1
- package/resources/subscriptions.d.ts +47 -13
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/subscriptions.js +5 -3
- package/resources/subscriptions.js.map +1 -1
- package/resources/subscriptions.mjs +5 -3
- package/resources/subscriptions.mjs.map +1 -1
- package/resources/usage-events.d.mts +2 -2
- package/resources/usage-events.d.ts +2 -2
- package/resources/usage-events.js +2 -2
- package/resources/usage-events.mjs +2 -2
- package/src/resources/pricing-metrics.ts +43 -22
- package/src/resources/rate-cards.ts +26 -0
- package/src/resources/subjects.ts +3 -3
- package/src/resources/subscriptions.ts +44 -14
- package/src/resources/usage-events.ts +2 -2
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -9,13 +9,15 @@ export declare class Subscriptions extends APIResource {
|
|
|
9
9
|
* @example
|
|
10
10
|
* ```ts
|
|
11
11
|
* const subscription = await client.subscriptions.create({
|
|
12
|
+
* rate_card_id: 'rc_AJWMxR81jxoRlli6p13uf3JB',
|
|
13
|
+
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
12
14
|
* checkout_callback_urls: {
|
|
13
15
|
* cancelled_url: 'https://example.com/try-again',
|
|
14
16
|
* success_url: 'https://example.com/welcome',
|
|
15
17
|
* },
|
|
16
|
-
*
|
|
17
|
-
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
18
|
+
* fixed_rate_quantities: { seats: '2', addon_storage: '0' },
|
|
18
19
|
* metadata: {},
|
|
20
|
+
* rate_price_multipliers: { seats: '0.5' },
|
|
19
21
|
* });
|
|
20
22
|
* ```
|
|
21
23
|
*/
|
|
@@ -59,11 +61,11 @@ export declare class Subscriptions extends APIResource {
|
|
|
59
61
|
* const response = await client.subscriptions.changeRateCard(
|
|
60
62
|
* 'subscription_id',
|
|
61
63
|
* {
|
|
64
|
+
* rate_card_id: 'rc_jQK2n0wutCj6bBcAIrL6o07g',
|
|
62
65
|
* checkout_callback_urls: {
|
|
63
66
|
* cancelled_url: 'https://example.com/try-again',
|
|
64
67
|
* success_url: 'https://example.com/completed',
|
|
65
68
|
* },
|
|
66
|
-
* rate_card_id: 'rc_jQK2n0wutCj6bBcAIrL6o07g',
|
|
67
69
|
* upgrade_behavior: 'prorate',
|
|
68
70
|
* },
|
|
69
71
|
* );
|
|
@@ -102,6 +104,12 @@ export interface SubscriptionResource {
|
|
|
102
104
|
* The date and time the subscription became effective.
|
|
103
105
|
*/
|
|
104
106
|
effective_at: string;
|
|
107
|
+
/**
|
|
108
|
+
* The quantities of the fixed rates of the subscription.
|
|
109
|
+
*/
|
|
110
|
+
fixed_rate_quantities: {
|
|
111
|
+
[key: string]: string;
|
|
112
|
+
};
|
|
105
113
|
metadata: {
|
|
106
114
|
[key: string]: string;
|
|
107
115
|
};
|
|
@@ -109,6 +117,12 @@ export interface SubscriptionResource {
|
|
|
109
117
|
* The ID of the rate card of the subscription.
|
|
110
118
|
*/
|
|
111
119
|
rate_card_id: string;
|
|
120
|
+
/**
|
|
121
|
+
* The price multipliers of the rates of the subscription.
|
|
122
|
+
*/
|
|
123
|
+
rate_price_multipliers: {
|
|
124
|
+
[key: string]: string;
|
|
125
|
+
};
|
|
112
126
|
/**
|
|
113
127
|
* The status of the subscription.
|
|
114
128
|
*/
|
|
@@ -206,11 +220,6 @@ export declare namespace SubscriptionChangeRateCardResponse {
|
|
|
206
220
|
}
|
|
207
221
|
}
|
|
208
222
|
export interface SubscriptionCreateParams {
|
|
209
|
-
/**
|
|
210
|
-
* The URLs to redirect to after the checkout is completed or cancelled, if a
|
|
211
|
-
* checkout is required.
|
|
212
|
-
*/
|
|
213
|
-
checkout_callback_urls: CheckoutCallback;
|
|
214
223
|
/**
|
|
215
224
|
* The ID of the rate card to use for the subscription.
|
|
216
225
|
*/
|
|
@@ -219,6 +228,11 @@ export interface SubscriptionCreateParams {
|
|
|
219
228
|
* The ID or external ID of the subject to create the subscription for.
|
|
220
229
|
*/
|
|
221
230
|
subject_id: string;
|
|
231
|
+
/**
|
|
232
|
+
* The URLs to redirect to after the checkout is completed or cancelled, if a
|
|
233
|
+
* checkout is required.
|
|
234
|
+
*/
|
|
235
|
+
checkout_callback_urls?: CheckoutCallback | null;
|
|
222
236
|
/**
|
|
223
237
|
* Determines whether a checkout session is always required even if the subject has
|
|
224
238
|
* a payment method on file. By default, if the subject has a payment method on
|
|
@@ -226,6 +240,15 @@ export interface SubscriptionCreateParams {
|
|
|
226
240
|
* and billed for immediately (if for a paid plan).
|
|
227
241
|
*/
|
|
228
242
|
create_checkout_session?: 'when_required' | 'always';
|
|
243
|
+
/**
|
|
244
|
+
* The quantities of the fixed rates to use for the subscription. Each quantity
|
|
245
|
+
* should be specified as a key-value pair, where the key is the `code` of the
|
|
246
|
+
* fixed rate and the value is the quantity. All fixed rates must have a quantity
|
|
247
|
+
* specified.
|
|
248
|
+
*/
|
|
249
|
+
fixed_rate_quantities?: {
|
|
250
|
+
[key: string]: number | string;
|
|
251
|
+
};
|
|
229
252
|
/**
|
|
230
253
|
* Additional metadata about the subscription. You may use this to store any custom
|
|
231
254
|
* data about the subscription.
|
|
@@ -233,6 +256,17 @@ export interface SubscriptionCreateParams {
|
|
|
233
256
|
metadata?: {
|
|
234
257
|
[key: string]: string;
|
|
235
258
|
};
|
|
259
|
+
/**
|
|
260
|
+
* Pricing multipliers to apply to the rate amounts. Each price multiplier should
|
|
261
|
+
* be specified as a key-value pair, where the key is the `code` of the rate and
|
|
262
|
+
* the value is the price multiplier. Typically, pricing multipliers are used to
|
|
263
|
+
* apply a discount to a rate. For example, if a rate is $10 per seat and the price
|
|
264
|
+
* multiplier for the `seats` rate is 0.5, the discounted rate amount will be $5
|
|
265
|
+
* per seat.
|
|
266
|
+
*/
|
|
267
|
+
rate_price_multipliers?: {
|
|
268
|
+
[key: string]: number | string;
|
|
269
|
+
};
|
|
236
270
|
}
|
|
237
271
|
export interface SubscriptionListParams {
|
|
238
272
|
limit?: number;
|
|
@@ -259,15 +293,15 @@ export interface SubscriptionCancelParams {
|
|
|
259
293
|
reason?: string | null;
|
|
260
294
|
}
|
|
261
295
|
export interface SubscriptionChangeRateCardParams {
|
|
262
|
-
/**
|
|
263
|
-
* The URLs to redirect to after the checkout is completed or cancelled, if a
|
|
264
|
-
* checkout is required.
|
|
265
|
-
*/
|
|
266
|
-
checkout_callback_urls: CheckoutCallback;
|
|
267
296
|
/**
|
|
268
297
|
* The ID of the rate card to change the subscription to.
|
|
269
298
|
*/
|
|
270
299
|
rate_card_id: string;
|
|
300
|
+
/**
|
|
301
|
+
* The URLs to redirect to after the checkout is completed or cancelled, if a
|
|
302
|
+
* checkout is required.
|
|
303
|
+
*/
|
|
304
|
+
checkout_callback_urls?: CheckoutCallback | null;
|
|
271
305
|
/**
|
|
272
306
|
* The behavior to use when upgrading the subscription. If 'prorate', the customer
|
|
273
307
|
* will be charged for the prorated difference. If 'rate_difference', the customer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.d.mts","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,gBAAgB;OACrB,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,aAAc,SAAQ,WAAW;IAC5C
|
|
1
|
+
{"version":3,"file":"subscriptions.d.mts","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,gBAAgB;OACrB,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;IAIxG;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAI5F;;;;;;;OAOG;IACH,IAAI,CACF,KAAK,GAAE,sBAAsB,GAAG,IAAI,GAAG,SAAc,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,wBAAwB,CAAC;IAIvC;;;;;;;;;;OAUG;IACH,MAAM,CACJ,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,wBAAwB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IAInC;;;;;;;;;;;;;;;;;OAiBG;IACH,cAAc,CACZ,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,gCAAgC,EACtC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,kCAAkC,CAAC;CAGlD;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,aAAa,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CAAC;CACH"}
|
|
@@ -9,13 +9,15 @@ export declare class Subscriptions extends APIResource {
|
|
|
9
9
|
* @example
|
|
10
10
|
* ```ts
|
|
11
11
|
* const subscription = await client.subscriptions.create({
|
|
12
|
+
* rate_card_id: 'rc_AJWMxR81jxoRlli6p13uf3JB',
|
|
13
|
+
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
12
14
|
* checkout_callback_urls: {
|
|
13
15
|
* cancelled_url: 'https://example.com/try-again',
|
|
14
16
|
* success_url: 'https://example.com/welcome',
|
|
15
17
|
* },
|
|
16
|
-
*
|
|
17
|
-
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
18
|
+
* fixed_rate_quantities: { seats: '2', addon_storage: '0' },
|
|
18
19
|
* metadata: {},
|
|
20
|
+
* rate_price_multipliers: { seats: '0.5' },
|
|
19
21
|
* });
|
|
20
22
|
* ```
|
|
21
23
|
*/
|
|
@@ -59,11 +61,11 @@ export declare class Subscriptions extends APIResource {
|
|
|
59
61
|
* const response = await client.subscriptions.changeRateCard(
|
|
60
62
|
* 'subscription_id',
|
|
61
63
|
* {
|
|
64
|
+
* rate_card_id: 'rc_jQK2n0wutCj6bBcAIrL6o07g',
|
|
62
65
|
* checkout_callback_urls: {
|
|
63
66
|
* cancelled_url: 'https://example.com/try-again',
|
|
64
67
|
* success_url: 'https://example.com/completed',
|
|
65
68
|
* },
|
|
66
|
-
* rate_card_id: 'rc_jQK2n0wutCj6bBcAIrL6o07g',
|
|
67
69
|
* upgrade_behavior: 'prorate',
|
|
68
70
|
* },
|
|
69
71
|
* );
|
|
@@ -102,6 +104,12 @@ export interface SubscriptionResource {
|
|
|
102
104
|
* The date and time the subscription became effective.
|
|
103
105
|
*/
|
|
104
106
|
effective_at: string;
|
|
107
|
+
/**
|
|
108
|
+
* The quantities of the fixed rates of the subscription.
|
|
109
|
+
*/
|
|
110
|
+
fixed_rate_quantities: {
|
|
111
|
+
[key: string]: string;
|
|
112
|
+
};
|
|
105
113
|
metadata: {
|
|
106
114
|
[key: string]: string;
|
|
107
115
|
};
|
|
@@ -109,6 +117,12 @@ export interface SubscriptionResource {
|
|
|
109
117
|
* The ID of the rate card of the subscription.
|
|
110
118
|
*/
|
|
111
119
|
rate_card_id: string;
|
|
120
|
+
/**
|
|
121
|
+
* The price multipliers of the rates of the subscription.
|
|
122
|
+
*/
|
|
123
|
+
rate_price_multipliers: {
|
|
124
|
+
[key: string]: string;
|
|
125
|
+
};
|
|
112
126
|
/**
|
|
113
127
|
* The status of the subscription.
|
|
114
128
|
*/
|
|
@@ -206,11 +220,6 @@ export declare namespace SubscriptionChangeRateCardResponse {
|
|
|
206
220
|
}
|
|
207
221
|
}
|
|
208
222
|
export interface SubscriptionCreateParams {
|
|
209
|
-
/**
|
|
210
|
-
* The URLs to redirect to after the checkout is completed or cancelled, if a
|
|
211
|
-
* checkout is required.
|
|
212
|
-
*/
|
|
213
|
-
checkout_callback_urls: CheckoutCallback;
|
|
214
223
|
/**
|
|
215
224
|
* The ID of the rate card to use for the subscription.
|
|
216
225
|
*/
|
|
@@ -219,6 +228,11 @@ export interface SubscriptionCreateParams {
|
|
|
219
228
|
* The ID or external ID of the subject to create the subscription for.
|
|
220
229
|
*/
|
|
221
230
|
subject_id: string;
|
|
231
|
+
/**
|
|
232
|
+
* The URLs to redirect to after the checkout is completed or cancelled, if a
|
|
233
|
+
* checkout is required.
|
|
234
|
+
*/
|
|
235
|
+
checkout_callback_urls?: CheckoutCallback | null;
|
|
222
236
|
/**
|
|
223
237
|
* Determines whether a checkout session is always required even if the subject has
|
|
224
238
|
* a payment method on file. By default, if the subject has a payment method on
|
|
@@ -226,6 +240,15 @@ export interface SubscriptionCreateParams {
|
|
|
226
240
|
* and billed for immediately (if for a paid plan).
|
|
227
241
|
*/
|
|
228
242
|
create_checkout_session?: 'when_required' | 'always';
|
|
243
|
+
/**
|
|
244
|
+
* The quantities of the fixed rates to use for the subscription. Each quantity
|
|
245
|
+
* should be specified as a key-value pair, where the key is the `code` of the
|
|
246
|
+
* fixed rate and the value is the quantity. All fixed rates must have a quantity
|
|
247
|
+
* specified.
|
|
248
|
+
*/
|
|
249
|
+
fixed_rate_quantities?: {
|
|
250
|
+
[key: string]: number | string;
|
|
251
|
+
};
|
|
229
252
|
/**
|
|
230
253
|
* Additional metadata about the subscription. You may use this to store any custom
|
|
231
254
|
* data about the subscription.
|
|
@@ -233,6 +256,17 @@ export interface SubscriptionCreateParams {
|
|
|
233
256
|
metadata?: {
|
|
234
257
|
[key: string]: string;
|
|
235
258
|
};
|
|
259
|
+
/**
|
|
260
|
+
* Pricing multipliers to apply to the rate amounts. Each price multiplier should
|
|
261
|
+
* be specified as a key-value pair, where the key is the `code` of the rate and
|
|
262
|
+
* the value is the price multiplier. Typically, pricing multipliers are used to
|
|
263
|
+
* apply a discount to a rate. For example, if a rate is $10 per seat and the price
|
|
264
|
+
* multiplier for the `seats` rate is 0.5, the discounted rate amount will be $5
|
|
265
|
+
* per seat.
|
|
266
|
+
*/
|
|
267
|
+
rate_price_multipliers?: {
|
|
268
|
+
[key: string]: number | string;
|
|
269
|
+
};
|
|
236
270
|
}
|
|
237
271
|
export interface SubscriptionListParams {
|
|
238
272
|
limit?: number;
|
|
@@ -259,15 +293,15 @@ export interface SubscriptionCancelParams {
|
|
|
259
293
|
reason?: string | null;
|
|
260
294
|
}
|
|
261
295
|
export interface SubscriptionChangeRateCardParams {
|
|
262
|
-
/**
|
|
263
|
-
* The URLs to redirect to after the checkout is completed or cancelled, if a
|
|
264
|
-
* checkout is required.
|
|
265
|
-
*/
|
|
266
|
-
checkout_callback_urls: CheckoutCallback;
|
|
267
296
|
/**
|
|
268
297
|
* The ID of the rate card to change the subscription to.
|
|
269
298
|
*/
|
|
270
299
|
rate_card_id: string;
|
|
300
|
+
/**
|
|
301
|
+
* The URLs to redirect to after the checkout is completed or cancelled, if a
|
|
302
|
+
* checkout is required.
|
|
303
|
+
*/
|
|
304
|
+
checkout_callback_urls?: CheckoutCallback | null;
|
|
271
305
|
/**
|
|
272
306
|
* The behavior to use when upgrading the subscription. If 'prorate', the customer
|
|
273
307
|
* will be charged for the prorated difference. If 'rate_difference', the customer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,gBAAgB;OACrB,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,aAAc,SAAQ,WAAW;IAC5C
|
|
1
|
+
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,gBAAgB;OACrB,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;IAIxG;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAI5F;;;;;;;OAOG;IACH,IAAI,CACF,KAAK,GAAE,sBAAsB,GAAG,IAAI,GAAG,SAAc,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,wBAAwB,CAAC;IAIvC;;;;;;;;;;OAUG;IACH,MAAM,CACJ,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,wBAAwB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IAInC;;;;;;;;;;;;;;;;;OAiBG;IACH,cAAc,CACZ,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,gCAAgC,EACtC,OAAO,CAAC,EAAE,cAAc,G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AI,sBAAsB,EACrD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,gCAAgC,IAAI,gCAAgC,GAC1E,CAAC;CACH"}
|
|
@@ -11,13 +11,15 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts
|
|
13
13
|
* const subscription = await client.subscriptions.create({
|
|
14
|
+
* rate_card_id: 'rc_AJWMxR81jxoRlli6p13uf3JB',
|
|
15
|
+
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
14
16
|
* checkout_callback_urls: {
|
|
15
17
|
* cancelled_url: 'https://example.com/try-again',
|
|
16
18
|
* success_url: 'https://example.com/welcome',
|
|
17
19
|
* },
|
|
18
|
-
*
|
|
19
|
-
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
20
|
+
* fixed_rate_quantities: { seats: '2', addon_storage: '0' },
|
|
20
21
|
* metadata: {},
|
|
22
|
+
* rate_price_multipliers: { seats: '0.5' },
|
|
21
23
|
* });
|
|
22
24
|
* ```
|
|
23
25
|
*/
|
|
@@ -69,11 +71,11 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
69
71
|
* const response = await client.subscriptions.changeRateCard(
|
|
70
72
|
* 'subscription_id',
|
|
71
73
|
* {
|
|
74
|
+
* rate_card_id: 'rc_jQK2n0wutCj6bBcAIrL6o07g',
|
|
72
75
|
* checkout_callback_urls: {
|
|
73
76
|
* cancelled_url: 'https://example.com/try-again',
|
|
74
77
|
* success_url: 'https://example.com/completed',
|
|
75
78
|
* },
|
|
76
|
-
* rate_card_id: 'rc_jQK2n0wutCj6bBcAIrL6o07g',
|
|
77
79
|
* upgrade_behavior: 'prorate',
|
|
78
80
|
* },
|
|
79
81
|
* );
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,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AAC;CACF;AA/FD,sCA+FC"}
|
|
@@ -8,13 +8,15 @@ export class Subscriptions extends APIResource {
|
|
|
8
8
|
* @example
|
|
9
9
|
* ```ts
|
|
10
10
|
* const subscription = await client.subscriptions.create({
|
|
11
|
+
* rate_card_id: 'rc_AJWMxR81jxoRlli6p13uf3JB',
|
|
12
|
+
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
11
13
|
* checkout_callback_urls: {
|
|
12
14
|
* cancelled_url: 'https://example.com/try-again',
|
|
13
15
|
* success_url: 'https://example.com/welcome',
|
|
14
16
|
* },
|
|
15
|
-
*
|
|
16
|
-
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
17
|
+
* fixed_rate_quantities: { seats: '2', addon_storage: '0' },
|
|
17
18
|
* metadata: {},
|
|
19
|
+
* rate_price_multipliers: { seats: '0.5' },
|
|
18
20
|
* });
|
|
19
21
|
* ```
|
|
20
22
|
*/
|
|
@@ -66,11 +68,11 @@ export class Subscriptions extends APIResource {
|
|
|
66
68
|
* const response = await client.subscriptions.changeRateCard(
|
|
67
69
|
* 'subscription_id',
|
|
68
70
|
* {
|
|
71
|
+
* rate_card_id: 'rc_jQK2n0wutCj6bBcAIrL6o07g',
|
|
69
72
|
* checkout_callback_urls: {
|
|
70
73
|
* cancelled_url: 'https://example.com/try-again',
|
|
71
74
|
* success_url: 'https://example.com/completed',
|
|
72
75
|
* },
|
|
73
|
-
* rate_card_id: 'rc_jQK2n0wutCj6bBcAIrL6o07g',
|
|
74
76
|
* upgrade_behavior: 'prorate',
|
|
75
77
|
* },
|
|
76
78
|
* );
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.mjs","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C
|
|
1
|
+
{"version":3,"file":"subscriptions.mjs","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,IAA8B,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAsB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,kBAAkB,cAAc,EAAE,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CACF,QAAmD,EAAE,EACrD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CACJ,cAAsB,EACtB,IAA8B,EAC9B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,kBAAkB,cAAc,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChG,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,cAAc,CACZ,cAAsB,EACtB,IAAsC,EACtC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,kBAAkB,cAAc,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1G,CAAC;CACF"}
|
|
@@ -14,9 +14,9 @@ export declare class UsageEvents extends APIResource {
|
|
|
14
14
|
* region: 'us-east-1',
|
|
15
15
|
* },
|
|
16
16
|
* event_name: 'job_completed',
|
|
17
|
-
* idempotency_key: '
|
|
17
|
+
* idempotency_key: '526f0753-bb0c-4eb5-9541-645bf2e023a8',
|
|
18
18
|
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
19
|
-
* timestamp: '2025-12-
|
|
19
|
+
* timestamp: '2025-12-18T07:07:32.616489+00:00',
|
|
20
20
|
* });
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
@@ -14,9 +14,9 @@ export declare class UsageEvents extends APIResource {
|
|
|
14
14
|
* region: 'us-east-1',
|
|
15
15
|
* },
|
|
16
16
|
* event_name: 'job_completed',
|
|
17
|
-
* idempotency_key: '
|
|
17
|
+
* idempotency_key: '526f0753-bb0c-4eb5-9541-645bf2e023a8',
|
|
18
18
|
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
19
|
-
* timestamp: '2025-12-
|
|
19
|
+
* timestamp: '2025-12-18T07:07:32.616489+00:00',
|
|
20
20
|
* });
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
@@ -16,9 +16,9 @@ class UsageEvents extends resource_1.APIResource {
|
|
|
16
16
|
* region: 'us-east-1',
|
|
17
17
|
* },
|
|
18
18
|
* event_name: 'job_completed',
|
|
19
|
-
* idempotency_key: '
|
|
19
|
+
* idempotency_key: '526f0753-bb0c-4eb5-9541-645bf2e023a8',
|
|
20
20
|
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
21
|
-
* timestamp: '2025-12-
|
|
21
|
+
* timestamp: '2025-12-18T07:07:32.616489+00:00',
|
|
22
22
|
* });
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
@@ -13,9 +13,9 @@ export class UsageEvents extends APIResource {
|
|
|
13
13
|
* region: 'us-east-1',
|
|
14
14
|
* },
|
|
15
15
|
* event_name: 'job_completed',
|
|
16
|
-
* idempotency_key: '
|
|
16
|
+
* idempotency_key: '526f0753-bb0c-4eb5-9541-645bf2e023a8',
|
|
17
17
|
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
18
|
-
* timestamp: '2025-12-
|
|
18
|
+
* timestamp: '2025-12-18T07:07:32.616489+00:00',
|
|
19
19
|
* });
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../core/resource';
|
|
4
|
+
import * as PricingMetricsAPI from './pricing-metrics';
|
|
4
5
|
import { APIPromise } from '../core/api-promise';
|
|
5
6
|
import { RequestOptions } from '../internal/request-options';
|
|
6
7
|
import { path } from '../internal/utils/path';
|
|
@@ -166,32 +167,42 @@ export interface PricingMetricListResponse {
|
|
|
166
167
|
pricing_metrics: Array<PricingMetricResource>;
|
|
167
168
|
}
|
|
168
169
|
|
|
169
|
-
export
|
|
170
|
-
|
|
171
|
-
* The ID of the pricing metric summary.
|
|
172
|
-
*/
|
|
173
|
-
id: string;
|
|
170
|
+
export type PricingMetricCreateSummaryResponse =
|
|
171
|
+
Array<PricingMetricCreateSummaryResponse.PricingMetricCreateSummaryResponseItem>;
|
|
174
172
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
173
|
+
export namespace PricingMetricCreateSummaryResponse {
|
|
174
|
+
export interface PricingMetricCreateSummaryResponseItem {
|
|
175
|
+
/**
|
|
176
|
+
* The ID of the pricing metric summary.
|
|
177
|
+
*/
|
|
178
|
+
id: string;
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
/**
|
|
181
|
+
* The dimension coordinates that the summary is for.
|
|
182
|
+
*/
|
|
183
|
+
dimension_coordinates: { [key: string]: string } | null;
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
/**
|
|
186
|
+
* The period that the summary is computed over.
|
|
187
|
+
*/
|
|
188
|
+
period: PricingMetricsAPI.Period;
|
|
189
189
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
/**
|
|
191
|
+
* The ID of the pricing metric that the summary is for.
|
|
192
|
+
*/
|
|
193
|
+
pricing_metric_id: string;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The ID of the subject that the summary is for.
|
|
197
|
+
*/
|
|
198
|
+
subject_id: string;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The computed value of the pricing metric for the period. If the pricing metric
|
|
202
|
+
* does not have any usage events for the period, this will be `null`.
|
|
203
|
+
*/
|
|
204
|
+
value: string | null;
|
|
205
|
+
}
|
|
195
206
|
}
|
|
196
207
|
|
|
197
208
|
export interface PricingMetricCreateParams {
|
|
@@ -302,6 +313,16 @@ export interface PricingMetricCreateSummaryParams {
|
|
|
302
313
|
* The ID or external ID of the subject that the summary should be computed for.
|
|
303
314
|
*/
|
|
304
315
|
subject_id: string;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* The dimensions by which the events are grouped to compute the pricing metric.
|
|
319
|
+
*/
|
|
320
|
+
dimensions?: Array<string> | null;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* The granularity of the period that the summary should be computed over.
|
|
324
|
+
*/
|
|
325
|
+
period_granularity?: 'hour' | 'day' | 'week' | null;
|
|
305
326
|
}
|
|
306
327
|
|
|
307
328
|
export declare namespace PricingMetrics {
|
|
@@ -21,6 +21,7 @@ export class RateCards extends APIResource {
|
|
|
21
21
|
* fixed_rates: [
|
|
22
22
|
* {
|
|
23
23
|
* name: 'Base Rate',
|
|
24
|
+
* code: 'base_rate',
|
|
24
25
|
* price: {
|
|
25
26
|
* price_type: 'flat',
|
|
26
27
|
* amount: { value: 2500, currency_code: 'usd' },
|
|
@@ -32,6 +33,7 @@ export class RateCards extends APIResource {
|
|
|
32
33
|
* {
|
|
33
34
|
* usage_based_rate_type: 'simple',
|
|
34
35
|
* name: 'Compute Hours',
|
|
36
|
+
* code: 'compute_hours',
|
|
35
37
|
* price: {
|
|
36
38
|
* price_type: 'flat',
|
|
37
39
|
* amount: { value: 100, currency_code: 'usd' },
|
|
@@ -191,6 +193,8 @@ export namespace RateCardResource {
|
|
|
191
193
|
export interface FixedRate {
|
|
192
194
|
id: string;
|
|
193
195
|
|
|
196
|
+
code: string;
|
|
197
|
+
|
|
194
198
|
description: string | null;
|
|
195
199
|
|
|
196
200
|
name: string;
|
|
@@ -204,6 +208,8 @@ export namespace RateCardResource {
|
|
|
204
208
|
export interface SimpleUsageBasedRateInterface {
|
|
205
209
|
id: string;
|
|
206
210
|
|
|
211
|
+
code: string;
|
|
212
|
+
|
|
207
213
|
description: string | null;
|
|
208
214
|
|
|
209
215
|
included_units: number;
|
|
@@ -223,6 +229,8 @@ export namespace RateCardResource {
|
|
|
223
229
|
export interface DimensionalUsageBasedRateInterface {
|
|
224
230
|
id: string;
|
|
225
231
|
|
|
232
|
+
code: string;
|
|
233
|
+
|
|
226
234
|
description: string | null;
|
|
227
235
|
|
|
228
236
|
dimensions: Array<DimensionalUsageBasedRateInterface.Dimension>;
|
|
@@ -306,6 +314,12 @@ export interface RateCardCreateParams {
|
|
|
306
314
|
|
|
307
315
|
export namespace RateCardCreateParams {
|
|
308
316
|
export interface FixedRate {
|
|
317
|
+
/**
|
|
318
|
+
* Code of this rate to be used for setting quantity and price multipliers. This
|
|
319
|
+
* code must be unique within the rate card.
|
|
320
|
+
*/
|
|
321
|
+
code: string;
|
|
322
|
+
|
|
309
323
|
/**
|
|
310
324
|
* The name of the rate displayed to the customer.
|
|
311
325
|
*/
|
|
@@ -323,6 +337,12 @@ export namespace RateCardCreateParams {
|
|
|
323
337
|
}
|
|
324
338
|
|
|
325
339
|
export interface CreateSimpleUsageBasedRateRequest {
|
|
340
|
+
/**
|
|
341
|
+
* Code of this rate to be used for price multipliers. This code must be unique
|
|
342
|
+
* within the rate card.
|
|
343
|
+
*/
|
|
344
|
+
code: string;
|
|
345
|
+
|
|
326
346
|
/**
|
|
327
347
|
* The name of the rate displayed to the customer.
|
|
328
348
|
*/
|
|
@@ -352,6 +372,12 @@ export namespace RateCardCreateParams {
|
|
|
352
372
|
}
|
|
353
373
|
|
|
354
374
|
export interface CreateDimensionalUsageBasedRateRequest {
|
|
375
|
+
/**
|
|
376
|
+
* Code of this rate to be used for price multipliers. This code must be unique
|
|
377
|
+
* within the rate card.
|
|
378
|
+
*/
|
|
379
|
+
code: string;
|
|
380
|
+
|
|
355
381
|
/**
|
|
356
382
|
* The dimensions of the rate.
|
|
357
383
|
*/
|
|
@@ -192,18 +192,18 @@ export interface SubjectUpdateParams {
|
|
|
192
192
|
/**
|
|
193
193
|
* The email of the subject. Must be a valid email address.
|
|
194
194
|
*/
|
|
195
|
-
email
|
|
195
|
+
email?: string | null;
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
198
|
* Additional metadata about the subject. You may use this to store any custom data
|
|
199
199
|
* about the subject.
|
|
200
200
|
*/
|
|
201
|
-
metadata
|
|
201
|
+
metadata?: { [key: string]: string } | null;
|
|
202
202
|
|
|
203
203
|
/**
|
|
204
204
|
* The name of the subject. Used for display in the dashboard.
|
|
205
205
|
*/
|
|
206
|
-
name
|
|
206
|
+
name?: string | null;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
export interface SubjectListParams {
|