@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,35 @@
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 Rates extends APIResource {
9
9
  /**
10
10
  * Get all rates for a rate card at a point in time
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * // Automatically fetches more pages as needed.
15
+ * for await (const rateListResponse of client.v1.contracts.rateCards.rates.list(
16
+ * {
17
+ * at: '2024-01-01T00:00:00.000Z',
18
+ * rate_card_id: 'f3d51ae8-f283-44e1-9933-a3cf9ad7a6fe',
19
+ * selectors: [
20
+ * {
21
+ * product_id: 'd6300dbb-882e-4d2d-8dec-5125d16b65d0',
22
+ * partial_pricing_group_values: {
23
+ * region: 'us-west-2',
24
+ * cloud: 'aws',
25
+ * },
26
+ * },
27
+ * ],
28
+ * },
29
+ * )) {
30
+ * // ...
31
+ * }
32
+ * ```
11
33
  */
12
34
  list(
13
35
  params: RateListParams,
@@ -24,6 +46,20 @@ export class Rates extends APIResource {
24
46
 
25
47
  /**
26
48
  * Add a new rate
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const response =
53
+ * await client.v1.contracts.rateCards.rates.add({
54
+ * entitled: true,
55
+ * product_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
56
+ * rate_card_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
57
+ * rate_type: 'FLAT',
58
+ * starting_at: '2020-01-01T00:00:00.000Z',
59
+ * credit_type_id: '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
60
+ * price: 100,
61
+ * });
62
+ * ```
27
63
  */
28
64
  add(body: RateAddParams, options?: Core.RequestOptions): Core.APIPromise<RateAddResponse> {
29
65
  return this._client.post('/v1/contract-pricing/rate-cards/addRate', { body, ...options });
@@ -31,6 +67,38 @@ export class Rates extends APIResource {
31
67
 
32
68
  /**
33
69
  * Add new rates
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * const response =
74
+ * await client.v1.contracts.rateCards.rates.addMany({
75
+ * rate_card_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
76
+ * rates: [
77
+ * {
78
+ * product_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
79
+ * starting_at: '2020-01-01T00:00:00.000Z',
80
+ * entitled: true,
81
+ * rate_type: 'FLAT',
82
+ * price: 100,
83
+ * pricing_group_values: {
84
+ * region: 'us-west-2',
85
+ * cloud: 'aws',
86
+ * },
87
+ * },
88
+ * {
89
+ * product_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
90
+ * starting_at: '2020-01-01T00:00:00.000Z',
91
+ * entitled: true,
92
+ * rate_type: 'FLAT',
93
+ * price: 120,
94
+ * pricing_group_values: {
95
+ * region: 'us-east-2',
96
+ * cloud: 'aws',
97
+ * },
98
+ * },
99
+ * ],
100
+ * });
101
+ * ```
34
102
  */
35
103
  addMany(body: RateAddManyParams, options?: Core.RequestOptions): Core.APIPromise<RateAddManyResponse> {
36
104
  return this._client.post('/v1/contract-pricing/rate-cards/addRates', { body, ...options });
@@ -42,7 +110,7 @@ export class RateListResponsesCursorPage extends CursorPage<RateListResponse> {}
42
110
  export interface RateListResponse {
43
111
  entitled: boolean;
44
112
 
45
- product_custom_fields: Record<string, string>;
113
+ product_custom_fields: { [key: string]: string };
46
114
 
47
115
  product_id: string;
48
116
 
@@ -54,7 +122,7 @@ export interface RateListResponse {
54
122
 
55
123
  starting_at: string;
56
124
 
57
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
125
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
58
126
 
59
127
  /**
60
128
  * A distinct rate on the rate card. You can choose to use this rate rather than
@@ -64,7 +132,7 @@ export interface RateListResponse {
64
132
 
65
133
  ending_before?: string;
66
134
 
67
- pricing_group_values?: Record<string, string>;
135
+ pricing_group_values?: { [key: string]: string };
68
136
  }
69
137
 
70
138
  export namespace RateListResponse {
@@ -107,7 +175,7 @@ export namespace RateAddResponse {
107
175
  * Only set for CUSTOM rate_type. This field is interpreted by custom rate
108
176
  * processors.
109
177
  */
110
- custom_rate?: Record<string, unknown>;
178
+ custom_rate?: { [key: string]: unknown };
111
179
 
112
180
  /**
113
181
  * Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be
@@ -125,7 +193,7 @@ export namespace RateAddResponse {
125
193
  * if pricing groups are used, this will contain the values used to calculate the
126
194
  * price
127
195
  */
128
- pricing_group_values?: Record<string, string>;
196
+ pricing_group_values?: { [key: string]: string };
129
197
 
130
198
  /**
131
199
  * Default quantity. For SUBSCRIPTION rate_type, this must be >=0.
@@ -198,19 +266,19 @@ export namespace RateListParams {
198
266
  * Subscription rates matching the billing frequency will be included in the
199
267
  * response.
200
268
  */
201
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
269
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
202
270
 
203
271
  /**
204
272
  * List of pricing group key value pairs, rates containing the matching key / value
205
273
  * pairs will be included in the response.
206
274
  */
207
- partial_pricing_group_values?: Record<string, string>;
275
+ partial_pricing_group_values?: { [key: string]: string };
208
276
 
209
277
  /**
210
278
  * List of pricing group key value pairs, rates matching all of the key / value
211
279
  * pairs will be included in the response.
212
280
  */
213
- pricing_group_values?: Record<string, string>;
281
+ pricing_group_values?: { [key: string]: string };
214
282
 
215
283
  /**
216
284
  * Rates matching the product id will be included in the response.
@@ -249,7 +317,7 @@ export interface RateAddParams {
249
317
  * Optional. Frequency to bill subscriptions with. Required for subscription type
250
318
  * products with Flat rate.
251
319
  */
252
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
320
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
253
321
 
254
322
  /**
255
323
  * A distinct rate on the rate card. You can choose to use this rate rather than
@@ -268,7 +336,7 @@ export interface RateAddParams {
268
336
  * Only set for CUSTOM rate_type. This field is interpreted by custom rate
269
337
  * processors.
270
338
  */
271
- custom_rate?: Record<string, unknown>;
339
+ custom_rate?: { [key: string]: unknown };
272
340
 
273
341
  /**
274
342
  * exclusive end date
@@ -292,7 +360,7 @@ export interface RateAddParams {
292
360
  * Optional. List of pricing group key value pairs which will be used to calculate
293
361
  * the price.
294
362
  */
295
- pricing_group_values?: Record<string, string>;
363
+ pricing_group_values?: { [key: string]: string };
296
364
 
297
365
  /**
298
366
  * Default quantity. For SUBSCRIPTION rate_type, this must be >=0.
@@ -358,7 +426,7 @@ export namespace RateAddManyParams {
358
426
  * Optional. Frequency to bill subscriptions with. Required for subscription type
359
427
  * products with Flat rate.
360
428
  */
361
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
429
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
362
430
 
363
431
  /**
364
432
  * A distinct rate on the rate card. You can choose to use this rate rather than
@@ -377,7 +445,7 @@ export namespace RateAddManyParams {
377
445
  * Only set for CUSTOM rate_type. This field is interpreted by custom rate
378
446
  * processors.
379
447
  */
380
- custom_rate?: Record<string, unknown>;
448
+ custom_rate?: { [key: string]: unknown };
381
449
 
382
450
  /**
383
451
  * exclusive end date
@@ -401,7 +469,7 @@ export namespace RateAddManyParams {
401
469
  * Optional. List of pricing group key value pairs which will be used to calculate
402
470
  * the price.
403
471
  */
404
- pricing_group_values?: Record<string, string>;
472
+ pricing_group_values?: { [key: string]: string };
405
473
 
406
474
  /**
407
475
  * Default quantity. For SUBSCRIPTION rate_type, this must be >=0.
@@ -1,3 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export * from './rate-cards/index';
3
+ export * from "./rate-cards/index.js";
@@ -1,3 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export * from './contracts/index';
3
+ export * from "./contracts/index.js";
@@ -1,15 +1,36 @@
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 CreditGrantsAPI from './credit-grants';
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 CreditGrantsAPI from "./credit-grants.js";
7
+ import * as Shared from "../shared.js";
8
+ import { CursorPage, type CursorPageParams } from "../../pagination.js";
9
9
 
10
10
  export class CreditGrants extends APIResource {
11
11
  /**
12
12
  * Create a new credit grant
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const creditGrant = await client.v1.creditGrants.create({
17
+ * customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
18
+ * expires_at: '2022-04-01T00:00:00Z',
19
+ * grant_amount: {
20
+ * amount: 1000,
21
+ * credit_type_id: '5ae401dc-a648-4b49-9ac3-391bb5bc4d7b',
22
+ * },
23
+ * name: 'Acme Corp Promotional Credit Grant',
24
+ * paid_amount: {
25
+ * amount: 5000,
26
+ * credit_type_id: '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
27
+ * },
28
+ * priority: 0.5,
29
+ * credit_grant_type: 'trial',
30
+ * effective_at: '2022-02-01T00:00:00Z',
31
+ * reason: 'Incentivize new customer',
32
+ * });
33
+ * ```
13
34
  */
14
35
  create(
15
36
  body: CreditGrantCreateParams,
@@ -20,6 +41,26 @@ export class CreditGrants extends APIResource {
20
41
 
21
42
  /**
22
43
  * List credit grants. This list does not included voided grants.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * // Automatically fetches more pages as needed.
48
+ * for await (const creditGrantListResponse of client.v1.creditGrants.list(
49
+ * {
50
+ * credit_type_ids: [
51
+ * '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
52
+ * ],
53
+ * customer_ids: [
54
+ * 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
55
+ * '0e5b8609-d901-4992-b394-c3c2e3f37b1c',
56
+ * ],
57
+ * effective_before: '2022-02-01T00:00:00Z',
58
+ * not_expiring_before: '2022-02-01T00:00:00Z',
59
+ * },
60
+ * )) {
61
+ * // ...
62
+ * }
63
+ * ```
23
64
  */
24
65
  list(
25
66
  params?: CreditGrantListParams,
@@ -46,6 +87,15 @@ export class CreditGrants extends APIResource {
46
87
 
47
88
  /**
48
89
  * Edit an existing credit grant
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * const response = await client.v1.creditGrants.edit({
94
+ * id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
95
+ * expires_at: '2022-04-01T00:00:00Z',
96
+ * name: 'Acme Corp Promotional Credit Grant',
97
+ * });
98
+ * ```
49
99
  */
50
100
  edit(body: CreditGrantEditParams, options?: Core.RequestOptions): Core.APIPromise<CreditGrantEditResponse> {
51
101
  return this._client.post('/v1/credits/editGrant', { body, ...options });
@@ -55,6 +105,16 @@ export class CreditGrants extends APIResource {
55
105
  * Fetches a list of credit ledger entries. Returns lists of ledgers per customer.
56
106
  * Ledger entries are returned in chronological order. Ledger entries associated
57
107
  * with voided credit grants are not included.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * const response = await client.v1.creditGrants.listEntries({
112
+ * credit_type_ids: ['2714e483-4ff1-48e4-9e25-ac732e8f24f2'],
113
+ * customer_ids: ['6a37bb88-8538-48c5-b37b-a41c836328bd'],
114
+ * ending_before: '2021-02-01T00:00:00Z',
115
+ * starting_on: '2021-01-01T00:00:00Z',
116
+ * });
117
+ * ```
58
118
  */
59
119
  listEntries(
60
120
  params?: CreditGrantListEntriesParams,
@@ -68,12 +128,19 @@ export class CreditGrants extends APIResource {
68
128
  if (isRequestOptions(params)) {
69
129
  return this.listEntries({}, params);
70
130
  }
71
- const { next_page, ...body } = params;
72
- return this._client.post('/v1/credits/listEntries', { query: { next_page }, body, ...options });
131
+ const { next_page, sort, ...body } = params;
132
+ return this._client.post('/v1/credits/listEntries', { query: { next_page, sort }, body, ...options });
73
133
  }
74
134
 
75
135
  /**
76
136
  * Void a credit grant
137
+ *
138
+ * @example
139
+ * ```ts
140
+ * const response = await client.v1.creditGrants.void({
141
+ * id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
142
+ * });
143
+ * ```
77
144
  */
78
145
  void(body: CreditGrantVoidParams, options?: Core.RequestOptions): Core.APIPromise<CreditGrantVoidResponse> {
79
146
  return this._client.post('/v1/credits/voidGrant', { body, ...options });
@@ -154,7 +221,7 @@ export interface CreditGrantListResponse {
154
221
  */
155
222
  balance: CreditGrantListResponse.Balance;
156
223
 
157
- custom_fields: Record<string, string>;
224
+ custom_fields: { [key: string]: string };
158
225
 
159
226
  /**
160
227
  * the Metronome ID of the customer
@@ -382,7 +449,7 @@ export interface CreditGrantCreateParams {
382
449
  /**
383
450
  * Custom fields to attach to the credit grant.
384
451
  */
385
- custom_fields?: Record<string, string>;
452
+ custom_fields?: { [key: string]: string };
386
453
 
387
454
  /**
388
455
  * The credit grant will only apply to usage or charges dated on or after this
@@ -528,6 +595,11 @@ export interface CreditGrantListEntriesParams {
528
595
  */
529
596
  next_page?: string;
530
597
 
598
+ /**
599
+ * Query param: Ledgers sort order by date, asc or desc. Defaults to asc.
600
+ */
601
+ sort?: 'asc' | 'desc';
602
+
531
603
  /**
532
604
  * Body param: A list of Metronome credit type IDs to fetch ledger entries for. If
533
605
  * absent, ledger entries for all credit types will be returned.
@@ -1,13 +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 { isRequestOptions } from '../../core';
5
- import * as Core from '../../core';
3
+ import { APIResource } from "../../resource.js";
4
+ import { isRequestOptions } from "../../core.js";
5
+ import * as Core from "../../core.js";
6
6
 
7
7
  export class CustomFields extends APIResource {
8
8
  /**
9
9
  * Add a key to the allow list for a given entity. There is a 100 character limit
10
10
  * on custom field keys.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * await client.v1.customFields.addKey({
15
+ * enforce_uniqueness: true,
16
+ * entity: 'customer',
17
+ * key: 'x_account_id',
18
+ * });
19
+ * ```
11
20
  */
12
21
  addKey(body: CustomFieldAddKeyParams, options?: Core.RequestOptions): Core.APIPromise<void> {
13
22
  return this._client.post('/v1/customFields/addKey', {
@@ -19,6 +28,15 @@ export class CustomFields extends APIResource {
19
28
 
20
29
  /**
21
30
  * Deletes one or more custom fields on an instance of a Metronome entity.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * await client.v1.customFields.deleteValues({
35
+ * entity: 'customer',
36
+ * entity_id: '99594816-e8a5-4bca-be21-8d1de0f45120',
37
+ * keys: ['x_account_id'],
38
+ * });
39
+ * ```
22
40
  */
23
41
  deleteValues(body: CustomFieldDeleteValuesParams, options?: Core.RequestOptions): Core.APIPromise<void> {
24
42
  return this._client.post('/v1/customFields/deleteValues', {
@@ -30,6 +48,13 @@ export class CustomFields extends APIResource {
30
48
 
31
49
  /**
32
50
  * List all active custom field keys, optionally filtered by entity type.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const response = await client.v1.customFields.listKeys({
55
+ * entities: ['customer'],
56
+ * });
57
+ * ```
33
58
  */
34
59
  listKeys(
35
60
  params?: CustomFieldListKeysParams,
@@ -49,6 +74,14 @@ export class CustomFields extends APIResource {
49
74
 
50
75
  /**
51
76
  * Remove a key from the allow list for a given entity.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * await client.v1.customFields.removeKey({
81
+ * entity: 'customer',
82
+ * key: 'x_account_id',
83
+ * });
84
+ * ```
52
85
  */
53
86
  removeKey(body: CustomFieldRemoveKeyParams, options?: Core.RequestOptions): Core.APIPromise<void> {
54
87
  return this._client.post('/v1/customFields/removeKey', {
@@ -66,6 +99,15 @@ export class CustomFields extends APIResource {
66
99
  * transactional and will update all key/value pairs or no key/value pairs. Partial
67
100
  * updates are not supported. There is a 200 character limit on custom field
68
101
  * values.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * await client.v1.customFields.setValues({
106
+ * custom_fields: { x_account_id: 'KyVnHhSBWl7eY2bl' },
107
+ * entity: 'customer',
108
+ * entity_id: '99594816-e8a5-4bca-be21-8d1de0f45120',
109
+ * });
110
+ * ```
69
111
  */
70
112
  setValues(body: CustomFieldSetValuesParams, options?: Core.RequestOptions): Core.APIPromise<void> {
71
113
  return this._client.post('/v1/customFields/setValues', {
@@ -103,7 +145,8 @@ export namespace CustomFieldListKeysResponse {
103
145
  | 'professional_service'
104
146
  | 'product'
105
147
  | 'rate_card'
106
- | 'scheduled_charge';
148
+ | 'scheduled_charge'
149
+ | 'subscription';
107
150
 
108
151
  key: string;
109
152
  }
@@ -129,7 +172,8 @@ export interface CustomFieldAddKeyParams {
129
172
  | 'professional_service'
130
173
  | 'product'
131
174
  | 'rate_card'
132
- | 'scheduled_charge';
175
+ | 'scheduled_charge'
176
+ | 'subscription';
133
177
 
134
178
  key: string;
135
179
  }
@@ -152,7 +196,8 @@ export interface CustomFieldDeleteValuesParams {
152
196
  | 'professional_service'
153
197
  | 'product'
154
198
  | 'rate_card'
155
- | 'scheduled_charge';
199
+ | 'scheduled_charge'
200
+ | 'subscription';
156
201
 
157
202
  entity_id: string;
158
203
 
@@ -186,6 +231,7 @@ export interface CustomFieldListKeysParams {
186
231
  | 'product'
187
232
  | 'rate_card'
188
233
  | 'scheduled_charge'
234
+ | 'subscription'
189
235
  >;
190
236
  }
191
237
 
@@ -207,13 +253,14 @@ export interface CustomFieldRemoveKeyParams {
207
253
  | 'professional_service'
208
254
  | 'product'
209
255
  | 'rate_card'
210
- | 'scheduled_charge';
256
+ | 'scheduled_charge'
257
+ | 'subscription';
211
258
 
212
259
  key: string;
213
260
  }
214
261
 
215
262
  export interface CustomFieldSetValuesParams {
216
- custom_fields: Record<string, string>;
263
+ custom_fields: { [key: string]: string };
217
264
 
218
265
  entity:
219
266
  | 'alert'
@@ -232,7 +279,8 @@ export interface CustomFieldSetValuesParams {
232
279
  | 'professional_service'
233
280
  | 'product'
234
281
  | 'rate_card'
235
- | 'scheduled_charge';
282
+ | 'scheduled_charge'
283
+ | 'subscription';
236
284
 
237
285
  entity_id: string;
238
286
  }
@@ -1,13 +1,21 @@
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 Alerts extends APIResource {
8
8
  /**
9
9
  * Get the customer alert status and alert information for the specified customer
10
10
  * and alert
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const alert = await client.v1.customers.alerts.retrieve({
15
+ * alert_id: '8deed800-1b7a-495d-a207-6c52bac54dc9',
16
+ * customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
17
+ * });
18
+ * ```
11
19
  */
12
20
  retrieve(body: AlertRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<AlertRetrieveResponse> {
13
21
  return this._client.post('/v1/customer-alerts/get', { body, ...options });
@@ -15,6 +23,13 @@ export class Alerts extends APIResource {
15
23
 
16
24
  /**
17
25
  * Fetch all customer alert statuses and alert information for a customer
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const alerts = await client.v1.customers.alerts.list({
30
+ * customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
31
+ * });
32
+ * ```
18
33
  */
19
34
  list(params: AlertListParams, options?: Core.RequestOptions): Core.APIPromise<AlertListResponse> {
20
35
  const { next_page, ...body } = params;
@@ -23,6 +38,14 @@ export class Alerts extends APIResource {
23
38
 
24
39
  /**
25
40
  * Reset state for an alert by customer id and force re-evaluation
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * await client.v1.customers.alerts.reset({
45
+ * alert_id: '5e8691bf-b22a-4672-922d-f80eee940f01',
46
+ * customer_id: '4c83caf3-8af4-44e2-9aeb-e290531726d9',
47
+ * });
48
+ * ```
26
49
  */
27
50
  reset(body: AlertResetParams, options?: Core.RequestOptions): Core.APIPromise<void> {
28
51
  return this._client.post('/v1/customer-alerts/reset', {
@@ -114,6 +137,12 @@ export namespace CustomerAlert {
114
137
  */
115
138
  group_key_filter?: Alert.GroupKeyFilter;
116
139
 
140
+ /**
141
+ * Only present for `spend_threshold_reached` alerts. Scope alert to a specific
142
+ * group key on individual line items.
143
+ */
144
+ group_values?: Array<Alert.GroupValue>;
145
+
117
146
  /**
118
147
  * Only supported for invoice_total_reached alerts. A list of invoice types to
119
148
  * evaluate.
@@ -146,6 +175,12 @@ export namespace CustomerAlert {
146
175
 
147
176
  value: string;
148
177
  }
178
+
179
+ export interface GroupValue {
180
+ key: string;
181
+
182
+ value: string;
183
+ }
149
184
  }
150
185
  }
151
186
 
@@ -169,6 +204,12 @@ export interface AlertRetrieveParams {
169
204
  * The Metronome ID of the customer
170
205
  */
171
206
  customer_id: string;
207
+
208
+ /**
209
+ * When parallel alerts are enabled during migration, this flag denotes whether to
210
+ * fetch alerts for plans or contracts.
211
+ */
212
+ plans_or_contracts?: 'PLANS' | 'CONTRACTS';
172
213
  }
173
214
 
174
215
  export interface AlertListParams {
@@ -1,11 +1,21 @@
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 BillingConfig extends APIResource {
7
7
  /**
8
8
  * Set the billing configuration for a given customer.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * await client.v1.customers.billingConfig.create({
13
+ * customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
14
+ * billing_provider_type: 'stripe',
15
+ * billing_provider_customer_id: 'cus_AJ6y20bjkOOayM',
16
+ * stripe_collection_method: 'charge_automatically',
17
+ * });
18
+ * ```
9
19
  */
10
20
  create(params: BillingConfigCreateParams, options?: Core.RequestOptions): Core.APIPromise<void> {
11
21
  const { customer_id, billing_provider_type, ...body } = params;
@@ -18,6 +28,15 @@ export class BillingConfig extends APIResource {
18
28
 
19
29
  /**
20
30
  * Fetch the billing configuration for the given customer.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const billingConfig =
35
+ * await client.v1.customers.billingConfig.retrieve({
36
+ * customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
37
+ * billing_provider_type: 'stripe',
38
+ * });
39
+ * ```
21
40
  */
22
41
  retrieve(
23
42
  params: BillingConfigRetrieveParams,
@@ -30,6 +49,14 @@ export class BillingConfig extends APIResource {
30
49
  /**
31
50
  * Delete the billing configuration for a given customer. Note: this is unsupported
32
51
  * for Azure and AWS Marketplace customers.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * await client.v1.customers.billingConfig.delete({
56
+ * customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
57
+ * billing_provider_type: 'stripe',
58
+ * });
59
+ * ```
33
60
  */
34
61
  delete(params: BillingConfigDeleteParams, options?: Core.RequestOptions): Core.APIPromise<void> {
35
62
  const { customer_id, billing_provider_type } = params;
@@ -53,6 +80,11 @@ export namespace BillingConfigRetrieveResponse {
53
80
  */
54
81
  aws_expiration_date?: string;
55
82
 
83
+ /**
84
+ * True if the aws_product_code is a SAAS subscription product, false otherwise.
85
+ */
86
+ aws_is_subscription_product?: boolean;
87
+
56
88
  aws_product_code?: string;
57
89
 
58
90
  aws_region?: