@metronome/sdk 0.1.0-beta.9 → 0.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 (286) hide show
  1. package/CHANGELOG.md +179 -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 -1
  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 +473 -37
  31. package/resources/shared.d.ts.map +1 -1
  32. package/resources/v1/alerts.d.ts +26 -2
  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 +1478 -102
  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 +28 -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 +30 -2
  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 +2923 -207
  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 +539 -40
  236. package/src/resources/v1/alerts.ts +29 -5
  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 +1643 -124
  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 +32 -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 +30 -4
  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 +3397 -235
  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
@@ -10,6 +10,7 @@ export {
10
10
  type ContractCreateHistoricalInvoicesResponse,
11
11
  type ContractListBalancesResponse,
12
12
  type ContractRetrieveRateScheduleResponse,
13
+ type ContractRetrieveSubscriptionQuantityHistoryResponse,
13
14
  type ContractScheduleProServicesInvoiceResponse,
14
15
  type ContractUpdateEndDateResponse,
15
16
  type ContractCreateParams,
@@ -21,16 +22,17 @@ export {
21
22
  type ContractCreateHistoricalInvoicesParams,
22
23
  type ContractListBalancesParams,
23
24
  type ContractRetrieveRateScheduleParams,
25
+ type ContractRetrieveSubscriptionQuantityHistoryParams,
24
26
  type ContractScheduleProServicesInvoiceParams,
25
27
  type ContractSetUsageFilterParams,
26
28
  type ContractUpdateEndDateParams,
27
- } from './contracts';
29
+ } from "./contracts.js";
28
30
  export {
29
31
  NamedSchedules,
30
32
  type NamedScheduleRetrieveResponse,
31
33
  type NamedScheduleRetrieveParams,
32
34
  type NamedScheduleUpdateParams,
33
- } from './named-schedules';
35
+ } from "./named-schedules.js";
34
36
  export {
35
37
  ProductListResponsesCursorPage,
36
38
  Products,
@@ -47,7 +49,7 @@ export {
47
49
  type ProductUpdateParams,
48
50
  type ProductListParams,
49
51
  type ProductArchiveParams,
50
- } from './products';
52
+ } from "./products.js";
51
53
  export {
52
54
  RateCardListResponsesCursorPage,
53
55
  RateCards,
@@ -55,10 +57,12 @@ export {
55
57
  type RateCardRetrieveResponse,
56
58
  type RateCardUpdateResponse,
57
59
  type RateCardListResponse,
60
+ type RateCardArchiveResponse,
58
61
  type RateCardRetrieveRateScheduleResponse,
59
62
  type RateCardCreateParams,
60
63
  type RateCardRetrieveParams,
61
64
  type RateCardUpdateParams,
62
65
  type RateCardListParams,
66
+ type RateCardArchiveParams,
63
67
  type RateCardRetrieveRateScheduleParams,
64
- } from './rate-cards/index';
68
+ } from "./rate-cards/index.js";
@@ -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 rate card. 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.contracts.namedSchedules.retrieve({
15
+ * rate_card_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
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 rate card. This endpoint's availability is
20
30
  * dependent on your client's configuration.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * await client.v1.contracts.namedSchedules.update({
35
+ * rate_card_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
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/contract-pricing/rate-cards/updateNamedSchedule', {
@@ -1,15 +1,25 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../../resource';
4
- import { isRequestOptions } from '../../../core';
5
- import * as Core from '../../../core';
6
- import * as ProductsAPI from './products';
7
- import * as Shared from '../../shared';
8
- import { CursorPage, type CursorPageParams } from '../../../pagination';
3
+ import { APIResource } from "../../../resource.js";
4
+ import { isRequestOptions } from "../../../core.js";
5
+ import * as Core from "../../../core.js";
6
+ import * as ProductsAPI from "./products.js";
7
+ import * as Shared from "../../shared.js";
8
+ import { CursorPage, type CursorPageParams } from "../../../pagination.js";
9
9
 
10
10
  export class Products extends APIResource {
11
11
  /**
12
12
  * Create a new product
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const product = await client.v1.contracts.products.create({
17
+ * name: 'My Product',
18
+ * type: 'USAGE',
19
+ * billable_metric_id:
20
+ * '13117714-3f05-48e5-a6e9-a66093f13b4d',
21
+ * });
22
+ * ```
13
23
  */
14
24
  create(body: ProductCreateParams, options?: Core.RequestOptions): Core.APIPromise<ProductCreateResponse> {
15
25
  return this._client.post('/v1/contract-pricing/products/create', { body, ...options });
@@ -17,6 +27,13 @@ export class Products extends APIResource {
17
27
 
18
28
  /**
19
29
  * Get a specific product
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const product = await client.v1.contracts.products.retrieve(
34
+ * { id: 'd84e7f4e-7a70-4fe4-be02-7a5027beffcc' },
35
+ * );
36
+ * ```
20
37
  */
21
38
  retrieve(
22
39
  body: ProductRetrieveParams,
@@ -27,6 +44,15 @@ export class Products extends APIResource {
27
44
 
28
45
  /**
29
46
  * Update a product
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const product = await client.v1.contracts.products.update({
51
+ * product_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
52
+ * starting_at: '2020-01-01T00:00:00.000Z',
53
+ * name: 'My Updated Product',
54
+ * });
55
+ * ```
30
56
  */
31
57
  update(body: ProductUpdateParams, options?: Core.RequestOptions): Core.APIPromise<ProductUpdateResponse> {
32
58
  return this._client.post('/v1/contract-pricing/products/update', { body, ...options });
@@ -34,6 +60,16 @@ export class Products extends APIResource {
34
60
 
35
61
  /**
36
62
  * List products
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * // Automatically fetches more pages as needed.
67
+ * for await (const productListResponse of client.v1.contracts.products.list(
68
+ * { archive_filter: 'NOT_ARCHIVED' },
69
+ * )) {
70
+ * // ...
71
+ * }
72
+ * ```
37
73
  */
38
74
  list(
39
75
  params?: ProductListParams,
@@ -58,6 +94,13 @@ export class Products extends APIResource {
58
94
 
59
95
  /**
60
96
  * Archive a product
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const response = await client.v1.contracts.products.archive(
101
+ * { product_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc' },
102
+ * );
103
+ * ```
61
104
  */
62
105
  archive(
63
106
  body: ProductArchiveParams,
@@ -198,7 +241,7 @@ export namespace ProductRetrieveResponse {
198
241
 
199
242
  archived_at?: string | null;
200
243
 
201
- custom_fields?: Record<string, string>;
244
+ custom_fields?: { [key: string]: string };
202
245
  }
203
246
 
204
247
  export namespace Data {
@@ -287,7 +330,7 @@ export interface ProductListResponse {
287
330
 
288
331
  archived_at?: string | null;
289
332
 
290
- custom_fields?: Record<string, string>;
333
+ custom_fields?: { [key: string]: string };
291
334
  }
292
335
 
293
336
  export namespace ProductListResponse {
@@ -550,7 +593,8 @@ export interface ProductUpdateParams {
550
593
 
551
594
  export interface ProductListParams extends CursorPageParams {
552
595
  /**
553
- * Body param: Filter options for the product list
596
+ * Body param: Filter options for the product list. If not provided, defaults to
597
+ * not archived.
554
598
  */
555
599
  archive_filter?: 'ARCHIVED' | 'NOT_ARCHIVED' | 'ALL';
556
600
  }
@@ -5,14 +5,14 @@ export {
5
5
  type NamedScheduleRetrieveResponse,
6
6
  type NamedScheduleRetrieveParams,
7
7
  type NamedScheduleUpdateParams,
8
- } from './named-schedules';
8
+ } from "./named-schedules.js";
9
9
  export {
10
10
  ProductOrders,
11
11
  type ProductOrderUpdateResponse,
12
12
  type ProductOrderSetResponse,
13
13
  type ProductOrderUpdateParams,
14
14
  type ProductOrderSetParams,
15
- } from './product-orders';
15
+ } from "./product-orders.js";
16
16
  export {
17
17
  RateCardListResponsesCursorPage,
18
18
  RateCards,
@@ -20,13 +20,15 @@ export {
20
20
  type RateCardRetrieveResponse,
21
21
  type RateCardUpdateResponse,
22
22
  type RateCardListResponse,
23
+ type RateCardArchiveResponse,
23
24
  type RateCardRetrieveRateScheduleResponse,
24
25
  type RateCardCreateParams,
25
26
  type RateCardRetrieveParams,
26
27
  type RateCardUpdateParams,
27
28
  type RateCardListParams,
29
+ type RateCardArchiveParams,
28
30
  type RateCardRetrieveRateScheduleParams,
29
- } from './rate-cards';
31
+ } from "./rate-cards.js";
30
32
  export {
31
33
  RateListResponsesCursorPage,
32
34
  Rates,
@@ -36,4 +38,4 @@ export {
36
38
  type RateListParams,
37
39
  type RateAddParams,
38
40
  type RateAddManyParams,
39
- } from './rates';
41
+ } from "./rates.js";
@@ -1,12 +1,25 @@
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 contract. 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.contracts.rateCards.namedSchedules.retrieve(
15
+ * {
16
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
17
+ * customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
18
+ * schedule_name: 'my-schedule',
19
+ * covering_date: '2022-02-15T00:00:00Z',
20
+ * },
21
+ * );
22
+ * ```
10
23
  */
11
24
  retrieve(
12
25
  body: NamedScheduleRetrieveParams,
@@ -18,6 +31,18 @@ export class NamedSchedules extends APIResource {
18
31
  /**
19
32
  * Update a named schedule for the given contract. This endpoint's availability is
20
33
  * dependent on your client's configuration.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * await client.v1.contracts.rateCards.namedSchedules.update({
38
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
39
+ * customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
40
+ * schedule_name: 'my-schedule',
41
+ * starting_at: '2022-02-01T00:00:00Z',
42
+ * value: { my_key: 'my_value' },
43
+ * ending_before: '2022-02-15T00:00:00Z',
44
+ * });
45
+ * ```
21
46
  */
22
47
  update(body: NamedScheduleUpdateParams, options?: Core.RequestOptions): Core.APIPromise<void> {
23
48
  return this._client.post('/v1/contracts/updateNamedSchedule', {
@@ -1,12 +1,30 @@
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';
3
+ import { APIResource } from "../../../../resource.js";
4
+ import * as Core from "../../../../core.js";
5
+ import * as Shared from "../../../shared.js";
6
6
 
7
7
  export class ProductOrders extends APIResource {
8
8
  /**
9
9
  * Updates ordering of specified products
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const productOrder =
14
+ * await client.v1.contracts.rateCards.productOrders.update({
15
+ * product_moves: [
16
+ * {
17
+ * product_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
18
+ * position: 0,
19
+ * },
20
+ * {
21
+ * product_id: 'b086f2f4-9851-4466-9ca0-30d53e6a42ac',
22
+ * position: 1,
23
+ * },
24
+ * ],
25
+ * rate_card_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
26
+ * });
27
+ * ```
10
28
  */
11
29
  update(
12
30
  body: ProductOrderUpdateParams,
@@ -17,6 +35,18 @@ export class ProductOrders extends APIResource {
17
35
 
18
36
  /**
19
37
  * Sets the ordering of products within a rate card
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const response =
42
+ * await client.v1.contracts.rateCards.productOrders.set({
43
+ * product_order: [
44
+ * '13117714-3f05-48e5-a6e9-a66093f13b4d',
45
+ * 'b086f2f4-9851-4466-9ca0-30d53e6a42ac',
46
+ * ],
47
+ * rate_card_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
48
+ * });
49
+ * ```
20
50
  */
21
51
  set(body: ProductOrderSetParams, options?: Core.RequestOptions): Core.APIPromise<ProductOrderSetResponse> {
22
52
  return this._client.post('/v1/contract-pricing/rate-cards/setRateCardProductsOrder', {
@@ -1,25 +1,25 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../../../resource';
4
- import { isRequestOptions } from '../../../../core';
5
- import * as Core from '../../../../core';
6
- import * as Shared from '../../../shared';
7
- import * as NamedSchedulesAPI from './named-schedules';
3
+ import { APIResource } from "../../../../resource.js";
4
+ import { isRequestOptions } from "../../../../core.js";
5
+ import * as Core from "../../../../core.js";
6
+ import * as Shared from "../../../shared.js";
7
+ import * as NamedSchedulesAPI from "./named-schedules.js";
8
8
  import {
9
9
  NamedScheduleRetrieveParams,
10
10
  NamedScheduleRetrieveResponse,
11
11
  NamedScheduleUpdateParams,
12
12
  NamedSchedules,
13
- } from './named-schedules';
14
- import * as ProductOrdersAPI from './product-orders';
13
+ } from "./named-schedules.js";
14
+ import * as ProductOrdersAPI from "./product-orders.js";
15
15
  import {
16
16
  ProductOrderSetParams,
17
17
  ProductOrderSetResponse,
18
18
  ProductOrderUpdateParams,
19
19
  ProductOrderUpdateResponse,
20
20
  ProductOrders,
21
- } from './product-orders';
22
- import * as RatesAPI from './rates';
21
+ } from "./product-orders.js";
22
+ import * as RatesAPI from "./rates.js";
23
23
  import {
24
24
  RateAddManyParams,
25
25
  RateAddManyResponse,
@@ -29,8 +29,8 @@ import {
29
29
  RateListResponse,
30
30
  RateListResponsesCursorPage,
31
31
  Rates,
32
- } from './rates';
33
- import { CursorPage, type CursorPageParams } from '../../../../pagination';
32
+ } from "./rates.js";
33
+ import { CursorPage, type CursorPageParams } from "../../../../pagination.js";
34
34
 
35
35
  export class RateCards extends APIResource {
36
36
  productOrders: ProductOrdersAPI.ProductOrders = new ProductOrdersAPI.ProductOrders(this._client);
@@ -39,6 +39,26 @@ export class RateCards extends APIResource {
39
39
 
40
40
  /**
41
41
  * Create a new rate card
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const rateCard = await client.v1.contracts.rateCards.create(
46
+ * {
47
+ * name: 'My Rate Card',
48
+ * aliases: [{ name: 'my-rate-card' }],
49
+ * credit_type_conversions: [
50
+ * {
51
+ * custom_credit_type_id:
52
+ * '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
53
+ * fiat_per_custom_credit: 2,
54
+ * },
55
+ * ],
56
+ * description: 'My Rate Card Description',
57
+ * fiat_credit_type_id:
58
+ * '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
59
+ * },
60
+ * );
61
+ * ```
42
62
  */
43
63
  create(body: RateCardCreateParams, options?: Core.RequestOptions): Core.APIPromise<RateCardCreateResponse> {
44
64
  return this._client.post('/v1/contract-pricing/rate-cards/create', { body, ...options });
@@ -47,6 +67,14 @@ export class RateCards extends APIResource {
47
67
  /**
48
68
  * Get a specific rate card NOTE: Use `/contract-pricing/rate-cards/getRates` to
49
69
  * retrieve rate card rates.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * const rateCard =
74
+ * await client.v1.contracts.rateCards.retrieve({
75
+ * id: 'f3d51ae8-f283-44e1-9933-a3cf9ad7a6fe',
76
+ * });
77
+ * ```
50
78
  */
51
79
  retrieve(
52
80
  body: RateCardRetrieveParams,
@@ -57,6 +85,17 @@ export class RateCards extends APIResource {
57
85
 
58
86
  /**
59
87
  * Update a rate card
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * const rateCard = await client.v1.contracts.rateCards.update(
92
+ * {
93
+ * rate_card_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
94
+ * description: 'My Updated Rate Card Description',
95
+ * name: 'My Updated Rate Card',
96
+ * },
97
+ * );
98
+ * ```
60
99
  */
61
100
  update(body: RateCardUpdateParams, options?: Core.RequestOptions): Core.APIPromise<RateCardUpdateResponse> {
62
101
  return this._client.post('/v1/contract-pricing/rate-cards/update', { body, ...options });
@@ -65,6 +104,14 @@ export class RateCards extends APIResource {
65
104
  /**
66
105
  * List rate cards NOTE: Use `/contract-pricing/rate-cards/getRates` to retrieve
67
106
  * rate card rates.
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * // Automatically fetches more pages as needed.
111
+ * for await (const rateCardListResponse of client.v1.contracts.rateCards.list()) {
112
+ * // ...
113
+ * }
114
+ * ```
68
115
  */
69
116
  list(
70
117
  params?: RateCardListParams,
@@ -89,9 +136,45 @@ export class RateCards extends APIResource {
89
136
  });
90
137
  }
91
138
 
139
+ /**
140
+ * Archive a rate card
141
+ *
142
+ * @example
143
+ * ```ts
144
+ * const response =
145
+ * await client.v1.contracts.rateCards.archive({
146
+ * id: '12b21470-4570-40df-8998-449d0b0bc52f',
147
+ * });
148
+ * ```
149
+ */
150
+ archive(
151
+ body: RateCardArchiveParams,
152
+ options?: Core.RequestOptions,
153
+ ): Core.APIPromise<RateCardArchiveResponse> {
154
+ return this._client.post('/v1/contract-pricing/rate-cards/archive', { body, ...options });
155
+ }
156
+
92
157
  /**
93
158
  * Get all rates for a rate card from starting_at (either in perpetuity or until
94
159
  * ending_before, if provided)
160
+ *
161
+ * @example
162
+ * ```ts
163
+ * const response =
164
+ * await client.v1.contracts.rateCards.retrieveRateSchedule({
165
+ * rate_card_id: 'f3d51ae8-f283-44e1-9933-a3cf9ad7a6fe',
166
+ * starting_at: '2024-01-01T00:00:00.000Z',
167
+ * selectors: [
168
+ * {
169
+ * product_id: 'd6300dbb-882e-4d2d-8dec-5125d16b65d0',
170
+ * partial_pricing_group_values: {
171
+ * region: 'us-west-2',
172
+ * cloud: 'aws',
173
+ * },
174
+ * },
175
+ * ],
176
+ * });
177
+ * ```
95
178
  */
96
179
  retrieveRateSchedule(
97
180
  params: RateCardRetrieveRateScheduleParams,
@@ -130,7 +213,7 @@ export namespace RateCardRetrieveResponse {
130
213
 
131
214
  credit_type_conversions?: Array<Data.CreditTypeConversion>;
132
215
 
133
- custom_fields?: Record<string, string>;
216
+ custom_fields?: { [key: string]: string };
134
217
 
135
218
  description?: string;
136
219
 
@@ -171,7 +254,7 @@ export interface RateCardListResponse {
171
254
 
172
255
  credit_type_conversions?: Array<RateCardListResponse.CreditTypeConversion>;
173
256
 
174
- custom_fields?: Record<string, string>;
257
+ custom_fields?: { [key: string]: string };
175
258
 
176
259
  description?: string;
177
260
 
@@ -194,6 +277,10 @@ export namespace RateCardListResponse {
194
277
  }
195
278
  }
196
279
 
280
+ export interface RateCardArchiveResponse {
281
+ data: Shared.ID;
282
+ }
283
+
197
284
  export interface RateCardRetrieveRateScheduleResponse {
198
285
  data: Array<RateCardRetrieveRateScheduleResponse.Data>;
199
286
 
@@ -204,7 +291,7 @@ export namespace RateCardRetrieveRateScheduleResponse {
204
291
  export interface Data {
205
292
  entitled: boolean;
206
293
 
207
- product_custom_fields: Record<string, string>;
294
+ product_custom_fields: { [key: string]: string };
208
295
 
209
296
  product_id: string;
210
297
 
@@ -216,7 +303,7 @@ export namespace RateCardRetrieveRateScheduleResponse {
216
303
 
217
304
  starting_at: string;
218
305
 
219
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
306
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
220
307
 
221
308
  /**
222
309
  * A distinct rate on the rate card. You can choose to use this rate rather than
@@ -226,7 +313,7 @@ export namespace RateCardRetrieveRateScheduleResponse {
226
313
 
227
314
  ending_before?: string;
228
315
 
229
- pricing_group_values?: Record<string, string>;
316
+ pricing_group_values?: { [key: string]: string };
230
317
  }
231
318
 
232
319
  export namespace Data {
@@ -268,7 +355,7 @@ export interface RateCardCreateParams {
268
355
  */
269
356
  credit_type_conversions?: Array<RateCardCreateParams.CreditTypeConversion>;
270
357
 
271
- custom_fields?: Record<string, string>;
358
+ custom_fields?: { [key: string]: string };
272
359
 
273
360
  description?: string;
274
361
 
@@ -337,6 +424,10 @@ export interface RateCardListParams extends CursorPageParams {
337
424
  body?: unknown;
338
425
  }
339
426
 
427
+ export interface RateCardArchiveParams {
428
+ id: string;
429
+ }
430
+
340
431
  export interface RateCardRetrieveRateScheduleParams {
341
432
  /**
342
433
  * Body param: ID of the rate card to get the schedule for
@@ -378,19 +469,19 @@ export namespace RateCardRetrieveRateScheduleParams {
378
469
  * Subscription rates matching the billing frequency will be included in the
379
470
  * response.
380
471
  */
381
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
472
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
382
473
 
383
474
  /**
384
475
  * List of pricing group key value pairs, rates containing the matching key / value
385
476
  * pairs will be included in the response.
386
477
  */
387
- partial_pricing_group_values?: Record<string, string>;
478
+ partial_pricing_group_values?: { [key: string]: string };
388
479
 
389
480
  /**
390
481
  * List of pricing group key value pairs, rates matching all of the key / value
391
482
  * pairs will be included in the response.
392
483
  */
393
- pricing_group_values?: Record<string, string>;
484
+ pricing_group_values?: { [key: string]: string };
394
485
 
395
486
  /**
396
487
  * Rates matching the product id will be included in the response.
@@ -411,12 +502,14 @@ export declare namespace RateCards {
411
502
  type RateCardRetrieveResponse as RateCardRetrieveResponse,
412
503
  type RateCardUpdateResponse as RateCardUpdateResponse,
413
504
  type RateCardListResponse as RateCardListResponse,
505
+ type RateCardArchiveResponse as RateCardArchiveResponse,
414
506
  type RateCardRetrieveRateScheduleResponse as RateCardRetrieveRateScheduleResponse,
415
507
  RateCardListResponsesCursorPage as RateCardListResponsesCursorPage,
416
508
  type RateCardCreateParams as RateCardCreateParams,
417
509
  type RateCardRetrieveParams as RateCardRetrieveParams,
418
510
  type RateCardUpdateParams as RateCardUpdateParams,
419
511
  type RateCardListParams as RateCardListParams,
512
+ type RateCardArchiveParams as RateCardArchiveParams,
420
513
  type RateCardRetrieveRateScheduleParams as RateCardRetrieveRateScheduleParams,
421
514
  };
422
515