orb-billing 1.27.0 → 1.28.1

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 (146) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +1 -1
  3. package/core.d.ts +0 -10
  4. package/core.d.ts.map +1 -1
  5. package/core.js +1 -13
  6. package/core.js.map +1 -1
  7. package/core.mjs +0 -11
  8. package/core.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resource.d.ts +1 -7
  11. package/resource.d.ts.map +1 -1
  12. package/resource.js +1 -7
  13. package/resource.js.map +1 -1
  14. package/resource.mjs +1 -7
  15. package/resource.mjs.map +1 -1
  16. package/resources/coupons/coupons.d.ts.map +1 -1
  17. package/resources/coupons/coupons.js +5 -5
  18. package/resources/coupons/coupons.js.map +1 -1
  19. package/resources/coupons/coupons.mjs +5 -5
  20. package/resources/coupons/coupons.mjs.map +1 -1
  21. package/resources/coupons/subscriptions.d.ts.map +1 -1
  22. package/resources/coupons/subscriptions.js +4 -1
  23. package/resources/coupons/subscriptions.js.map +1 -1
  24. package/resources/coupons/subscriptions.mjs +4 -1
  25. package/resources/coupons/subscriptions.mjs.map +1 -1
  26. package/resources/credit-notes.js +2 -2
  27. package/resources/credit-notes.js.map +1 -1
  28. package/resources/credit-notes.mjs +2 -2
  29. package/resources/credit-notes.mjs.map +1 -1
  30. package/resources/customers/balance-transactions.js +2 -2
  31. package/resources/customers/balance-transactions.js.map +1 -1
  32. package/resources/customers/balance-transactions.mjs +2 -2
  33. package/resources/customers/balance-transactions.mjs.map +1 -1
  34. package/resources/customers/costs.d.ts.map +1 -1
  35. package/resources/customers/costs.js +5 -2
  36. package/resources/customers/costs.js.map +1 -1
  37. package/resources/customers/costs.mjs +5 -2
  38. package/resources/customers/costs.mjs.map +1 -1
  39. package/resources/customers/credits/credits.d.ts.map +1 -1
  40. package/resources/customers/credits/credits.js +3 -3
  41. package/resources/customers/credits/credits.js.map +1 -1
  42. package/resources/customers/credits/credits.mjs +3 -3
  43. package/resources/customers/credits/credits.mjs.map +1 -1
  44. package/resources/customers/credits/ledger.d.ts +132 -20
  45. package/resources/customers/credits/ledger.d.ts.map +1 -1
  46. package/resources/customers/credits/ledger.js +4 -4
  47. package/resources/customers/credits/ledger.js.map +1 -1
  48. package/resources/customers/credits/ledger.mjs +4 -4
  49. package/resources/customers/credits/ledger.mjs.map +1 -1
  50. package/resources/customers/customers.d.ts +11 -10
  51. package/resources/customers/customers.d.ts.map +1 -1
  52. package/resources/customers/customers.js +12 -12
  53. package/resources/customers/customers.js.map +1 -1
  54. package/resources/customers/customers.mjs +12 -12
  55. package/resources/customers/customers.mjs.map +1 -1
  56. package/resources/customers/usage.js +2 -2
  57. package/resources/customers/usage.js.map +1 -1
  58. package/resources/customers/usage.mjs +2 -2
  59. package/resources/customers/usage.mjs.map +1 -1
  60. package/resources/events/backfills.js +5 -5
  61. package/resources/events/backfills.js.map +1 -1
  62. package/resources/events/backfills.mjs +5 -5
  63. package/resources/events/backfills.mjs.map +1 -1
  64. package/resources/events/events.d.ts.map +1 -1
  65. package/resources/events/events.js +5 -5
  66. package/resources/events/events.js.map +1 -1
  67. package/resources/events/events.mjs +5 -5
  68. package/resources/events/events.mjs.map +1 -1
  69. package/resources/invoice-line-items.js +1 -1
  70. package/resources/invoice-line-items.js.map +1 -1
  71. package/resources/invoice-line-items.mjs +1 -1
  72. package/resources/invoice-line-items.mjs.map +1 -1
  73. package/resources/invoices.d.ts +10 -2
  74. package/resources/invoices.d.ts.map +1 -1
  75. package/resources/invoices.js +7 -7
  76. package/resources/invoices.js.map +1 -1
  77. package/resources/invoices.mjs +7 -7
  78. package/resources/invoices.mjs.map +1 -1
  79. package/resources/items.js +3 -3
  80. package/resources/items.js.map +1 -1
  81. package/resources/items.mjs +3 -3
  82. package/resources/items.mjs.map +1 -1
  83. package/resources/metrics.d.ts +14 -3
  84. package/resources/metrics.d.ts.map +1 -1
  85. package/resources/metrics.js +3 -3
  86. package/resources/metrics.js.map +1 -1
  87. package/resources/metrics.mjs +3 -3
  88. package/resources/metrics.mjs.map +1 -1
  89. package/resources/plans/external-plan-id.d.ts +4 -1
  90. package/resources/plans/external-plan-id.d.ts.map +1 -1
  91. package/resources/plans/external-plan-id.js +2 -2
  92. package/resources/plans/external-plan-id.js.map +1 -1
  93. package/resources/plans/external-plan-id.mjs +2 -2
  94. package/resources/plans/external-plan-id.mjs.map +1 -1
  95. package/resources/plans/plans.d.ts +13 -3
  96. package/resources/plans/plans.d.ts.map +1 -1
  97. package/resources/plans/plans.js +5 -5
  98. package/resources/plans/plans.js.map +1 -1
  99. package/resources/plans/plans.mjs +5 -5
  100. package/resources/plans/plans.mjs.map +1 -1
  101. package/resources/prices/external-price-id.js +1 -1
  102. package/resources/prices/external-price-id.js.map +1 -1
  103. package/resources/prices/external-price-id.mjs +1 -1
  104. package/resources/prices/external-price-id.mjs.map +1 -1
  105. package/resources/prices/prices.d.ts.map +1 -1
  106. package/resources/prices/prices.js +4 -4
  107. package/resources/prices/prices.js.map +1 -1
  108. package/resources/prices/prices.mjs +4 -4
  109. package/resources/prices/prices.mjs.map +1 -1
  110. package/resources/subscriptions.d.ts +7 -4
  111. package/resources/subscriptions.d.ts.map +1 -1
  112. package/resources/subscriptions.js +17 -14
  113. package/resources/subscriptions.js.map +1 -1
  114. package/resources/subscriptions.mjs +17 -14
  115. package/resources/subscriptions.mjs.map +1 -1
  116. package/resources/top-level.js +1 -1
  117. package/resources/top-level.js.map +1 -1
  118. package/resources/top-level.mjs +1 -1
  119. package/resources/top-level.mjs.map +1 -1
  120. package/src/core.ts +0 -21
  121. package/src/resource.ts +3 -16
  122. package/src/resources/coupons/coupons.ts +5 -5
  123. package/src/resources/coupons/subscriptions.ts +4 -1
  124. package/src/resources/credit-notes.ts +2 -2
  125. package/src/resources/customers/balance-transactions.ts +2 -2
  126. package/src/resources/customers/costs.ts +5 -2
  127. package/src/resources/customers/credits/credits.ts +3 -3
  128. package/src/resources/customers/credits/ledger.ts +136 -24
  129. package/src/resources/customers/customers.ts +22 -21
  130. package/src/resources/customers/usage.ts +2 -2
  131. package/src/resources/events/backfills.ts +5 -5
  132. package/src/resources/events/events.ts +5 -5
  133. package/src/resources/invoice-line-items.ts +1 -1
  134. package/src/resources/invoices.ts +17 -9
  135. package/src/resources/items.ts +3 -3
  136. package/src/resources/metrics.ts +17 -6
  137. package/src/resources/plans/external-plan-id.ts +6 -3
  138. package/src/resources/plans/plans.ts +18 -8
  139. package/src/resources/prices/external-price-id.ts +1 -1
  140. package/src/resources/prices/prices.ts +4 -4
  141. package/src/resources/subscriptions.ts +24 -18
  142. package/src/resources/top-level.ts +1 -1
  143. package/src/version.ts +1 -1
  144. package/version.d.ts +1 -1
  145. package/version.js +1 -1
  146. package/version.mjs +1 -1
@@ -11,11 +11,11 @@ import * as CreditsAPI from "./credits/credits";
11
11
  import { Page, type PageParams } from "../../pagination";
12
12
 
13
13
  export class Customers extends APIResource {
14
- costs: CostsAPI.Costs = new CostsAPI.Costs(this.client);
15
- usage: UsageAPI.Usage = new UsageAPI.Usage(this.client);
16
- credits: CreditsAPI.Credits = new CreditsAPI.Credits(this.client);
14
+ costs: CostsAPI.Costs = new CostsAPI.Costs(this._client);
15
+ usage: UsageAPI.Usage = new UsageAPI.Usage(this._client);
16
+ credits: CreditsAPI.Credits = new CreditsAPI.Credits(this._client);
17
17
  balanceTransactions: BalanceTransactionsAPI.BalanceTransactions =
18
- new BalanceTransactionsAPI.BalanceTransactions(this.client);
18
+ new BalanceTransactionsAPI.BalanceTransactions(this._client);
19
19
 
20
20
  /**
21
21
  * This operation is used to create an Orb customer, who is party to the core
@@ -32,7 +32,7 @@ export class Customers extends APIResource {
32
32
  * configured on a per-customer basis by setting the `timezone` parameter
33
33
  */
34
34
  create(body: CustomerCreateParams, options?: Core.RequestOptions): Core.APIPromise<Customer> {
35
- return this.post('/customers', { body, ...options });
35
+ return this._client.post('/customers', { body, ...options });
36
36
  }
37
37
 
38
38
  /**
@@ -56,7 +56,7 @@ export class Customers extends APIResource {
56
56
  if (isRequestOptions(body)) {
57
57
  return this.update(customerId, {}, body);
58
58
  }
59
- return this.put(`/customers/${customerId}`, { body, ...options });
59
+ return this._client.put(`/customers/${customerId}`, { body, ...options });
60
60
  }
61
61
 
62
62
  /**
@@ -77,7 +77,7 @@ export class Customers extends APIResource {
77
77
  if (isRequestOptions(query)) {
78
78
  return this.list({}, query);
79
79
  }
80
- return this.getAPIList('/customers', CustomersPage, { query, ...options });
80
+ return this._client.getAPIList('/customers', CustomersPage, { query, ...options });
81
81
  }
82
82
 
83
83
  /**
@@ -94,8 +94,8 @@ export class Customers extends APIResource {
94
94
  *
95
95
  * On successful processing, this returns an empty dictionary (`{}`) in the API.
96
96
  */
97
- del(customerId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
98
- return this.delete(`/customers/${customerId}`, {
97
+ delete(customerId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
98
+ return this._client.delete(`/customers/${customerId}`, {
99
99
  ...options,
100
100
  headers: { Accept: '', ...options?.headers },
101
101
  });
@@ -110,7 +110,7 @@ export class Customers extends APIResource {
110
110
  * discussion of the Customer model.
111
111
  */
112
112
  fetch(customerId: string, options?: Core.RequestOptions): Core.APIPromise<Customer> {
113
- return this.get(`/customers/${customerId}`, options);
113
+ return this._client.get(`/customers/${customerId}`, options);
114
114
  }
115
115
 
116
116
  /**
@@ -121,7 +121,7 @@ export class Customers extends APIResource {
121
121
  * [Get Customer](fetch-customer).
122
122
  */
123
123
  fetchByExternalId(externalCustomerId: string, options?: Core.RequestOptions): Core.APIPromise<Customer> {
124
- return this.get(`/customers/external_customer_id/${externalCustomerId}`, options);
124
+ return this._client.get(`/customers/external_customer_id/${externalCustomerId}`, options);
125
125
  }
126
126
 
127
127
  /**
@@ -144,7 +144,7 @@ export class Customers extends APIResource {
144
144
  if (isRequestOptions(body)) {
145
145
  return this.updateByExternalId(id, {}, body);
146
146
  }
147
- return this.put(`/customers/external_customer_id/${id}`, { body, ...options });
147
+ return this._client.put(`/customers/external_customer_id/${id}`, { body, ...options });
148
148
  }
149
149
  }
150
150
 
@@ -205,6 +205,10 @@ export interface Customer {
205
205
  */
206
206
  external_customer_id: string | null;
207
207
 
208
+ /**
209
+ * User specified key-value pairs. If not provided, this defaults to an empty
210
+ * dictionary.
211
+ */
208
212
  metadata: Record<string, string>;
209
213
 
210
214
  /**
@@ -628,10 +632,9 @@ export interface CustomerCreateParams {
628
632
  external_customer_id?: string | null;
629
633
 
630
634
  /**
631
- * User-specified key value pairs, often useful for referencing internal resources
632
- * or IDs. Returned as-is in the customer resource.
635
+ * User-specified key/value pairs for the resource.
633
636
  */
634
- metadata?: unknown | null;
637
+ metadata?: Record<string, string | null> | null;
635
638
 
636
639
  /**
637
640
  * This is used for creating charges or invoices in an external system via Orb.
@@ -1031,10 +1034,9 @@ export interface CustomerUpdateParams {
1031
1034
  email_delivery?: boolean | null;
1032
1035
 
1033
1036
  /**
1034
- * User-specified key value pairs, often useful for referencing internal resources
1035
- * or IDs. Returned as-is in the customer resource.
1037
+ * User-specified key/value pairs for the resource.
1036
1038
  */
1037
- metadata?: unknown | null;
1039
+ metadata?: Record<string, string | null> | null;
1038
1040
 
1039
1041
  /**
1040
1042
  * The full name of the customer
@@ -1446,10 +1448,9 @@ export interface CustomerUpdateByExternalIDParams {
1446
1448
  email_delivery?: boolean | null;
1447
1449
 
1448
1450
  /**
1449
- * User-specified key value pairs, often useful for referencing internal resources
1450
- * or IDs. Returned as-is in the customer resource.
1451
+ * User-specified key/value pairs for the resource.
1451
1452
  */
1452
- metadata?: unknown | null;
1453
+ metadata?: Record<string, string | null> | null;
1453
1454
 
1454
1455
  /**
1455
1456
  * The full name of the customer
@@ -109,7 +109,7 @@ export class Usage extends APIResource {
109
109
  options?: Core.RequestOptions,
110
110
  ): Core.APIPromise<UsageUpdateResponse> {
111
111
  const { timeframe_end, timeframe_start, ...body } = params;
112
- return this.patch(`/customers/${id}/usage`, {
112
+ return this._client.patch(`/customers/${id}/usage`, {
113
113
  query: { timeframe_end, timeframe_start },
114
114
  body,
115
115
  ...options,
@@ -220,7 +220,7 @@ export class Usage extends APIResource {
220
220
  options?: Core.RequestOptions,
221
221
  ): Core.APIPromise<UsageUpdateByExternalIDResponse> {
222
222
  const { timeframe_end, timeframe_start, ...body } = params;
223
- return this.patch(`/customers/external_customer_id/${id}/usage`, {
223
+ return this._client.patch(`/customers/external_customer_id/${id}/usage`, {
224
224
  query: { timeframe_end, timeframe_start },
225
225
  body,
226
226
  ...options,
@@ -35,7 +35,7 @@ export class Backfills extends APIResource {
35
35
  * events.
36
36
  */
37
37
  create(body: BackfillCreateParams, options?: Core.RequestOptions): Core.APIPromise<BackfillCreateResponse> {
38
- return this.post('/events/backfills', { body, ...options });
38
+ return this._client.post('/events/backfills', { body, ...options });
39
39
  }
40
40
 
41
41
  /**
@@ -59,7 +59,7 @@ export class Backfills extends APIResource {
59
59
  if (isRequestOptions(query)) {
60
60
  return this.list({}, query);
61
61
  }
62
- return this.getAPIList('/events/backfills', BackfillListResponsesPage, { query, ...options });
62
+ return this._client.getAPIList('/events/backfills', BackfillListResponsesPage, { query, ...options });
63
63
  }
64
64
 
65
65
  /**
@@ -69,14 +69,14 @@ export class Backfills extends APIResource {
69
69
  * will transition to `reflected`.
70
70
  */
71
71
  close(backfillId: string, options?: Core.RequestOptions): Core.APIPromise<BackfillCloseResponse> {
72
- return this.post(`/events/backfills/${backfillId}/close`, options);
72
+ return this._client.post(`/events/backfills/${backfillId}/close`, options);
73
73
  }
74
74
 
75
75
  /**
76
76
  * This endpoint is used to fetch a backfill given an identifier.
77
77
  */
78
78
  fetch(backfillId: string, options?: Core.RequestOptions): Core.APIPromise<BackfillFetchResponse> {
79
- return this.get(`/events/backfills/${backfillId}`, options);
79
+ return this._client.get(`/events/backfills/${backfillId}`, options);
80
80
  }
81
81
 
82
82
  /**
@@ -89,7 +89,7 @@ export class Backfills extends APIResource {
89
89
  * result of the backfill and it will immediately transition to `reverted`.
90
90
  */
91
91
  revert(backfillId: string, options?: Core.RequestOptions): Core.APIPromise<BackfillRevertResponse> {
92
- return this.post(`/events/backfills/${backfillId}/revert`, options);
92
+ return this._client.post(`/events/backfills/${backfillId}/revert`, options);
93
93
  }
94
94
  }
95
95
 
@@ -6,7 +6,7 @@ import * as EventsAPI from "./events";
6
6
  import * as BackfillsAPI from "./backfills";
7
7
 
8
8
  export class Events extends APIResource {
9
- backfills: BackfillsAPI.Backfills = new BackfillsAPI.Backfills(this.client);
9
+ backfills: BackfillsAPI.Backfills = new BackfillsAPI.Backfills(this._client);
10
10
 
11
11
  /**
12
12
  * This endpoint is used to amend a single usage event with a given `event_id`.
@@ -58,7 +58,7 @@ export class Events extends APIResource {
58
58
  body: EventUpdateParams,
59
59
  options?: Core.RequestOptions,
60
60
  ): Core.APIPromise<EventUpdateResponse> {
61
- return this.put(`/events/${eventId}`, { body, ...options });
61
+ return this._client.put(`/events/${eventId}`, { body, ...options });
62
62
  }
63
63
 
64
64
  /**
@@ -101,7 +101,7 @@ export class Events extends APIResource {
101
101
  * deprecating events for customers not in the Orb system.
102
102
  */
103
103
  deprecate(eventId: string, options?: Core.RequestOptions): Core.APIPromise<EventDeprecateResponse> {
104
- return this.put(`/events/${eventId}/deprecate`, options);
104
+ return this._client.put(`/events/${eventId}/deprecate`, options);
105
105
  }
106
106
 
107
107
  /**
@@ -306,7 +306,7 @@ export class Events extends APIResource {
306
306
  */
307
307
  ingest(params: EventIngestParams, options?: Core.RequestOptions): Core.APIPromise<EventIngestResponse> {
308
308
  const { backfill_id, debug, ...body } = params;
309
- return this.post('/ingest', { query: { backfill_id, debug }, body, ...options });
309
+ return this._client.post('/ingest', { query: { backfill_id, debug }, body, ...options });
310
310
  }
311
311
 
312
312
  /**
@@ -329,7 +329,7 @@ export class Events extends APIResource {
329
329
  * empty array for `data` instead.
330
330
  */
331
331
  search(body: EventSearchParams, options?: Core.RequestOptions): Core.APIPromise<EventSearchResponse> {
332
- return this.post('/events/search', { body, ...options });
332
+ return this._client.post('/events/search', { body, ...options });
333
333
  }
334
334
  }
335
335
 
@@ -15,7 +15,7 @@ export class InvoiceLineItems extends APIResource {
15
15
  body: InvoiceLineItemCreateParams,
16
16
  options?: Core.RequestOptions,
17
17
  ): Core.APIPromise<InvoiceLineItemCreateResponse> {
18
- return this.post('/invoice_line_items', { body, ...options });
18
+ return this._client.post('/invoice_line_items', { body, ...options });
19
19
  }
20
20
  }
21
21
 
@@ -13,7 +13,7 @@ export class Invoices extends APIResource {
13
13
  * This endpoint is used to create a one-off invoice for a customer.
14
14
  */
15
15
  create(body: InvoiceCreateParams, options?: Core.RequestOptions): Core.APIPromise<Invoice> {
16
- return this.post('/invoices', { body, ...options });
16
+ return this._client.post('/invoices', { body, ...options });
17
17
  }
18
18
 
19
19
  /**
@@ -36,7 +36,7 @@ export class Invoices extends APIResource {
36
36
  if (isRequestOptions(query)) {
37
37
  return this.list({}, query);
38
38
  }
39
- return this.getAPIList('/invoices', InvoicesPage, { query, ...options });
39
+ return this._client.getAPIList('/invoices', InvoicesPage, { query, ...options });
40
40
  }
41
41
 
42
42
  /**
@@ -44,7 +44,7 @@ export class Invoices extends APIResource {
44
44
  * an identifier.
45
45
  */
46
46
  fetch(invoiceId: string, options?: Core.RequestOptions): Core.APIPromise<Invoice> {
47
- return this.get(`/invoices/${invoiceId}`, options);
47
+ return this._client.get(`/invoices/${invoiceId}`, options);
48
48
  }
49
49
 
50
50
  /**
@@ -64,7 +64,7 @@ export class Invoices extends APIResource {
64
64
  if (isRequestOptions(query)) {
65
65
  return this.fetchUpcoming({}, query);
66
66
  }
67
- return this.get('/invoices/upcoming', { query, ...options });
67
+ return this._client.get('/invoices/upcoming', { query, ...options });
68
68
  }
69
69
 
70
70
  /**
@@ -76,7 +76,7 @@ export class Invoices extends APIResource {
76
76
  * providers, etc).
77
77
  */
78
78
  issue(invoiceId: string, options?: Core.RequestOptions): Core.APIPromise<Invoice> {
79
- return this.post(`/invoices/${invoiceId}/issue`, options);
79
+ return this._client.post(`/invoices/${invoiceId}/issue`, options);
80
80
  }
81
81
 
82
82
  /**
@@ -88,7 +88,7 @@ export class Invoices extends APIResource {
88
88
  body: InvoiceMarkPaidParams,
89
89
  options?: Core.RequestOptions,
90
90
  ): Core.APIPromise<Invoice> {
91
- return this.post(`/invoices/${invoiceId}/mark_paid`, { body, ...options });
91
+ return this._client.post(`/invoices/${invoiceId}/mark_paid`, { body, ...options });
92
92
  }
93
93
 
94
94
  /**
@@ -101,7 +101,7 @@ export class Invoices extends APIResource {
101
101
  * customer balance upon voiding.
102
102
  */
103
103
  void(invoiceId: string, options?: Core.RequestOptions): Core.APIPromise<Invoice> {
104
- return this.post(`/invoices/${invoiceId}/void`, options);
104
+ return this._client.post(`/invoices/${invoiceId}/void`, options);
105
105
  }
106
106
  }
107
107
 
@@ -298,7 +298,11 @@ export interface Invoice {
298
298
  */
299
299
  memo: string | null;
300
300
 
301
- metadata: unknown;
301
+ /**
302
+ * User specified key-value pairs. If not provided, this defaults to an empty
303
+ * dictionary.
304
+ */
305
+ metadata: Record<string, string>;
302
306
 
303
307
  minimum: Invoice.Minimum | null;
304
308
 
@@ -1363,7 +1367,11 @@ export interface InvoiceFetchUpcomingResponse {
1363
1367
  */
1364
1368
  memo: string | null;
1365
1369
 
1366
- metadata: unknown;
1370
+ /**
1371
+ * User specified key-value pairs. If not provided, this defaults to an empty
1372
+ * dictionary.
1373
+ */
1374
+ metadata: Record<string, string>;
1367
1375
 
1368
1376
  minimum: InvoiceFetchUpcomingResponse.Minimum | null;
1369
1377
 
@@ -11,7 +11,7 @@ export class Items extends APIResource {
11
11
  * This endpoint is used to create an [Item](../guides/concepts#item).
12
12
  */
13
13
  create(body: ItemCreateParams, options?: Core.RequestOptions): Core.APIPromise<Item> {
14
- return this.post('/items', { body, ...options });
14
+ return this._client.post('/items', { body, ...options });
15
15
  }
16
16
 
17
17
  /**
@@ -27,14 +27,14 @@ export class Items extends APIResource {
27
27
  if (isRequestOptions(query)) {
28
28
  return this.list({}, query);
29
29
  }
30
- return this.getAPIList('/items', ItemsPage, { query, ...options });
30
+ return this._client.getAPIList('/items', ItemsPage, { query, ...options });
31
31
  }
32
32
 
33
33
  /**
34
34
  * This endpoint returns an item identified by its item_id.
35
35
  */
36
36
  fetch(itemId: string, options?: Core.RequestOptions): Core.APIPromise<Item> {
37
- return this.get(`/items/${itemId}`, options);
37
+ return this._client.get(`/items/${itemId}`, options);
38
38
  }
39
39
  }
40
40
 
@@ -15,7 +15,7 @@ export class Metrics extends APIResource {
15
15
  * description of constructing SQL queries with examples.
16
16
  */
17
17
  create(body: MetricCreateParams, options?: Core.RequestOptions): Core.APIPromise<MetricCreateResponse> {
18
- return this.post('/metrics', { body, ...options });
18
+ return this._client.post('/metrics', { body, ...options });
19
19
  }
20
20
 
21
21
  /**
@@ -35,7 +35,7 @@ export class Metrics extends APIResource {
35
35
  if (isRequestOptions(query)) {
36
36
  return this.list({}, query);
37
37
  }
38
- return this.getAPIList('/metrics', MetricListResponsesPage, { query, ...options });
38
+ return this._client.getAPIList('/metrics', MetricListResponsesPage, { query, ...options });
39
39
  }
40
40
 
41
41
  /**
@@ -43,7 +43,7 @@ export class Metrics extends APIResource {
43
43
  * information about the metrics including its name, description, and item.
44
44
  */
45
45
  fetch(metricId: string, options?: Core.RequestOptions): Core.APIPromise<MetricFetchResponse> {
46
- return this.get(`/metrics/${metricId}`, options);
46
+ return this._client.get(`/metrics/${metricId}`, options);
47
47
  }
48
48
  }
49
49
 
@@ -66,6 +66,10 @@ export interface MetricCreateResponse {
66
66
  */
67
67
  item: ItemsAPI.Item;
68
68
 
69
+ /**
70
+ * User specified key-value pairs. If not provided, this defaults to an empty
71
+ * dictionary.
72
+ */
69
73
  metadata: Record<string, string>;
70
74
 
71
75
  name: string;
@@ -90,6 +94,10 @@ export interface MetricListResponse {
90
94
  */
91
95
  item: ItemsAPI.Item;
92
96
 
97
+ /**
98
+ * User specified key-value pairs. If not provided, this defaults to an empty
99
+ * dictionary.
100
+ */
93
101
  metadata: Record<string, string>;
94
102
 
95
103
  name: string;
@@ -114,6 +122,10 @@ export interface MetricFetchResponse {
114
122
  */
115
123
  item: ItemsAPI.Item;
116
124
 
125
+ /**
126
+ * User specified key-value pairs. If not provided, this defaults to an empty
127
+ * dictionary.
128
+ */
117
129
  metadata: Record<string, string>;
118
130
 
119
131
  name: string;
@@ -143,10 +155,9 @@ export interface MetricCreateParams {
143
155
  sql: string;
144
156
 
145
157
  /**
146
- * User-specified key value pairs, often useful for referencing internal resources
147
- * or IDs. Returned as-is in the metric resource.
158
+ * User-specified key/value pairs for the resource.
148
159
  */
149
- metadata?: unknown | null;
160
+ metadata?: Record<string, string | null> | null;
150
161
  }
151
162
 
152
163
  export interface MetricListParams extends PageParams {
@@ -35,7 +35,7 @@ export class ExternalPlanID extends APIResource {
35
35
  if (isRequestOptions(body)) {
36
36
  return this.update(otherExternalPlanId, {}, body);
37
37
  }
38
- return this.put(`/plans/external_plan_id/${otherExternalPlanId}`, { body, ...options });
38
+ return this._client.put(`/plans/external_plan_id/${otherExternalPlanId}`, { body, ...options });
39
39
  }
40
40
 
41
41
  /**
@@ -53,7 +53,7 @@ export class ExternalPlanID extends APIResource {
53
53
  * [Price schema](../guides/concepts#plan-and-price). "
54
54
  */
55
55
  fetch(externalPlanId: string, options?: Core.RequestOptions): Core.APIPromise<PlansAPI.Plan> {
56
- return this.get(`/plans/external_plan_id/${externalPlanId}`, options);
56
+ return this._client.get(`/plans/external_plan_id/${externalPlanId}`, options);
57
57
  }
58
58
  }
59
59
 
@@ -65,7 +65,10 @@ export interface ExternalPlanIDUpdateParams {
65
65
  */
66
66
  external_plan_id?: string | null;
67
67
 
68
- metadata?: unknown | null;
68
+ /**
69
+ * User-specified key/value pairs for the resource.
70
+ */
71
+ metadata?: Record<string, string | null> | null;
69
72
  }
70
73
 
71
74
  export namespace ExternalPlanID {
@@ -10,13 +10,13 @@ import * as PricesAPI from "../prices/prices";
10
10
  import { Page, type PageParams } from "../../pagination";
11
11
 
12
12
  export class Plans extends APIResource {
13
- externalPlanId: ExternalPlanIDAPI.ExternalPlanID = new ExternalPlanIDAPI.ExternalPlanID(this.client);
13
+ externalPlanId: ExternalPlanIDAPI.ExternalPlanID = new ExternalPlanIDAPI.ExternalPlanID(this._client);
14
14
 
15
15
  /**
16
16
  * This endpoint allows creation of plans including their prices.
17
17
  */
18
18
  create(body: PlanCreateParams, options?: Core.RequestOptions): Core.APIPromise<Plan> {
19
- return this.post('/plans', { body, ...options });
19
+ return this._client.post('/plans', { body, ...options });
20
20
  }
21
21
 
22
22
  /**
@@ -35,7 +35,7 @@ export class Plans extends APIResource {
35
35
  if (isRequestOptions(body)) {
36
36
  return this.update(planId, {}, body);
37
37
  }
38
- return this.put(`/plans/${planId}`, { body, ...options });
38
+ return this._client.put(`/plans/${planId}`, { body, ...options });
39
39
  }
40
40
 
41
41
  /**
@@ -54,7 +54,7 @@ export class Plans extends APIResource {
54
54
  if (isRequestOptions(query)) {
55
55
  return this.list({}, query);
56
56
  }
57
- return this.getAPIList('/plans', PlansPage, { query, ...options });
57
+ return this._client.getAPIList('/plans', PlansPage, { query, ...options });
58
58
  }
59
59
 
60
60
  /**
@@ -77,7 +77,7 @@ export class Plans extends APIResource {
77
77
  * the serialized prices refer to all prices across all phases.
78
78
  */
79
79
  fetch(planId: string, options?: Core.RequestOptions): Core.APIPromise<Plan> {
80
- return this.get(`/plans/${planId}`, options);
80
+ return this._client.get(`/plans/${planId}`, options);
81
81
  }
82
82
  }
83
83
 
@@ -135,7 +135,11 @@ export interface Plan {
135
135
 
136
136
  maximum_amount: string | null;
137
137
 
138
- metadata: unknown;
138
+ /**
139
+ * User specified key-value pairs. If not provided, this defaults to an empty
140
+ * dictionary.
141
+ */
142
+ metadata: Record<string, string>;
139
143
 
140
144
  minimum: Plan.Minimum | null;
141
145
 
@@ -316,7 +320,10 @@ export interface PlanCreateParams {
316
320
 
317
321
  external_plan_id?: string | null;
318
322
 
319
- metadata?: unknown | null;
323
+ /**
324
+ * User-specified key/value pairs for the resource.
325
+ */
326
+ metadata?: Record<string, string | null> | null;
320
327
 
321
328
  /**
322
329
  * The net terms determines the difference between the invoice date and the issue
@@ -1127,7 +1134,10 @@ export interface PlanUpdateParams {
1127
1134
  */
1128
1135
  external_plan_id?: string | null;
1129
1136
 
1130
- metadata?: unknown | null;
1137
+ /**
1138
+ * User-specified key/value pairs for the resource.
1139
+ */
1140
+ metadata?: Record<string, string | null> | null;
1131
1141
  }
1132
1142
 
1133
1143
  export interface PlanListParams extends PageParams {
@@ -11,6 +11,6 @@ export class ExternalPriceID extends APIResource {
11
11
  * external price aliases.
12
12
  */
13
13
  fetch(externalPriceId: string, options?: Core.RequestOptions): Core.APIPromise<PricesAPI.Price> {
14
- return this.get(`/prices/external_price_id/${externalPriceId}`, options);
14
+ return this._client.get(`/prices/external_price_id/${externalPriceId}`, options);
15
15
  }
16
16
  }
@@ -9,7 +9,7 @@ import * as ExternalPriceIDAPI from "./external-price-id";
9
9
  import { Page, type PageParams } from "../../pagination";
10
10
 
11
11
  export class Prices extends APIResource {
12
- externalPriceId: ExternalPriceIDAPI.ExternalPriceID = new ExternalPriceIDAPI.ExternalPriceID(this.client);
12
+ externalPriceId: ExternalPriceIDAPI.ExternalPriceID = new ExternalPriceIDAPI.ExternalPriceID(this._client);
13
13
 
14
14
  /**
15
15
  * This endpoint is used to create a [price](../reference/price). A price created
@@ -24,7 +24,7 @@ export class Prices extends APIResource {
24
24
  * price model configurations possible in this endpoint.
25
25
  */
26
26
  create(body: PriceCreateParams, options?: Core.RequestOptions): Core.APIPromise<Price> {
27
- return this.post('/prices', { body, ...options });
27
+ return this._client.post('/prices', { body, ...options });
28
28
  }
29
29
 
30
30
  /**
@@ -40,14 +40,14 @@ export class Prices extends APIResource {
40
40
  if (isRequestOptions(query)) {
41
41
  return this.list({}, query);
42
42
  }
43
- return this.getAPIList('/prices', PricesPage, { query, ...options });
43
+ return this._client.getAPIList('/prices', PricesPage, { query, ...options });
44
44
  }
45
45
 
46
46
  /**
47
47
  * This endpoint returns a price given an identifier.
48
48
  */
49
49
  fetch(priceId: string, options?: Core.RequestOptions): Core.APIPromise<Price> {
50
- return this.get(`/prices/${priceId}`, options);
50
+ return this._client.get(`/prices/${priceId}`, options);
51
51
  }
52
52
  }
53
53