lark-billing 0.3.0 → 0.4.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 +16 -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 +10 -2
- package/resources/pricing-metrics.d.mts.map +1 -1
- package/resources/pricing-metrics.d.ts +10 -2
- package/resources/pricing-metrics.d.ts.map +1 -1
- package/resources/pricing-metrics.js +2 -2
- package/resources/pricing-metrics.mjs +2 -2
- 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 +9 -5
- package/resources/subscriptions.d.mts.map +1 -1
- package/resources/subscriptions.d.ts +9 -5
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/subscriptions.js +9 -5
- package/resources/subscriptions.js.map +1 -1
- package/resources/subscriptions.mjs +9 -5
- 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 +12 -2
- package/src/resources/rate-cards.ts +179 -4
- package/src/resources/subjects.ts +7 -2
- package/src/resources/subscriptions.ts +9 -5
- 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
|
@@ -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
|
* );
|
|
@@ -14,11 +14,12 @@ export class Subscriptions extends APIResource {
|
|
|
14
14
|
* ```ts
|
|
15
15
|
* const subscription = await client.subscriptions.create({
|
|
16
16
|
* checkout_callback_urls: {
|
|
17
|
-
* cancelled_url: 'https://example.com/
|
|
18
|
-
* success_url: 'https://example.com/
|
|
17
|
+
* cancelled_url: 'https://example.com/try-again',
|
|
18
|
+
* success_url: 'https://example.com/welcome',
|
|
19
19
|
* },
|
|
20
20
|
* rate_card_id: 'rc_AJWMxR81jxoRlli6p13uf3JB',
|
|
21
21
|
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
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(
|
|
@@ -80,10 +83,11 @@ export class Subscriptions extends APIResource {
|
|
|
80
83
|
* 'subscription_id',
|
|
81
84
|
* {
|
|
82
85
|
* checkout_callback_urls: {
|
|
83
|
-
* cancelled_url: 'https://example.com/
|
|
84
|
-
* success_url: 'https://example.com/
|
|
86
|
+
* cancelled_url: 'https://example.com/try-again',
|
|
87
|
+
* success_url: 'https://example.com/completed',
|
|
85
88
|
* },
|
|
86
89
|
* rate_card_id: 'rc_jQK2n0wutCj6bBcAIrL6o07g',
|
|
90
|
+
* upgrade_behavior: 'prorate',
|
|
87
91
|
* },
|
|
88
92
|
* );
|
|
89
93
|
* ```
|
|
@@ -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: '168fbd3a-4d39-4db3-a204-15e014857d10',
|
|
21
21
|
* subject_id: 'subj_VyX6Q96h5avMho8O7QWlKeXE',
|
|
22
|
+
* timestamp: '2025-12-03T22:13:28.294419+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.4.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.4.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.4.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.4.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|