lark-billing 0.3.0 → 0.5.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 +37 -0
- package/README.md +21 -30
- package/client.d.mts +1 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +1 -1
- package/client.d.ts.map +1 -1
- package/package.json +1 -1
- package/resources/customer-access.d.mts +8 -0
- package/resources/customer-access.d.mts.map +1 -1
- package/resources/customer-access.d.ts +8 -0
- package/resources/customer-access.d.ts.map +1 -1
- package/resources/customer-access.js +8 -0
- package/resources/customer-access.js.map +1 -1
- package/resources/customer-access.mjs +8 -0
- package/resources/customer-access.mjs.map +1 -1
- package/resources/invoices.d.mts +7 -0
- package/resources/invoices.d.mts.map +1 -1
- package/resources/invoices.d.ts +7 -0
- package/resources/invoices.d.ts.map +1 -1
- package/resources/invoices.js +7 -0
- package/resources/invoices.js.map +1 -1
- package/resources/invoices.mjs +7 -0
- package/resources/invoices.mjs.map +1 -1
- package/resources/pricing-metrics.d.mts +50 -24
- package/resources/pricing-metrics.d.mts.map +1 -1
- package/resources/pricing-metrics.d.ts +50 -24
- package/resources/pricing-metrics.d.ts.map +1 -1
- package/resources/pricing-metrics.js +2 -2
- package/resources/pricing-metrics.js.map +1 -1
- package/resources/pricing-metrics.mjs +2 -2
- package/resources/pricing-metrics.mjs.map +1 -1
- package/resources/rate-cards.d.mts +151 -4
- package/resources/rate-cards.d.mts.map +1 -1
- package/resources/rate-cards.d.ts +151 -4
- package/resources/rate-cards.d.ts.map +1 -1
- package/resources/rate-cards.js +44 -0
- package/resources/rate-cards.js.map +1 -1
- package/resources/rate-cards.mjs +44 -0
- package/resources/rate-cards.mjs.map +1 -1
- package/resources/subjects.d.mts +7 -2
- package/resources/subjects.d.mts.map +1 -1
- package/resources/subjects.d.ts +7 -2
- package/resources/subjects.d.ts.map +1 -1
- package/resources/subjects.js +7 -2
- package/resources/subjects.js.map +1 -1
- package/resources/subjects.mjs +7 -2
- package/resources/subjects.mjs.map +1 -1
- package/resources/subscriptions.d.mts +22 -18
- package/resources/subscriptions.d.mts.map +1 -1
- package/resources/subscriptions.d.ts +22 -18
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/subscriptions.js +12 -8
- package/resources/subscriptions.js.map +1 -1
- package/resources/subscriptions.mjs +12 -8
- package/resources/subscriptions.mjs.map +1 -1
- package/resources/usage-events.d.mts +4 -3
- package/resources/usage-events.d.mts.map +1 -1
- package/resources/usage-events.d.ts +4 -3
- package/resources/usage-events.d.ts.map +1 -1
- package/resources/usage-events.js +4 -3
- package/resources/usage-events.js.map +1 -1
- package/resources/usage-events.mjs +4 -3
- package/resources/usage-events.mjs.map +1 -1
- package/src/client.ts +1 -1
- package/src/resources/customer-access.ts +8 -0
- package/src/resources/invoices.ts +7 -0
- package/src/resources/pricing-metrics.ts +55 -24
- package/src/resources/rate-cards.ts +179 -4
- package/src/resources/subjects.ts +7 -2
- package/src/resources/subscriptions.ts +23 -19
- package/src/resources/usage-events.ts +4 -3
- 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,14 @@ export declare class UsageEvents extends APIResource {
|
|
|
9
9
|
* ```ts
|
|
10
10
|
* const usageEvent = await client.usageEvents.create({
|
|
11
11
|
* data: {
|
|
12
|
-
* compute_hours: 100,
|
|
12
|
+
* compute_hours: '100.5',
|
|
13
13
|
* instance_type: 't2.micro',
|
|
14
14
|
* region: 'us-east-1',
|
|
15
15
|
* },
|
|
16
|
-
* event_name: '
|
|
17
|
-
* idempotency_key: '
|
|
16
|
+
* event_name: 'job_completed',
|
|
17
|
+
* idempotency_key: 'dec98bc7-e75c-4414-9f34-02e98ae9e047',
|
|
18
18
|
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
19
|
+
* timestamp: '2025-12-14T19:55:29.967956+00:00',
|
|
19
20
|
* });
|
|
20
21
|
* ```
|
|
21
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage-events.d.ts","sourceRoot":"","sources":["../src/resources/usage-events.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,WAAY,SAAQ,WAAW;IAC1C
|
|
1
|
+
{"version":3,"file":"usage-events.d.ts","sourceRoot":"","sources":["../src/resources/usage-events.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC;CAGpF;AAED,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,IAAI,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAEzC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
|
|
@@ -11,13 +11,14 @@ class UsageEvents extends resource_1.APIResource {
|
|
|
11
11
|
* ```ts
|
|
12
12
|
* const usageEvent = await client.usageEvents.create({
|
|
13
13
|
* data: {
|
|
14
|
-
* compute_hours: 100,
|
|
14
|
+
* compute_hours: '100.5',
|
|
15
15
|
* instance_type: 't2.micro',
|
|
16
16
|
* region: 'us-east-1',
|
|
17
17
|
* },
|
|
18
|
-
* event_name: '
|
|
19
|
-
* idempotency_key: '
|
|
18
|
+
* event_name: 'job_completed',
|
|
19
|
+
* idempotency_key: 'dec98bc7-e75c-4414-9f34-02e98ae9e047',
|
|
20
20
|
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
21
|
+
* timestamp: '2025-12-14T19:55:29.967956+00:00',
|
|
21
22
|
* });
|
|
22
23
|
* ```
|
|
23
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage-events.js","sourceRoot":"","sources":["../src/resources/usage-events.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,WAAY,SAAQ,sBAAW;IAC1C
|
|
1
|
+
{"version":3,"file":"usage-events.js","sourceRoot":"","sources":["../src/resources/usage-events.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,IAA4B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;CACF;AAtBD,kCAsBC"}
|
|
@@ -8,13 +8,14 @@ export class UsageEvents extends APIResource {
|
|
|
8
8
|
* ```ts
|
|
9
9
|
* const usageEvent = await client.usageEvents.create({
|
|
10
10
|
* data: {
|
|
11
|
-
* compute_hours: 100,
|
|
11
|
+
* compute_hours: '100.5',
|
|
12
12
|
* instance_type: 't2.micro',
|
|
13
13
|
* region: 'us-east-1',
|
|
14
14
|
* },
|
|
15
|
-
* event_name: '
|
|
16
|
-
* idempotency_key: '
|
|
15
|
+
* event_name: 'job_completed',
|
|
16
|
+
* idempotency_key: 'dec98bc7-e75c-4414-9f34-02e98ae9e047',
|
|
17
17
|
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
18
|
+
* timestamp: '2025-12-14T19:55:29.967956+00:00',
|
|
18
19
|
* });
|
|
19
20
|
* ```
|
|
20
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage-events.mjs","sourceRoot":"","sources":["../src/resources/usage-events.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C
|
|
1
|
+
{"version":3,"file":"usage-events.mjs","sourceRoot":"","sources":["../src/resources/usage-events.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,IAA4B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -8,6 +8,14 @@ import { path } from '../internal/utils/path';
|
|
|
8
8
|
export class CustomerAccess extends APIResource {
|
|
9
9
|
/**
|
|
10
10
|
* Get Billing State
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const response =
|
|
15
|
+
* await client.customerAccess.retrieveBillingState(
|
|
16
|
+
* 'user_1234567890',
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
11
19
|
*/
|
|
12
20
|
retrieveBillingState(
|
|
13
21
|
subjectID: string,
|
|
@@ -8,6 +8,13 @@ import { RequestOptions } from '../internal/request-options';
|
|
|
8
8
|
export class Invoices extends APIResource {
|
|
9
9
|
/**
|
|
10
10
|
* List Invoices
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const invoices = await client.invoices.list({
|
|
15
|
+
* subject_id: 'user_1234567890',
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
11
18
|
*/
|
|
12
19
|
list(query: InvoiceListParams, options?: RequestOptions): APIPromise<InvoiceListResponse> {
|
|
13
20
|
return this._client.get('/invoices', { query, ...options });
|
|
@@ -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';
|
|
@@ -61,11 +62,11 @@ export class PricingMetrics extends APIResource {
|
|
|
61
62
|
* @example
|
|
62
63
|
* ```ts
|
|
63
64
|
* const response = await client.pricingMetrics.createSummary(
|
|
64
|
-
* '
|
|
65
|
+
* 'pmtr_GlX5Tcm2HOn00CoRTFxw2Amw',
|
|
65
66
|
* {
|
|
66
67
|
* period: {
|
|
67
|
-
* end: '2025-11-01T00:00:00Z',
|
|
68
68
|
* start: '2025-10-01T00:00:00Z',
|
|
69
|
+
* end: '2025-11-01T00:00:00Z',
|
|
69
70
|
* },
|
|
70
71
|
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
71
72
|
* },
|
|
@@ -120,6 +121,11 @@ export interface PricingMetricResource {
|
|
|
120
121
|
* The unit of the value computed by the pricing metric.
|
|
121
122
|
*/
|
|
122
123
|
unit: string;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The dimensions by which the events are grouped to compute the pricing metric.
|
|
127
|
+
*/
|
|
128
|
+
dimensions?: Array<string> | null;
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
export namespace PricingMetricResource {
|
|
@@ -161,32 +167,42 @@ export interface PricingMetricListResponse {
|
|
|
161
167
|
pricing_metrics: Array<PricingMetricResource>;
|
|
162
168
|
}
|
|
163
169
|
|
|
164
|
-
export
|
|
165
|
-
|
|
166
|
-
* The ID of the pricing metric summary.
|
|
167
|
-
*/
|
|
168
|
-
id: string;
|
|
170
|
+
export type PricingMetricCreateSummaryResponse =
|
|
171
|
+
Array<PricingMetricCreateSummaryResponse.PricingMetricCreateSummaryResponseItem>;
|
|
169
172
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
export namespace PricingMetricCreateSummaryResponse {
|
|
174
|
+
export interface PricingMetricCreateSummaryResponseItem {
|
|
175
|
+
/**
|
|
176
|
+
* The ID of the pricing metric summary.
|
|
177
|
+
*/
|
|
178
|
+
id: string;
|
|
174
179
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
180
|
+
/**
|
|
181
|
+
* The dimension coordinates that the summary is for.
|
|
182
|
+
*/
|
|
183
|
+
dimension_coordinates: { [key: string]: string } | null;
|
|
179
184
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
185
|
+
/**
|
|
186
|
+
* The period that the summary is computed over.
|
|
187
|
+
*/
|
|
188
|
+
period: PricingMetricsAPI.Period;
|
|
184
189
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
+
}
|
|
190
206
|
}
|
|
191
207
|
|
|
192
208
|
export interface PricingMetricCreateParams {
|
|
@@ -214,6 +230,11 @@ export interface PricingMetricCreateParams {
|
|
|
214
230
|
* Unit of measurement for the pricing metric.
|
|
215
231
|
*/
|
|
216
232
|
unit: string;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* The dimensions by which the events are grouped to compute the pricing metric.
|
|
236
|
+
*/
|
|
237
|
+
dimensions?: Array<string> | null;
|
|
217
238
|
}
|
|
218
239
|
|
|
219
240
|
export namespace PricingMetricCreateParams {
|
|
@@ -292,6 +313,16 @@ export interface PricingMetricCreateSummaryParams {
|
|
|
292
313
|
* The ID or external ID of the subject that the summary should be computed for.
|
|
293
314
|
*/
|
|
294
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;
|
|
295
326
|
}
|
|
296
327
|
|
|
297
328
|
export declare namespace PricingMetrics {
|
|
@@ -10,6 +10,38 @@ import { path } from '../internal/utils/path';
|
|
|
10
10
|
export class RateCards extends APIResource {
|
|
11
11
|
/**
|
|
12
12
|
* Create Rate Card
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const rateCardResource = await client.rateCards.create({
|
|
17
|
+
* billing_interval: 'monthly',
|
|
18
|
+
* name: 'Pro Plan',
|
|
19
|
+
* description:
|
|
20
|
+
* 'For production applicatidddons with moderate usage.',
|
|
21
|
+
* fixed_rates: [
|
|
22
|
+
* {
|
|
23
|
+
* name: 'Base Rate',
|
|
24
|
+
* price: {
|
|
25
|
+
* price_type: 'flat',
|
|
26
|
+
* amount: { value: 2500, currency_code: 'usd' },
|
|
27
|
+
* },
|
|
28
|
+
* },
|
|
29
|
+
* ],
|
|
30
|
+
* metadata: {},
|
|
31
|
+
* usage_based_rates: [
|
|
32
|
+
* {
|
|
33
|
+
* usage_based_rate_type: 'simple',
|
|
34
|
+
* name: 'Compute Hours',
|
|
35
|
+
* price: {
|
|
36
|
+
* price_type: 'flat',
|
|
37
|
+
* amount: { value: 100, currency_code: 'usd' },
|
|
38
|
+
* },
|
|
39
|
+
* included_units: 30,
|
|
40
|
+
* pricing_metric_id: 'pmtr_GlX5Tcm2HOn00CoRTFxw2Amw',
|
|
41
|
+
* },
|
|
42
|
+
* ],
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
13
45
|
*/
|
|
14
46
|
create(body: RateCardCreateParams, options?: RequestOptions): APIPromise<RateCardResource> {
|
|
15
47
|
return this._client.post('/rate-cards', { body, ...options });
|
|
@@ -17,6 +49,13 @@ export class RateCards extends APIResource {
|
|
|
17
49
|
|
|
18
50
|
/**
|
|
19
51
|
* Get Rate Card
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const rateCardResource = await client.rateCards.retrieve(
|
|
56
|
+
* 'rate_card_id',
|
|
57
|
+
* );
|
|
58
|
+
* ```
|
|
20
59
|
*/
|
|
21
60
|
retrieve(rateCardID: string, options?: RequestOptions): APIPromise<RateCardResource> {
|
|
22
61
|
return this._client.get(path`/rate-cards/${rateCardID}`, options);
|
|
@@ -24,6 +63,11 @@ export class RateCards extends APIResource {
|
|
|
24
63
|
|
|
25
64
|
/**
|
|
26
65
|
* List Rate Cards
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const rateCards = await client.rateCards.list();
|
|
70
|
+
* ```
|
|
27
71
|
*/
|
|
28
72
|
list(
|
|
29
73
|
query: RateCardListParams | null | undefined = {},
|
|
@@ -99,6 +143,9 @@ export interface RateCardResource {
|
|
|
99
143
|
*/
|
|
100
144
|
id: string;
|
|
101
145
|
|
|
146
|
+
/**
|
|
147
|
+
* How often the customer will be billed for this rate card.
|
|
148
|
+
*/
|
|
102
149
|
billing_interval: 'monthly' | 'yearly';
|
|
103
150
|
|
|
104
151
|
/**
|
|
@@ -111,6 +158,10 @@ export interface RateCardResource {
|
|
|
111
158
|
*/
|
|
112
159
|
fixed_rates: Array<RateCardResource.FixedRate>;
|
|
113
160
|
|
|
161
|
+
/**
|
|
162
|
+
* Additional metadata about the rate card. You may use this to store any custom
|
|
163
|
+
* data about the rate card.
|
|
164
|
+
*/
|
|
114
165
|
metadata: { [key: string]: string };
|
|
115
166
|
|
|
116
167
|
/**
|
|
@@ -126,7 +177,9 @@ export interface RateCardResource {
|
|
|
126
177
|
/**
|
|
127
178
|
* The usage based rates of the rate card.
|
|
128
179
|
*/
|
|
129
|
-
usage_based_rates: Array<
|
|
180
|
+
usage_based_rates: Array<
|
|
181
|
+
RateCardResource.SimpleUsageBasedRateInterface | RateCardResource.DimensionalUsageBasedRateInterface
|
|
182
|
+
>;
|
|
130
183
|
|
|
131
184
|
/**
|
|
132
185
|
* The description of the rate card.
|
|
@@ -148,7 +201,7 @@ export namespace RateCardResource {
|
|
|
148
201
|
price: RateCardsAPI.FlatPriceOutput | RateCardsAPI.PackagePriceOutput;
|
|
149
202
|
}
|
|
150
203
|
|
|
151
|
-
export interface
|
|
204
|
+
export interface SimpleUsageBasedRateInterface {
|
|
152
205
|
id: string;
|
|
153
206
|
|
|
154
207
|
description: string | null;
|
|
@@ -166,6 +219,49 @@ export namespace RateCardResource {
|
|
|
166
219
|
|
|
167
220
|
usage_based_rate_type?: 'simple';
|
|
168
221
|
}
|
|
222
|
+
|
|
223
|
+
export interface DimensionalUsageBasedRateInterface {
|
|
224
|
+
id: string;
|
|
225
|
+
|
|
226
|
+
description: string | null;
|
|
227
|
+
|
|
228
|
+
dimensions: Array<DimensionalUsageBasedRateInterface.Dimension>;
|
|
229
|
+
|
|
230
|
+
included_units: number;
|
|
231
|
+
|
|
232
|
+
name: string;
|
|
233
|
+
|
|
234
|
+
pricing_matrix: DimensionalUsageBasedRateInterface.PricingMatrix;
|
|
235
|
+
|
|
236
|
+
pricing_metric_id: string;
|
|
237
|
+
|
|
238
|
+
usage_based_rate_type?: 'dimensional';
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export namespace DimensionalUsageBasedRateInterface {
|
|
242
|
+
export interface Dimension {
|
|
243
|
+
description: string | null;
|
|
244
|
+
|
|
245
|
+
key: string;
|
|
246
|
+
|
|
247
|
+
values: Array<string>;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface PricingMatrix {
|
|
251
|
+
cells: Array<PricingMatrix.Cell>;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export namespace PricingMatrix {
|
|
255
|
+
export interface Cell {
|
|
256
|
+
dimension_coordinates: { [key: string]: string };
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Flat price is a price that linearly scales with the quantity.
|
|
260
|
+
*/
|
|
261
|
+
price: RateCardsAPI.FlatPriceOutput | RateCardsAPI.PackagePriceOutput;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
169
265
|
}
|
|
170
266
|
|
|
171
267
|
export interface RateCardListResponse {
|
|
@@ -202,7 +298,10 @@ export interface RateCardCreateParams {
|
|
|
202
298
|
* The usage based rates of the rate card. These are billed at the end of each
|
|
203
299
|
* billing cycle.
|
|
204
300
|
*/
|
|
205
|
-
usage_based_rates?: Array<
|
|
301
|
+
usage_based_rates?: Array<
|
|
302
|
+
| RateCardCreateParams.CreateSimpleUsageBasedRateRequest
|
|
303
|
+
| RateCardCreateParams.CreateDimensionalUsageBasedRateRequest
|
|
304
|
+
>;
|
|
206
305
|
}
|
|
207
306
|
|
|
208
307
|
export namespace RateCardCreateParams {
|
|
@@ -223,7 +322,7 @@ export namespace RateCardCreateParams {
|
|
|
223
322
|
description?: string | null;
|
|
224
323
|
}
|
|
225
324
|
|
|
226
|
-
export interface
|
|
325
|
+
export interface CreateSimpleUsageBasedRateRequest {
|
|
227
326
|
/**
|
|
228
327
|
* The name of the rate displayed to the customer.
|
|
229
328
|
*/
|
|
@@ -251,6 +350,82 @@ export namespace RateCardCreateParams {
|
|
|
251
350
|
*/
|
|
252
351
|
included_units?: number;
|
|
253
352
|
}
|
|
353
|
+
|
|
354
|
+
export interface CreateDimensionalUsageBasedRateRequest {
|
|
355
|
+
/**
|
|
356
|
+
* The dimensions of the rate.
|
|
357
|
+
*/
|
|
358
|
+
dimensions: Array<CreateDimensionalUsageBasedRateRequest.Dimension>;
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* The name of the rate displayed to the customer.
|
|
362
|
+
*/
|
|
363
|
+
name: string;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* The pricing matrix of the rate.
|
|
367
|
+
*/
|
|
368
|
+
pricing_matrix: CreateDimensionalUsageBasedRateRequest.PricingMatrix;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* The ID of the pricing metric to use for this rate.
|
|
372
|
+
*/
|
|
373
|
+
pricing_metric_id: string;
|
|
374
|
+
|
|
375
|
+
usage_based_rate_type: 'dimensional';
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* The description of the rate displayed to the customer.
|
|
379
|
+
*/
|
|
380
|
+
description?: string | null;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* The number of units included in the rate before the price is applied.
|
|
384
|
+
*/
|
|
385
|
+
included_units?: number;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export namespace CreateDimensionalUsageBasedRateRequest {
|
|
389
|
+
export interface Dimension {
|
|
390
|
+
/**
|
|
391
|
+
* The name of the dimension. This is used to identify the dimension in the pricing
|
|
392
|
+
* matrix.
|
|
393
|
+
*/
|
|
394
|
+
key: string;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* A list of possible values for the dimension.
|
|
398
|
+
*/
|
|
399
|
+
values: Array<string>;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* The description of the dimension.
|
|
403
|
+
*/
|
|
404
|
+
description?: string | null;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* The pricing matrix of the rate.
|
|
409
|
+
*/
|
|
410
|
+
export interface PricingMatrix {
|
|
411
|
+
cells: Array<PricingMatrix.Cell>;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export namespace PricingMatrix {
|
|
415
|
+
export interface Cell {
|
|
416
|
+
/**
|
|
417
|
+
* A key-value mapping of dimension keys and values to identify the price for a
|
|
418
|
+
* given set of dimension values.
|
|
419
|
+
*/
|
|
420
|
+
dimension_coordinates: { [key: string]: string };
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* The price for the cell.
|
|
424
|
+
*/
|
|
425
|
+
price: RateCardsAPI.FlatPriceInput | RateCardsAPI.PackagePriceInput;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
254
429
|
}
|
|
255
430
|
|
|
256
431
|
export interface RateCardListParams {
|
|
@@ -11,7 +11,12 @@ export class Subjects extends APIResource {
|
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
14
|
-
* const subject = await client.subjects.create(
|
|
14
|
+
* const subject = await client.subjects.create({
|
|
15
|
+
* email: 'john.doe@example.com',
|
|
16
|
+
* external_id: 'user_1234567890',
|
|
17
|
+
* metadata: {},
|
|
18
|
+
* name: 'John Doe',
|
|
19
|
+
* });
|
|
15
20
|
* ```
|
|
16
21
|
*/
|
|
17
22
|
create(body: SubjectCreateParams, options?: RequestOptions): APIPromise<SubjectCreateResponse> {
|
|
@@ -41,7 +46,7 @@ export class Subjects extends APIResource {
|
|
|
41
46
|
* 'subject_id',
|
|
42
47
|
* {
|
|
43
48
|
* email: 'john.doe@example.com',
|
|
44
|
-
* metadata: {
|
|
49
|
+
* metadata: {},
|
|
45
50
|
* name: 'John Doe',
|
|
46
51
|
* },
|
|
47
52
|
* );
|
|
@@ -13,12 +13,13 @@ export class Subscriptions extends APIResource {
|
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
15
15
|
* const subscription = await client.subscriptions.create({
|
|
16
|
-
* checkout_callback_urls: {
|
|
17
|
-
* cancelled_url: 'https://example.com/callback',
|
|
18
|
-
* success_url: 'https://example.com/callback',
|
|
19
|
-
* },
|
|
20
16
|
* rate_card_id: 'rc_AJWMxR81jxoRlli6p13uf3JB',
|
|
21
17
|
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
18
|
+
* checkout_callback_urls: {
|
|
19
|
+
* cancelled_url: 'https://example.com/try-again',
|
|
20
|
+
* success_url: 'https://example.com/welcome',
|
|
21
|
+
* },
|
|
22
|
+
* metadata: {},
|
|
22
23
|
* });
|
|
23
24
|
* ```
|
|
24
25
|
*/
|
|
@@ -60,7 +61,9 @@ export class Subscriptions extends APIResource {
|
|
|
60
61
|
* @example
|
|
61
62
|
* ```ts
|
|
62
63
|
* const subscriptionResource =
|
|
63
|
-
* await client.subscriptions.cancel('subscription_id'
|
|
64
|
+
* await client.subscriptions.cancel('subscription_id', {
|
|
65
|
+
* cancel_at_end_of_cycle: true,
|
|
66
|
+
* });
|
|
64
67
|
* ```
|
|
65
68
|
*/
|
|
66
69
|
cancel(
|
|
@@ -79,11 +82,12 @@ export class Subscriptions extends APIResource {
|
|
|
79
82
|
* const response = await client.subscriptions.changeRateCard(
|
|
80
83
|
* 'subscription_id',
|
|
81
84
|
* {
|
|
85
|
+
* rate_card_id: 'rc_jQK2n0wutCj6bBcAIrL6o07g',
|
|
82
86
|
* checkout_callback_urls: {
|
|
83
|
-
* cancelled_url: 'https://example.com/
|
|
84
|
-
* success_url: 'https://example.com/
|
|
87
|
+
* cancelled_url: 'https://example.com/try-again',
|
|
88
|
+
* success_url: 'https://example.com/completed',
|
|
85
89
|
* },
|
|
86
|
-
*
|
|
90
|
+
* upgrade_behavior: 'prorate',
|
|
87
91
|
* },
|
|
88
92
|
* );
|
|
89
93
|
* ```
|
|
@@ -265,12 +269,6 @@ export namespace SubscriptionChangeRateCardResponse {
|
|
|
265
269
|
}
|
|
266
270
|
|
|
267
271
|
export interface SubscriptionCreateParams {
|
|
268
|
-
/**
|
|
269
|
-
* The URLs to redirect to after the checkout is completed or cancelled, if a
|
|
270
|
-
* checkout is required.
|
|
271
|
-
*/
|
|
272
|
-
checkout_callback_urls: CheckoutCallback;
|
|
273
|
-
|
|
274
272
|
/**
|
|
275
273
|
* The ID of the rate card to use for the subscription.
|
|
276
274
|
*/
|
|
@@ -281,6 +279,12 @@ export interface SubscriptionCreateParams {
|
|
|
281
279
|
*/
|
|
282
280
|
subject_id: string;
|
|
283
281
|
|
|
282
|
+
/**
|
|
283
|
+
* The URLs to redirect to after the checkout is completed or cancelled, if a
|
|
284
|
+
* checkout is required.
|
|
285
|
+
*/
|
|
286
|
+
checkout_callback_urls?: CheckoutCallback | null;
|
|
287
|
+
|
|
284
288
|
/**
|
|
285
289
|
* Determines whether a checkout session is always required even if the subject has
|
|
286
290
|
* a payment method on file. By default, if the subject has a payment method on
|
|
@@ -328,15 +332,15 @@ export interface SubscriptionCancelParams {
|
|
|
328
332
|
|
|
329
333
|
export interface SubscriptionChangeRateCardParams {
|
|
330
334
|
/**
|
|
331
|
-
* The
|
|
332
|
-
* checkout is required.
|
|
335
|
+
* The ID of the rate card to change the subscription to.
|
|
333
336
|
*/
|
|
334
|
-
|
|
337
|
+
rate_card_id: string;
|
|
335
338
|
|
|
336
339
|
/**
|
|
337
|
-
* The
|
|
340
|
+
* The URLs to redirect to after the checkout is completed or cancelled, if a
|
|
341
|
+
* checkout is required.
|
|
338
342
|
*/
|
|
339
|
-
|
|
343
|
+
checkout_callback_urls?: CheckoutCallback | null;
|
|
340
344
|
|
|
341
345
|
/**
|
|
342
346
|
* The behavior to use when upgrading the subscription. If 'prorate', the customer
|
|
@@ -12,13 +12,14 @@ export class UsageEvents extends APIResource {
|
|
|
12
12
|
* ```ts
|
|
13
13
|
* const usageEvent = await client.usageEvents.create({
|
|
14
14
|
* data: {
|
|
15
|
-
* compute_hours: 100,
|
|
15
|
+
* compute_hours: '100.5',
|
|
16
16
|
* instance_type: 't2.micro',
|
|
17
17
|
* region: 'us-east-1',
|
|
18
18
|
* },
|
|
19
|
-
* event_name: '
|
|
20
|
-
* idempotency_key: '
|
|
19
|
+
* event_name: 'job_completed',
|
|
20
|
+
* idempotency_key: 'dec98bc7-e75c-4414-9f34-02e98ae9e047',
|
|
21
21
|
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
22
|
+
* timestamp: '2025-12-14T19:55:29.967956+00:00',
|
|
22
23
|
* });
|
|
23
24
|
* ```
|
|
24
25
|
*/
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.5.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.5.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.5.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.5.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|