Skip to content

Commit e8f7516

Browse files
feat(api): api update
1 parent fa11e86 commit e8f7516

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 118
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-b070c1d97a6e3b400f43d2bce36c22ed89d432345b26374728c55dd0a20f0afa.yml
3-
openapi_spec_hash: dba4ff52c381cda6159fc56d8b77eb32
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-15e42bc01739abea4a925894a1a7de447de40b003a3433461952e8e06919588b.yml
3+
openapi_spec_hash: 8a0bc5b6ab417f7256cbf83d70c459a3
44
config_hash: 1f73a949b649ecfe6ec68ba1bb459dc2

src/resources/invoice-line-items.ts

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ export class InvoiceLineItems extends APIResource {
88
/**
99
* This creates a one-off fixed fee invoice line item on an Invoice. This can only
1010
* be done for invoices that are in a `draft` status.
11+
*
12+
* The behavior depends on which parameters are provided:
13+
*
14+
* - If `item_id` is provided without `name`: The item is looked up by ID, and the
15+
* item's name is used for the line item.
16+
* - If `name` is provided without `item_id`: An item with the given name is
17+
* searched for in the account. If found, that item is used. If not found, a new
18+
* item is created with that name. The new item's name is used for the line item.
19+
* - If both `item_id` and `name` are provided: The item is looked up by ID for
20+
* association, but the provided `name` is used for the line item (not the item's
21+
* name).
1122
*/
1223
create(
1324
body: InvoiceLineItemCreateParams,
@@ -168,12 +179,6 @@ export interface InvoiceLineItemCreateParams {
168179
*/
169180
invoice_id: string;
170181

171-
/**
172-
* The item name associated with this line item. If an item with the same name
173-
* exists in Orb, that item will be associated with the line item.
174-
*/
175-
name: string;
176-
177182
/**
178183
* The number of units on the line item
179184
*/
@@ -183,6 +188,24 @@ export interface InvoiceLineItemCreateParams {
183188
* A date string to specify the line item's start date in the customer's timezone.
184189
*/
185190
start_date: string;
191+
192+
/**
193+
* The id of the item to associate with this line item. If provided without `name`,
194+
* the item's name will be used for the price/line item. If provided with `name`,
195+
* the item will be associated but `name` will be used for the line item. At least
196+
* one of `name` or `item_id` must be provided.
197+
*/
198+
item_id?: string | null;
199+
200+
/**
201+
* The name to use for the line item. If `item_id` is not provided, Orb will search
202+
* for an item with this name. If found, that item will be associated with the line
203+
* item. If not found, a new item will be created with this name. If `item_id` is
204+
* provided, this name will be used for the line item, but the item association
205+
* will be based on `item_id`. At least one of `name` or `item_id` must be
206+
* provided.
207+
*/
208+
name?: string | null;
186209
}
187210

188211
export declare namespace InvoiceLineItems {

tests/api-resources/invoice-line-items.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ describe('resource invoiceLineItems', () => {
1414
amount: '12.00',
1515
end_date: '2023-09-22',
1616
invoice_id: '4khy3nwzktxv7',
17-
name: 'Item Name',
1817
quantity: 1,
1918
start_date: '2023-09-22',
2019
});
@@ -32,9 +31,10 @@ describe('resource invoiceLineItems', () => {
3231
amount: '12.00',
3332
end_date: '2023-09-22',
3433
invoice_id: '4khy3nwzktxv7',
35-
name: 'Item Name',
3634
quantity: 1,
3735
start_date: '2023-09-22',
36+
item_id: '4khy3nwzktxv7',
37+
name: 'Item Name',
3838
});
3939
});
4040
});

0 commit comments

Comments
 (0)