@metronome/sdk 0.1.0-beta.9 → 0.2.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 (286) hide show
  1. package/CHANGELOG.md +194 -0
  2. package/README.md +30 -46
  3. package/_shims/index.d.ts +2 -0
  4. package/_shims/index.js +5 -1
  5. package/_shims/index.mjs +5 -1
  6. package/core.d.ts +19 -5
  7. package/core.d.ts.map +1 -1
  8. package/core.js +23 -14
  9. package/core.js.map +1 -1
  10. package/core.mjs +24 -15
  11. package/core.mjs.map +1 -1
  12. package/index.d.mts +3 -2
  13. package/index.d.ts +3 -2
  14. package/index.d.ts.map +1 -1
  15. package/index.js +6 -3
  16. package/index.js.map +1 -1
  17. package/index.mjs +6 -3
  18. package/index.mjs.map +1 -1
  19. package/package.json +1 -5
  20. package/pagination.d.ts +1 -0
  21. package/pagination.d.ts.map +1 -1
  22. package/pagination.js +3 -0
  23. package/pagination.js.map +1 -1
  24. package/pagination.mjs +3 -0
  25. package/pagination.mjs.map +1 -1
  26. package/resource.d.ts +1 -1
  27. package/resource.d.ts.map +1 -1
  28. package/resource.js.map +1 -1
  29. package/resource.mjs.map +1 -1
  30. package/resources/shared.d.ts +521 -37
  31. package/resources/shared.d.ts.map +1 -1
  32. package/resources/v1/alerts.d.ts +30 -10
  33. package/resources/v1/alerts.d.ts.map +1 -1
  34. package/resources/v1/alerts.js +19 -0
  35. package/resources/v1/alerts.js.map +1 -1
  36. package/resources/v1/alerts.mjs +19 -0
  37. package/resources/v1/alerts.mjs.map +1 -1
  38. package/resources/v1/audit-logs.d.ts +8 -0
  39. package/resources/v1/audit-logs.d.ts.map +1 -1
  40. package/resources/v1/audit-logs.js.map +1 -1
  41. package/resources/v1/audit-logs.mjs.map +1 -1
  42. package/resources/v1/billable-metrics.d.ts +58 -3
  43. package/resources/v1/billable-metrics.d.ts.map +1 -1
  44. package/resources/v1/billable-metrics.js +41 -0
  45. package/resources/v1/billable-metrics.js.map +1 -1
  46. package/resources/v1/billable-metrics.mjs +41 -0
  47. package/resources/v1/billable-metrics.mjs.map +1 -1
  48. package/resources/v1/contracts/contracts.d.ts +1556 -122
  49. package/resources/v1/contracts/contracts.d.ts.map +1 -1
  50. package/resources/v1/contracts/contracts.js +180 -3
  51. package/resources/v1/contracts/contracts.js.map +1 -1
  52. package/resources/v1/contracts/contracts.mjs +180 -3
  53. package/resources/v1/contracts/contracts.mjs.map +1 -1
  54. package/resources/v1/contracts/index.d.ts +2 -2
  55. package/resources/v1/contracts/index.d.ts.map +1 -1
  56. package/resources/v1/contracts/index.js.map +1 -1
  57. package/resources/v1/contracts/index.mjs.map +1 -1
  58. package/resources/v1/contracts/named-schedules.d.ts +21 -0
  59. package/resources/v1/contracts/named-schedules.d.ts.map +1 -1
  60. package/resources/v1/contracts/named-schedules.js +21 -0
  61. package/resources/v1/contracts/named-schedules.js.map +1 -1
  62. package/resources/v1/contracts/named-schedules.mjs +21 -0
  63. package/resources/v1/contracts/named-schedules.mjs.map +1 -1
  64. package/resources/v1/contracts/products.d.ts +51 -3
  65. package/resources/v1/contracts/products.d.ts.map +1 -1
  66. package/resources/v1/contracts/products.js +33 -0
  67. package/resources/v1/contracts/products.js.map +1 -1
  68. package/resources/v1/contracts/products.mjs +33 -0
  69. package/resources/v1/contracts/products.mjs.map +1 -1
  70. package/resources/v1/contracts/rate-cards/index.d.ts +1 -1
  71. package/resources/v1/contracts/rate-cards/index.d.ts.map +1 -1
  72. package/resources/v1/contracts/rate-cards/index.js.map +1 -1
  73. package/resources/v1/contracts/rate-cards/index.mjs.map +1 -1
  74. package/resources/v1/contracts/rate-cards/named-schedules.d.ts +25 -0
  75. package/resources/v1/contracts/rate-cards/named-schedules.d.ts.map +1 -1
  76. package/resources/v1/contracts/rate-cards/named-schedules.js +25 -0
  77. package/resources/v1/contracts/rate-cards/named-schedules.js.map +1 -1
  78. package/resources/v1/contracts/rate-cards/named-schedules.mjs +25 -0
  79. package/resources/v1/contracts/rate-cards/named-schedules.mjs.map +1 -1
  80. package/resources/v1/contracts/rate-cards/product-orders.d.ts +30 -0
  81. package/resources/v1/contracts/rate-cards/product-orders.d.ts.map +1 -1
  82. package/resources/v1/contracts/rate-cards/product-orders.js +30 -0
  83. package/resources/v1/contracts/rate-cards/product-orders.js.map +1 -1
  84. package/resources/v1/contracts/rate-cards/product-orders.mjs +30 -0
  85. package/resources/v1/contracts/rate-cards/product-orders.mjs.map +1 -1
  86. package/resources/v1/contracts/rate-cards/rate-cards.d.ts +107 -10
  87. package/resources/v1/contracts/rate-cards/rate-cards.d.ts.map +1 -1
  88. package/resources/v1/contracts/rate-cards/rate-cards.js +71 -0
  89. package/resources/v1/contracts/rate-cards/rate-cards.js.map +1 -1
  90. package/resources/v1/contracts/rate-cards/rate-cards.mjs +71 -0
  91. package/resources/v1/contracts/rate-cards/rate-cards.mjs.map +1 -1
  92. package/resources/v1/contracts/rate-cards/rates.d.ts +102 -14
  93. package/resources/v1/contracts/rate-cards/rates.d.ts.map +1 -1
  94. package/resources/v1/contracts/rate-cards/rates.js +68 -0
  95. package/resources/v1/contracts/rate-cards/rates.js.map +1 -1
  96. package/resources/v1/contracts/rate-cards/rates.mjs +68 -0
  97. package/resources/v1/contracts/rate-cards/rates.mjs.map +1 -1
  98. package/resources/v1/credit-grants.d.ts +77 -2
  99. package/resources/v1/credit-grants.d.ts.map +1 -1
  100. package/resources/v1/credit-grants.js +39 -2
  101. package/resources/v1/credit-grants.js.map +1 -1
  102. package/resources/v1/credit-grants.mjs +39 -2
  103. package/resources/v1/credit-grants.mjs.map +1 -1
  104. package/resources/v1/custom-fields.d.ts +51 -7
  105. package/resources/v1/custom-fields.d.ts.map +1 -1
  106. package/resources/v1/custom-fields.js +35 -0
  107. package/resources/v1/custom-fields.js.map +1 -1
  108. package/resources/v1/custom-fields.mjs +35 -0
  109. package/resources/v1/custom-fields.mjs.map +1 -1
  110. package/resources/v1/customers/alerts.d.ts +37 -0
  111. package/resources/v1/customers/alerts.d.ts.map +1 -1
  112. package/resources/v1/customers/alerts.js +23 -0
  113. package/resources/v1/customers/alerts.js.map +1 -1
  114. package/resources/v1/customers/alerts.mjs +23 -0
  115. package/resources/v1/customers/alerts.mjs.map +1 -1
  116. package/resources/v1/customers/billing-config.d.ts +31 -0
  117. package/resources/v1/customers/billing-config.d.ts.map +1 -1
  118. package/resources/v1/customers/billing-config.js +27 -0
  119. package/resources/v1/customers/billing-config.js.map +1 -1
  120. package/resources/v1/customers/billing-config.mjs +27 -0
  121. package/resources/v1/customers/billing-config.mjs.map +1 -1
  122. package/resources/v1/customers/commits.d.ts +94 -7
  123. package/resources/v1/customers/commits.d.ts.map +1 -1
  124. package/resources/v1/customers/commits.js +56 -1
  125. package/resources/v1/customers/commits.js.map +1 -1
  126. package/resources/v1/customers/commits.mjs +56 -1
  127. package/resources/v1/customers/commits.mjs.map +1 -1
  128. package/resources/v1/customers/credits.d.ts +73 -3
  129. package/resources/v1/customers/credits.d.ts.map +1 -1
  130. package/resources/v1/customers/credits.js +41 -1
  131. package/resources/v1/customers/credits.js.map +1 -1
  132. package/resources/v1/customers/credits.mjs +41 -1
  133. package/resources/v1/customers/credits.mjs.map +1 -1
  134. package/resources/v1/customers/customers.d.ts +186 -9
  135. package/resources/v1/customers/customers.d.ts.map +1 -1
  136. package/resources/v1/customers/customers.js +106 -1
  137. package/resources/v1/customers/customers.js.map +1 -1
  138. package/resources/v1/customers/customers.mjs +106 -1
  139. package/resources/v1/customers/customers.mjs.map +1 -1
  140. package/resources/v1/customers/index.d.ts +1 -1
  141. package/resources/v1/customers/index.d.ts.map +1 -1
  142. package/resources/v1/customers/index.js.map +1 -1
  143. package/resources/v1/customers/index.mjs.map +1 -1
  144. package/resources/v1/customers/invoices.d.ts +144 -52
  145. package/resources/v1/customers/invoices.d.ts.map +1 -1
  146. package/resources/v1/customers/invoices.js +49 -0
  147. package/resources/v1/customers/invoices.js.map +1 -1
  148. package/resources/v1/customers/invoices.mjs +49 -0
  149. package/resources/v1/customers/invoices.mjs.map +1 -1
  150. package/resources/v1/customers/named-schedules.d.ts +21 -0
  151. package/resources/v1/customers/named-schedules.d.ts.map +1 -1
  152. package/resources/v1/customers/named-schedules.js +21 -0
  153. package/resources/v1/customers/named-schedules.js.map +1 -1
  154. package/resources/v1/customers/named-schedules.mjs +21 -0
  155. package/resources/v1/customers/named-schedules.mjs.map +1 -1
  156. package/resources/v1/customers/plans.d.ts +46 -1
  157. package/resources/v1/customers/plans.d.ts.map +1 -1
  158. package/resources/v1/customers/plans.js +43 -0
  159. package/resources/v1/customers/plans.js.map +1 -1
  160. package/resources/v1/customers/plans.mjs +43 -0
  161. package/resources/v1/customers/plans.mjs.map +1 -1
  162. package/resources/v1/dashboards.d.ts +31 -3
  163. package/resources/v1/dashboards.d.ts.map +1 -1
  164. package/resources/v1/dashboards.js +26 -0
  165. package/resources/v1/dashboards.js.map +1 -1
  166. package/resources/v1/dashboards.mjs +26 -0
  167. package/resources/v1/dashboards.mjs.map +1 -1
  168. package/resources/v1/index.d.ts +3 -3
  169. package/resources/v1/index.d.ts.map +1 -1
  170. package/resources/v1/index.js.map +1 -1
  171. package/resources/v1/index.mjs.map +1 -1
  172. package/resources/v1/invoices.d.ts +14 -0
  173. package/resources/v1/invoices.d.ts.map +1 -1
  174. package/resources/v1/invoices.js +14 -0
  175. package/resources/v1/invoices.js.map +1 -1
  176. package/resources/v1/invoices.mjs +14 -0
  177. package/resources/v1/invoices.mjs.map +1 -1
  178. package/resources/v1/plans.d.ts +47 -4
  179. package/resources/v1/plans.d.ts.map +1 -1
  180. package/resources/v1/plans.js +27 -0
  181. package/resources/v1/plans.js.map +1 -1
  182. package/resources/v1/plans.mjs +27 -0
  183. package/resources/v1/plans.mjs.map +1 -1
  184. package/resources/v1/pricing-units.d.ts +8 -0
  185. package/resources/v1/pricing-units.d.ts.map +1 -1
  186. package/resources/v1/pricing-units.js.map +1 -1
  187. package/resources/v1/pricing-units.mjs.map +1 -1
  188. package/resources/v1/services.d.ts +5 -0
  189. package/resources/v1/services.d.ts.map +1 -1
  190. package/resources/v1/services.js +5 -0
  191. package/resources/v1/services.js.map +1 -1
  192. package/resources/v1/services.mjs +5 -0
  193. package/resources/v1/services.mjs.map +1 -1
  194. package/resources/v1/usage.d.ts +161 -3
  195. package/resources/v1/usage.d.ts.map +1 -1
  196. package/resources/v1/usage.js +46 -0
  197. package/resources/v1/usage.js.map +1 -1
  198. package/resources/v1/usage.mjs +46 -0
  199. package/resources/v1/usage.mjs.map +1 -1
  200. package/resources/v1/v1.d.ts +6 -6
  201. package/resources/v1/v1.d.ts.map +1 -1
  202. package/resources/v1/v1.js.map +1 -1
  203. package/resources/v1/v1.mjs.map +1 -1
  204. package/resources/v2/contracts.d.ts +3241 -205
  205. package/resources/v2/contracts.d.ts.map +1 -1
  206. package/resources/v2/contracts.js +90 -2
  207. package/resources/v2/contracts.js.map +1 -1
  208. package/resources/v2/contracts.mjs +90 -2
  209. package/resources/v2/contracts.mjs.map +1 -1
  210. package/resources/webhooks.js +5 -5
  211. package/resources/webhooks.js.map +1 -1
  212. package/resources/webhooks.mjs +5 -5
  213. package/resources/webhooks.mjs.map +1 -1
  214. package/src/_shims/auto/runtime-bun.ts +1 -1
  215. package/src/_shims/auto/runtime-node.ts +1 -1
  216. package/src/_shims/auto/runtime.ts +1 -1
  217. package/src/_shims/auto/types-node.ts +1 -1
  218. package/src/_shims/bun-runtime.ts +2 -2
  219. package/src/_shims/index.d.ts +5 -3
  220. package/src/_shims/index.js +5 -1
  221. package/src/_shims/index.mjs +6 -2
  222. package/src/_shims/node-runtime.ts +3 -3
  223. package/src/_shims/registry.ts +1 -1
  224. package/src/_shims/web-runtime.ts +3 -3
  225. package/src/core.ts +46 -18
  226. package/src/error.ts +1 -1
  227. package/src/index.ts +22 -16
  228. package/src/internal/qs/formats.ts +1 -1
  229. package/src/internal/qs/index.ts +3 -3
  230. package/src/internal/qs/stringify.ts +3 -3
  231. package/src/internal/qs/utils.ts +2 -2
  232. package/src/pagination.ts +5 -1
  233. package/src/resource.ts +2 -2
  234. package/src/resources/index.ts +4 -4
  235. package/src/resources/shared.ts +605 -40
  236. package/src/resources/v1/alerts.ts +33 -13
  237. package/src/resources/v1/audit-logs.ts +12 -4
  238. package/src/resources/v1/billable-metrics.ts +57 -8
  239. package/src/resources/v1/contracts/contracts.ts +1723 -135
  240. package/src/resources/v1/contracts/index.ts +8 -4
  241. package/src/resources/v1/contracts/named-schedules.ts +23 -2
  242. package/src/resources/v1/contracts/products.ts +53 -9
  243. package/src/resources/v1/contracts/rate-cards/index.ts +6 -4
  244. package/src/resources/v1/contracts/rate-cards/named-schedules.ts +27 -2
  245. package/src/resources/v1/contracts/rate-cards/product-orders.ts +33 -3
  246. package/src/resources/v1/contracts/rate-cards/rate-cards.ts +113 -20
  247. package/src/resources/v1/contracts/rate-cards/rates.ts +86 -18
  248. package/src/resources/v1/contracts/rate-cards.ts +1 -1
  249. package/src/resources/v1/contracts.ts +1 -1
  250. package/src/resources/v1/credit-grants.ts +82 -10
  251. package/src/resources/v1/custom-fields.ts +57 -9
  252. package/src/resources/v1/customers/alerts.ts +44 -3
  253. package/src/resources/v1/customers/billing-config.ts +34 -2
  254. package/src/resources/v1/customers/commits.ts +97 -10
  255. package/src/resources/v1/customers/credits.ts +76 -6
  256. package/src/resources/v1/customers/customers.ts +208 -27
  257. package/src/resources/v1/customers/index.ts +10 -8
  258. package/src/resources/v1/customers/invoices.ts +123 -57
  259. package/src/resources/v1/customers/named-schedules.ts +23 -2
  260. package/src/resources/v1/customers/plans.ts +48 -5
  261. package/src/resources/v1/customers.ts +1 -1
  262. package/src/resources/v1/dashboards.ts +33 -5
  263. package/src/resources/v1/index.ts +20 -14
  264. package/src/resources/v1/invoices.ts +16 -2
  265. package/src/resources/v1/plans.ts +45 -10
  266. package/src/resources/v1/pricing-units.ts +12 -4
  267. package/src/resources/v1/services.ts +7 -2
  268. package/src/resources/v1/usage.ts +187 -6
  269. package/src/resources/v1/v1.ts +39 -27
  270. package/src/resources/v1.ts +1 -1
  271. package/src/resources/v2/contracts.ts +3838 -261
  272. package/src/resources/v2/index.ts +2 -2
  273. package/src/resources/v2/v2.ts +3 -3
  274. package/src/resources/v2.ts +1 -1
  275. package/src/resources/webhooks.ts +7 -7
  276. package/src/resources.ts +1 -1
  277. package/src/shims/node.ts +3 -3
  278. package/src/shims/web.ts +3 -3
  279. package/src/uploads.ts +4 -4
  280. package/src/version.ts +1 -1
  281. package/version.d.ts +1 -1
  282. package/version.d.ts.map +1 -1
  283. package/version.js +1 -1
  284. package/version.js.map +1 -1
  285. package/version.mjs +1 -1
  286. package/version.mjs.map +1 -1
@@ -1,13 +1,23 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../../resource';
4
- import * as Core from '../../../core';
5
- import * as Shared from '../../shared';
6
- import { CursorPage, type CursorPageParams } from '../../../pagination';
3
+ import { APIResource } from "../../../resource.js";
4
+ import * as Core from "../../../core.js";
5
+ import * as Shared from "../../shared.js";
6
+ import { CursorPage, type CursorPageParams } from "../../../pagination.js";
7
7
 
8
8
  export class Invoices extends APIResource {
9
9
  /**
10
10
  * Fetch a specific invoice for a given customer.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const invoice = await client.v1.customers.invoices.retrieve(
15
+ * {
16
+ * customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
17
+ * invoice_id: '6a37bb88-8538-48c5-b37b-a41c836328bd',
18
+ * },
19
+ * );
20
+ * ```
11
21
  */
12
22
  retrieve(
13
23
  params: InvoiceRetrieveParams,
@@ -20,6 +30,16 @@ export class Invoices extends APIResource {
20
30
  /**
21
31
  * List all invoices for a given customer, optionally filtered by status, date
22
32
  * range, and/or credit type.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * // Automatically fetches more pages as needed.
37
+ * for await (const invoice of client.v1.customers.invoices.list(
38
+ * { customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc' },
39
+ * )) {
40
+ * // ...
41
+ * }
42
+ * ```
23
43
  */
24
44
  list(
25
45
  params: InvoiceListParams,
@@ -34,6 +54,21 @@ export class Invoices extends APIResource {
34
54
 
35
55
  /**
36
56
  * Add a one time charge to the specified invoice
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const response =
61
+ * await client.v1.customers.invoices.addCharge({
62
+ * customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
63
+ * charge_id: '5ae4b726-1ebe-439c-9190-9831760ba195',
64
+ * customer_plan_id:
65
+ * 'a23b3cf4-47fb-4c3f-bb3d-9e64f7704015',
66
+ * description: 'One time charge',
67
+ * invoice_start_timestamp: '2024-01-01T00:00:00Z',
68
+ * price: 250,
69
+ * quantity: 1,
70
+ * });
71
+ * ```
37
72
  */
38
73
  addCharge(
39
74
  params: InvoiceAddChargeParams,
@@ -49,6 +84,20 @@ export class Invoices extends APIResource {
49
84
  *
50
85
  * - If we receive backdated usage after an invoice has been finalized, the
51
86
  * backdated usage will be included in the response and usage numbers may differ.
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * // Automatically fetches more pages as needed.
91
+ * for await (const invoiceListBreakdownsResponse of client.v1.customers.invoices.listBreakdowns(
92
+ * {
93
+ * customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
94
+ * ending_before: '2019-12-27T18:11:19.117Z',
95
+ * starting_on: '2019-12-27T18:11:19.117Z',
96
+ * },
97
+ * )) {
98
+ * // ...
99
+ * }
100
+ * ```
52
101
  */
53
102
  listBreakdowns(
54
103
  params: InvoiceListBreakdownsParams,
@@ -89,7 +138,7 @@ export interface Invoice {
89
138
  */
90
139
  billable_status?: 'billable' | 'unbillable';
91
140
 
92
- contract_custom_fields?: Record<string, string>;
141
+ contract_custom_fields?: { [key: string]: string };
93
142
 
94
143
  contract_id?: string;
95
144
 
@@ -101,9 +150,9 @@ export interface Invoice {
101
150
  */
102
151
  created_at?: string;
103
152
 
104
- custom_fields?: Record<string, unknown>;
153
+ custom_fields?: { [key: string]: unknown };
105
154
 
106
- customer_custom_fields?: Record<string, string>;
155
+ customer_custom_fields?: { [key: string]: string };
107
156
 
108
157
  /**
109
158
  * End of the usage period this invoice covers (UTC)
@@ -126,14 +175,14 @@ export interface Invoice {
126
175
  */
127
176
  netsuite_sales_order_id?: string;
128
177
 
129
- plan_custom_fields?: Record<string, string>;
178
+ plan_custom_fields?: { [key: string]: string };
130
179
 
131
180
  plan_id?: string;
132
181
 
133
182
  plan_name?: string;
134
183
 
135
184
  /**
136
- * only present for beta contract invoices with reseller royalties
185
+ * Only present for contract invoices with reseller royalties.
137
186
  */
138
187
  reseller_royalty?: Invoice.ResellerRoyalty;
139
188
 
@@ -159,46 +208,45 @@ export namespace Invoice {
159
208
  total: number;
160
209
 
161
210
  /**
162
- * only present for beta contract invoices
211
+ * Details about the credit or commit that was applied to this line item. Only
212
+ * present on line items with product of `USAGE`, `SUBSCRIPTION` or `COMPOSITE`
213
+ * types.
163
214
  */
164
215
  applied_commit_or_credit?: LineItem.AppliedCommitOrCredit;
165
216
 
166
- /**
167
- * only present for beta contract invoices
168
- */
169
- commit_custom_fields?: Record<string, string>;
217
+ commit_custom_fields?: { [key: string]: string };
170
218
 
171
219
  /**
172
- * only present for beta contract invoices
220
+ * For line items with product of `USAGE`, `SUBSCRIPTION`, or `COMPOSITE` types,
221
+ * the ID of the credit or commit that was applied to this line item. For line
222
+ * items with product type of `FIXED`, the ID of the prepaid or postpaid commit
223
+ * that is being paid for.
173
224
  */
174
225
  commit_id?: string;
175
226
 
176
- /**
177
- * only present for beta contract invoices. This field's availability is dependent
178
- * on your client's configuration.
179
- */
180
227
  commit_netsuite_item_id?: string;
181
228
 
182
- /**
183
- * only present for beta contract invoices. This field's availability is dependent
184
- * on your client's configuration.
185
- */
186
229
  commit_netsuite_sales_order_id?: string;
187
230
 
188
- /**
189
- * only present for beta contract invoices
190
- */
191
231
  commit_segment_id?: string;
192
232
 
193
233
  /**
194
- * only present for beta contract invoices
234
+ * `PrepaidCommit` (for commit types `PREPAID` and `CREDIT`) or `PostpaidCommit`
235
+ * (for commit type `POSTPAID`).
195
236
  */
196
237
  commit_type?: string;
197
238
 
198
- custom_fields?: Record<string, string>;
239
+ custom_fields?: { [key: string]: string };
240
+
241
+ discount_custom_fields?: { [key: string]: string };
242
+
243
+ /**
244
+ * ID of the discount applied to this line item.
245
+ */
246
+ discount_id?: string;
199
247
 
200
248
  /**
201
- * only present for beta contract invoices
249
+ * The line item's end date (exclusive).
202
250
  */
203
251
  ending_before?: string;
204
252
 
@@ -207,12 +255,12 @@ export namespace Invoice {
207
255
  group_value?: string | null;
208
256
 
209
257
  /**
210
- * only present for beta contract invoices
258
+ * Indicates whether the line item is prorated for `SUBSCRIPTION` type product.
211
259
  */
212
260
  is_prorated?: boolean;
213
261
 
214
262
  /**
215
- * Only present for contract invoices and when the include_list_prices query
263
+ * Only present for contract invoices and when the `include_list_prices` query
216
264
  * parameter is set to true. This will include the list rate for the charge if
217
265
  * applicable. Only present for usage and subscription line items.
218
266
  */
@@ -230,74 +278,89 @@ export namespace Invoice {
230
278
  */
231
279
  netsuite_invoice_billing_start?: string;
232
280
 
233
- /**
234
- * only present for beta contract invoices. This field's availability is dependent
235
- * on your client's configuration.
236
- */
237
281
  netsuite_item_id?: string;
238
282
 
239
283
  /**
240
- * only present for beta contract invoices
284
+ * Only present for line items paying for a postpaid commit true-up.
241
285
  */
242
286
  postpaid_commit?: LineItem.PostpaidCommit;
243
287
 
244
288
  /**
245
- * if presentation groups are used, this will contain the values used to break down
246
- * the line item
289
+ * Includes the presentation group values associated with this line item if
290
+ * presentation group keys are used.
247
291
  */
248
- presentation_group_values?: Record<string, string | null>;
292
+ presentation_group_values?: { [key: string]: string | null };
249
293
 
250
294
  /**
251
- * if pricing groups are used, this will contain the values used to calculate the
252
- * price
295
+ * Includes the pricing group values associated with this line item if dimensional
296
+ * pricing is used.
253
297
  */
254
- pricing_group_values?: Record<string, string>;
298
+ pricing_group_values?: { [key: string]: string };
255
299
 
256
- product_custom_fields?: Record<string, string>;
300
+ product_custom_fields?: { [key: string]: string };
257
301
 
302
+ /**
303
+ * ID of the product associated with the line item.
304
+ */
258
305
  product_id?: string;
259
306
 
260
- product_type?: string;
261
-
262
307
  /**
263
- * only present for beta contract invoices
308
+ * The current product tags associated with the line item's `product_id`.
264
309
  */
265
- professional_service_custom_fields?: Record<string, string>;
310
+ product_tags?: Array<string>;
266
311
 
267
312
  /**
268
- * only present for beta contract invoices
313
+ * The type of the line item's product. Possible values are `FixedProductListItem`
314
+ * (for `FIXED` type products), `UsageProductListItem` (for `USAGE` type products),
315
+ * `SubscriptionProductListItem` (for `SUBSCRIPTION` type products) or
316
+ * `CompositeProductListItem` (for `COMPOSITE` type products). For scheduled
317
+ * charges, commit and credit payments, the value is `FixedProductListItem`.
269
318
  */
319
+ product_type?: string;
320
+
321
+ professional_service_custom_fields?: { [key: string]: string };
322
+
270
323
  professional_service_id?: string;
271
324
 
325
+ /**
326
+ * The quantity associated with the line item.
327
+ */
272
328
  quantity?: number;
273
329
 
274
330
  reseller_type?: 'AWS' | 'AWS_PRO_SERVICE' | 'GCP' | 'GCP_PRO_SERVICE';
275
331
 
276
- scheduled_charge_custom_fields?: Record<string, string>;
332
+ scheduled_charge_custom_fields?: { [key: string]: string };
277
333
 
278
334
  /**
279
- * only present for beta contract invoices
335
+ * ID of scheduled charge.
280
336
  */
281
337
  scheduled_charge_id?: string;
282
338
 
283
339
  /**
284
- * only present for beta contract invoices
340
+ * The line item's start date (inclusive).
285
341
  */
286
342
  starting_at?: string;
287
343
 
288
344
  sub_line_items?: Array<LineItem.SubLineItem>;
289
345
 
346
+ subscription_custom_fields?: { [key: string]: string };
347
+
348
+ /**
349
+ * Populated if the line item has a tiered price.
350
+ */
290
351
  tier?: LineItem.Tier;
291
352
 
292
353
  /**
293
- * only present for beta contract invoices
354
+ * The unit price associated with the line item.
294
355
  */
295
356
  unit_price?: number;
296
357
  }
297
358
 
298
359
  export namespace LineItem {
299
360
  /**
300
- * only present for beta contract invoices
361
+ * Details about the credit or commit that was applied to this line item. Only
362
+ * present on line items with product of `USAGE`, `SUBSCRIPTION` or `COMPOSITE`
363
+ * types.
301
364
  */
302
365
  export interface AppliedCommitOrCredit {
303
366
  id: string;
@@ -306,14 +369,14 @@ export namespace Invoice {
306
369
  }
307
370
 
308
371
  /**
309
- * only present for beta contract invoices
372
+ * Only present for line items paying for a postpaid commit true-up.
310
373
  */
311
374
  export interface PostpaidCommit {
312
375
  id: string;
313
376
  }
314
377
 
315
378
  export interface SubLineItem {
316
- custom_fields: Record<string, string>;
379
+ custom_fields: { [key: string]: string };
317
380
 
318
381
  name: string;
319
382
 
@@ -373,6 +436,9 @@ export namespace Invoice {
373
436
  }
374
437
  }
375
438
 
439
+ /**
440
+ * Populated if the line item has a tiered price.
441
+ */
376
442
  export interface Tier {
377
443
  level: number;
378
444
 
@@ -459,13 +525,13 @@ export namespace Invoice {
459
525
 
460
526
  total: number;
461
527
 
462
- credit_grant_custom_fields?: Record<string, string>;
528
+ credit_grant_custom_fields?: { [key: string]: string };
463
529
 
464
530
  credit_grant_id?: string;
465
531
  }
466
532
 
467
533
  /**
468
- * only present for beta contract invoices with reseller royalties
534
+ * Only present for contract invoices with reseller royalties.
469
535
  */
470
536
  export interface ResellerRoyalty {
471
537
  fraction: string;
@@ -1,12 +1,22 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../../resource';
4
- import * as Core from '../../../core';
3
+ import { APIResource } from "../../../resource.js";
4
+ import * as Core from "../../../core.js";
5
5
 
6
6
  export class NamedSchedules extends APIResource {
7
7
  /**
8
8
  * Get a named schedule for the given customer. This endpoint's availability is
9
9
  * dependent on your client's configuration.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const namedSchedule =
14
+ * await client.v1.customers.namedSchedules.retrieve({
15
+ * customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
16
+ * schedule_name: 'my-schedule',
17
+ * covering_date: '2022-02-15T00:00:00Z',
18
+ * });
19
+ * ```
10
20
  */
11
21
  retrieve(
12
22
  body: NamedScheduleRetrieveParams,
@@ -18,6 +28,17 @@ export class NamedSchedules extends APIResource {
18
28
  /**
19
29
  * Update a named schedule for the given customer. This endpoint's availability is
20
30
  * dependent on your client's configuration.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * await client.v1.customers.namedSchedules.update({
35
+ * customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
36
+ * schedule_name: 'my-schedule',
37
+ * starting_at: '2022-02-01T00:00:00Z',
38
+ * value: { my_key: 'my_value' },
39
+ * ending_before: '2022-02-15T00:00:00Z',
40
+ * });
41
+ * ```
21
42
  */
22
43
  update(body: NamedScheduleUpdateParams, options?: Core.RequestOptions): Core.APIPromise<void> {
23
44
  return this._client.post('/v1/customers/updateNamedSchedule', {
@@ -1,13 +1,23 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../../resource';
4
- import * as Core from '../../../core';
5
- import * as Shared from '../../shared';
6
- import { CursorPage, type CursorPageParams } from '../../../pagination';
3
+ import { APIResource } from "../../../resource.js";
4
+ import * as Core from "../../../core.js";
5
+ import * as Shared from "../../shared.js";
6
+ import { CursorPage, type CursorPageParams } from "../../../pagination.js";
7
7
 
8
8
  export class Plans extends APIResource {
9
9
  /**
10
10
  * List the given customer's plans in reverse-chronological order.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * // Automatically fetches more pages as needed.
15
+ * for await (const planListResponse of client.v1.customers.plans.list(
16
+ * { customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc' },
17
+ * )) {
18
+ * // ...
19
+ * }
20
+ * ```
11
21
  */
12
22
  list(
13
23
  params: PlanListParams,
@@ -24,6 +34,16 @@ export class Plans extends APIResource {
24
34
  * Associate an existing customer with a plan for a specified date range. See the
25
35
  * [price adjustments documentation](https://plans-docs.metronome.com/pricing/managing-plans/#price-adjustments)
26
36
  * for details on the price adjustments.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const response = await client.v1.customers.plans.add({
41
+ * customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
42
+ * plan_id: 'd2c06dae-9549-4d7d-bc04-b78dd3d241b8',
43
+ * starting_on: '2021-02-01T00:00:00Z',
44
+ * ending_before: '2022-02-01T00:00:00Z',
45
+ * });
46
+ * ```
27
47
  */
28
48
  add(params: PlanAddParams, options?: Core.RequestOptions): Core.APIPromise<PlanAddResponse> {
29
49
  const { customer_id, ...body } = params;
@@ -32,6 +52,15 @@ export class Plans extends APIResource {
32
52
 
33
53
  /**
34
54
  * Change the end date of a customer's plan.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const response = await client.v1.customers.plans.end({
59
+ * customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
60
+ * customer_plan_id: '7aa11640-0703-4600-8eb9-293f535a6b74',
61
+ * ending_before: '2021-02-01T00:00:00Z',
62
+ * });
63
+ * ```
35
64
  */
36
65
  end(params: PlanEndParams, options?: Core.RequestOptions): Core.APIPromise<PlanEndResponse> {
37
66
  const { customer_id, customer_plan_id, ...body } = params;
@@ -45,6 +74,20 @@ export class Plans extends APIResource {
45
74
  * Lists a customer plans adjustments. See the
46
75
  * [price adjustments documentation](https://plans-docs.metronome.com/pricing/managing-plans/#price-adjustments)
47
76
  * for details.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * // Automatically fetches more pages as needed.
81
+ * for await (const planListPriceAdjustmentsResponse of client.v1.customers.plans.listPriceAdjustments(
82
+ * {
83
+ * customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
84
+ * customer_plan_id:
85
+ * '7aa11640-0703-4600-8eb9-293f535a6b74',
86
+ * },
87
+ * )) {
88
+ * // ...
89
+ * }
90
+ * ```
48
91
  */
49
92
  listPriceAdjustments(
50
93
  params: PlanListPriceAdjustmentsParams,
@@ -69,7 +112,7 @@ export interface PlanListResponse {
69
112
  */
70
113
  id: string;
71
114
 
72
- custom_fields: Record<string, string>;
115
+ custom_fields: { [key: string]: string };
73
116
 
74
117
  plan_description: string;
75
118
 
@@ -1,3 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export * from './customers/index';
3
+ export * from "./customers/index.js";
@@ -1,13 +1,39 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../resource';
4
- import * as Core from '../../core';
3
+ import { APIResource } from "../../resource.js";
4
+ import * as Core from "../../core.js";
5
5
 
6
6
  export class Dashboards extends APIResource {
7
7
  /**
8
8
  * Retrieve an embeddable dashboard url for a customer. The dashboard can be
9
9
  * embedded using an iframe in a website. This will show information such as usage
10
10
  * data and customer invoices.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const response =
15
+ * await client.v1.dashboards.getEmbeddableURL({
16
+ * customer_id: '4db51251-61de-4bfe-b9ce-495e244f3491',
17
+ * dashboard: 'invoices',
18
+ * bm_group_key_overrides: [
19
+ * {
20
+ * group_key_name: 'tenant_id',
21
+ * display_name: 'Org ID',
22
+ * value_display_names: {
23
+ * '48ecb18f358f': 'Cluster EU',
24
+ * e358f3ce242d: 'Cluster APAC',
25
+ * },
26
+ * },
27
+ * ],
28
+ * color_overrides: [
29
+ * { name: 'Gray_dark', value: '#ff0000' },
30
+ * ],
31
+ * dashboard_options: [
32
+ * { key: 'show_zero_usage_line_items', value: 'false' },
33
+ * { key: 'hide_voided_invoices', value: 'true' },
34
+ * ],
35
+ * });
36
+ * ```
11
37
  */
12
38
  getEmbeddableURL(
13
39
  body: DashboardGetEmbeddableURLParams,
@@ -33,7 +59,7 @@ export interface DashboardGetEmbeddableURLParams {
33
59
  /**
34
60
  * The type of dashboard to retrieve.
35
61
  */
36
- dashboard: 'invoices' | 'usage' | 'credits';
62
+ dashboard: 'invoices' | 'usage' | 'credits' | 'commits_and_credits';
37
63
 
38
64
  /**
39
65
  * Optional list of billable metric group key overrides
@@ -67,7 +93,7 @@ export namespace DashboardGetEmbeddableURLParams {
67
93
  * <key, value> pairs of the billable metric group key values and their display
68
94
  * names. e.g. {"a": "Asia", "b": "Euro"}
69
95
  */
70
- value_display_names?: Record<string, unknown>;
96
+ value_display_names?: { [key: string]: unknown };
71
97
  }
72
98
 
73
99
  export interface ColorOverride {
@@ -93,7 +119,9 @@ export namespace DashboardGetEmbeddableURLParams {
93
119
  | 'UsageLine_8'
94
120
  | 'UsageLine_9'
95
121
  | 'Primary_green'
96
- | 'Primary_red';
122
+ | 'Primary_red'
123
+ | 'Progress_bar'
124
+ | 'Progress_bar_background';
97
125
 
98
126
  /**
99
127
  * Hex value representation of the color