lark-billing 0.6.0 → 0.8.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/LICENSE +1 -1
- package/README.md +9 -0
- package/client.d.mts +6 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +6 -0
- package/client.d.ts.map +1 -1
- package/client.js +6 -0
- package/client.js.map +1 -1
- package/client.mjs +6 -0
- package/client.mjs.map +1 -1
- package/internal/tslib.js +17 -17
- package/package.json +1 -1
- package/resources/index.d.mts +2 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/rate-cards.d.mts +9 -0
- package/resources/rate-cards.d.mts.map +1 -1
- package/resources/rate-cards.d.ts +9 -0
- package/resources/rate-cards.d.ts.map +1 -1
- package/resources/rate-catalogs.d.mts +361 -0
- package/resources/rate-catalogs.d.mts.map +1 -0
- package/resources/rate-catalogs.d.ts +361 -0
- package/resources/rate-catalogs.d.ts.map +1 -0
- package/resources/rate-catalogs.js +75 -0
- package/resources/rate-catalogs.js.map +1 -0
- package/resources/rate-catalogs.mjs +71 -0
- package/resources/rate-catalogs.mjs.map +1 -0
- package/resources/subscription-timelines/index.d.mts +3 -0
- package/resources/subscription-timelines/index.d.mts.map +1 -0
- package/resources/subscription-timelines/index.d.ts +3 -0
- package/resources/subscription-timelines/index.d.ts.map +1 -0
- package/resources/subscription-timelines/index.js +9 -0
- package/resources/subscription-timelines/index.js.map +1 -0
- package/resources/subscription-timelines/index.mjs +4 -0
- package/resources/subscription-timelines/index.mjs.map +1 -0
- package/resources/subscription-timelines/items.d.mts +130 -0
- package/resources/subscription-timelines/items.d.mts.map +1 -0
- package/resources/subscription-timelines/items.d.ts +130 -0
- package/resources/subscription-timelines/items.d.ts.map +1 -0
- package/resources/subscription-timelines/items.js +28 -0
- package/resources/subscription-timelines/items.js.map +1 -0
- package/resources/subscription-timelines/items.mjs +24 -0
- package/resources/subscription-timelines/items.mjs.map +1 -0
- package/resources/subscription-timelines/subscription-timelines.d.mts +145 -0
- package/resources/subscription-timelines/subscription-timelines.d.mts.map +1 -0
- package/resources/subscription-timelines/subscription-timelines.d.ts +145 -0
- package/resources/subscription-timelines/subscription-timelines.d.ts.map +1 -0
- package/resources/subscription-timelines/subscription-timelines.js +45 -0
- package/resources/subscription-timelines/subscription-timelines.js.map +1 -0
- package/resources/subscription-timelines/subscription-timelines.mjs +40 -0
- package/resources/subscription-timelines/subscription-timelines.mjs.map +1 -0
- package/resources/subscription-timelines.d.mts +2 -0
- package/resources/subscription-timelines.d.mts.map +1 -0
- package/resources/subscription-timelines.d.ts +2 -0
- package/resources/subscription-timelines.d.ts.map +1 -0
- package/resources/subscription-timelines.js +6 -0
- package/resources/subscription-timelines.js.map +1 -0
- package/resources/subscription-timelines.mjs +3 -0
- package/resources/subscription-timelines.mjs.map +1 -0
- package/resources/subscriptions.d.mts +4 -0
- package/resources/subscriptions.d.mts.map +1 -1
- package/resources/subscriptions.d.ts +4 -0
- package/resources/subscriptions.d.ts.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/client.ts +56 -0
- package/src/resources/index.ts +25 -0
- package/src/resources/rate-cards.ts +11 -0
- package/src/resources/rate-catalogs.ts +521 -0
- package/src/resources/subscription-timelines/index.ts +19 -0
- package/src/resources/subscription-timelines/items.ts +187 -0
- package/src/resources/subscription-timelines/subscription-timelines.ts +240 -0
- package/src/resources/subscription-timelines.ts +3 -0
- package/src/resources/subscriptions.ts +5 -0
- 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
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import * as RateCatalogsAPI from './rate-catalogs';
|
|
5
|
+
import * as InvoicesAPI from './invoices';
|
|
6
|
+
import * as RateCardsAPI from './rate-cards';
|
|
7
|
+
import { APIPromise } from '../core/api-promise';
|
|
8
|
+
import { RequestOptions } from '../internal/request-options';
|
|
9
|
+
import { path } from '../internal/utils/path';
|
|
10
|
+
|
|
11
|
+
export class RateCatalogs extends APIResource {
|
|
12
|
+
/**
|
|
13
|
+
* Create Rate Catalog
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const rateCatalog = await client.rateCatalogs.create({
|
|
18
|
+
* description: 'My Catalog Description',
|
|
19
|
+
* name: 'My Catalog',
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
create(body: RateCatalogCreateParams, options?: RequestOptions): APIPromise<RateCatalogCreateResponse> {
|
|
24
|
+
return this._client.post('/rate-catalogs', { body, ...options });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get Rate Catalog
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const rateCatalog = await client.rateCatalogs.retrieve(
|
|
33
|
+
* 'rate_catalog_id',
|
|
34
|
+
* );
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
retrieve(rateCatalogID: string, options?: RequestOptions): APIPromise<RateCatalogRetrieveResponse> {
|
|
38
|
+
return this._client.get(path`/rate-catalogs/${rateCatalogID}`, options);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* List Rate Catalogs
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const rateCatalogs = await client.rateCatalogs.list();
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
list(
|
|
50
|
+
query: RateCatalogListParams | null | undefined = {},
|
|
51
|
+
options?: RequestOptions,
|
|
52
|
+
): APIPromise<RateCatalogListResponse> {
|
|
53
|
+
return this._client.get('/rate-catalogs', { query, ...options });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Add Rates To Rate Catalog
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const response = await client.rateCatalogs.addRates(
|
|
62
|
+
* 'rate_catalog_id',
|
|
63
|
+
* { billing_interval: 'monthly' },
|
|
64
|
+
* );
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
addRates(
|
|
68
|
+
rateCatalogID: string,
|
|
69
|
+
body: RateCatalogAddRatesParams,
|
|
70
|
+
options?: RequestOptions,
|
|
71
|
+
): APIPromise<RateCatalogAddRatesResponse> {
|
|
72
|
+
return this._client.post(path`/rate-catalogs/${rateCatalogID}/add_rates`, { body, ...options });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* List Rates In Catalog
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const response = await client.rateCatalogs.listRates(
|
|
81
|
+
* 'rate_catalog_id',
|
|
82
|
+
* );
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
listRates(
|
|
86
|
+
rateCatalogID: string,
|
|
87
|
+
query: RateCatalogListRatesParams | null | undefined = {},
|
|
88
|
+
options?: RequestOptions,
|
|
89
|
+
): APIPromise<RateCatalogListRatesResponse> {
|
|
90
|
+
return this._client.get(path`/rate-catalogs/${rateCatalogID}/rates`, { query, ...options });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface AmountTypedDict {
|
|
95
|
+
currency_code: string;
|
|
96
|
+
|
|
97
|
+
value: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface FlatPriceTypedDict {
|
|
101
|
+
amount: AmountTypedDict;
|
|
102
|
+
|
|
103
|
+
price_type: 'flat';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface PackagePriceTypedDict {
|
|
107
|
+
amount: AmountTypedDict;
|
|
108
|
+
|
|
109
|
+
package_units: number;
|
|
110
|
+
|
|
111
|
+
price_type: 'package';
|
|
112
|
+
|
|
113
|
+
rounding_behavior: 'round_up' | 'round_down';
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface RateCatalogCreateResponse {
|
|
117
|
+
id: string;
|
|
118
|
+
|
|
119
|
+
description: string;
|
|
120
|
+
|
|
121
|
+
name: string;
|
|
122
|
+
|
|
123
|
+
rate_count: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface RateCatalogRetrieveResponse {
|
|
127
|
+
id: string;
|
|
128
|
+
|
|
129
|
+
description: string;
|
|
130
|
+
|
|
131
|
+
name: string;
|
|
132
|
+
|
|
133
|
+
rate_count: number;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface RateCatalogListResponse {
|
|
137
|
+
has_more: boolean;
|
|
138
|
+
|
|
139
|
+
rate_catalogs: Array<RateCatalogListResponse.RateCatalog>;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export namespace RateCatalogListResponse {
|
|
143
|
+
export interface RateCatalog {
|
|
144
|
+
id: string;
|
|
145
|
+
|
|
146
|
+
description: string;
|
|
147
|
+
|
|
148
|
+
name: string;
|
|
149
|
+
|
|
150
|
+
rate_count: number;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface RateCatalogAddRatesResponse {
|
|
155
|
+
id: string;
|
|
156
|
+
|
|
157
|
+
description: string;
|
|
158
|
+
|
|
159
|
+
name: string;
|
|
160
|
+
|
|
161
|
+
rate_count: number;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface RateCatalogListRatesResponse {
|
|
165
|
+
has_more: boolean;
|
|
166
|
+
|
|
167
|
+
rates: Array<RateCatalogListRatesResponse.Rate>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export namespace RateCatalogListRatesResponse {
|
|
171
|
+
export interface Rate {
|
|
172
|
+
id: string;
|
|
173
|
+
|
|
174
|
+
interval: 'monthly' | 'yearly';
|
|
175
|
+
|
|
176
|
+
rate_catalog_id: string;
|
|
177
|
+
|
|
178
|
+
type: 'fixed' | 'usage_based';
|
|
179
|
+
|
|
180
|
+
fixed?: Rate.Fixed | null;
|
|
181
|
+
|
|
182
|
+
usage_based?: Rate.SimpleUsageBasedRateTypedDict | Rate.DimensionalUsageBasedRateTypedDict | null;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export namespace Rate {
|
|
186
|
+
export interface Fixed {
|
|
187
|
+
id: string;
|
|
188
|
+
|
|
189
|
+
code: string | null;
|
|
190
|
+
|
|
191
|
+
credit_grants: Array<Fixed.CreditGrant>;
|
|
192
|
+
|
|
193
|
+
description: string | null;
|
|
194
|
+
|
|
195
|
+
name: string;
|
|
196
|
+
|
|
197
|
+
price: RateCatalogsAPI.FlatPriceTypedDict | RateCatalogsAPI.PackagePriceTypedDict;
|
|
198
|
+
|
|
199
|
+
quantity_code: string | null;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export namespace Fixed {
|
|
203
|
+
export interface CreditGrant {
|
|
204
|
+
amount: InvoicesAPI.AmountOutput;
|
|
205
|
+
|
|
206
|
+
expiration:
|
|
207
|
+
| CreditGrant.CreditGrantDurationExpirationModel
|
|
208
|
+
| CreditGrant.CreditGrantDateTimeExpirationModel
|
|
209
|
+
| null;
|
|
210
|
+
|
|
211
|
+
metadata: { [key: string]: string };
|
|
212
|
+
|
|
213
|
+
name: string;
|
|
214
|
+
|
|
215
|
+
schedule:
|
|
216
|
+
| CreditGrant.CreditGrantScheduleOneTimeModel
|
|
217
|
+
| CreditGrant.CreditGrantScheduleRateCycleStartModel
|
|
218
|
+
| null;
|
|
219
|
+
|
|
220
|
+
subject_granting_config: CreditGrant.SubjectGrantingConfig | null;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export namespace CreditGrant {
|
|
224
|
+
export interface CreditGrantDurationExpirationModel {
|
|
225
|
+
duration: number;
|
|
226
|
+
|
|
227
|
+
unit: 'hours' | 'days' | 'weeks' | 'months' | 'years';
|
|
228
|
+
|
|
229
|
+
expiration_type?: 'duration';
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface CreditGrantDateTimeExpirationModel {
|
|
233
|
+
date: string;
|
|
234
|
+
|
|
235
|
+
expiration_type?: 'date';
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface CreditGrantScheduleOneTimeModel {
|
|
239
|
+
scheduled_at: string;
|
|
240
|
+
|
|
241
|
+
schedule_type?: 'one_time';
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface CreditGrantScheduleRateCycleStartModel {
|
|
245
|
+
rate_cycle_start_at: string;
|
|
246
|
+
|
|
247
|
+
schedule_type?: 'rate_cycle_start';
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface SubjectGrantingConfig {
|
|
251
|
+
apply_to_children: boolean;
|
|
252
|
+
|
|
253
|
+
apply_to_self: boolean;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface SimpleUsageBasedRateTypedDict {
|
|
259
|
+
id: string;
|
|
260
|
+
|
|
261
|
+
code: string;
|
|
262
|
+
|
|
263
|
+
description: string | null;
|
|
264
|
+
|
|
265
|
+
included_units: number;
|
|
266
|
+
|
|
267
|
+
name: string;
|
|
268
|
+
|
|
269
|
+
price: RateCatalogsAPI.FlatPriceTypedDict | RateCatalogsAPI.PackagePriceTypedDict;
|
|
270
|
+
|
|
271
|
+
pricing_metric_id: string;
|
|
272
|
+
|
|
273
|
+
usage_based_rate_type: 'simple';
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export interface DimensionalUsageBasedRateTypedDict {
|
|
277
|
+
id: string;
|
|
278
|
+
|
|
279
|
+
code: string;
|
|
280
|
+
|
|
281
|
+
description: string | null;
|
|
282
|
+
|
|
283
|
+
dimensions: Array<DimensionalUsageBasedRateTypedDict.Dimension>;
|
|
284
|
+
|
|
285
|
+
included_units: number;
|
|
286
|
+
|
|
287
|
+
name: string;
|
|
288
|
+
|
|
289
|
+
pricing_matrix: DimensionalUsageBasedRateTypedDict.PricingMatrix;
|
|
290
|
+
|
|
291
|
+
pricing_metric_id: string;
|
|
292
|
+
|
|
293
|
+
usage_based_rate_type: 'dimensional';
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export namespace DimensionalUsageBasedRateTypedDict {
|
|
297
|
+
export interface Dimension {
|
|
298
|
+
description: string | null;
|
|
299
|
+
|
|
300
|
+
key: string;
|
|
301
|
+
|
|
302
|
+
values: Array<string>;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface PricingMatrix {
|
|
306
|
+
cells: Array<PricingMatrix.Cell>;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export namespace PricingMatrix {
|
|
310
|
+
export interface Cell {
|
|
311
|
+
dimension_coordinates: { [key: string]: string };
|
|
312
|
+
|
|
313
|
+
price: RateCatalogsAPI.FlatPriceTypedDict | RateCatalogsAPI.PackagePriceTypedDict;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export interface RateCatalogCreateParams {
|
|
321
|
+
/**
|
|
322
|
+
* The description of the catalog.
|
|
323
|
+
*/
|
|
324
|
+
description: string;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* The name of the catalog.
|
|
328
|
+
*/
|
|
329
|
+
name: string;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export interface RateCatalogListParams {
|
|
333
|
+
limit?: number;
|
|
334
|
+
|
|
335
|
+
offset?: number;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export interface RateCatalogAddRatesParams {
|
|
339
|
+
/**
|
|
340
|
+
* How often the customer will be billed for these rates.
|
|
341
|
+
*/
|
|
342
|
+
billing_interval: 'monthly' | 'yearly';
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* The fixed rate to create in the catalog.
|
|
346
|
+
*/
|
|
347
|
+
fixed_rates?: Array<RateCatalogAddRatesParams.FixedRate>;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* The usage based rates to create in the catalog.
|
|
351
|
+
*/
|
|
352
|
+
usage_based_rates?: Array<
|
|
353
|
+
| RateCatalogAddRatesParams.CreateSimpleUsageBasedRateRequest
|
|
354
|
+
| RateCatalogAddRatesParams.CreateDimensionalUsageBasedRateRequest
|
|
355
|
+
>;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export namespace RateCatalogAddRatesParams {
|
|
359
|
+
export interface FixedRate {
|
|
360
|
+
/**
|
|
361
|
+
* Code of this rate to be used for setting quantity and price multipliers. This
|
|
362
|
+
* code must be unique within the rate card.
|
|
363
|
+
*/
|
|
364
|
+
code: string;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* The name of the rate displayed to the customer.
|
|
368
|
+
*/
|
|
369
|
+
name: string;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Flat price is a price that linearly scales with the quantity.
|
|
373
|
+
*/
|
|
374
|
+
price: RateCardsAPI.FlatPriceInput | RateCardsAPI.PackagePriceInput;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* The description of the rate displayed to the customer.
|
|
378
|
+
*/
|
|
379
|
+
description?: string | null;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export interface CreateSimpleUsageBasedRateRequest {
|
|
383
|
+
/**
|
|
384
|
+
* Code of this rate to be used for price multipliers. This code must be unique
|
|
385
|
+
* within the rate card.
|
|
386
|
+
*/
|
|
387
|
+
code: string;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* The name of the rate displayed to the customer.
|
|
391
|
+
*/
|
|
392
|
+
name: string;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Flat price is a price that linearly scales with the quantity.
|
|
396
|
+
*/
|
|
397
|
+
price: RateCardsAPI.FlatPriceInput | RateCardsAPI.PackagePriceInput;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* The ID of the pricing metric to use for this rate.
|
|
401
|
+
*/
|
|
402
|
+
pricing_metric_id: string;
|
|
403
|
+
|
|
404
|
+
usage_based_rate_type: 'simple';
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* The description of the rate displayed to the customer.
|
|
408
|
+
*/
|
|
409
|
+
description?: string | null;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* The number of units included in the rate before the price is applied.
|
|
413
|
+
*/
|
|
414
|
+
included_units?: number;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export interface CreateDimensionalUsageBasedRateRequest {
|
|
418
|
+
/**
|
|
419
|
+
* Code of this rate to be used for price multipliers. This code must be unique
|
|
420
|
+
* within the rate card.
|
|
421
|
+
*/
|
|
422
|
+
code: string;
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* The dimensions of the rate.
|
|
426
|
+
*/
|
|
427
|
+
dimensions: Array<CreateDimensionalUsageBasedRateRequest.Dimension>;
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* The name of the rate displayed to the customer.
|
|
431
|
+
*/
|
|
432
|
+
name: string;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* The pricing matrix of the rate.
|
|
436
|
+
*/
|
|
437
|
+
pricing_matrix: CreateDimensionalUsageBasedRateRequest.PricingMatrix;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* The ID of the pricing metric to use for this rate.
|
|
441
|
+
*/
|
|
442
|
+
pricing_metric_id: string;
|
|
443
|
+
|
|
444
|
+
usage_based_rate_type: 'dimensional';
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* The description of the rate displayed to the customer.
|
|
448
|
+
*/
|
|
449
|
+
description?: string | null;
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* The number of units included in the rate before the price is applied.
|
|
453
|
+
*/
|
|
454
|
+
included_units?: number;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export namespace CreateDimensionalUsageBasedRateRequest {
|
|
458
|
+
export interface Dimension {
|
|
459
|
+
/**
|
|
460
|
+
* The name of the dimension. This is used to identify the dimension in the pricing
|
|
461
|
+
* matrix.
|
|
462
|
+
*/
|
|
463
|
+
key: string;
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* A list of possible values for the dimension.
|
|
467
|
+
*/
|
|
468
|
+
values: Array<string>;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* The description of the dimension.
|
|
472
|
+
*/
|
|
473
|
+
description?: string | null;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* The pricing matrix of the rate.
|
|
478
|
+
*/
|
|
479
|
+
export interface PricingMatrix {
|
|
480
|
+
cells: Array<PricingMatrix.Cell>;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export namespace PricingMatrix {
|
|
484
|
+
export interface Cell {
|
|
485
|
+
/**
|
|
486
|
+
* A key-value mapping of dimension keys and values to identify the price for a
|
|
487
|
+
* given set of dimension values.
|
|
488
|
+
*/
|
|
489
|
+
dimension_coordinates: { [key: string]: string };
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* The price for the cell.
|
|
493
|
+
*/
|
|
494
|
+
price: RateCardsAPI.FlatPriceInput | RateCardsAPI.PackagePriceInput;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export interface RateCatalogListRatesParams {
|
|
501
|
+
limit?: number;
|
|
502
|
+
|
|
503
|
+
offset?: number;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export declare namespace RateCatalogs {
|
|
507
|
+
export {
|
|
508
|
+
type AmountTypedDict as AmountTypedDict,
|
|
509
|
+
type FlatPriceTypedDict as FlatPriceTypedDict,
|
|
510
|
+
type PackagePriceTypedDict as PackagePriceTypedDict,
|
|
511
|
+
type RateCatalogCreateResponse as RateCatalogCreateResponse,
|
|
512
|
+
type RateCatalogRetrieveResponse as RateCatalogRetrieveResponse,
|
|
513
|
+
type RateCatalogListResponse as RateCatalogListResponse,
|
|
514
|
+
type RateCatalogAddRatesResponse as RateCatalogAddRatesResponse,
|
|
515
|
+
type RateCatalogListRatesResponse as RateCatalogListRatesResponse,
|
|
516
|
+
type RateCatalogCreateParams as RateCatalogCreateParams,
|
|
517
|
+
type RateCatalogListParams as RateCatalogListParams,
|
|
518
|
+
type RateCatalogAddRatesParams as RateCatalogAddRatesParams,
|
|
519
|
+
type RateCatalogListRatesParams as RateCatalogListRatesParams,
|
|
520
|
+
};
|
|
521
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
Items,
|
|
5
|
+
type ItemCreateResponse,
|
|
6
|
+
type ItemListResponse,
|
|
7
|
+
type ItemCreateParams,
|
|
8
|
+
type ItemListParams,
|
|
9
|
+
} from './items';
|
|
10
|
+
export {
|
|
11
|
+
SubscriptionTimelines,
|
|
12
|
+
type SubscriptionTimelineCreateResponse,
|
|
13
|
+
type SubscriptionTimelineRetrieveResponse,
|
|
14
|
+
type SubscriptionTimelineListResponse,
|
|
15
|
+
type SubscriptionTimelineStartResponse,
|
|
16
|
+
type SubscriptionTimelineCreateParams,
|
|
17
|
+
type SubscriptionTimelineListParams,
|
|
18
|
+
type SubscriptionTimelineStartParams,
|
|
19
|
+
} from './subscription-timelines';
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
6
|
+
import { path } from '../../internal/utils/path';
|
|
7
|
+
|
|
8
|
+
export class Items extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Create Subscription Timeline Items
|
|
11
|
+
*/
|
|
12
|
+
create(
|
|
13
|
+
subscriptionTimelineID: string,
|
|
14
|
+
body: ItemCreateParams,
|
|
15
|
+
options?: RequestOptions,
|
|
16
|
+
): APIPromise<ItemCreateResponse> {
|
|
17
|
+
return this._client.post(path`/subscription-timelines/${subscriptionTimelineID}/items`, {
|
|
18
|
+
body,
|
|
19
|
+
...options,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* List Subscription Timeline Items
|
|
25
|
+
*/
|
|
26
|
+
list(
|
|
27
|
+
subscriptionTimelineID: string,
|
|
28
|
+
query: ItemListParams | null | undefined = {},
|
|
29
|
+
options?: RequestOptions,
|
|
30
|
+
): APIPromise<ItemListResponse> {
|
|
31
|
+
return this._client.get(path`/subscription-timelines/${subscriptionTimelineID}/items`, {
|
|
32
|
+
query,
|
|
33
|
+
...options,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type ItemCreateResponse = Array<ItemCreateResponse.ItemCreateResponseItem>;
|
|
39
|
+
|
|
40
|
+
export namespace ItemCreateResponse {
|
|
41
|
+
export interface ItemCreateResponseItem {
|
|
42
|
+
id: string;
|
|
43
|
+
|
|
44
|
+
created_at: string;
|
|
45
|
+
|
|
46
|
+
period: ItemCreateResponseItem.Period;
|
|
47
|
+
|
|
48
|
+
subscription_input: ItemCreateResponseItem.SubscriptionInput;
|
|
49
|
+
|
|
50
|
+
subscription_timeline_id: string;
|
|
51
|
+
|
|
52
|
+
updated_at: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export namespace ItemCreateResponseItem {
|
|
56
|
+
export interface Period {
|
|
57
|
+
end: string | null;
|
|
58
|
+
|
|
59
|
+
start: string;
|
|
60
|
+
|
|
61
|
+
inclusive_end?: boolean;
|
|
62
|
+
|
|
63
|
+
inclusive_start?: boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface SubscriptionInput {
|
|
67
|
+
fixed_rate_quantities: { [key: string]: string };
|
|
68
|
+
|
|
69
|
+
rate_card_id: string;
|
|
70
|
+
|
|
71
|
+
rate_price_multipliers: { [key: string]: string };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface ItemListResponse {
|
|
77
|
+
has_more: boolean;
|
|
78
|
+
|
|
79
|
+
items: Array<ItemListResponse.Item>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export namespace ItemListResponse {
|
|
83
|
+
export interface Item {
|
|
84
|
+
id: string;
|
|
85
|
+
|
|
86
|
+
created_at: string;
|
|
87
|
+
|
|
88
|
+
period: Item.Period;
|
|
89
|
+
|
|
90
|
+
subscription_input: Item.SubscriptionInput;
|
|
91
|
+
|
|
92
|
+
subscription_timeline_id: string;
|
|
93
|
+
|
|
94
|
+
updated_at: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export namespace Item {
|
|
98
|
+
export interface Period {
|
|
99
|
+
end: string | null;
|
|
100
|
+
|
|
101
|
+
start: string;
|
|
102
|
+
|
|
103
|
+
inclusive_end?: boolean;
|
|
104
|
+
|
|
105
|
+
inclusive_start?: boolean;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface SubscriptionInput {
|
|
109
|
+
fixed_rate_quantities: { [key: string]: string };
|
|
110
|
+
|
|
111
|
+
rate_card_id: string;
|
|
112
|
+
|
|
113
|
+
rate_price_multipliers: { [key: string]: string };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface ItemCreateParams {
|
|
119
|
+
/**
|
|
120
|
+
* The items to create for the subscription timeline.
|
|
121
|
+
*/
|
|
122
|
+
items: Array<ItemCreateParams.Item>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export namespace ItemCreateParams {
|
|
126
|
+
export interface Item {
|
|
127
|
+
/**
|
|
128
|
+
* The period of the subscription timeline item.
|
|
129
|
+
*/
|
|
130
|
+
period: Item.Period;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The subscription input for the subscription timeline item.
|
|
134
|
+
*/
|
|
135
|
+
subscription_input: Item.SubscriptionInput;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export namespace Item {
|
|
139
|
+
/**
|
|
140
|
+
* The period of the subscription timeline item.
|
|
141
|
+
*/
|
|
142
|
+
export interface Period {
|
|
143
|
+
end: string | null;
|
|
144
|
+
|
|
145
|
+
start: string;
|
|
146
|
+
|
|
147
|
+
inclusive_end?: boolean;
|
|
148
|
+
|
|
149
|
+
inclusive_start?: boolean;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* The subscription input for the subscription timeline item.
|
|
154
|
+
*/
|
|
155
|
+
export interface SubscriptionInput {
|
|
156
|
+
/**
|
|
157
|
+
* The quantities of the fixed rates to use for the subscription timeline item.
|
|
158
|
+
*/
|
|
159
|
+
fixed_rate_quantities: { [key: string]: number | string };
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The ID of the rate card to use for the subscription timeline item.
|
|
163
|
+
*/
|
|
164
|
+
rate_card_id: string;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The price multipliers to use for the subscription timeline item.
|
|
168
|
+
*/
|
|
169
|
+
rate_price_multipliers: { [key: string]: number | string };
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface ItemListParams {
|
|
175
|
+
limit?: number;
|
|
176
|
+
|
|
177
|
+
offset?: number;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export declare namespace Items {
|
|
181
|
+
export {
|
|
182
|
+
type ItemCreateResponse as ItemCreateResponse,
|
|
183
|
+
type ItemListResponse as ItemListResponse,
|
|
184
|
+
type ItemCreateParams as ItemCreateParams,
|
|
185
|
+
type ItemListParams as ItemListParams,
|
|
186
|
+
};
|
|
187
|
+
}
|