forked from Modern-Treasury/modern-treasury-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathline-items.ts
More file actions
176 lines (153 loc) · 4.91 KB
/
Copy pathline-items.ts
File metadata and controls
176 lines (153 loc) · 4.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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
164
165
166
167
168
169
170
171
172
173
174
175
176
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as Core from '../core';
import * as LineItemsAPI from './line-items';
import { Page, type PageParams } from '../pagination';
export class LineItems extends APIResource {
/**
* Get a single line item
*/
retrieve(
itemizableType: 'expected_payments' | 'payment_orders',
itemizableId: string,
id: string,
options?: Core.RequestOptions,
): Core.APIPromise<LineItem> {
return this._client.get(`/api/${itemizableType}/${itemizableId}/line_items/${id}`, options);
}
/**
* update line item
*/
update(
itemizableType: 'expected_payments' | 'payment_orders',
itemizableId: string,
id: string,
body?: LineItemUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<LineItem>;
update(
itemizableType: 'expected_payments' | 'payment_orders',
itemizableId: string,
id: string,
options?: Core.RequestOptions,
): Core.APIPromise<LineItem>;
update(
itemizableType: 'expected_payments' | 'payment_orders',
itemizableId: string,
id: string,
body: LineItemUpdateParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<LineItem> {
if (isRequestOptions(body)) {
return this.update(itemizableType, itemizableId, id, {}, body);
}
return this._client.patch(`/api/${itemizableType}/${itemizableId}/line_items/${id}`, {
body,
...options,
});
}
/**
* Get a list of line items
*/
list(
itemizableType: 'expected_payments' | 'payment_orders',
itemizableId: string,
query?: LineItemListParams,
options?: Core.RequestOptions,
): Core.PagePromise<LineItemsPage, LineItem>;
list(
itemizableType: 'expected_payments' | 'payment_orders',
itemizableId: string,
options?: Core.RequestOptions,
): Core.PagePromise<LineItemsPage, LineItem>;
list(
itemizableType: 'expected_payments' | 'payment_orders',
itemizableId: string,
query: LineItemListParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.PagePromise<LineItemsPage, LineItem> {
if (isRequestOptions(query)) {
return this.list(itemizableType, itemizableId, {}, query);
}
return this._client.getAPIList(`/api/${itemizableType}/${itemizableId}/line_items`, LineItemsPage, {
query,
...options,
});
}
}
export class LineItemsPage extends Page<LineItem> {}
export interface LineItem {
id: string;
accounting: LineItem.Accounting;
/**
* The ID of one of your accounting categories. Note that these will only be
* accessible if your accounting system has been connected.
*/
accounting_category_id: string | null;
/**
* The ID of one of the class objects in your accounting system. Class objects
* track segments of your business independent of client or project. Note that
* these will only be accessible if your accounting system has been connected.
*/
accounting_ledger_class_id: string | null;
/**
* Value in specified currency's smallest unit. e.g. $10 would be represented
* as 1000.
*/
amount: number;
created_at: string;
/**
* A free-form description of the line item.
*/
description: string | null;
/**
* The ID of the payment order or expected payment.
*/
itemizable_id: string;
/**
* One of `payment_orders` or `expected_payments`.
*/
itemizable_type: 'ExpectedPayment' | 'PaymentOrder';
/**
* This field will be true if this object exists in the live environment or false
* if it exists in the test environment.
*/
live_mode: boolean;
/**
* Additional data represented as key-value pairs. Both the key and value must be
* strings.
*/
metadata: Record<string, string>;
object: string;
updated_at: string;
}
export namespace LineItem {
export interface Accounting {
/**
* The ID of one of your accounting categories. Note that these will only be
* accessible if your accounting system has been connected.
*/
account_id?: string | null;
/**
* The ID of one of the class objects in your accounting system. Class objects
* track segments of your business independent of client or project. Note that
* these will only be accessible if your accounting system has been connected.
*/
class_id?: string | null;
}
}
export interface LineItemUpdateParams {
/**
* Additional data represented as key-value pairs. Both the key and value must be
* strings.
*/
metadata?: Record<string, string>;
}
export interface LineItemListParams extends PageParams {}
export namespace LineItems {
export import LineItem = LineItemsAPI.LineItem;
export import LineItemsPage = LineItemsAPI.LineItemsPage;
export import LineItemUpdateParams = LineItemsAPI.LineItemUpdateParams;
export import LineItemListParams = LineItemsAPI.LineItemListParams;
}