orb-billing 5.48.0 → 5.76.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 +249 -0
- package/core.js +2 -2
- package/core.js.map +1 -1
- package/core.mjs +2 -2
- package/core.mjs.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +11 -0
- package/index.js.map +1 -1
- package/index.mjs +11 -0
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/alerts.d.ts +140 -3
- package/resources/alerts.d.ts.map +1 -1
- package/resources/alerts.js.map +1 -1
- package/resources/alerts.mjs.map +1 -1
- package/resources/beta/beta.d.ts +738 -7570
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/external-plan-id.d.ts +664 -7572
- package/resources/beta/external-plan-id.d.ts.map +1 -1
- package/resources/coupons/coupons.d.ts +29 -0
- package/resources/coupons/coupons.d.ts.map +1 -1
- package/resources/coupons/coupons.js +21 -0
- package/resources/coupons/coupons.js.map +1 -1
- package/resources/coupons/coupons.mjs +21 -0
- package/resources/coupons/coupons.mjs.map +1 -1
- package/resources/coupons/subscriptions.d.ts +10 -0
- package/resources/coupons/subscriptions.d.ts.map +1 -1
- package/resources/coupons/subscriptions.js.map +1 -1
- package/resources/coupons/subscriptions.mjs.map +1 -1
- package/resources/credit-blocks.d.ts +138 -7
- package/resources/credit-blocks.d.ts.map +1 -1
- package/resources/credit-blocks.js +10 -7
- package/resources/credit-blocks.js.map +1 -1
- package/resources/credit-blocks.mjs +10 -7
- package/resources/credit-blocks.mjs.map +1 -1
- package/resources/credit-notes.d.ts +28 -0
- package/resources/credit-notes.d.ts.map +1 -1
- package/resources/credit-notes.js +20 -0
- package/resources/credit-notes.js.map +1 -1
- package/resources/credit-notes.mjs +20 -0
- package/resources/credit-notes.mjs.map +1 -1
- package/resources/customers/credits/credits.d.ts +129 -0
- package/resources/customers/credits/credits.d.ts.map +1 -1
- package/resources/customers/credits/credits.js.map +1 -1
- package/resources/customers/credits/credits.mjs.map +1 -1
- package/resources/customers/credits/ledger.d.ts +34 -20
- package/resources/customers/credits/ledger.d.ts.map +1 -1
- package/resources/customers/credits/ledger.js +28 -14
- package/resources/customers/credits/ledger.js.map +1 -1
- package/resources/customers/credits/ledger.mjs +28 -14
- package/resources/customers/credits/ledger.mjs.map +1 -1
- package/resources/customers/customers.d.ts +89 -6
- 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/dimensional-price-groups/dimensional-price-groups.d.ts +35 -1
- package/resources/dimensional-price-groups/dimensional-price-groups.d.ts.map +1 -1
- package/resources/dimensional-price-groups/dimensional-price-groups.js +26 -0
- package/resources/dimensional-price-groups/dimensional-price-groups.js.map +1 -1
- package/resources/dimensional-price-groups/dimensional-price-groups.mjs +26 -0
- package/resources/dimensional-price-groups/dimensional-price-groups.mjs.map +1 -1
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.ts +16 -0
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.ts.map +1 -1
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.js +16 -0
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.js.map +1 -1
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.mjs +16 -0
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.mjs.map +1 -1
- package/resources/events/backfills.d.ts +37 -0
- package/resources/events/backfills.d.ts.map +1 -1
- package/resources/events/backfills.js +29 -0
- package/resources/events/backfills.js.map +1 -1
- package/resources/events/backfills.mjs +29 -0
- package/resources/events/backfills.mjs.map +1 -1
- package/resources/events/events.d.ts +41 -33
- package/resources/events/events.d.ts.map +1 -1
- package/resources/events/events.js +39 -31
- package/resources/events/events.js.map +1 -1
- package/resources/events/events.mjs +39 -31
- package/resources/events/events.mjs.map +1 -1
- package/resources/events/volume.d.ts +7 -0
- package/resources/events/volume.d.ts.map +1 -1
- package/resources/events/volume.js +7 -0
- package/resources/events/volume.js.map +1 -1
- package/resources/events/volume.mjs +7 -0
- package/resources/events/volume.mjs.map +1 -1
- package/resources/invoice-line-items.d.ts +89 -1
- package/resources/invoice-line-items.d.ts.map +1 -1
- package/resources/invoice-line-items.js +12 -0
- package/resources/invoice-line-items.js.map +1 -1
- package/resources/invoice-line-items.mjs +12 -0
- package/resources/invoice-line-items.mjs.map +1 -1
- package/resources/invoices.d.ts +200 -12
- package/resources/invoices.d.ts.map +1 -1
- package/resources/invoices.js +64 -0
- package/resources/invoices.js.map +1 -1
- package/resources/invoices.mjs +64 -0
- package/resources/invoices.mjs.map +1 -1
- package/resources/items.d.ts +30 -0
- package/resources/items.d.ts.map +1 -1
- package/resources/items.js +22 -0
- package/resources/items.js.map +1 -1
- package/resources/items.mjs +22 -0
- package/resources/items.mjs.map +1 -1
- package/resources/licenses/external-licenses.d.ts +13 -1
- package/resources/licenses/external-licenses.d.ts.map +1 -1
- package/resources/licenses/external-licenses.js +12 -0
- package/resources/licenses/external-licenses.js.map +1 -1
- package/resources/licenses/external-licenses.mjs +12 -0
- package/resources/licenses/external-licenses.mjs.map +1 -1
- package/resources/licenses/licenses.d.ts +44 -0
- package/resources/licenses/licenses.d.ts.map +1 -1
- package/resources/licenses/licenses.js +44 -0
- package/resources/licenses/licenses.js.map +1 -1
- package/resources/licenses/licenses.mjs +44 -0
- package/resources/licenses/licenses.mjs.map +1 -1
- package/resources/licenses/usage.d.ts +17 -2
- package/resources/licenses/usage.d.ts.map +1 -1
- package/resources/licenses/usage.js +8 -0
- package/resources/licenses/usage.js.map +1 -1
- package/resources/licenses/usage.mjs +8 -0
- package/resources/licenses/usage.mjs.map +1 -1
- package/resources/metrics.d.ts +42 -5
- package/resources/metrics.d.ts.map +1 -1
- package/resources/metrics.js +27 -2
- package/resources/metrics.js.map +1 -1
- package/resources/metrics.mjs +27 -2
- package/resources/metrics.mjs.map +1 -1
- package/resources/plans/external-plan-id.d.ts +6 -2
- package/resources/plans/external-plan-id.d.ts.map +1 -1
- package/resources/plans/external-plan-id.js +2 -2
- package/resources/plans/external-plan-id.mjs +2 -2
- package/resources/plans/migrations.d.ts +42 -0
- package/resources/plans/migrations.d.ts.map +1 -1
- package/resources/plans/migrations.js.map +1 -1
- package/resources/plans/migrations.mjs.map +1 -1
- package/resources/plans/plans.d.ts +382 -3754
- package/resources/plans/plans.d.ts.map +1 -1
- package/resources/plans/plans.js +2 -2
- package/resources/plans/plans.js.map +1 -1
- package/resources/plans/plans.mjs +2 -2
- package/resources/plans/plans.mjs.map +1 -1
- package/resources/prices/external-price-id.d.ts +14 -0
- package/resources/prices/external-price-id.d.ts.map +1 -1
- package/resources/prices/external-price-id.js +14 -0
- package/resources/prices/external-price-id.js.map +1 -1
- package/resources/prices/external-price-id.mjs +14 -0
- package/resources/prices/external-price-id.mjs.map +1 -1
- package/resources/prices/prices.d.ts +1632 -393
- package/resources/prices/prices.d.ts.map +1 -1
- package/resources/prices/prices.js +46 -0
- package/resources/prices/prices.js.map +1 -1
- package/resources/prices/prices.mjs +46 -0
- package/resources/prices/prices.mjs.map +1 -1
- package/resources/shared.d.ts +922 -52
- package/resources/shared.d.ts.map +1 -1
- package/resources/shared.js.map +1 -1
- package/resources/shared.mjs.map +1 -1
- package/resources/subscription-changes.d.ts +72 -1
- package/resources/subscription-changes.d.ts.map +1 -1
- package/resources/subscription-changes.js.map +1 -1
- package/resources/subscription-changes.mjs.map +1 -1
- package/resources/subscriptions.d.ts +3075 -464
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/subscriptions.js +111 -0
- package/resources/subscriptions.js.map +1 -1
- package/resources/subscriptions.mjs +111 -0
- package/resources/subscriptions.mjs.map +1 -1
- package/src/core.ts +2 -2
- package/src/index.ts +12 -0
- package/src/resources/alerts.ts +161 -3
- package/src/resources/beta/beta.ts +828 -8988
- package/src/resources/beta/external-plan-id.ts +745 -8997
- package/src/resources/coupons/coupons.ts +29 -0
- package/src/resources/coupons/subscriptions.ts +10 -0
- package/src/resources/credit-blocks.ts +166 -7
- package/src/resources/credit-notes.ts +28 -0
- package/src/resources/customers/credits/credits.ts +157 -0
- package/src/resources/customers/credits/ledger.ts +34 -20
- package/src/resources/customers/customers.ts +99 -6
- package/src/resources/dimensional-price-groups/dimensional-price-groups.ts +35 -1
- package/src/resources/dimensional-price-groups/external-dimensional-price-group-id.ts +16 -0
- package/src/resources/events/backfills.ts +37 -0
- package/src/resources/events/events.ts +41 -33
- package/src/resources/events/volume.ts +7 -0
- package/src/resources/invoice-line-items.ts +104 -0
- package/src/resources/invoices.ts +215 -11
- package/src/resources/items.ts +30 -0
- package/src/resources/licenses/external-licenses.ts +13 -1
- package/src/resources/licenses/licenses.ts +44 -0
- package/src/resources/licenses/usage.ts +17 -2
- package/src/resources/metrics.ts +43 -5
- package/src/resources/plans/external-plan-id.ts +7 -2
- package/src/resources/plans/migrations.ts +42 -0
- package/src/resources/plans/plans.ts +456 -4482
- package/src/resources/prices/external-price-id.ts +14 -0
- package/src/resources/prices/prices.ts +1743 -264
- package/src/resources/shared.ts +1172 -50
- package/src/resources/subscription-changes.ts +88 -1
- package/src/resources/subscriptions.ts +4707 -1585
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -25,6 +25,18 @@ export class InvoiceLineItems extends APIResource {
|
|
|
25
25
|
* - If both `item_id` and `name` are provided: The item is looked up by ID for
|
|
26
26
|
* association, but the provided `name` is used for the line item (not the item's
|
|
27
27
|
* name).
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const invoiceLineItem =
|
|
32
|
+
* await client.invoiceLineItems.create({
|
|
33
|
+
* amount: '12.00',
|
|
34
|
+
* end_date: '2023-09-22',
|
|
35
|
+
* invoice_id: '4khy3nwzktxv7',
|
|
36
|
+
* quantity: 1,
|
|
37
|
+
* start_date: '2023-09-22',
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
28
40
|
*/
|
|
29
41
|
create(
|
|
30
42
|
body: InvoiceLineItemCreateParams,
|
|
@@ -55,6 +67,7 @@ export interface InvoiceLineItemCreateResponse {
|
|
|
55
67
|
| Shared.MonetaryUsageDiscountAdjustment
|
|
56
68
|
| Shared.MonetaryAmountDiscountAdjustment
|
|
57
69
|
| Shared.MonetaryPercentageDiscountAdjustment
|
|
70
|
+
| InvoiceLineItemCreateResponse.MonetaryTieredPercentageDiscountAdjustment
|
|
58
71
|
| Shared.MonetaryMinimumAdjustment
|
|
59
72
|
| Shared.MonetaryMaximumAdjustment
|
|
60
73
|
>;
|
|
@@ -144,6 +157,97 @@ export interface InvoiceLineItemCreateResponse {
|
|
|
144
157
|
usage_customer_ids: Array<string> | null;
|
|
145
158
|
}
|
|
146
159
|
|
|
160
|
+
export namespace InvoiceLineItemCreateResponse {
|
|
161
|
+
export interface MonetaryTieredPercentageDiscountAdjustment {
|
|
162
|
+
id: string;
|
|
163
|
+
|
|
164
|
+
adjustment_type: 'tiered_percentage_discount';
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The value applied by an adjustment.
|
|
168
|
+
*/
|
|
169
|
+
amount: string;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @deprecated The price IDs that this adjustment applies to.
|
|
173
|
+
*/
|
|
174
|
+
applies_to_price_ids: Array<string>;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The filters that determine which prices to apply this adjustment to.
|
|
178
|
+
*/
|
|
179
|
+
filters: Array<MonetaryTieredPercentageDiscountAdjustment.Filter>;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* True for adjustments that apply to an entire invoice, false for adjustments that
|
|
183
|
+
* apply to only one price.
|
|
184
|
+
*/
|
|
185
|
+
is_invoice_level: boolean;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* The reason for the adjustment.
|
|
189
|
+
*/
|
|
190
|
+
reason: string | null;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The adjustment id this adjustment replaces. This adjustment will take the place
|
|
194
|
+
* of the replaced adjustment in plan version migrations.
|
|
195
|
+
*/
|
|
196
|
+
replaces_adjustment_id: string | null;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* The ordered, contiguous bands of cumulative eligible spend, each discounted at
|
|
200
|
+
* its own percentage (progressive fill-a-tier), applied to the prices this
|
|
201
|
+
* adjustment covers in a given billing period.
|
|
202
|
+
*/
|
|
203
|
+
tiers: Array<MonetaryTieredPercentageDiscountAdjustment.Tier>;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export namespace MonetaryTieredPercentageDiscountAdjustment {
|
|
207
|
+
export interface Filter {
|
|
208
|
+
/**
|
|
209
|
+
* The property of the price to filter on.
|
|
210
|
+
*/
|
|
211
|
+
field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Should prices that match the filter be included or excluded.
|
|
215
|
+
*/
|
|
216
|
+
operator: 'includes' | 'excludes';
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* The IDs or values that match this filter.
|
|
220
|
+
*/
|
|
221
|
+
values: Array<string>;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* One band of a tiered percentage discount. Bounds are denominated in the
|
|
226
|
+
* discount's currency. `lower_bound` is the exclusive start of the band and
|
|
227
|
+
* `upper_bound` is the inclusive end; `upper_bound` is null only for the
|
|
228
|
+
* open-ended final tier.
|
|
229
|
+
*/
|
|
230
|
+
export interface Tier {
|
|
231
|
+
/**
|
|
232
|
+
* Exclusive lower bound of cumulative spend for this tier.
|
|
233
|
+
*/
|
|
234
|
+
lower_bound: number;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* The percentage (between 0 and 1) discounted from spend that falls within this
|
|
238
|
+
* tier.
|
|
239
|
+
*/
|
|
240
|
+
percentage: number;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Inclusive upper bound of cumulative spend for this tier; null for the final
|
|
244
|
+
* open-ended tier.
|
|
245
|
+
*/
|
|
246
|
+
upper_bound?: number | null;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
147
251
|
export interface InvoiceLineItemCreateParams {
|
|
148
252
|
/**
|
|
149
253
|
* The total amount in the invoice's currency to add to the line item.
|
|
@@ -16,6 +16,25 @@ import { Page, type PageParams } from '../pagination';
|
|
|
16
16
|
export class Invoices extends APIResource {
|
|
17
17
|
/**
|
|
18
18
|
* This endpoint is used to create a one-off invoice for a customer.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const invoice = await client.invoices.create({
|
|
23
|
+
* currency: 'USD',
|
|
24
|
+
* invoice_date: '2019-12-27T18:11:19.117Z',
|
|
25
|
+
* line_items: [
|
|
26
|
+
* {
|
|
27
|
+
* end_date: '2023-09-22',
|
|
28
|
+
* item_id: '4khy3nwzktxv7',
|
|
29
|
+
* model_type: 'unit',
|
|
30
|
+
* name: 'Line Item Name',
|
|
31
|
+
* quantity: 1,
|
|
32
|
+
* start_date: '2023-09-22',
|
|
33
|
+
* unit_config: { unit_amount: 'unit_amount' },
|
|
34
|
+
* },
|
|
35
|
+
* ],
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
19
38
|
*/
|
|
20
39
|
create(body: InvoiceCreateParams, options?: Core.RequestOptions): Core.APIPromise<Shared.Invoice> {
|
|
21
40
|
return this._client.post('/invoices', { body, ...options });
|
|
@@ -30,6 +49,11 @@ export class Invoices extends APIResource {
|
|
|
30
49
|
* `invoice_date`, and `auto_collection` can only be modified if the invoice is in
|
|
31
50
|
* a `draft` state. `invoice_date` can only be modified for non-subscription
|
|
32
51
|
* invoices.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const invoice = await client.invoices.update('invoice_id');
|
|
56
|
+
* ```
|
|
33
57
|
*/
|
|
34
58
|
update(
|
|
35
59
|
invoiceId: string,
|
|
@@ -53,6 +77,18 @@ export class Invoices extends APIResource {
|
|
|
53
77
|
* When fetching any `draft` invoices, this returns the last-computed invoice
|
|
54
78
|
* values for each draft invoice, which may not always be up-to-date since Orb
|
|
55
79
|
* regularly refreshes invoices asynchronously.
|
|
80
|
+
*
|
|
81
|
+
* If you don't need line item details, minimums, maximums, or discounts, prefer
|
|
82
|
+
* the [list invoices summary](/api-reference/invoice/list-invoices-summary)
|
|
83
|
+
* endpoint for better performance.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* // Automatically fetches more pages as needed.
|
|
88
|
+
* for await (const invoice of client.invoices.list()) {
|
|
89
|
+
* // ...
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
56
92
|
*/
|
|
57
93
|
list(
|
|
58
94
|
query?: InvoiceListParams,
|
|
@@ -75,6 +111,14 @@ export class Invoices extends APIResource {
|
|
|
75
111
|
* This endpoint only allows deletion of one-off line items (not subscription-based
|
|
76
112
|
* line items). The invoice must be in a draft status for this operation to
|
|
77
113
|
* succeed.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* await client.invoices.deleteLineItem(
|
|
118
|
+
* 'invoice_id',
|
|
119
|
+
* 'line_item_id',
|
|
120
|
+
* );
|
|
121
|
+
* ```
|
|
78
122
|
*/
|
|
79
123
|
deleteLineItem(
|
|
80
124
|
invoiceId: string,
|
|
@@ -90,6 +134,11 @@ export class Invoices extends APIResource {
|
|
|
90
134
|
/**
|
|
91
135
|
* This endpoint is used to fetch an [`Invoice`](/core-concepts#invoice) given an
|
|
92
136
|
* identifier.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* const invoice = await client.invoices.fetch('invoice_id');
|
|
141
|
+
* ```
|
|
93
142
|
*/
|
|
94
143
|
fetch(invoiceId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.Invoice> {
|
|
95
144
|
return this._client.get(`/invoices/${invoiceId}`, options);
|
|
@@ -99,6 +148,13 @@ export class Invoices extends APIResource {
|
|
|
99
148
|
* This endpoint can be used to fetch the upcoming
|
|
100
149
|
* [invoice](/core-concepts#invoice) for the current billing period given a
|
|
101
150
|
* subscription.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* const response = await client.invoices.fetchUpcoming({
|
|
155
|
+
* subscription_id: 'subscription_id',
|
|
156
|
+
* });
|
|
157
|
+
* ```
|
|
102
158
|
*/
|
|
103
159
|
fetchUpcoming(
|
|
104
160
|
query: InvoiceFetchUpcomingParams,
|
|
@@ -114,6 +170,11 @@ export class Invoices extends APIResource {
|
|
|
114
170
|
* possibly trigger side effects, some of which could be customer-visible (e.g.
|
|
115
171
|
* sending emails, auto-collecting payment, syncing the invoice to external
|
|
116
172
|
* providers, etc).
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* const invoice = await client.invoices.issue('invoice_id');
|
|
177
|
+
* ```
|
|
117
178
|
*/
|
|
118
179
|
issue(
|
|
119
180
|
invoiceId: string,
|
|
@@ -142,6 +203,13 @@ export class Invoices extends APIResource {
|
|
|
142
203
|
*
|
|
143
204
|
* This is a lighter-weight alternative to the issue invoice endpoint, returning an
|
|
144
205
|
* invoice summary without any line item details.
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```ts
|
|
209
|
+
* const response = await client.invoices.issueSummary(
|
|
210
|
+
* 'invoice_id',
|
|
211
|
+
* );
|
|
212
|
+
* ```
|
|
145
213
|
*/
|
|
146
214
|
issueSummary(
|
|
147
215
|
invoiceId: string,
|
|
@@ -180,6 +248,14 @@ export class Invoices extends APIResource {
|
|
|
180
248
|
* When fetching any `draft` invoices, this returns the last-computed invoice
|
|
181
249
|
* values for each draft invoice, which may not always be up-to-date since Orb
|
|
182
250
|
* regularly refreshes invoices asynchronously.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```ts
|
|
254
|
+
* // Automatically fetches more pages as needed.
|
|
255
|
+
* for await (const invoiceListSummaryResponse of client.invoices.listSummary()) {
|
|
256
|
+
* // ...
|
|
257
|
+
* }
|
|
258
|
+
* ```
|
|
183
259
|
*/
|
|
184
260
|
listSummary(
|
|
185
261
|
query?: InvoiceListSummaryParams,
|
|
@@ -204,6 +280,14 @@ export class Invoices extends APIResource {
|
|
|
204
280
|
/**
|
|
205
281
|
* This endpoint allows an invoice's status to be set to the `paid` status. This
|
|
206
282
|
* can only be done to invoices that are in the `issued` or `synced` status.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* const invoice = await client.invoices.markPaid(
|
|
287
|
+
* 'invoice_id',
|
|
288
|
+
* { payment_received_date: '2023-09-22' },
|
|
289
|
+
* );
|
|
290
|
+
* ```
|
|
207
291
|
*/
|
|
208
292
|
markPaid(
|
|
209
293
|
invoiceId: string,
|
|
@@ -218,6 +302,13 @@ export class Invoices extends APIResource {
|
|
|
218
302
|
* customer's default payment method. Optionally, a shared payment token (SPT) can
|
|
219
303
|
* be provided to pay using agent-granted credentials instead. This action can only
|
|
220
304
|
* be taken on invoices with status "issued".
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```ts
|
|
308
|
+
* const invoice = await client.invoices.pay('invoice_id', {
|
|
309
|
+
* shared_payment_token_id: 'shared_payment_token_id',
|
|
310
|
+
* });
|
|
311
|
+
* ```
|
|
221
312
|
*/
|
|
222
313
|
pay(
|
|
223
314
|
invoiceId: string,
|
|
@@ -239,6 +330,11 @@ export class Invoices extends APIResource {
|
|
|
239
330
|
* If the invoice was used to purchase a credit block, but the invoice is not yet
|
|
240
331
|
* paid, the credit block will be voided. If the invoice was created due to a
|
|
241
332
|
* top-up, the top-up will be disabled.
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* ```ts
|
|
336
|
+
* const invoice = await client.invoices.void('invoice_id');
|
|
337
|
+
* ```
|
|
242
338
|
*/
|
|
243
339
|
void(invoiceId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.Invoice> {
|
|
244
340
|
return this._client.post(`/invoices/${invoiceId}/void`, options);
|
|
@@ -337,11 +433,13 @@ export interface InvoiceFetchUpcomingResponse {
|
|
|
337
433
|
* | Estonia | `eu_vat` | European VAT Number |
|
|
338
434
|
* | Ethiopia | `et_tin` | Ethiopia Tax Identification Number |
|
|
339
435
|
* | European Union | `eu_oss_vat` | European One Stop Shop VAT Number for non-Union scheme |
|
|
436
|
+
* | Faroe Islands | `fo_vat` | Faroe Islands VAT Number |
|
|
340
437
|
* | Finland | `eu_vat` | European VAT Number |
|
|
341
438
|
* | France | `eu_vat` | European VAT Number |
|
|
342
439
|
* | Georgia | `ge_vat` | Georgian VAT |
|
|
343
440
|
* | Germany | `de_stn` | German Tax Number (Steuernummer) |
|
|
344
441
|
* | Germany | `eu_vat` | European VAT Number |
|
|
442
|
+
* | Gibraltar | `gi_tin` | Gibraltar Tax Identification Number |
|
|
345
443
|
* | Greece | `eu_vat` | European VAT Number |
|
|
346
444
|
* | Guinea | `gn_nif` | Guinea Tax Identification Number (Número de Identificação Fiscal) |
|
|
347
445
|
* | Hong Kong | `hk_br` | Hong Kong BR Number |
|
|
@@ -353,6 +451,7 @@ export interface InvoiceFetchUpcomingResponse {
|
|
|
353
451
|
* | Ireland | `eu_vat` | European VAT Number |
|
|
354
452
|
* | Israel | `il_vat` | Israel VAT |
|
|
355
453
|
* | Italy | `eu_vat` | European VAT Number |
|
|
454
|
+
* | Italy | `it_cf` | Italian Codice Fiscale Number |
|
|
356
455
|
* | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) |
|
|
357
456
|
* | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) |
|
|
358
457
|
* | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) |
|
|
@@ -383,6 +482,7 @@ export interface InvoiceFetchUpcomingResponse {
|
|
|
383
482
|
* | Norway | `no_vat` | Norwegian VAT Number |
|
|
384
483
|
* | Norway | `no_voec` | Norwegian VAT on e-commerce Number |
|
|
385
484
|
* | Oman | `om_vat` | Omani VAT Number |
|
|
485
|
+
* | Paraguay | `py_ruc` | Paraguayan RUC Number |
|
|
386
486
|
* | Peru | `pe_ruc` | Peruvian RUC Number |
|
|
387
487
|
* | Philippines | `ph_tin` | Philippines Tax Identification Number |
|
|
388
488
|
* | Poland | `eu_vat` | European VAT Number |
|
|
@@ -404,6 +504,7 @@ export interface InvoiceFetchUpcomingResponse {
|
|
|
404
504
|
* | South Korea | `kr_brn` | Korean BRN |
|
|
405
505
|
* | Spain | `es_cif` | Spanish NIF Number (previously Spanish CIF Number) |
|
|
406
506
|
* | Spain | `eu_vat` | European VAT Number |
|
|
507
|
+
* | Sri Lanka | `lk_vat` | Sri Lanka VAT Number |
|
|
407
508
|
* | Suriname | `sr_fin` | Suriname FIN Number |
|
|
408
509
|
* | Sweden | `eu_vat` | European VAT Number |
|
|
409
510
|
* | Switzerland | `ch_uid` | Switzerland UID Number |
|
|
@@ -451,8 +552,8 @@ export interface InvoiceFetchUpcomingResponse {
|
|
|
451
552
|
eligible_to_issue_at: string | null;
|
|
452
553
|
|
|
453
554
|
/**
|
|
454
|
-
* A URL for the customer-facing invoice portal. This URL expires
|
|
455
|
-
*
|
|
555
|
+
* A URL for the customer-facing invoice portal. This URL expires 60 days after the
|
|
556
|
+
* link is generated, or 30 days after the invoice's due date — whichever is later.
|
|
456
557
|
*/
|
|
457
558
|
hosted_invoice_url: string | null;
|
|
458
559
|
|
|
@@ -705,6 +806,7 @@ export namespace InvoiceFetchUpcomingResponse {
|
|
|
705
806
|
| Shared.MonetaryUsageDiscountAdjustment
|
|
706
807
|
| Shared.MonetaryAmountDiscountAdjustment
|
|
707
808
|
| Shared.MonetaryPercentageDiscountAdjustment
|
|
809
|
+
| LineItem.MonetaryTieredPercentageDiscountAdjustment
|
|
708
810
|
| Shared.MonetaryMinimumAdjustment
|
|
709
811
|
| Shared.MonetaryMaximumAdjustment
|
|
710
812
|
>;
|
|
@@ -794,6 +896,97 @@ export namespace InvoiceFetchUpcomingResponse {
|
|
|
794
896
|
usage_customer_ids: Array<string> | null;
|
|
795
897
|
}
|
|
796
898
|
|
|
899
|
+
export namespace LineItem {
|
|
900
|
+
export interface MonetaryTieredPercentageDiscountAdjustment {
|
|
901
|
+
id: string;
|
|
902
|
+
|
|
903
|
+
adjustment_type: 'tiered_percentage_discount';
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* The value applied by an adjustment.
|
|
907
|
+
*/
|
|
908
|
+
amount: string;
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* @deprecated The price IDs that this adjustment applies to.
|
|
912
|
+
*/
|
|
913
|
+
applies_to_price_ids: Array<string>;
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* The filters that determine which prices to apply this adjustment to.
|
|
917
|
+
*/
|
|
918
|
+
filters: Array<MonetaryTieredPercentageDiscountAdjustment.Filter>;
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* True for adjustments that apply to an entire invoice, false for adjustments that
|
|
922
|
+
* apply to only one price.
|
|
923
|
+
*/
|
|
924
|
+
is_invoice_level: boolean;
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* The reason for the adjustment.
|
|
928
|
+
*/
|
|
929
|
+
reason: string | null;
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* The adjustment id this adjustment replaces. This adjustment will take the place
|
|
933
|
+
* of the replaced adjustment in plan version migrations.
|
|
934
|
+
*/
|
|
935
|
+
replaces_adjustment_id: string | null;
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* The ordered, contiguous bands of cumulative eligible spend, each discounted at
|
|
939
|
+
* its own percentage (progressive fill-a-tier), applied to the prices this
|
|
940
|
+
* adjustment covers in a given billing period.
|
|
941
|
+
*/
|
|
942
|
+
tiers: Array<MonetaryTieredPercentageDiscountAdjustment.Tier>;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
export namespace MonetaryTieredPercentageDiscountAdjustment {
|
|
946
|
+
export interface Filter {
|
|
947
|
+
/**
|
|
948
|
+
* The property of the price to filter on.
|
|
949
|
+
*/
|
|
950
|
+
field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
|
|
951
|
+
|
|
952
|
+
/**
|
|
953
|
+
* Should prices that match the filter be included or excluded.
|
|
954
|
+
*/
|
|
955
|
+
operator: 'includes' | 'excludes';
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* The IDs or values that match this filter.
|
|
959
|
+
*/
|
|
960
|
+
values: Array<string>;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* One band of a tiered percentage discount. Bounds are denominated in the
|
|
965
|
+
* discount's currency. `lower_bound` is the exclusive start of the band and
|
|
966
|
+
* `upper_bound` is the inclusive end; `upper_bound` is null only for the
|
|
967
|
+
* open-ended final tier.
|
|
968
|
+
*/
|
|
969
|
+
export interface Tier {
|
|
970
|
+
/**
|
|
971
|
+
* Exclusive lower bound of cumulative spend for this tier.
|
|
972
|
+
*/
|
|
973
|
+
lower_bound: number;
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* The percentage (between 0 and 1) discounted from spend that falls within this
|
|
977
|
+
* tier.
|
|
978
|
+
*/
|
|
979
|
+
percentage: number;
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Inclusive upper bound of cumulative spend for this tier; null for the final
|
|
983
|
+
* open-ended tier.
|
|
984
|
+
*/
|
|
985
|
+
upper_bound?: number | null;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
|
|
797
990
|
export interface PaymentAttempt {
|
|
798
991
|
/**
|
|
799
992
|
* The ID of the payment attempt.
|
|
@@ -813,7 +1006,7 @@ export namespace InvoiceFetchUpcomingResponse {
|
|
|
813
1006
|
/**
|
|
814
1007
|
* The payment provider that attempted to collect the payment.
|
|
815
1008
|
*/
|
|
816
|
-
payment_provider: 'stripe' | null;
|
|
1009
|
+
payment_provider: 'stripe' | 'adyen' | null;
|
|
817
1010
|
|
|
818
1011
|
/**
|
|
819
1012
|
* The ID of the payment attempt in the payment provider.
|
|
@@ -926,11 +1119,13 @@ export interface InvoiceIssueSummaryResponse {
|
|
|
926
1119
|
* | Estonia | `eu_vat` | European VAT Number |
|
|
927
1120
|
* | Ethiopia | `et_tin` | Ethiopia Tax Identification Number |
|
|
928
1121
|
* | European Union | `eu_oss_vat` | European One Stop Shop VAT Number for non-Union scheme |
|
|
1122
|
+
* | Faroe Islands | `fo_vat` | Faroe Islands VAT Number |
|
|
929
1123
|
* | Finland | `eu_vat` | European VAT Number |
|
|
930
1124
|
* | France | `eu_vat` | European VAT Number |
|
|
931
1125
|
* | Georgia | `ge_vat` | Georgian VAT |
|
|
932
1126
|
* | Germany | `de_stn` | German Tax Number (Steuernummer) |
|
|
933
1127
|
* | Germany | `eu_vat` | European VAT Number |
|
|
1128
|
+
* | Gibraltar | `gi_tin` | Gibraltar Tax Identification Number |
|
|
934
1129
|
* | Greece | `eu_vat` | European VAT Number |
|
|
935
1130
|
* | Guinea | `gn_nif` | Guinea Tax Identification Number (Número de Identificação Fiscal) |
|
|
936
1131
|
* | Hong Kong | `hk_br` | Hong Kong BR Number |
|
|
@@ -942,6 +1137,7 @@ export interface InvoiceIssueSummaryResponse {
|
|
|
942
1137
|
* | Ireland | `eu_vat` | European VAT Number |
|
|
943
1138
|
* | Israel | `il_vat` | Israel VAT |
|
|
944
1139
|
* | Italy | `eu_vat` | European VAT Number |
|
|
1140
|
+
* | Italy | `it_cf` | Italian Codice Fiscale Number |
|
|
945
1141
|
* | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) |
|
|
946
1142
|
* | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) |
|
|
947
1143
|
* | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) |
|
|
@@ -972,6 +1168,7 @@ export interface InvoiceIssueSummaryResponse {
|
|
|
972
1168
|
* | Norway | `no_vat` | Norwegian VAT Number |
|
|
973
1169
|
* | Norway | `no_voec` | Norwegian VAT on e-commerce Number |
|
|
974
1170
|
* | Oman | `om_vat` | Omani VAT Number |
|
|
1171
|
+
* | Paraguay | `py_ruc` | Paraguayan RUC Number |
|
|
975
1172
|
* | Peru | `pe_ruc` | Peruvian RUC Number |
|
|
976
1173
|
* | Philippines | `ph_tin` | Philippines Tax Identification Number |
|
|
977
1174
|
* | Poland | `eu_vat` | European VAT Number |
|
|
@@ -993,6 +1190,7 @@ export interface InvoiceIssueSummaryResponse {
|
|
|
993
1190
|
* | South Korea | `kr_brn` | Korean BRN |
|
|
994
1191
|
* | Spain | `es_cif` | Spanish NIF Number (previously Spanish CIF Number) |
|
|
995
1192
|
* | Spain | `eu_vat` | European VAT Number |
|
|
1193
|
+
* | Sri Lanka | `lk_vat` | Sri Lanka VAT Number |
|
|
996
1194
|
* | Suriname | `sr_fin` | Suriname FIN Number |
|
|
997
1195
|
* | Sweden | `eu_vat` | European VAT Number |
|
|
998
1196
|
* | Switzerland | `ch_uid` | Switzerland UID Number |
|
|
@@ -1031,8 +1229,8 @@ export interface InvoiceIssueSummaryResponse {
|
|
|
1031
1229
|
eligible_to_issue_at: string | null;
|
|
1032
1230
|
|
|
1033
1231
|
/**
|
|
1034
|
-
* A URL for the customer-facing invoice portal. This URL expires
|
|
1035
|
-
*
|
|
1232
|
+
* A URL for the customer-facing invoice portal. This URL expires 60 days after the
|
|
1233
|
+
* link is generated, or 30 days after the invoice's due date — whichever is later.
|
|
1036
1234
|
*/
|
|
1037
1235
|
hosted_invoice_url: string | null;
|
|
1038
1236
|
|
|
@@ -1265,7 +1463,7 @@ export namespace InvoiceIssueSummaryResponse {
|
|
|
1265
1463
|
/**
|
|
1266
1464
|
* The payment provider that attempted to collect the payment.
|
|
1267
1465
|
*/
|
|
1268
|
-
payment_provider: 'stripe' | null;
|
|
1466
|
+
payment_provider: 'stripe' | 'adyen' | null;
|
|
1269
1467
|
|
|
1270
1468
|
/**
|
|
1271
1469
|
* The ID of the payment attempt in the payment provider.
|
|
@@ -1378,11 +1576,13 @@ export interface InvoiceListSummaryResponse {
|
|
|
1378
1576
|
* | Estonia | `eu_vat` | European VAT Number |
|
|
1379
1577
|
* | Ethiopia | `et_tin` | Ethiopia Tax Identification Number |
|
|
1380
1578
|
* | European Union | `eu_oss_vat` | European One Stop Shop VAT Number for non-Union scheme |
|
|
1579
|
+
* | Faroe Islands | `fo_vat` | Faroe Islands VAT Number |
|
|
1381
1580
|
* | Finland | `eu_vat` | European VAT Number |
|
|
1382
1581
|
* | France | `eu_vat` | European VAT Number |
|
|
1383
1582
|
* | Georgia | `ge_vat` | Georgian VAT |
|
|
1384
1583
|
* | Germany | `de_stn` | German Tax Number (Steuernummer) |
|
|
1385
1584
|
* | Germany | `eu_vat` | European VAT Number |
|
|
1585
|
+
* | Gibraltar | `gi_tin` | Gibraltar Tax Identification Number |
|
|
1386
1586
|
* | Greece | `eu_vat` | European VAT Number |
|
|
1387
1587
|
* | Guinea | `gn_nif` | Guinea Tax Identification Number (Número de Identificação Fiscal) |
|
|
1388
1588
|
* | Hong Kong | `hk_br` | Hong Kong BR Number |
|
|
@@ -1394,6 +1594,7 @@ export interface InvoiceListSummaryResponse {
|
|
|
1394
1594
|
* | Ireland | `eu_vat` | European VAT Number |
|
|
1395
1595
|
* | Israel | `il_vat` | Israel VAT |
|
|
1396
1596
|
* | Italy | `eu_vat` | European VAT Number |
|
|
1597
|
+
* | Italy | `it_cf` | Italian Codice Fiscale Number |
|
|
1397
1598
|
* | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) |
|
|
1398
1599
|
* | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) |
|
|
1399
1600
|
* | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) |
|
|
@@ -1424,6 +1625,7 @@ export interface InvoiceListSummaryResponse {
|
|
|
1424
1625
|
* | Norway | `no_vat` | Norwegian VAT Number |
|
|
1425
1626
|
* | Norway | `no_voec` | Norwegian VAT on e-commerce Number |
|
|
1426
1627
|
* | Oman | `om_vat` | Omani VAT Number |
|
|
1628
|
+
* | Paraguay | `py_ruc` | Paraguayan RUC Number |
|
|
1427
1629
|
* | Peru | `pe_ruc` | Peruvian RUC Number |
|
|
1428
1630
|
* | Philippines | `ph_tin` | Philippines Tax Identification Number |
|
|
1429
1631
|
* | Poland | `eu_vat` | European VAT Number |
|
|
@@ -1445,6 +1647,7 @@ export interface InvoiceListSummaryResponse {
|
|
|
1445
1647
|
* | South Korea | `kr_brn` | Korean BRN |
|
|
1446
1648
|
* | Spain | `es_cif` | Spanish NIF Number (previously Spanish CIF Number) |
|
|
1447
1649
|
* | Spain | `eu_vat` | European VAT Number |
|
|
1650
|
+
* | Sri Lanka | `lk_vat` | Sri Lanka VAT Number |
|
|
1448
1651
|
* | Suriname | `sr_fin` | Suriname FIN Number |
|
|
1449
1652
|
* | Sweden | `eu_vat` | European VAT Number |
|
|
1450
1653
|
* | Switzerland | `ch_uid` | Switzerland UID Number |
|
|
@@ -1483,8 +1686,8 @@ export interface InvoiceListSummaryResponse {
|
|
|
1483
1686
|
eligible_to_issue_at: string | null;
|
|
1484
1687
|
|
|
1485
1688
|
/**
|
|
1486
|
-
* A URL for the customer-facing invoice portal. This URL expires
|
|
1487
|
-
*
|
|
1689
|
+
* A URL for the customer-facing invoice portal. This URL expires 60 days after the
|
|
1690
|
+
* link is generated, or 30 days after the invoice's due date — whichever is later.
|
|
1488
1691
|
*/
|
|
1489
1692
|
hosted_invoice_url: string | null;
|
|
1490
1693
|
|
|
@@ -1717,7 +1920,7 @@ export namespace InvoiceListSummaryResponse {
|
|
|
1717
1920
|
/**
|
|
1718
1921
|
* The payment provider that attempted to collect the payment.
|
|
1719
1922
|
*/
|
|
1720
|
-
payment_provider: 'stripe' | null;
|
|
1923
|
+
payment_provider: 'stripe' | 'adyen' | null;
|
|
1721
1924
|
|
|
1722
1925
|
/**
|
|
1723
1926
|
* The ID of the payment attempt in the payment provider.
|
|
@@ -1745,8 +1948,9 @@ export interface InvoiceCreateParams {
|
|
|
1745
1948
|
currency: string;
|
|
1746
1949
|
|
|
1747
1950
|
/**
|
|
1748
|
-
*
|
|
1749
|
-
* set
|
|
1951
|
+
* An ISO 8601 date or timestamp, interpreted in the customer's timezone. Must be
|
|
1952
|
+
* in the past. If a date is set without a time, `invoice_date` is set to midnight
|
|
1953
|
+
* on the chosen date in the customer's timezone.
|
|
1750
1954
|
*/
|
|
1751
1955
|
invoice_date: string;
|
|
1752
1956
|
|
package/src/resources/items.ts
CHANGED
|
@@ -12,6 +12,13 @@ import { Page, type PageParams } from '../pagination';
|
|
|
12
12
|
export class Items extends APIResource {
|
|
13
13
|
/**
|
|
14
14
|
* This endpoint is used to create an [Item](/core-concepts#item).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const item = await client.items.create({
|
|
19
|
+
* name: 'API requests',
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
15
22
|
*/
|
|
16
23
|
create(body: ItemCreateParams, options?: Core.RequestOptions): Core.APIPromise<Item> {
|
|
17
24
|
return this._client.post('/items', { body, ...options });
|
|
@@ -19,6 +26,11 @@ export class Items extends APIResource {
|
|
|
19
26
|
|
|
20
27
|
/**
|
|
21
28
|
* This endpoint can be used to update properties on the Item.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const item = await client.items.update('item_id');
|
|
33
|
+
* ```
|
|
22
34
|
*/
|
|
23
35
|
update(itemId: string, body: ItemUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Item> {
|
|
24
36
|
return this._client.put(`/items/${itemId}`, { body, ...options });
|
|
@@ -27,6 +39,14 @@ export class Items extends APIResource {
|
|
|
27
39
|
/**
|
|
28
40
|
* This endpoint returns a list of all Items, ordered in descending order by
|
|
29
41
|
* creation time.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* // Automatically fetches more pages as needed.
|
|
46
|
+
* for await (const item of client.items.list()) {
|
|
47
|
+
* // ...
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
30
50
|
*/
|
|
31
51
|
list(query?: ItemListParams, options?: Core.RequestOptions): Core.PagePromise<ItemsPage, Item>;
|
|
32
52
|
list(options?: Core.RequestOptions): Core.PagePromise<ItemsPage, Item>;
|
|
@@ -42,6 +62,11 @@ export class Items extends APIResource {
|
|
|
42
62
|
|
|
43
63
|
/**
|
|
44
64
|
* Archive item
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const item = await client.items.archive('item_id');
|
|
69
|
+
* ```
|
|
45
70
|
*/
|
|
46
71
|
archive(itemId: string, options?: Core.RequestOptions): Core.APIPromise<Item> {
|
|
47
72
|
return this._client.post(`/items/${itemId}/archive`, options);
|
|
@@ -49,6 +74,11 @@ export class Items extends APIResource {
|
|
|
49
74
|
|
|
50
75
|
/**
|
|
51
76
|
* This endpoint returns an item identified by its item_id.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const item = await client.items.fetch('item_id');
|
|
81
|
+
* ```
|
|
52
82
|
*/
|
|
53
83
|
fetch(itemId: string, options?: Core.RequestOptions): Core.APIPromise<Item> {
|
|
54
84
|
return this._client.get(`/items/${itemId}`, options);
|