orb-billing 1.23.0 → 1.24.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 +8 -0
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +4 -0
- package/index.js.map +1 -1
- package/index.mjs +4 -0
- package/index.mjs.map +1 -1
- package/package.json +3 -1
- package/resources/coupons/coupons.d.ts +60 -2
- package/resources/coupons/coupons.d.ts.map +1 -1
- package/resources/coupons/coupons.js.map +1 -1
- package/resources/coupons/coupons.mjs.map +1 -1
- package/resources/credit-notes.d.ts +57 -5
- package/resources/credit-notes.d.ts.map +1 -1
- package/resources/credit-notes.js.map +1 -1
- package/resources/credit-notes.mjs.map +1 -1
- package/resources/customers/balance-transactions.d.ts +2 -2
- package/resources/customers/balance-transactions.d.ts.map +1 -1
- package/resources/customers/balance-transactions.js.map +1 -1
- package/resources/customers/balance-transactions.mjs.map +1 -1
- package/resources/customers/customers.d.ts +696 -8
- package/resources/customers/customers.d.ts.map +1 -1
- package/resources/customers/customers.js.map +1 -1
- package/resources/customers/customers.mjs.map +1 -1
- package/resources/customers/usage.d.ts +74 -58
- package/resources/customers/usage.d.ts.map +1 -1
- package/resources/customers/usage.js +14 -14
- package/resources/customers/usage.js.map +1 -1
- package/resources/customers/usage.mjs +14 -14
- package/resources/customers/usage.mjs.map +1 -1
- package/resources/events/events.d.ts +40 -40
- package/resources/events/events.js +40 -40
- package/resources/events/events.mjs +40 -40
- package/resources/index.d.ts +4 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +19 -4
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -1
- package/resources/index.mjs.map +1 -1
- package/resources/invoice-line-items.d.ts +2 -2
- package/resources/invoice-line-items.d.ts.map +1 -1
- package/resources/invoices.d.ts +358 -71
- package/resources/invoices.d.ts.map +1 -1
- package/resources/invoices.js.map +1 -1
- package/resources/invoices.mjs.map +1 -1
- package/resources/plans/plans.d.ts +648 -4
- package/resources/plans/plans.d.ts.map +1 -1
- package/resources/plans/plans.js.map +1 -1
- package/resources/plans/plans.mjs.map +1 -1
- package/resources/prices/index.d.ts +1 -1
- package/resources/prices/index.d.ts.map +1 -1
- package/resources/prices/index.js +3 -3
- package/resources/prices/index.js.map +1 -1
- package/resources/prices/index.mjs +1 -1
- package/resources/prices/index.mjs.map +1 -1
- package/resources/prices/prices.d.ts +56 -83
- package/resources/prices/prices.d.ts.map +1 -1
- package/resources/prices/prices.js.map +1 -1
- package/resources/prices/prices.mjs.map +1 -1
- package/resources/shared.d.ts +62 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/resources/subscriptions.d.ts +1084 -241
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/subscriptions.js.map +1 -1
- package/resources/subscriptions.mjs.map +1 -1
- package/src/index.ts +7 -2
- package/src/resources/coupons/coupons.ts +76 -2
- package/src/resources/credit-notes.ts +81 -5
- package/src/resources/customers/balance-transactions.ts +18 -2
- package/src/resources/customers/customers.ts +1144 -12
- package/src/resources/customers/usage.ts +80 -62
- package/src/resources/events/events.ts +40 -40
- package/src/resources/index.ts +3 -3
- package/src/resources/invoice-line-items.ts +2 -2
- package/src/resources/invoices.ts +598 -91
- package/src/resources/plans/plans.ts +810 -4
- package/src/resources/prices/index.ts +1 -1
- package/src/resources/prices/prices.ts +67 -100
- package/src/resources/shared.ts +84 -0
- package/src/resources/subscriptions.ts +1291 -279
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -10,7 +10,7 @@ export class Usage extends APIResource {
|
|
|
10
10
|
* an active subscription.
|
|
11
11
|
*
|
|
12
12
|
* This endpoint will mark _all_ existing events within
|
|
13
|
-
* `[timeframe_start, timeframe_end)` as _ignored_ for billing
|
|
13
|
+
* `[timeframe_start, timeframe_end)` as _ignored_ for billing purposes, and Orb
|
|
14
14
|
* will only use the _new_ events passed in the body of this request as the source
|
|
15
15
|
* of truth for that timeframe moving forwards. Note that a given time period can
|
|
16
16
|
* be amended any number of times, so events can be overwritten in subsequent calls
|
|
@@ -22,7 +22,7 @@ export class Usage extends APIResource {
|
|
|
22
22
|
* - decrease historical usage consumption because of degraded service availability
|
|
23
23
|
* in your systems
|
|
24
24
|
* - account for gaps from your usage reporting mechanism
|
|
25
|
-
* - make point-in-time fixes for specific event records, while
|
|
25
|
+
* - make point-in-time fixes for specific event records, while retaining the
|
|
26
26
|
* original time of usage and associated metadata. This amendment API is designed
|
|
27
27
|
* with two explicit goals:
|
|
28
28
|
*
|
|
@@ -30,10 +30,10 @@ export class Usage extends APIResource {
|
|
|
30
30
|
* original events in the timeframe, though they will be ignored for billing
|
|
31
31
|
* calculations. For auditing a nd data fidelity purposes, Orb never overwrites
|
|
32
32
|
* or permanently deletes ingested usage data.
|
|
33
|
-
* 2. Amendments always
|
|
34
|
-
* amendment is fully processed by the system (and the new events for
|
|
33
|
+
* 2. Amendments always preserve data **consistency**. In other words, either an
|
|
34
|
+
* amendment is fully processed by the system (and the new events for the
|
|
35
35
|
* timeframe are honored rather than the existing ones) or the amendment request
|
|
36
|
-
* fails. To maintain this important
|
|
36
|
+
* fails. To maintain this important property, Orb prevents _partial event
|
|
37
37
|
* ingestion_ on this endpoint.
|
|
38
38
|
*
|
|
39
39
|
* ## Response semantics
|
|
@@ -45,12 +45,12 @@ export class Usage extends APIResource {
|
|
|
45
45
|
* also not deprecate existing events in the time period.
|
|
46
46
|
* - You can assume that the amendment is successful on receipt of a `2xx`
|
|
47
47
|
* response.While a successful response from this endpoint indicates that the new
|
|
48
|
-
* events have been ingested,
|
|
48
|
+
* events have been ingested, updating usage totals happens asynchronously and
|
|
49
49
|
* may be delayed by a few minutes.
|
|
50
50
|
*
|
|
51
51
|
* As emphasized above, Orb will never show an inconsistent state (e.g. in invoice
|
|
52
52
|
* previews or dashboards); either it will show the existing state (before the
|
|
53
|
-
*
|
|
53
|
+
* amendment) or the new state (with new events in the requested timeframe).
|
|
54
54
|
*
|
|
55
55
|
* ## Sample request body
|
|
56
56
|
*
|
|
@@ -121,7 +121,7 @@ export class Usage extends APIResource {
|
|
|
121
121
|
* an active subscription.
|
|
122
122
|
*
|
|
123
123
|
* This endpoint will mark _all_ existing events within
|
|
124
|
-
* `[timeframe_start, timeframe_end)` as _ignored_ for billing
|
|
124
|
+
* `[timeframe_start, timeframe_end)` as _ignored_ for billing purposes, and Orb
|
|
125
125
|
* will only use the _new_ events passed in the body of this request as the source
|
|
126
126
|
* of truth for that timeframe moving forwards. Note that a given time period can
|
|
127
127
|
* be amended any number of times, so events can be overwritten in subsequent calls
|
|
@@ -133,7 +133,7 @@ export class Usage extends APIResource {
|
|
|
133
133
|
* - decrease historical usage consumption because of degraded service availability
|
|
134
134
|
* in your systems
|
|
135
135
|
* - account for gaps from your usage reporting mechanism
|
|
136
|
-
* - make point-in-time fixes for specific event records, while
|
|
136
|
+
* - make point-in-time fixes for specific event records, while retaining the
|
|
137
137
|
* original time of usage and associated metadata. This amendment API is designed
|
|
138
138
|
* with two explicit goals:
|
|
139
139
|
*
|
|
@@ -141,10 +141,10 @@ export class Usage extends APIResource {
|
|
|
141
141
|
* original events in the timeframe, though they will be ignored for billing
|
|
142
142
|
* calculations. For auditing a nd data fidelity purposes, Orb never overwrites
|
|
143
143
|
* or permanently deletes ingested usage data.
|
|
144
|
-
* 2. Amendments always
|
|
145
|
-
* amendment is fully processed by the system (and the new events for
|
|
144
|
+
* 2. Amendments always preserve data **consistency**. In other words, either an
|
|
145
|
+
* amendment is fully processed by the system (and the new events for the
|
|
146
146
|
* timeframe are honored rather than the existing ones) or the amendment request
|
|
147
|
-
* fails. To maintain this important
|
|
147
|
+
* fails. To maintain this important property, Orb prevents _partial event
|
|
148
148
|
* ingestion_ on this endpoint.
|
|
149
149
|
*
|
|
150
150
|
* ## Response semantics
|
|
@@ -156,12 +156,12 @@ export class Usage extends APIResource {
|
|
|
156
156
|
* also not deprecate existing events in the time period.
|
|
157
157
|
* - You can assume that the amendment is successful on receipt of a `2xx`
|
|
158
158
|
* response.While a successful response from this endpoint indicates that the new
|
|
159
|
-
* events have been ingested,
|
|
159
|
+
* events have been ingested, updating usage totals happens asynchronously and
|
|
160
160
|
* may be delayed by a few minutes.
|
|
161
161
|
*
|
|
162
162
|
* As emphasized above, Orb will never show an inconsistent state (e.g. in invoice
|
|
163
163
|
* previews or dashboards); either it will show the existing state (before the
|
|
164
|
-
*
|
|
164
|
+
* amendment) or the new state (with new events in the requested timeframe).
|
|
165
165
|
*
|
|
166
166
|
* ## Sample request body
|
|
167
167
|
*
|
|
@@ -258,22 +258,9 @@ export interface UsageUpdateByExternalIDResponse {
|
|
|
258
258
|
|
|
259
259
|
export interface UsageUpdateParams {
|
|
260
260
|
/**
|
|
261
|
-
* Body param:
|
|
261
|
+
* Body param: Events to update
|
|
262
262
|
*/
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Body param: A dictionary of custom properties. Values in this dictionary must be
|
|
267
|
-
* numeric, boolean, or strings. Nested dictionaries are disallowed.
|
|
268
|
-
*/
|
|
269
|
-
properties: unknown;
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Body param: An ISO 8601 format date with no timezone offset (i.e. UTC). This
|
|
273
|
-
* should represent the time that usage was recorded, and is particularly important
|
|
274
|
-
* to attribute usage to a given billing period.
|
|
275
|
-
*/
|
|
276
|
-
timestamp: string;
|
|
263
|
+
events: Array<UsageUpdateParams.Event>;
|
|
277
264
|
|
|
278
265
|
/**
|
|
279
266
|
* Query param: This bound is exclusive (i.e. events before this timestamp will be
|
|
@@ -286,37 +273,46 @@ export interface UsageUpdateParams {
|
|
|
286
273
|
* inclusive will be updated)
|
|
287
274
|
*/
|
|
288
275
|
timeframe_start?: string;
|
|
276
|
+
}
|
|
289
277
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
278
|
+
export namespace UsageUpdateParams {
|
|
279
|
+
export interface Event {
|
|
280
|
+
/**
|
|
281
|
+
* A name to meaningfully identify the action or event type.
|
|
282
|
+
*/
|
|
283
|
+
event_name: string;
|
|
294
284
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
285
|
+
/**
|
|
286
|
+
* A dictionary of custom properties. Values in this dictionary must be numeric,
|
|
287
|
+
* boolean, or strings. Nested dictionaries are disallowed.
|
|
288
|
+
*/
|
|
289
|
+
properties: unknown;
|
|
301
290
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
291
|
+
/**
|
|
292
|
+
* An ISO 8601 format date with no timezone offset (i.e. UTC). This should
|
|
293
|
+
* represent the time that usage was recorded, and is particularly important to
|
|
294
|
+
* attribute usage to a given billing period.
|
|
295
|
+
*/
|
|
296
|
+
timestamp: string;
|
|
307
297
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
298
|
+
/**
|
|
299
|
+
* The Orb Customer identifier
|
|
300
|
+
*/
|
|
301
|
+
customer_id?: string | null;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* An alias for the Orb customer, whose mapping is specified when creating the
|
|
305
|
+
* customer
|
|
306
|
+
*/
|
|
307
|
+
external_customer_id?: string | null;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
313
310
|
|
|
311
|
+
export interface UsageUpdateByExternalIDParams {
|
|
314
312
|
/**
|
|
315
|
-
* Body param:
|
|
316
|
-
* should represent the time that usage was recorded, and is particularly important
|
|
317
|
-
* to attribute usage to a given billing period.
|
|
313
|
+
* Body param: Events to update
|
|
318
314
|
*/
|
|
319
|
-
|
|
315
|
+
events: Array<UsageUpdateByExternalIDParams.Event>;
|
|
320
316
|
|
|
321
317
|
/**
|
|
322
318
|
* Query param: This bound is exclusive (i.e. events before this timestamp will be
|
|
@@ -329,17 +325,39 @@ export interface UsageUpdateByExternalIDParams {
|
|
|
329
325
|
* inclusive will be updated)
|
|
330
326
|
*/
|
|
331
327
|
timeframe_start?: string;
|
|
328
|
+
}
|
|
332
329
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
330
|
+
export namespace UsageUpdateByExternalIDParams {
|
|
331
|
+
export interface Event {
|
|
332
|
+
/**
|
|
333
|
+
* A name to meaningfully identify the action or event type.
|
|
334
|
+
*/
|
|
335
|
+
event_name: string;
|
|
337
336
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
337
|
+
/**
|
|
338
|
+
* A dictionary of custom properties. Values in this dictionary must be numeric,
|
|
339
|
+
* boolean, or strings. Nested dictionaries are disallowed.
|
|
340
|
+
*/
|
|
341
|
+
properties: unknown;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* An ISO 8601 format date with no timezone offset (i.e. UTC). This should
|
|
345
|
+
* represent the time that usage was recorded, and is particularly important to
|
|
346
|
+
* attribute usage to a given billing period.
|
|
347
|
+
*/
|
|
348
|
+
timestamp: string;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* The Orb Customer identifier
|
|
352
|
+
*/
|
|
353
|
+
customer_id?: string | null;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* An alias for the Orb customer, whose mapping is specified when creating the
|
|
357
|
+
* customer
|
|
358
|
+
*/
|
|
359
|
+
external_customer_id?: string | null;
|
|
360
|
+
}
|
|
343
361
|
}
|
|
344
362
|
|
|
345
363
|
export namespace Usage {
|
|
@@ -120,47 +120,47 @@ export class Events extends APIResource {
|
|
|
120
120
|
* Events are the starting point for all usage calculations in the system, and are
|
|
121
121
|
* simple at their core:
|
|
122
122
|
*
|
|
123
|
-
* ```
|
|
123
|
+
* ```ts
|
|
124
124
|
* {
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
125
|
+
* // customer_id and external_customer_id are used to
|
|
126
|
+
* // attribute usage to a given Customer. Exactly one of these
|
|
127
|
+
* // should be specified in a given ingestion event.
|
|
128
|
+
*
|
|
129
|
+
* // `customer_id` is the Orb generated identifier for the Customer,
|
|
130
|
+
* // which is returned from the Create customer API call.
|
|
131
|
+
* customer_id: string,
|
|
132
|
+
*
|
|
133
|
+
* // external_customer_id is an alternate identifier which is associated
|
|
134
|
+
* // with a Customer at creation time. This is treated as an alias for
|
|
135
|
+
* // customer_id, and is usually set to an identifier native to your system.
|
|
136
|
+
* external_customer_id: string,
|
|
137
|
+
*
|
|
138
|
+
* // A string name identifying the event, usually a usage
|
|
139
|
+
* // action. By convention, this should not contain any whitespace.
|
|
140
|
+
* event_name: string,
|
|
141
|
+
*
|
|
142
|
+
* // An ISO 8601 format date with no timezone offset.
|
|
143
|
+
* // This should represent the time that usage occurred
|
|
144
|
+
* // and is important to attribute usage to a given
|
|
145
|
+
* // billing period. See the notes below on determining the timestamp.
|
|
146
|
+
* // e.g. 2020-12-09T16:09:53Z
|
|
147
|
+
* timestamp: string,
|
|
148
|
+
*
|
|
149
|
+
* // A unique value, generated by the client, that is
|
|
150
|
+
* // used to de-duplicate events.
|
|
151
|
+
* // Exactly one event with a given
|
|
152
|
+
* // idempotency key will be ingested, which allows for
|
|
153
|
+
* // safe request retries.
|
|
154
|
+
* idempotency_key: string
|
|
155
|
+
*
|
|
156
|
+
* // Optional custom metadata to attach to the event.
|
|
157
|
+
* // This might include a numeric value used for aggregation,
|
|
158
|
+
* // or a string/boolean value used for filtering.
|
|
159
|
+
* // The schema of this dictionary need not be pre-declared, and
|
|
160
|
+
* // properties can be added at any time.
|
|
161
|
+
* properties: {
|
|
162
|
+
* [key: string]?: string | number | boolean,
|
|
163
|
+
* },
|
|
164
164
|
* }
|
|
165
165
|
* ```
|
|
166
166
|
*
|
package/src/resources/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
+
export * from './shared';
|
|
3
4
|
export { Coupon, CouponCreateParams, CouponListParams, CouponsPage, Coupons } from './coupons/coupons';
|
|
4
5
|
export { CreditNote, CreditNoteListParams, CreditNotesPage, CreditNotes } from './credit-notes';
|
|
5
6
|
export {
|
|
@@ -11,7 +12,6 @@ export {
|
|
|
11
12
|
CustomersPage,
|
|
12
13
|
Customers,
|
|
13
14
|
} from './customers/customers';
|
|
14
|
-
export { Discount, Price, PriceCreateParams, PriceListParams, PricesPage, Prices } from './prices/prices';
|
|
15
15
|
export {
|
|
16
16
|
EventUpdateResponse,
|
|
17
17
|
EventDeprecateResponse,
|
|
@@ -24,7 +24,6 @@ export {
|
|
|
24
24
|
} from './events/events';
|
|
25
25
|
export {
|
|
26
26
|
Invoice,
|
|
27
|
-
InvoiceDiscount,
|
|
28
27
|
InvoiceFetchUpcomingResponse,
|
|
29
28
|
InvoiceCreateParams,
|
|
30
29
|
InvoiceListParams,
|
|
@@ -49,10 +48,11 @@ export {
|
|
|
49
48
|
Metrics,
|
|
50
49
|
} from './metrics';
|
|
51
50
|
export { Plan, PlanCreateParams, PlanUpdateParams, PlanListParams, PlansPage, Plans } from './plans/plans';
|
|
51
|
+
export { Price, PriceCreateParams, PriceListParams, PricesPage, Prices } from './prices/prices';
|
|
52
52
|
export {
|
|
53
53
|
Subscription,
|
|
54
|
-
Subscriptions,
|
|
55
54
|
SubscriptionUsage,
|
|
55
|
+
Subscriptions,
|
|
56
56
|
SubscriptionFetchCostsResponse,
|
|
57
57
|
SubscriptionFetchScheduleResponse,
|
|
58
58
|
SubscriptionCreateParams,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as Core from "../core";
|
|
4
4
|
import { APIResource } from "../resource";
|
|
5
5
|
import * as InvoiceLineItemsAPI from "./invoice-line-items";
|
|
6
|
-
import * as
|
|
6
|
+
import * as Shared from "./shared";
|
|
7
7
|
import * as PricesAPI from "./prices/prices";
|
|
8
8
|
|
|
9
9
|
export class InvoiceLineItems extends APIResource {
|
|
@@ -30,7 +30,7 @@ export interface InvoiceLineItemCreateResponse {
|
|
|
30
30
|
*/
|
|
31
31
|
amount: string;
|
|
32
32
|
|
|
33
|
-
discount:
|
|
33
|
+
discount: Shared.Discount | null;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* The end date of the range of time applied for this line item's price.
|