orb-billing 4.74.0 → 5.1.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.
Files changed (166) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/core.d.ts +7 -4
  3. package/core.d.ts.map +1 -1
  4. package/core.js +16 -9
  5. package/core.js.map +1 -1
  6. package/core.mjs +16 -9
  7. package/core.mjs.map +1 -1
  8. package/index.d.mts +151 -14
  9. package/index.d.ts +151 -14
  10. package/index.d.ts.map +1 -1
  11. package/index.js +6 -5
  12. package/index.js.map +1 -1
  13. package/index.mjs +9 -8
  14. package/index.mjs.map +1 -1
  15. package/package.json +1 -1
  16. package/resource.d.ts +1 -1
  17. package/resource.d.ts.map +1 -1
  18. package/resource.js.map +1 -1
  19. package/resource.mjs.map +1 -1
  20. package/resources/alerts.d.ts +20 -88
  21. package/resources/alerts.d.ts.map +1 -1
  22. package/resources/alerts.js.map +1 -1
  23. package/resources/alerts.mjs.map +1 -1
  24. package/resources/beta/beta.d.ts +9 -7313
  25. package/resources/beta/beta.d.ts.map +1 -1
  26. package/resources/beta/beta.js.map +1 -1
  27. package/resources/beta/beta.mjs.map +1 -1
  28. package/resources/beta/external-plan-id.d.ts +7 -7074
  29. package/resources/beta/external-plan-id.d.ts.map +1 -1
  30. package/resources/beta/external-plan-id.js.map +1 -1
  31. package/resources/beta/external-plan-id.mjs.map +1 -1
  32. package/resources/credit-notes.d.ts +64 -164
  33. package/resources/credit-notes.d.ts.map +1 -1
  34. package/resources/credit-notes.js +28 -6
  35. package/resources/credit-notes.js.map +1 -1
  36. package/resources/credit-notes.mjs +27 -4
  37. package/resources/credit-notes.mjs.map +1 -1
  38. package/resources/customers/balance-transactions.d.ts +5 -32
  39. package/resources/customers/balance-transactions.d.ts.map +1 -1
  40. package/resources/customers/balance-transactions.js.map +1 -1
  41. package/resources/customers/balance-transactions.mjs.map +1 -1
  42. package/resources/customers/costs.d.ts +19 -97
  43. package/resources/customers/costs.d.ts.map +1 -1
  44. package/resources/customers/credits/credits.d.ts +4 -4
  45. package/resources/customers/credits/credits.d.ts.map +1 -1
  46. package/resources/customers/credits/credits.js.map +1 -1
  47. package/resources/customers/credits/credits.mjs.map +1 -1
  48. package/resources/customers/credits/index.d.ts +2 -2
  49. package/resources/customers/credits/index.d.ts.map +1 -1
  50. package/resources/customers/credits/index.js.map +1 -1
  51. package/resources/customers/credits/index.mjs.map +1 -1
  52. package/resources/customers/credits/ledger.d.ts +239 -984
  53. package/resources/customers/credits/ledger.d.ts.map +1 -1
  54. package/resources/customers/credits/ledger.js.map +1 -1
  55. package/resources/customers/credits/ledger.mjs.map +1 -1
  56. package/resources/customers/credits/top-ups.d.ts +29 -121
  57. package/resources/customers/credits/top-ups.d.ts.map +1 -1
  58. package/resources/customers/credits/top-ups.js.map +1 -1
  59. package/resources/customers/credits/top-ups.mjs.map +1 -1
  60. package/resources/customers/customers.d.ts +84 -682
  61. package/resources/customers/customers.d.ts.map +1 -1
  62. package/resources/customers/customers.js.map +1 -1
  63. package/resources/customers/customers.mjs.map +1 -1
  64. package/resources/customers/index.d.ts +1 -1
  65. package/resources/customers/index.d.ts.map +1 -1
  66. package/resources/customers/index.js.map +1 -1
  67. package/resources/customers/index.mjs.map +1 -1
  68. package/resources/dimensional-price-groups/dimensional-price-groups.d.ts +6 -2
  69. package/resources/dimensional-price-groups/dimensional-price-groups.d.ts.map +1 -1
  70. package/resources/events/backfills.d.ts +2 -2
  71. package/resources/events/events.d.ts +9 -3
  72. package/resources/events/events.d.ts.map +1 -1
  73. package/resources/index.d.ts +7 -7
  74. package/resources/index.d.ts.map +1 -1
  75. package/resources/index.js +1 -4
  76. package/resources/index.js.map +1 -1
  77. package/resources/index.mjs +3 -3
  78. package/resources/index.mjs.map +1 -1
  79. package/resources/invoice-line-items.d.ts +9 -395
  80. package/resources/invoice-line-items.d.ts.map +1 -1
  81. package/resources/invoice-line-items.js.map +1 -1
  82. package/resources/invoice-line-items.mjs.map +1 -1
  83. package/resources/invoices.d.ts +43 -1704
  84. package/resources/invoices.d.ts.map +1 -1
  85. package/resources/invoices.js +4 -7
  86. package/resources/invoices.js.map +1 -1
  87. package/resources/invoices.mjs +3 -5
  88. package/resources/invoices.mjs.map +1 -1
  89. package/resources/items.d.ts +9 -3
  90. package/resources/items.d.ts.map +1 -1
  91. package/resources/metrics.d.ts +9 -3
  92. package/resources/metrics.d.ts.map +1 -1
  93. package/resources/plans/external-plan-id.d.ts +3 -1
  94. package/resources/plans/external-plan-id.d.ts.map +1 -1
  95. package/resources/plans/plans.d.ts +47 -3783
  96. package/resources/plans/plans.d.ts.map +1 -1
  97. package/resources/plans/plans.js.map +1 -1
  98. package/resources/plans/plans.mjs.map +1 -1
  99. package/resources/prices/external-price-id.d.ts +6 -4
  100. package/resources/prices/external-price-id.d.ts.map +1 -1
  101. package/resources/prices/index.d.ts +1 -1
  102. package/resources/prices/index.d.ts.map +1 -1
  103. package/resources/prices/index.js +1 -2
  104. package/resources/prices/index.js.map +1 -1
  105. package/resources/prices/index.mjs +1 -1
  106. package/resources/prices/index.mjs.map +1 -1
  107. package/resources/prices/prices.d.ts +505 -9417
  108. package/resources/prices/prices.d.ts.map +1 -1
  109. package/resources/prices/prices.js +39 -20
  110. package/resources/prices/prices.js.map +1 -1
  111. package/resources/prices/prices.mjs +38 -18
  112. package/resources/prices/prices.mjs.map +1 -1
  113. package/resources/shared.d.ts +7894 -9
  114. package/resources/shared.d.ts.map +1 -1
  115. package/resources/shared.js +11 -0
  116. package/resources/shared.js.map +1 -1
  117. package/resources/shared.mjs +7 -1
  118. package/resources/shared.mjs.map +1 -1
  119. package/resources/subscription-changes.d.ts +140 -2158
  120. package/resources/subscription-changes.d.ts.map +1 -1
  121. package/resources/subscription-changes.js.map +1 -1
  122. package/resources/subscription-changes.mjs.map +1 -1
  123. package/resources/subscriptions.d.ts +2646 -27141
  124. package/resources/subscriptions.d.ts.map +1 -1
  125. package/resources/subscriptions.js +2 -2
  126. package/resources/subscriptions.js.map +1 -1
  127. package/resources/subscriptions.mjs +2 -2
  128. package/resources/subscriptions.mjs.map +1 -1
  129. package/src/core.ts +17 -8
  130. package/src/index.ts +229 -42
  131. package/src/resource.ts +1 -1
  132. package/src/resources/alerts.ts +20 -94
  133. package/src/resources/beta/beta.ts +124 -8892
  134. package/src/resources/beta/external-plan-id.ts +118 -8593
  135. package/src/resources/credit-notes.ts +67 -216
  136. package/src/resources/customers/balance-transactions.ts +5 -36
  137. package/src/resources/customers/costs.ts +19 -117
  138. package/src/resources/customers/credits/credits.ts +18 -0
  139. package/src/resources/customers/credits/index.ts +9 -0
  140. package/src/resources/customers/credits/ledger.ts +259 -1468
  141. package/src/resources/customers/credits/top-ups.ts +33 -136
  142. package/src/resources/customers/customers.ts +165 -1457
  143. package/src/resources/customers/index.ts +8 -0
  144. package/src/resources/dimensional-price-groups/dimensional-price-groups.ts +2 -2
  145. package/src/resources/events/backfills.ts +2 -2
  146. package/src/resources/events/events.ts +3 -3
  147. package/src/resources/index.ts +42 -22
  148. package/src/resources/invoice-line-items.ts +13 -501
  149. package/src/resources/invoices.ts +65 -2396
  150. package/src/resources/items.ts +3 -3
  151. package/src/resources/metrics.ts +3 -3
  152. package/src/resources/plans/external-plan-id.ts +1 -1
  153. package/src/resources/plans/plans.ts +81 -4563
  154. package/src/resources/prices/external-price-id.ts +4 -4
  155. package/src/resources/prices/index.ts +2 -2
  156. package/src/resources/prices/prices.ts +561 -11851
  157. package/src/resources/shared.ts +9991 -22
  158. package/src/resources/subscription-changes.ts +171 -2670
  159. package/src/resources/subscriptions.ts +3246 -32984
  160. package/src/version.ts +1 -1
  161. package/version.d.ts +1 -1
  162. package/version.d.ts.map +1 -1
  163. package/version.js +1 -1
  164. package/version.js.map +1 -1
  165. package/version.mjs +1 -1
  166. package/version.mjs.map +1 -1
@@ -3,14 +3,41 @@
3
3
  import { APIResource } from '../resource';
4
4
  import { isRequestOptions } from '../core';
5
5
  import * as Core from '../core';
6
- import { Page, type PageParams } from '../pagination';
6
+ import * as Shared from './shared';
7
+ import { CreditNotesPage } from './shared';
8
+ import { type PageParams } from '../pagination';
7
9
 
8
10
  export class CreditNotes extends APIResource {
9
11
  /**
10
12
  * This endpoint is used to create a single
11
13
  * [`Credit Note`](/invoicing/credit-notes).
12
- */
13
- create(body: CreditNoteCreateParams, options?: Core.RequestOptions): Core.APIPromise<CreditNote> {
14
+ *
15
+ * The credit note service period configuration supports two explicit modes:
16
+ *
17
+ * 1. Global service periods: Specify start_date and end_date at the credit note
18
+ * level. These dates will be applied to all line items uniformly.
19
+ *
20
+ * 2. Individual service periods: Specify start_date and end_date for each line
21
+ * item. When using this mode, ALL line items must have individual periods
22
+ * specified.
23
+ *
24
+ * 3. Default behavior: If no service periods are specified (neither global nor
25
+ * individual), the original invoice line item service periods will be used.
26
+ *
27
+ * Note: Mixing global and individual service periods in the same request is not
28
+ * allowed to prevent confusion.
29
+ *
30
+ * Service period dates are normalized to the start of the day in the customer's
31
+ * timezone to ensure consistent handling across different timezones.
32
+ *
33
+ * Date Format: Use start_date and end_date with format "YYYY-MM-DD" (e.g.,
34
+ * "2023-09-22") to match other Orb APIs like /v1/invoice_line_items.
35
+ *
36
+ * Note: Both start_date and end_date are inclusive - the service period will cover
37
+ * both the start date and end date completely (from start of start_date to end of
38
+ * end_date).
39
+ */
40
+ create(body: CreditNoteCreateParams, options?: Core.RequestOptions): Core.APIPromise<Shared.CreditNote> {
14
41
  return this._client.post('/credit_notes', { body, ...options });
15
42
  }
16
43
 
@@ -22,12 +49,12 @@ export class CreditNotes extends APIResource {
22
49
  list(
23
50
  query?: CreditNoteListParams,
24
51
  options?: Core.RequestOptions,
25
- ): Core.PagePromise<CreditNotesPage, CreditNote>;
26
- list(options?: Core.RequestOptions): Core.PagePromise<CreditNotesPage, CreditNote>;
52
+ ): Core.PagePromise<CreditNotesPage, Shared.CreditNote>;
53
+ list(options?: Core.RequestOptions): Core.PagePromise<CreditNotesPage, Shared.CreditNote>;
27
54
  list(
28
55
  query: CreditNoteListParams | Core.RequestOptions = {},
29
56
  options?: Core.RequestOptions,
30
- ): Core.PagePromise<CreditNotesPage, CreditNote> {
57
+ ): Core.PagePromise<CreditNotesPage, Shared.CreditNote> {
31
58
  if (isRequestOptions(query)) {
32
59
  return this.list({}, query);
33
60
  }
@@ -38,243 +65,69 @@ export class CreditNotes extends APIResource {
38
65
  * This endpoint is used to fetch a single [`Credit Note`](/invoicing/credit-notes)
39
66
  * given an identifier.
40
67
  */
41
- fetch(creditNoteId: string, options?: Core.RequestOptions): Core.APIPromise<CreditNote> {
68
+ fetch(creditNoteId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.CreditNote> {
42
69
  return this._client.get(`/credit_notes/${creditNoteId}`, options);
43
70
  }
44
71
  }
45
72
 
46
- export class CreditNotesPage extends Page<CreditNote> {}
47
-
48
- /**
49
- * The [Credit Note](/invoicing/credit-notes) resource represents a credit that has
50
- * been applied to a particular invoice.
51
- */
52
- export interface CreditNote {
53
- /**
54
- * The Orb id of this credit note.
55
- */
56
- id: string;
57
-
58
- /**
59
- * The creation time of the resource in Orb.
60
- */
61
- created_at: string;
62
-
63
- /**
64
- * The unique identifier for credit notes.
65
- */
66
- credit_note_number: string;
67
-
68
- /**
69
- * A URL to a PDF of the credit note.
70
- */
71
- credit_note_pdf: string | null;
72
-
73
- customer: CreditNote.Customer;
74
-
75
- /**
76
- * The id of the invoice resource that this credit note is applied to.
77
- */
78
- invoice_id: string;
79
-
80
- /**
81
- * All of the line items associated with this credit note.
82
- */
83
- line_items: Array<CreditNote.LineItem>;
84
-
85
- /**
86
- * The maximum amount applied on the original invoice
87
- */
88
- maximum_amount_adjustment: CreditNote.MaximumAmountAdjustment | null;
89
-
90
- /**
91
- * An optional memo supplied on the credit note.
92
- */
93
- memo: string | null;
94
-
95
- /**
96
- * Any credited amount from the applied minimum on the invoice.
97
- */
98
- minimum_amount_refunded: string | null;
99
-
100
- reason: 'Duplicate' | 'Fraudulent' | 'Order change' | 'Product unsatisfactory' | null;
73
+ export interface CreditNoteCreateParams {
74
+ line_items: Array<CreditNoteCreateParams.LineItem>;
101
75
 
102
76
  /**
103
- * The total prior to any creditable invoice-level discounts or minimums.
77
+ * An optional reason for the credit note.
104
78
  */
105
- subtotal: string;
79
+ reason: 'duplicate' | 'fraudulent' | 'order_change' | 'product_unsatisfactory';
106
80
 
107
81
  /**
108
- * The total including creditable invoice-level discounts or minimums, and tax.
82
+ * A date string to specify the global credit note service period end date in the
83
+ * customer's timezone. This will be applied to all line items that don't have
84
+ * their own individual service periods specified. If not provided, line items will
85
+ * use their original invoice line item service periods. This date is inclusive.
109
86
  */
110
- total: string;
111
-
112
- type: 'refund' | 'adjustment';
87
+ end_date?: string | null;
113
88
 
114
89
  /**
115
- * The time at which the credit note was voided in Orb, if applicable.
90
+ * An optional memo to attach to the credit note.
116
91
  */
117
- voided_at: string | null;
92
+ memo?: string | null;
118
93
 
119
94
  /**
120
- * Any discounts applied on the original invoice.
95
+ * A date string to specify the global credit note service period start date in the
96
+ * customer's timezone. This will be applied to all line items that don't have
97
+ * their own individual service periods specified. If not provided, line items will
98
+ * use their original invoice line item service periods. This date is inclusive.
121
99
  */
122
- discounts?: Array<CreditNote.Discount>;
100
+ start_date?: string | null;
123
101
  }
124
102
 
125
- export namespace CreditNote {
126
- export interface Customer {
127
- id: string;
128
-
129
- external_customer_id: string | null;
130
- }
131
-
103
+ export namespace CreditNoteCreateParams {
132
104
  export interface LineItem {
133
105
  /**
134
- * The Orb id of this resource.
135
- */
136
- id: string;
137
-
138
- /**
139
- * The amount of the line item, including any line item minimums and discounts.
106
+ * The total amount in the invoice's currency to credit this line item.
140
107
  */
141
108
  amount: string;
142
109
 
143
110
  /**
144
- * The id of the item associated with this line item.
145
- */
146
- item_id: string;
147
-
148
- /**
149
- * The name of the corresponding invoice line item.
150
- */
151
- name: string;
152
-
153
- /**
154
- * An optional quantity credited.
155
- */
156
- quantity: number | null;
157
-
158
- /**
159
- * The amount of the line item, excluding any line item minimums and discounts.
160
- */
161
- subtotal: string;
162
-
163
- /**
164
- * Any tax amounts applied onto the line item.
165
- */
166
- tax_amounts: Array<LineItem.TaxAmount>;
167
-
168
- /**
169
- * Any line item discounts from the invoice's line item.
111
+ * The ID of the line item to credit.
170
112
  */
171
- discounts?: Array<LineItem.Discount>;
172
- }
173
-
174
- export namespace LineItem {
175
- export interface TaxAmount {
176
- /**
177
- * The amount of additional tax incurred by this tax rate.
178
- */
179
- amount: string;
180
-
181
- /**
182
- * The human-readable description of the applied tax rate.
183
- */
184
- tax_rate_description: string;
185
-
186
- /**
187
- * The tax rate percentage, out of 100.
188
- */
189
- tax_rate_percentage: string | null;
190
- }
191
-
192
- export interface Discount {
193
- id: string;
194
-
195
- amount_applied: string;
196
-
197
- applies_to_price_ids: Array<string>;
198
-
199
- discount_type: 'percentage' | 'amount';
200
-
201
- percentage_discount: number;
202
-
203
- amount_discount?: string | null;
204
-
205
- reason?: string | null;
206
- }
207
- }
208
-
209
- /**
210
- * The maximum amount applied on the original invoice
211
- */
212
- export interface MaximumAmountAdjustment {
213
- amount_applied: string;
214
-
215
- discount_type: 'percentage';
216
-
217
- percentage_discount: number;
218
-
219
- applies_to_prices?: Array<MaximumAmountAdjustment.AppliesToPrice> | null;
220
-
221
- reason?: string | null;
222
- }
223
-
224
- export namespace MaximumAmountAdjustment {
225
- export interface AppliesToPrice {
226
- id: string;
227
-
228
- name: string;
229
- }
230
- }
231
-
232
- export interface Discount {
233
- amount_applied: string;
234
-
235
- discount_type: 'percentage';
236
-
237
- percentage_discount: number;
238
-
239
- applies_to_prices?: Array<Discount.AppliesToPrice> | null;
240
-
241
- reason?: string | null;
242
- }
243
-
244
- export namespace Discount {
245
- export interface AppliesToPrice {
246
- id: string;
247
-
248
- name: string;
249
- }
250
- }
251
- }
252
-
253
- export interface CreditNoteCreateParams {
254
- line_items: Array<CreditNoteCreateParams.LineItem>;
255
-
256
- /**
257
- * An optional reason for the credit note.
258
- */
259
- reason: 'duplicate' | 'fraudulent' | 'order_change' | 'product_unsatisfactory';
260
-
261
- /**
262
- * An optional memo to attach to the credit note.
263
- */
264
- memo?: string | null;
265
- }
113
+ invoice_line_item_id: string;
266
114
 
267
- export namespace CreditNoteCreateParams {
268
- export interface LineItem {
269
115
  /**
270
- * The total amount in the invoice's currency to credit this line item.
116
+ * A date string to specify this line item's credit note service period end date in
117
+ * the customer's timezone. If provided, this will be used for this specific line
118
+ * item. If not provided, will use the global end_date if available, otherwise
119
+ * defaults to the original invoice line item's end date. This date is inclusive.
271
120
  */
272
- amount: string;
121
+ end_date?: string | null;
273
122
 
274
123
  /**
275
- * The ID of the line item to credit.
124
+ * A date string to specify this line item's credit note service period start date
125
+ * in the customer's timezone. If provided, this will be used for this specific
126
+ * line item. If not provided, will use the global start_date if available,
127
+ * otherwise defaults to the original invoice line item's start date. This date is
128
+ * inclusive.
276
129
  */
277
- invoice_line_item_id: string;
130
+ start_date?: string | null;
278
131
  }
279
132
  }
280
133
 
@@ -288,13 +141,11 @@ export interface CreditNoteListParams extends PageParams {
288
141
  'created_at[lte]'?: string | null;
289
142
  }
290
143
 
291
- CreditNotes.CreditNotesPage = CreditNotesPage;
292
-
293
144
  export declare namespace CreditNotes {
294
145
  export {
295
- type CreditNote as CreditNote,
296
- CreditNotesPage as CreditNotesPage,
297
146
  type CreditNoteCreateParams as CreditNoteCreateParams,
298
147
  type CreditNoteListParams as CreditNoteListParams,
299
148
  };
300
149
  }
150
+
151
+ export { CreditNotesPage };
@@ -3,6 +3,7 @@
3
3
  import { APIResource } from '../../resource';
4
4
  import { isRequestOptions } from '../../core';
5
5
  import * as Core from '../../core';
6
+ import * as Shared from '../shared';
6
7
  import { Page, type PageParams } from '../../pagination';
7
8
 
8
9
  export class BalanceTransactions extends APIResource {
@@ -95,7 +96,7 @@ export interface BalanceTransactionCreateResponse {
95
96
  */
96
97
  created_at: string;
97
98
 
98
- credit_note: BalanceTransactionCreateResponse.CreditNote | null;
99
+ credit_note: Shared.CreditNoteTiny | null;
99
100
 
100
101
  /**
101
102
  * An optional description provided for manual customer balance adjustments.
@@ -108,7 +109,7 @@ export interface BalanceTransactionCreateResponse {
108
109
  */
109
110
  ending_balance: string;
110
111
 
111
- invoice: BalanceTransactionCreateResponse.Invoice | null;
112
+ invoice: Shared.InvoiceTiny | null;
112
113
 
113
114
  /**
114
115
  * The original value of the customer's balance prior to the transaction, in the
@@ -119,22 +120,6 @@ export interface BalanceTransactionCreateResponse {
119
120
  type: 'increment' | 'decrement';
120
121
  }
121
122
 
122
- export namespace BalanceTransactionCreateResponse {
123
- export interface CreditNote {
124
- /**
125
- * The id of the Credit note
126
- */
127
- id: string;
128
- }
129
-
130
- export interface Invoice {
131
- /**
132
- * The Invoice id
133
- */
134
- id: string;
135
- }
136
- }
137
-
138
123
  export interface BalanceTransactionListResponse {
139
124
  /**
140
125
  * A unique id for this transaction.
@@ -162,7 +147,7 @@ export interface BalanceTransactionListResponse {
162
147
  */
163
148
  created_at: string;
164
149
 
165
- credit_note: BalanceTransactionListResponse.CreditNote | null;
150
+ credit_note: Shared.CreditNoteTiny | null;
166
151
 
167
152
  /**
168
153
  * An optional description provided for manual customer balance adjustments.
@@ -175,7 +160,7 @@ export interface BalanceTransactionListResponse {
175
160
  */
176
161
  ending_balance: string;
177
162
 
178
- invoice: BalanceTransactionListResponse.Invoice | null;
163
+ invoice: Shared.InvoiceTiny | null;
179
164
 
180
165
  /**
181
166
  * The original value of the customer's balance prior to the transaction, in the
@@ -186,22 +171,6 @@ export interface BalanceTransactionListResponse {
186
171
  type: 'increment' | 'decrement';
187
172
  }
188
173
 
189
- export namespace BalanceTransactionListResponse {
190
- export interface CreditNote {
191
- /**
192
- * The id of the Credit note
193
- */
194
- id: string;
195
- }
196
-
197
- export interface Invoice {
198
- /**
199
- * The Invoice id
200
- */
201
- id: string;
202
- }
203
- }
204
-
205
174
  export interface BalanceTransactionCreateParams {
206
175
  amount: string;
207
176
 
@@ -3,7 +3,7 @@
3
3
  import { APIResource } from '../../resource';
4
4
  import { isRequestOptions } from '../../core';
5
5
  import * as Core from '../../core';
6
- import * as PricesAPI from '../prices/prices';
6
+ import * as Shared from '../shared';
7
7
 
8
8
  export class Costs extends APIResource {
9
9
  /**
@@ -60,17 +60,17 @@ export class Costs extends APIResource {
60
60
  *
61
61
  * A customer that uses a few API calls a day but has a minimum commitment might
62
62
  * exhibit the following pattern for their subtotal and total in the first few days
63
- * of the month. Here, we assume that each API call is $2.50, the customer's plan
64
- * has a monthly minimum of $50 for this price, and that the subscription's billing
65
- * period bounds are aligned to the first of the month:
63
+ * of the month. Here, we assume that each API call is \$2.50, the customer's plan
64
+ * has a monthly minimum of \$50 for this price, and that the subscription's
65
+ * billing period bounds are aligned to the first of the month:
66
66
  *
67
67
  * | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
68
68
  * | --------------- | ------------- | ---------------- | -------- | ------------------------ |
69
- * | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
70
- * | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
71
- * | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
72
- * | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
73
- * | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
69
+ * | 2023-02-01 | 2023-02-02 | 9 | \$22.50 | \$50.00 |
70
+ * | 2023-02-01 | 2023-02-03 | 19 | \$47.50 | \$50.00 |
71
+ * | 2023-02-01 | 2023-02-04 | 20 | \$50.00 | \$50.00 |
72
+ * | 2023-02-01 | 2023-02-05 | 28 | \$70.00 | \$70.00 |
73
+ * | 2023-02-01 | 2023-02-06 | 36 | \$90.00 | \$90.00 |
74
74
  *
75
75
  * ### Periodic values
76
76
  *
@@ -196,17 +196,17 @@ export class Costs extends APIResource {
196
196
  *
197
197
  * A customer that uses a few API calls a day but has a minimum commitment might
198
198
  * exhibit the following pattern for their subtotal and total in the first few days
199
- * of the month. Here, we assume that each API call is $2.50, the customer's plan
200
- * has a monthly minimum of $50 for this price, and that the subscription's billing
201
- * period bounds are aligned to the first of the month:
199
+ * of the month. Here, we assume that each API call is \$2.50, the customer's plan
200
+ * has a monthly minimum of \$50 for this price, and that the subscription's
201
+ * billing period bounds are aligned to the first of the month:
202
202
  *
203
203
  * | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
204
204
  * | --------------- | ------------- | ---------------- | -------- | ------------------------ |
205
- * | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
206
- * | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
207
- * | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
208
- * | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
209
- * | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
205
+ * | 2023-02-01 | 2023-02-02 | 9 | \$22.50 | \$50.00 |
206
+ * | 2023-02-01 | 2023-02-03 | 19 | \$47.50 | \$50.00 |
207
+ * | 2023-02-01 | 2023-02-04 | 20 | \$50.00 | \$50.00 |
208
+ * | 2023-02-01 | 2023-02-05 | 28 | \$70.00 | \$70.00 |
209
+ * | 2023-02-01 | 2023-02-06 | 36 | \$90.00 | \$90.00 |
210
210
  *
211
211
  * ### Periodic values
212
212
  *
@@ -286,109 +286,11 @@ export class Costs extends APIResource {
286
286
  }
287
287
 
288
288
  export interface CostListResponse {
289
- data: Array<CostListResponse.Data>;
290
- }
291
-
292
- export namespace CostListResponse {
293
- export interface Data {
294
- per_price_costs: Array<Data.PerPriceCost>;
295
-
296
- /**
297
- * Total costs for the timeframe, excluding any minimums and discounts.
298
- */
299
- subtotal: string;
300
-
301
- timeframe_end: string;
302
-
303
- timeframe_start: string;
304
-
305
- /**
306
- * Total costs for the timeframe, including any minimums and discounts.
307
- */
308
- total: string;
309
- }
310
-
311
- export namespace Data {
312
- export interface PerPriceCost {
313
- /**
314
- * The price object
315
- */
316
- price: PricesAPI.Price;
317
-
318
- /**
319
- * The price the cost is associated with
320
- */
321
- price_id: string;
322
-
323
- /**
324
- * Price's contributions for the timeframe, excluding any minimums and discounts.
325
- */
326
- subtotal: string;
327
-
328
- /**
329
- * Price's contributions for the timeframe, including minimums and discounts.
330
- */
331
- total: string;
332
-
333
- /**
334
- * The price's quantity for the timeframe
335
- */
336
- quantity?: number | null;
337
- }
338
- }
289
+ data: Array<Shared.AggregatedCost>;
339
290
  }
340
291
 
341
292
  export interface CostListByExternalIDResponse {
342
- data: Array<CostListByExternalIDResponse.Data>;
343
- }
344
-
345
- export namespace CostListByExternalIDResponse {
346
- export interface Data {
347
- per_price_costs: Array<Data.PerPriceCost>;
348
-
349
- /**
350
- * Total costs for the timeframe, excluding any minimums and discounts.
351
- */
352
- subtotal: string;
353
-
354
- timeframe_end: string;
355
-
356
- timeframe_start: string;
357
-
358
- /**
359
- * Total costs for the timeframe, including any minimums and discounts.
360
- */
361
- total: string;
362
- }
363
-
364
- export namespace Data {
365
- export interface PerPriceCost {
366
- /**
367
- * The price object
368
- */
369
- price: PricesAPI.Price;
370
-
371
- /**
372
- * The price the cost is associated with
373
- */
374
- price_id: string;
375
-
376
- /**
377
- * Price's contributions for the timeframe, excluding any minimums and discounts.
378
- */
379
- subtotal: string;
380
-
381
- /**
382
- * Price's contributions for the timeframe, including minimums and discounts.
383
- */
384
- total: string;
385
-
386
- /**
387
- * The price's quantity for the timeframe
388
- */
389
- quantity?: number | null;
390
- }
391
- }
293
+ data: Array<Shared.AggregatedCost>;
392
294
  }
393
295
 
394
296
  export interface CostListParams {
@@ -5,6 +5,12 @@ import { isRequestOptions } from '../../../core';
5
5
  import * as Core from '../../../core';
6
6
  import * as LedgerAPI from './ledger';
7
7
  import {
8
+ AffectedBlock,
9
+ AmendmentLedgerEntry,
10
+ CreditBlockExpiryLedgerEntry,
11
+ DecrementLedgerEntry,
12
+ ExpirationChangeLedgerEntry,
13
+ IncrementLedgerEntry,
8
14
  Ledger,
9
15
  LedgerCreateEntryByExternalIDParams,
10
16
  LedgerCreateEntryByExternalIDResponse,
@@ -16,6 +22,8 @@ import {
16
22
  LedgerListParams,
17
23
  LedgerListResponse,
18
24
  LedgerListResponsesPage,
25
+ VoidInitiatedLedgerEntry,
26
+ VoidLedgerEntry,
19
27
  } from './ledger';
20
28
  import * as TopUpsAPI from './top-ups';
21
29
  import {
@@ -23,6 +31,7 @@ import {
23
31
  TopUpCreateByExternalIDResponse,
24
32
  TopUpCreateParams,
25
33
  TopUpCreateResponse,
34
+ TopUpInvoiceSettings,
26
35
  TopUpListByExternalIDParams,
27
36
  TopUpListByExternalIDResponse,
28
37
  TopUpListByExternalIDResponsesPage,
@@ -186,6 +195,14 @@ export declare namespace Credits {
186
195
 
187
196
  export {
188
197
  Ledger as Ledger,
198
+ type AffectedBlock as AffectedBlock,
199
+ type AmendmentLedgerEntry as AmendmentLedgerEntry,
200
+ type CreditBlockExpiryLedgerEntry as CreditBlockExpiryLedgerEntry,
201
+ type DecrementLedgerEntry as DecrementLedgerEntry,
202
+ type ExpirationChangeLedgerEntry as ExpirationChangeLedgerEntry,
203
+ type IncrementLedgerEntry as IncrementLedgerEntry,
204
+ type VoidInitiatedLedgerEntry as VoidInitiatedLedgerEntry,
205
+ type VoidLedgerEntry as VoidLedgerEntry,
189
206
  type LedgerListResponse as LedgerListResponse,
190
207
  type LedgerCreateEntryResponse as LedgerCreateEntryResponse,
191
208
  type LedgerCreateEntryByExternalIDResponse as LedgerCreateEntryByExternalIDResponse,
@@ -200,6 +217,7 @@ export declare namespace Credits {
200
217
 
201
218
  export {
202
219
  TopUps as TopUps,
220
+ type TopUpInvoiceSettings as TopUpInvoiceSettings,
203
221
  type TopUpCreateResponse as TopUpCreateResponse,
204
222
  type TopUpListResponse as TopUpListResponse,
205
223
  type TopUpCreateByExternalIDResponse as TopUpCreateByExternalIDResponse,
@@ -13,6 +13,14 @@ export {
13
13
  LedgerListResponsesPage,
14
14
  LedgerListByExternalIDResponsesPage,
15
15
  Ledger,
16
+ type AffectedBlock,
17
+ type AmendmentLedgerEntry,
18
+ type CreditBlockExpiryLedgerEntry,
19
+ type DecrementLedgerEntry,
20
+ type ExpirationChangeLedgerEntry,
21
+ type IncrementLedgerEntry,
22
+ type VoidInitiatedLedgerEntry,
23
+ type VoidLedgerEntry,
16
24
  type LedgerListResponse,
17
25
  type LedgerCreateEntryResponse,
18
26
  type LedgerCreateEntryByExternalIDResponse,
@@ -26,6 +34,7 @@ export {
26
34
  TopUpListResponsesPage,
27
35
  TopUpListByExternalIDResponsesPage,
28
36
  TopUps,
37
+ type TopUpInvoiceSettings,
29
38
  type TopUpCreateResponse,
30
39
  type TopUpListResponse,
31
40
  type TopUpCreateByExternalIDResponse,