orb-billing 2.11.2 → 3.0.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 (160) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +7 -15
  3. package/core.d.ts +4 -2
  4. package/core.d.ts.map +1 -1
  5. package/core.js +17 -4
  6. package/core.js.map +1 -1
  7. package/core.mjs +18 -5
  8. package/core.mjs.map +1 -1
  9. package/index.d.mts +7 -3
  10. package/index.d.ts +7 -3
  11. package/index.d.ts.map +1 -1
  12. package/index.js +4 -2
  13. package/index.js.map +1 -1
  14. package/index.mjs +4 -2
  15. package/index.mjs.map +1 -1
  16. package/package.json +1 -1
  17. package/resources/alerts.d.ts +1 -1
  18. package/resources/alerts.d.ts.map +1 -1
  19. package/resources/alerts.js.map +1 -1
  20. package/resources/alerts.mjs.map +1 -1
  21. package/resources/coupons/coupons.d.ts +25 -8
  22. package/resources/coupons/coupons.d.ts.map +1 -1
  23. package/resources/coupons/coupons.js.map +1 -1
  24. package/resources/coupons/coupons.mjs.map +1 -1
  25. package/resources/coupons/subscriptions.d.ts +1 -1
  26. package/resources/coupons/subscriptions.d.ts.map +1 -1
  27. package/resources/coupons/subscriptions.js.map +1 -1
  28. package/resources/coupons/subscriptions.mjs.map +1 -1
  29. package/resources/credit-notes.d.ts +1 -1
  30. package/resources/credit-notes.d.ts.map +1 -1
  31. package/resources/credit-notes.js.map +1 -1
  32. package/resources/credit-notes.mjs.map +1 -1
  33. package/resources/customers/balance-transactions.d.ts +1 -1
  34. package/resources/customers/balance-transactions.d.ts.map +1 -1
  35. package/resources/customers/balance-transactions.js.map +1 -1
  36. package/resources/customers/balance-transactions.mjs.map +1 -1
  37. package/resources/customers/costs.d.ts +1 -1
  38. package/resources/customers/costs.d.ts.map +1 -1
  39. package/resources/customers/costs.js.map +1 -1
  40. package/resources/customers/costs.mjs.map +1 -1
  41. package/resources/customers/credits/credits.d.ts +11 -1
  42. package/resources/customers/credits/credits.d.ts.map +1 -1
  43. package/resources/customers/credits/credits.js.map +1 -1
  44. package/resources/customers/credits/credits.mjs.map +1 -1
  45. package/resources/customers/credits/ledger.d.ts +1 -1
  46. package/resources/customers/credits/ledger.d.ts.map +1 -1
  47. package/resources/customers/credits/ledger.js.map +1 -1
  48. package/resources/customers/credits/ledger.mjs.map +1 -1
  49. package/resources/customers/credits/top-ups.d.ts +1 -1
  50. package/resources/customers/credits/top-ups.d.ts.map +1 -1
  51. package/resources/customers/credits/top-ups.js.map +1 -1
  52. package/resources/customers/credits/top-ups.mjs.map +1 -1
  53. package/resources/customers/customers.d.ts +1 -1
  54. package/resources/customers/customers.d.ts.map +1 -1
  55. package/resources/customers/customers.js.map +1 -1
  56. package/resources/customers/customers.mjs.map +1 -1
  57. package/resources/customers/usage.d.ts +1 -1
  58. package/resources/customers/usage.d.ts.map +1 -1
  59. package/resources/customers/usage.js.map +1 -1
  60. package/resources/customers/usage.mjs.map +1 -1
  61. package/resources/events/backfills.d.ts +1 -1
  62. package/resources/events/backfills.d.ts.map +1 -1
  63. package/resources/events/backfills.js.map +1 -1
  64. package/resources/events/backfills.mjs.map +1 -1
  65. package/resources/events/events.d.ts +1 -1
  66. package/resources/events/events.d.ts.map +1 -1
  67. package/resources/events/events.js.map +1 -1
  68. package/resources/events/events.mjs.map +1 -1
  69. package/resources/index.d.ts +2 -2
  70. package/resources/index.d.ts.map +1 -1
  71. package/resources/index.js.map +1 -1
  72. package/resources/index.mjs.map +1 -1
  73. package/resources/invoice-line-items.d.ts +1 -1
  74. package/resources/invoice-line-items.d.ts.map +1 -1
  75. package/resources/invoice-line-items.js.map +1 -1
  76. package/resources/invoice-line-items.mjs.map +1 -1
  77. package/resources/invoices.d.ts +31 -1
  78. package/resources/invoices.d.ts.map +1 -1
  79. package/resources/invoices.js +6 -0
  80. package/resources/invoices.js.map +1 -1
  81. package/resources/invoices.mjs +6 -0
  82. package/resources/invoices.mjs.map +1 -1
  83. package/resources/items.d.ts +6 -10
  84. package/resources/items.d.ts.map +1 -1
  85. package/resources/items.js +4 -4
  86. package/resources/items.js.map +1 -1
  87. package/resources/items.mjs +4 -4
  88. package/resources/items.mjs.map +1 -1
  89. package/resources/metrics.d.ts +1 -1
  90. package/resources/metrics.d.ts.map +1 -1
  91. package/resources/metrics.js.map +1 -1
  92. package/resources/metrics.mjs.map +1 -1
  93. package/resources/plans/external-plan-id.d.ts +8 -12
  94. package/resources/plans/external-plan-id.d.ts.map +1 -1
  95. package/resources/plans/external-plan-id.js +4 -0
  96. package/resources/plans/external-plan-id.js.map +1 -1
  97. package/resources/plans/external-plan-id.mjs +4 -0
  98. package/resources/plans/external-plan-id.mjs.map +1 -1
  99. package/resources/plans/plans.d.ts +112 -17
  100. package/resources/plans/plans.d.ts.map +1 -1
  101. package/resources/plans/plans.js.map +1 -1
  102. package/resources/plans/plans.mjs.map +1 -1
  103. package/resources/prices/external-price-id.d.ts +20 -1
  104. package/resources/prices/external-price-id.d.ts.map +1 -1
  105. package/resources/prices/external-price-id.js +9 -0
  106. package/resources/prices/external-price-id.js.map +1 -1
  107. package/resources/prices/external-price-id.mjs +9 -0
  108. package/resources/prices/external-price-id.mjs.map +1 -1
  109. package/resources/prices/index.d.ts +2 -2
  110. package/resources/prices/index.d.ts.map +1 -1
  111. package/resources/prices/index.js.map +1 -1
  112. package/resources/prices/index.mjs.map +1 -1
  113. package/resources/prices/prices.d.ts +288 -37
  114. package/resources/prices/prices.d.ts.map +1 -1
  115. package/resources/prices/prices.js +6 -0
  116. package/resources/prices/prices.js.map +1 -1
  117. package/resources/prices/prices.mjs +6 -0
  118. package/resources/prices/prices.mjs.map +1 -1
  119. package/resources/subscriptions.d.ts +247 -19
  120. package/resources/subscriptions.d.ts.map +1 -1
  121. package/resources/subscriptions.js.map +1 -1
  122. package/resources/subscriptions.mjs.map +1 -1
  123. package/resources/top-level.d.ts +1 -1
  124. package/resources/top-level.d.ts.map +1 -1
  125. package/resources/top-level.js.map +1 -1
  126. package/resources/top-level.mjs.map +1 -1
  127. package/src/core.ts +27 -8
  128. package/src/index.ts +8 -3
  129. package/src/resources/alerts.ts +1 -1
  130. package/src/resources/coupons/coupons.ts +25 -8
  131. package/src/resources/coupons/subscriptions.ts +1 -1
  132. package/src/resources/credit-notes.ts +1 -1
  133. package/src/resources/customers/balance-transactions.ts +1 -1
  134. package/src/resources/customers/costs.ts +1 -1
  135. package/src/resources/customers/credits/credits.ts +15 -1
  136. package/src/resources/customers/credits/ledger.ts +1 -1
  137. package/src/resources/customers/credits/top-ups.ts +1 -1
  138. package/src/resources/customers/customers.ts +1 -1
  139. package/src/resources/customers/usage.ts +1 -1
  140. package/src/resources/events/backfills.ts +1 -1
  141. package/src/resources/events/events.ts +1 -1
  142. package/src/resources/index.ts +2 -0
  143. package/src/resources/invoice-line-items.ts +1 -1
  144. package/src/resources/invoices.ts +50 -1
  145. package/src/resources/items.ts +14 -10
  146. package/src/resources/metrics.ts +1 -1
  147. package/src/resources/plans/external-plan-id.ts +8 -12
  148. package/src/resources/plans/plans.ts +128 -17
  149. package/src/resources/prices/external-price-id.ts +38 -1
  150. package/src/resources/prices/index.ts +2 -1
  151. package/src/resources/prices/prices.ts +336 -37
  152. package/src/resources/subscriptions.ts +295 -19
  153. package/src/resources/top-level.ts +1 -1
  154. package/src/version.ts +1 -1
  155. package/version.d.ts +1 -1
  156. package/version.d.ts.map +1 -1
  157. package/version.js +1 -1
  158. package/version.js.map +1 -1
  159. package/version.mjs +1 -1
  160. package/version.mjs.map +1 -1
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Core from '../../../core';
4
3
  import { APIResource } from '../../../resource';
5
4
  import { isRequestOptions } from '../../../core';
5
+ import * as Core from '../../../core';
6
6
  import * as CreditsAPI from './credits';
7
7
  import * as LedgerAPI from './ledger';
8
8
  import * as TopUpsAPI from './top-ups';
@@ -85,6 +85,8 @@ export interface CreditListResponse {
85
85
 
86
86
  expiry_date: string | null;
87
87
 
88
+ maximum_initial_balance: number | null;
89
+
88
90
  per_unit_cost_basis: string | null;
89
91
 
90
92
  status: 'active' | 'pending_payment';
@@ -99,6 +101,8 @@ export interface CreditListByExternalIDResponse {
99
101
 
100
102
  expiry_date: string | null;
101
103
 
104
+ maximum_initial_balance: number | null;
105
+
102
106
  per_unit_cost_basis: string | null;
103
107
 
104
108
  status: 'active' | 'pending_payment';
@@ -109,6 +113,11 @@ export interface CreditListParams extends PageParams {
109
113
  * The ledger currency or custom pricing unit to use.
110
114
  */
111
115
  currency?: string | null;
116
+
117
+ /**
118
+ * Include all blocks, not just active ones.
119
+ */
120
+ include_all_blocks?: boolean;
112
121
  }
113
122
 
114
123
  export interface CreditListByExternalIDParams extends PageParams {
@@ -116,6 +125,11 @@ export interface CreditListByExternalIDParams extends PageParams {
116
125
  * The ledger currency or custom pricing unit to use.
117
126
  */
118
127
  currency?: string | null;
128
+
129
+ /**
130
+ * Include all blocks, not just active ones.
131
+ */
132
+ include_all_blocks?: boolean;
119
133
  }
120
134
 
121
135
  export namespace Credits {
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Core from '../../../core';
4
3
  import { APIResource } from '../../../resource';
5
4
  import { isRequestOptions } from '../../../core';
5
+ import * as Core from '../../../core';
6
6
  import * as LedgerAPI from './ledger';
7
7
  import { Page, type PageParams } from '../../../pagination';
8
8
 
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Core from '../../../core';
4
3
  import { APIResource } from '../../../resource';
5
4
  import { isRequestOptions } from '../../../core';
5
+ import * as Core from '../../../core';
6
6
  import * as TopUpsAPI from './top-ups';
7
7
  import { Page, type PageParams } from '../../../pagination';
8
8
 
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Core from '../../core';
4
3
  import { APIResource } from '../../resource';
5
4
  import { isRequestOptions } from '../../core';
5
+ import * as Core from '../../core';
6
6
  import * as CustomersAPI from './customers';
7
7
  import * as BalanceTransactionsAPI from './balance-transactions';
8
8
  import * as CostsAPI from './costs';
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Core from '../../core';
4
3
  import { APIResource } from '../../resource';
4
+ import * as Core from '../../core';
5
5
  import * as UsageAPI from './usage';
6
6
 
7
7
  export class Usage extends APIResource {
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Core from '../../core';
4
3
  import { APIResource } from '../../resource';
5
4
  import { isRequestOptions } from '../../core';
5
+ import * as Core from '../../core';
6
6
  import * as BackfillsAPI from './backfills';
7
7
  import { Page, type PageParams } from '../../pagination';
8
8
 
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Core from '../../core';
4
3
  import { APIResource } from '../../resource';
4
+ import * as Core from '../../core';
5
5
  import * as EventsAPI from './events';
6
6
  import * as BackfillsAPI from './backfills';
7
7
 
@@ -26,6 +26,7 @@ export {
26
26
  Price,
27
27
  PriceEvaluateResponse,
28
28
  PriceCreateParams,
29
+ PriceUpdateParams,
29
30
  PriceListParams,
30
31
  PriceEvaluateParams,
31
32
  PricesPage,
@@ -45,6 +46,7 @@ export {
45
46
  Invoice,
46
47
  InvoiceFetchUpcomingResponse,
47
48
  InvoiceCreateParams,
49
+ InvoiceUpdateParams,
48
50
  InvoiceListParams,
49
51
  InvoiceFetchUpcomingParams,
50
52
  InvoiceMarkPaidParams,
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Core from '../core';
4
3
  import { APIResource } from '../resource';
4
+ import * as Core from '../core';
5
5
  import * as InvoiceLineItemsAPI from './invoice-line-items';
6
6
  import * as Shared from './shared';
7
7
  import * as PricesAPI from './prices/prices';
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Core from '../core';
4
3
  import { APIResource } from '../resource';
5
4
  import { isRequestOptions } from '../core';
5
+ import * as Core from '../core';
6
6
  import * as InvoicesAPI from './invoices';
7
7
  import * as Shared from './shared';
8
8
  import * as PricesAPI from './prices/prices';
@@ -16,6 +16,30 @@ export class Invoices extends APIResource {
16
16
  return this._client.post('/invoices', { body, ...options });
17
17
  }
18
18
 
19
+ /**
20
+ * This endpoint allows you to update the `metadata` property on an invoice. If you
21
+ * pass null for the metadata value, it will clear any existing metadata for that
22
+ * invoice.
23
+ *
24
+ * `metadata` can be modified regardless of invoice state.
25
+ */
26
+ update(
27
+ invoiceId: string,
28
+ body?: InvoiceUpdateParams,
29
+ options?: Core.RequestOptions,
30
+ ): Core.APIPromise<Invoice>;
31
+ update(invoiceId: string, options?: Core.RequestOptions): Core.APIPromise<Invoice>;
32
+ update(
33
+ invoiceId: string,
34
+ body: InvoiceUpdateParams | Core.RequestOptions = {},
35
+ options?: Core.RequestOptions,
36
+ ): Core.APIPromise<Invoice> {
37
+ if (isRequestOptions(body)) {
38
+ return this.update(invoiceId, {}, body);
39
+ }
40
+ return this._client.put(`/invoices/${invoiceId}`, { body, ...options });
41
+ }
42
+
19
43
  /**
20
44
  * This endpoint returns a list of all [`Invoice`](../guides/concepts#invoice)s for
21
45
  * an account in a list format.
@@ -408,6 +432,11 @@ export namespace Invoice {
408
432
  */
409
433
  next_attempt_at: string | null;
410
434
 
435
+ /**
436
+ * Number of auto-collection payment attempts.
437
+ */
438
+ num_attempts: number | null;
439
+
411
440
  /**
412
441
  * If Orb has ever attempted payment auto-collection for this invoice, this field
413
442
  * will reflect when that attempt occurred. In conjunction with `next_attempt_at`,
@@ -1571,6 +1600,11 @@ export namespace InvoiceFetchUpcomingResponse {
1571
1600
  */
1572
1601
  next_attempt_at: string | null;
1573
1602
 
1603
+ /**
1604
+ * Number of auto-collection payment attempts.
1605
+ */
1606
+ num_attempts: number | null;
1607
+
1574
1608
  /**
1575
1609
  * If Orb has ever attempted payment auto-collection for this invoice, this field
1576
1610
  * will reflect when that attempt occurred. In conjunction with `next_attempt_at`,
@@ -2469,6 +2503,11 @@ export interface InvoiceCreateParams {
2469
2503
  */
2470
2504
  customer_id?: string | null;
2471
2505
 
2506
+ /**
2507
+ * An optional discount to attach to the invoice.
2508
+ */
2509
+ discount?: Shared.Discount | null;
2510
+
2472
2511
  /**
2473
2512
  * The `external_customer_id` of the `Customer` to create this invoice for. One of
2474
2513
  * `customer_id` and `external_customer_id` are required.
@@ -2533,6 +2572,15 @@ export namespace InvoiceCreateParams {
2533
2572
  }
2534
2573
  }
2535
2574
 
2575
+ export interface InvoiceUpdateParams {
2576
+ /**
2577
+ * User-specified key/value pairs for the resource. Individual keys can be removed
2578
+ * by setting the value to `null`, and the entire metadata mapping can be cleared
2579
+ * by setting `metadata` to `null`.
2580
+ */
2581
+ metadata?: Record<string, string | null> | null;
2582
+ }
2583
+
2536
2584
  export interface InvoiceListParams extends PageParams {
2537
2585
  amount?: string | null;
2538
2586
 
@@ -2595,6 +2643,7 @@ export namespace Invoices {
2595
2643
  export import InvoiceFetchUpcomingResponse = InvoicesAPI.InvoiceFetchUpcomingResponse;
2596
2644
  export import InvoicesPage = InvoicesAPI.InvoicesPage;
2597
2645
  export import InvoiceCreateParams = InvoicesAPI.InvoiceCreateParams;
2646
+ export import InvoiceUpdateParams = InvoicesAPI.InvoiceUpdateParams;
2598
2647
  export import InvoiceListParams = InvoicesAPI.InvoiceListParams;
2599
2648
  export import InvoiceFetchUpcomingParams = InvoicesAPI.InvoiceFetchUpcomingParams;
2600
2649
  export import InvoiceMarkPaidParams = InvoicesAPI.InvoiceMarkPaidParams;
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Core from '../core';
4
3
  import { APIResource } from '../resource';
5
4
  import { isRequestOptions } from '../core';
5
+ import * as Core from '../core';
6
6
  import * as ItemsAPI from './items';
7
7
  import { Page, type PageParams } from '../pagination';
8
8
 
@@ -15,9 +15,18 @@ export class Items extends APIResource {
15
15
  }
16
16
 
17
17
  /**
18
- * Update items
18
+ * This endpoint can be used to update properties on the Item.
19
19
  */
20
- update(itemId: string, body: ItemUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Item> {
20
+ update(itemId: string, body?: ItemUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Item>;
21
+ update(itemId: string, options?: Core.RequestOptions): Core.APIPromise<Item>;
22
+ update(
23
+ itemId: string,
24
+ body: ItemUpdateParams | Core.RequestOptions = {},
25
+ options?: Core.RequestOptions,
26
+ ): Core.APIPromise<Item> {
27
+ if (isRequestOptions(body)) {
28
+ return this.update(itemId, {}, body);
29
+ }
21
30
  return this._client.put(`/items/${itemId}`, { body, ...options });
22
31
  }
23
32
 
@@ -85,14 +94,9 @@ export interface ItemCreateParams {
85
94
  }
86
95
 
87
96
  export interface ItemUpdateParams {
88
- external_connections: Array<ItemUpdateParams.ExternalConnection> | null;
97
+ external_connections?: Array<ItemUpdateParams.ExternalConnection> | null;
89
98
 
90
- /**
91
- * User-specified key/value pairs for the resource. Individual keys can be removed
92
- * by setting the value to `null`, and the entire metadata mapping can be cleared
93
- * by setting `metadata` to `null`.
94
- */
95
- metadata?: Record<string, string | null> | null;
99
+ name?: string | null;
96
100
  }
97
101
 
98
102
  export namespace ItemUpdateParams {
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Core from '../core';
4
3
  import { APIResource } from '../resource';
5
4
  import { isRequestOptions } from '../core';
5
+ import * as Core from '../core';
6
6
  import * as MetricsAPI from './metrics';
7
7
  import * as ItemsAPI from './items';
8
8
  import { Page, type PageParams } from '../pagination';
@@ -1,25 +1,17 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Core from '../../core';
4
3
  import { APIResource } from '../../resource';
5
4
  import { isRequestOptions } from '../../core';
5
+ import * as Core from '../../core';
6
6
  import * as ExternalPlanIDAPI from './external-plan-id';
7
7
  import * as PlansAPI from './plans';
8
8
 
9
9
  export class ExternalPlanID extends APIResource {
10
10
  /**
11
- * This endpoint is used to fetch [plan](../guides/concepts##plan-and-price)
12
- * details given an external_plan_id identifier. It returns information about the
13
- * prices included in the plan and their configuration, as well as the product that
14
- * the plan is attached to.
11
+ * This endpoint can be used to update the `external_plan_id`, and `metadata` of an
12
+ * existing plan.
15
13
  *
16
- * ## Serialized prices
17
- *
18
- * Orb supports a few different pricing models out of the box. Each of these models
19
- * is serialized differently in a given [Price](../guides/concepts#plan-and-price)
20
- * object. The `model_type` field determines the key for the configuration object
21
- * that is present. A detailed explanation of price types can be found in the
22
- * [Price schema](../guides/concepts#plan-and-price).
14
+ * Other fields on a customer are currently immutable.
23
15
  */
24
16
  update(
25
17
  otherExternalPlanId: string,
@@ -44,6 +36,10 @@ export class ExternalPlanID extends APIResource {
44
36
  * prices included in the plan and their configuration, as well as the product that
45
37
  * the plan is attached to.
46
38
  *
39
+ * If multiple plans are found to contain the specified external_plan_id, the
40
+ * active plans will take priority over archived ones, and among those, the
41
+ * endpoint will return the most recently created plan.
42
+ *
47
43
  * ## Serialized prices
48
44
  *
49
45
  * Orb supports a few different pricing models out of the box. Each of these models