@metronome/sdk 0.1.0-beta.8 → 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 (485) hide show
  1. package/CHANGELOG.md +227 -0
  2. package/README.md +37 -52
  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 +25 -15
  9. package/core.js.map +1 -1
  10. package/core.mjs +26 -16
  11. package/core.mjs.map +1 -1
  12. package/index.d.mts +10 -42
  13. package/index.d.ts +10 -42
  14. package/index.d.ts.map +1 -1
  15. package/index.js +14 -55
  16. package/index.js.map +1 -1
  17. package/index.mjs +14 -55
  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/index.d.ts +2 -13
  31. package/resources/index.d.ts.map +1 -1
  32. package/resources/index.js +5 -38
  33. package/resources/index.js.map +1 -1
  34. package/resources/index.mjs +2 -13
  35. package/resources/index.mjs.map +1 -1
  36. package/resources/shared.d.ts +512 -24
  37. package/resources/shared.d.ts.map +1 -1
  38. package/resources/{alerts.d.ts → v1/alerts.d.ts} +29 -5
  39. package/resources/v1/alerts.d.ts.map +1 -0
  40. package/resources/v1/alerts.js +40 -0
  41. package/resources/v1/alerts.js.map +1 -0
  42. package/resources/v1/alerts.mjs +36 -0
  43. package/resources/v1/alerts.mjs.map +1 -0
  44. package/resources/{audit-logs.d.ts → v1/audit-logs.d.ts} +11 -3
  45. package/resources/v1/audit-logs.d.ts.map +1 -0
  46. package/resources/{audit-logs.js → v1/audit-logs.js} +4 -4
  47. package/resources/v1/audit-logs.js.map +1 -0
  48. package/resources/{audit-logs.mjs → v1/audit-logs.mjs} +4 -4
  49. package/resources/v1/audit-logs.mjs.map +1 -0
  50. package/resources/{billable-metrics.d.ts → v1/billable-metrics.d.ts} +62 -7
  51. package/resources/v1/billable-metrics.d.ts.map +1 -0
  52. package/resources/v1/billable-metrics.js +84 -0
  53. package/resources/v1/billable-metrics.js.map +1 -0
  54. package/resources/v1/billable-metrics.mjs +79 -0
  55. package/resources/v1/billable-metrics.mjs.map +1 -0
  56. package/resources/{contracts → v1/contracts}/contracts.d.ts +1618 -62
  57. package/resources/v1/contracts/contracts.d.ts.map +1 -0
  58. package/resources/v1/contracts/contracts.js +312 -0
  59. package/resources/v1/contracts/contracts.js.map +1 -0
  60. package/resources/v1/contracts/contracts.mjs +285 -0
  61. package/resources/v1/contracts/contracts.mjs.map +1 -0
  62. package/resources/v1/contracts/index.d.ts +5 -0
  63. package/resources/v1/contracts/index.d.ts.map +1 -0
  64. package/resources/v1/contracts/index.js.map +1 -0
  65. package/resources/v1/contracts/index.mjs.map +1 -0
  66. package/resources/{contracts → v1/contracts}/named-schedules.d.ts +23 -2
  67. package/resources/v1/contracts/named-schedules.d.ts.map +1 -0
  68. package/resources/v1/contracts/named-schedules.js +48 -0
  69. package/resources/v1/contracts/named-schedules.js.map +1 -0
  70. package/resources/v1/contracts/named-schedules.mjs +44 -0
  71. package/resources/v1/contracts/named-schedules.mjs.map +1 -0
  72. package/resources/{contracts → v1/contracts}/products.d.ts +55 -7
  73. package/resources/v1/contracts/products.d.ts.map +1 -0
  74. package/resources/v1/contracts/products.js +84 -0
  75. package/resources/v1/contracts/products.js.map +1 -0
  76. package/resources/v1/contracts/products.mjs +79 -0
  77. package/resources/v1/contracts/products.mjs.map +1 -0
  78. package/resources/{contracts → v1/contracts}/rate-cards/index.d.ts +1 -1
  79. package/resources/v1/contracts/rate-cards/index.d.ts.map +1 -0
  80. package/resources/v1/contracts/rate-cards/index.js.map +1 -0
  81. package/resources/v1/contracts/rate-cards/index.mjs.map +1 -0
  82. package/resources/{contracts → v1/contracts}/rate-cards/named-schedules.d.ts +27 -2
  83. package/resources/v1/contracts/rate-cards/named-schedules.d.ts.map +1 -0
  84. package/resources/v1/contracts/rate-cards/named-schedules.js +52 -0
  85. package/resources/v1/contracts/rate-cards/named-schedules.js.map +1 -0
  86. package/resources/v1/contracts/rate-cards/named-schedules.mjs +48 -0
  87. package/resources/v1/contracts/rate-cards/named-schedules.mjs.map +1 -0
  88. package/resources/{contracts → v1/contracts}/rate-cards/product-orders.d.ts +33 -3
  89. package/resources/v1/contracts/rate-cards/product-orders.d.ts.map +1 -0
  90. package/resources/v1/contracts/rate-cards/product-orders.js +54 -0
  91. package/resources/v1/contracts/rate-cards/product-orders.js.map +1 -0
  92. package/resources/v1/contracts/rate-cards/product-orders.mjs +50 -0
  93. package/resources/v1/contracts/rate-cards/product-orders.mjs.map +1 -0
  94. package/resources/{contracts → v1/contracts}/rate-cards/rate-cards.d.ts +118 -14
  95. package/resources/v1/contracts/rate-cards/rate-cards.d.ts.map +1 -0
  96. package/resources/{contracts → v1/contracts}/rate-cards/rate-cards.js +83 -12
  97. package/resources/v1/contracts/rate-cards/rate-cards.js.map +1 -0
  98. package/resources/v1/contracts/rate-cards/rate-cards.mjs +140 -0
  99. package/resources/v1/contracts/rate-cards/rate-cards.mjs.map +1 -0
  100. package/resources/{contracts → v1/contracts}/rate-cards/rates.d.ts +118 -14
  101. package/resources/v1/contracts/rate-cards/rates.d.ts.map +1 -0
  102. package/resources/v1/contracts/rate-cards/rates.js +106 -0
  103. package/resources/v1/contracts/rate-cards/rates.js.map +1 -0
  104. package/resources/v1/contracts/rate-cards/rates.mjs +101 -0
  105. package/resources/v1/contracts/rate-cards/rates.mjs.map +1 -0
  106. package/resources/v1/contracts/rate-cards.d.ts +2 -0
  107. package/resources/v1/contracts/rate-cards.d.ts.map +1 -0
  108. package/resources/v1/contracts/rate-cards.js +19 -0
  109. package/resources/v1/contracts/rate-cards.js.map +1 -0
  110. package/resources/v1/contracts/rate-cards.mjs +3 -0
  111. package/resources/v1/contracts/rate-cards.mjs.map +1 -0
  112. package/resources/v1/contracts.d.ts +2 -0
  113. package/resources/v1/contracts.d.ts.map +1 -0
  114. package/resources/v1/contracts.js +19 -0
  115. package/resources/v1/contracts.js.map +1 -0
  116. package/resources/v1/contracts.mjs +3 -0
  117. package/resources/v1/contracts.mjs.map +1 -0
  118. package/resources/{credit-grants.d.ts → v1/credit-grants.d.ts} +81 -6
  119. package/resources/v1/credit-grants.d.ts.map +1 -0
  120. package/resources/v1/credit-grants.js +89 -0
  121. package/resources/v1/credit-grants.js.map +1 -0
  122. package/resources/v1/credit-grants.mjs +84 -0
  123. package/resources/v1/credit-grants.mjs.map +1 -0
  124. package/resources/{custom-fields.d.ts → v1/custom-fields.d.ts} +53 -9
  125. package/resources/v1/custom-fields.d.ts.map +1 -0
  126. package/resources/{custom-fields.js → v1/custom-fields.js} +42 -7
  127. package/resources/v1/custom-fields.js.map +1 -0
  128. package/resources/{custom-fields.mjs → v1/custom-fields.mjs} +42 -7
  129. package/resources/v1/custom-fields.mjs.map +1 -0
  130. package/resources/{customers → v1/customers}/alerts.d.ts +31 -3
  131. package/resources/v1/customers/alerts.d.ts.map +1 -0
  132. package/resources/v1/customers/alerts.js +56 -0
  133. package/resources/v1/customers/alerts.js.map +1 -0
  134. package/resources/v1/customers/alerts.mjs +52 -0
  135. package/resources/v1/customers/alerts.mjs.map +1 -0
  136. package/resources/{customers → v1/customers}/billing-config.d.ts +33 -2
  137. package/resources/v1/customers/billing-config.d.ts.map +1 -0
  138. package/resources/v1/customers/billing-config.js +65 -0
  139. package/resources/v1/customers/billing-config.js.map +1 -0
  140. package/resources/v1/customers/billing-config.mjs +61 -0
  141. package/resources/v1/customers/billing-config.mjs.map +1 -0
  142. package/resources/{customers → v1/customers}/commits.d.ts +97 -10
  143. package/resources/v1/customers/commits.d.ts.map +1 -0
  144. package/resources/v1/customers/commits.js +82 -0
  145. package/resources/v1/customers/commits.js.map +1 -0
  146. package/resources/v1/customers/commits.mjs +78 -0
  147. package/resources/v1/customers/commits.mjs.map +1 -0
  148. package/resources/{customers → v1/customers}/credits.d.ts +76 -6
  149. package/resources/v1/customers/credits.d.ts.map +1 -0
  150. package/resources/v1/customers/credits.js +67 -0
  151. package/resources/v1/customers/credits.js.map +1 -0
  152. package/resources/v1/customers/credits.mjs +63 -0
  153. package/resources/v1/customers/credits.mjs.map +1 -0
  154. package/resources/{customers → v1/customers}/customers.d.ts +197 -14
  155. package/resources/v1/customers/customers.d.ts.map +1 -0
  156. package/resources/{customers → v1/customers}/customers.js +118 -16
  157. package/resources/v1/customers/customers.js.map +1 -0
  158. package/resources/v1/customers/customers.mjs +228 -0
  159. package/resources/v1/customers/customers.mjs.map +1 -0
  160. package/resources/{customers → v1/customers}/index.d.ts +1 -1
  161. package/resources/v1/customers/index.d.ts.map +1 -0
  162. package/resources/v1/customers/index.js.map +1 -0
  163. package/resources/v1/customers/index.mjs.map +1 -0
  164. package/resources/{customers → v1/customers}/invoices.d.ts +152 -57
  165. package/resources/v1/customers/invoices.d.ts.map +1 -0
  166. package/resources/v1/customers/invoices.js +103 -0
  167. package/resources/v1/customers/invoices.js.map +1 -0
  168. package/resources/v1/customers/invoices.mjs +97 -0
  169. package/resources/v1/customers/invoices.mjs.map +1 -0
  170. package/resources/{customers → v1/customers}/named-schedules.d.ts +23 -2
  171. package/resources/v1/customers/named-schedules.d.ts.map +1 -0
  172. package/resources/v1/customers/named-schedules.js +48 -0
  173. package/resources/v1/customers/named-schedules.js.map +1 -0
  174. package/resources/v1/customers/named-schedules.mjs +44 -0
  175. package/resources/v1/customers/named-schedules.mjs.map +1 -0
  176. package/resources/{customers → v1/customers}/plans.d.ts +50 -5
  177. package/resources/v1/customers/plans.d.ts.map +1 -0
  178. package/resources/v1/customers/plans.js +99 -0
  179. package/resources/v1/customers/plans.js.map +1 -0
  180. package/resources/v1/customers/plans.mjs +93 -0
  181. package/resources/v1/customers/plans.mjs.map +1 -0
  182. package/resources/v1/customers.d.ts +2 -0
  183. package/resources/v1/customers.d.ts.map +1 -0
  184. package/resources/v1/customers.js +19 -0
  185. package/resources/v1/customers.js.map +1 -0
  186. package/resources/v1/customers.mjs +3 -0
  187. package/resources/v1/customers.mjs.map +1 -0
  188. package/resources/{dashboards.d.ts → v1/dashboards.d.ts} +32 -4
  189. package/resources/v1/dashboards.d.ts.map +1 -0
  190. package/resources/v1/dashboards.js +43 -0
  191. package/resources/v1/dashboards.js.map +1 -0
  192. package/resources/v1/dashboards.mjs +39 -0
  193. package/resources/v1/dashboards.mjs.map +1 -0
  194. package/resources/v1/index.d.ts +15 -0
  195. package/resources/v1/index.d.ts.map +1 -0
  196. package/resources/v1/index.js +44 -0
  197. package/resources/v1/index.js.map +1 -0
  198. package/resources/v1/index.mjs +16 -0
  199. package/resources/v1/index.mjs.map +1 -0
  200. package/resources/{invoices.d.ts → v1/invoices.d.ts} +16 -2
  201. package/resources/v1/invoices.d.ts.map +1 -0
  202. package/resources/v1/invoices.js +35 -0
  203. package/resources/v1/invoices.js.map +1 -0
  204. package/resources/v1/invoices.mjs +31 -0
  205. package/resources/v1/invoices.mjs.map +1 -0
  206. package/resources/{plans.d.ts → v1/plans.d.ts} +51 -8
  207. package/resources/v1/plans.d.ts.map +1 -0
  208. package/resources/{plans.js → v1/plans.js} +34 -7
  209. package/resources/v1/plans.js.map +1 -0
  210. package/resources/v1/plans.mjs +74 -0
  211. package/resources/v1/plans.mjs.map +1 -0
  212. package/resources/{pricing-units.d.ts → v1/pricing-units.d.ts} +11 -3
  213. package/resources/v1/pricing-units.d.ts.map +1 -0
  214. package/resources/{pricing-units.js → v1/pricing-units.js} +4 -4
  215. package/resources/v1/pricing-units.js.map +1 -0
  216. package/resources/{pricing-units.mjs → v1/pricing-units.mjs} +4 -4
  217. package/resources/v1/pricing-units.mjs.map +1 -0
  218. package/resources/{services.d.ts → v1/services.d.ts} +7 -2
  219. package/resources/v1/services.d.ts.map +1 -0
  220. package/resources/{services.js → v1/services.js} +7 -2
  221. package/resources/v1/services.js.map +1 -0
  222. package/resources/{services.mjs → v1/services.mjs} +7 -2
  223. package/resources/v1/services.mjs.map +1 -0
  224. package/resources/v1/usage.d.ts +325 -0
  225. package/resources/v1/usage.d.ts.map +1 -0
  226. package/resources/v1/usage.js +92 -0
  227. package/resources/v1/usage.js.map +1 -0
  228. package/resources/v1/usage.mjs +87 -0
  229. package/resources/v1/usage.mjs.map +1 -0
  230. package/resources/v1/v1.d.ts +58 -0
  231. package/resources/v1/v1.d.ts.map +1 -0
  232. package/resources/v1/v1.js +98 -0
  233. package/resources/v1/v1.js.map +1 -0
  234. package/resources/v1/v1.mjs +71 -0
  235. package/resources/v1/v1.mjs.map +1 -0
  236. package/resources/v1.d.ts +2 -0
  237. package/resources/v1.d.ts.map +1 -0
  238. package/resources/v1.js +19 -0
  239. package/resources/v1.js.map +1 -0
  240. package/resources/v1.mjs +3 -0
  241. package/resources/v1.mjs.map +1 -0
  242. package/resources/v2/contracts.d.ts +5955 -0
  243. package/resources/v2/contracts.d.ts.map +1 -0
  244. package/resources/v2/contracts.js +136 -0
  245. package/resources/v2/contracts.js.map +1 -0
  246. package/resources/v2/contracts.mjs +132 -0
  247. package/resources/v2/contracts.mjs.map +1 -0
  248. package/resources/v2/index.d.ts +3 -0
  249. package/resources/v2/index.d.ts.map +1 -0
  250. package/resources/v2/index.js +9 -0
  251. package/resources/v2/index.js.map +1 -0
  252. package/resources/v2/index.mjs +4 -0
  253. package/resources/v2/index.mjs.map +1 -0
  254. package/resources/v2/v2.d.ts +10 -0
  255. package/resources/v2/v2.d.ts.map +1 -0
  256. package/resources/v2/v2.js +39 -0
  257. package/resources/v2/v2.js.map +1 -0
  258. package/resources/v2/v2.mjs +12 -0
  259. package/resources/v2/v2.mjs.map +1 -0
  260. package/resources/v2.d.ts +2 -0
  261. package/resources/v2.d.ts.map +1 -0
  262. package/resources/v2.js +19 -0
  263. package/resources/v2.js.map +1 -0
  264. package/resources/v2.mjs +3 -0
  265. package/resources/v2.mjs.map +1 -0
  266. package/resources/webhooks.js +5 -5
  267. package/resources/webhooks.js.map +1 -1
  268. package/resources/webhooks.mjs +5 -5
  269. package/resources/webhooks.mjs.map +1 -1
  270. package/resources.d.ts +2 -0
  271. package/resources.d.ts.map +1 -0
  272. package/resources.js +18 -0
  273. package/resources.js.map +1 -0
  274. package/resources.mjs +2 -0
  275. package/resources.mjs.map +1 -0
  276. package/src/_shims/auto/runtime-bun.ts +1 -1
  277. package/src/_shims/auto/runtime-node.ts +1 -1
  278. package/src/_shims/auto/runtime.ts +1 -1
  279. package/src/_shims/auto/types-node.ts +1 -1
  280. package/src/_shims/bun-runtime.ts +2 -2
  281. package/src/_shims/index.d.ts +5 -3
  282. package/src/_shims/index.js +5 -1
  283. package/src/_shims/index.mjs +6 -2
  284. package/src/_shims/node-runtime.ts +3 -3
  285. package/src/_shims/registry.ts +1 -1
  286. package/src/_shims/web-runtime.ts +3 -3
  287. package/src/core.ts +49 -21
  288. package/src/error.ts +1 -1
  289. package/src/index.ts +31 -349
  290. package/src/internal/qs/formats.ts +1 -1
  291. package/src/internal/qs/index.ts +3 -3
  292. package/src/internal/qs/stringify.ts +3 -3
  293. package/src/internal/qs/utils.ts +2 -2
  294. package/src/pagination.ts +5 -1
  295. package/src/resource.ts +2 -2
  296. package/src/resources/index.ts +4 -144
  297. package/src/resources/shared.ts +587 -26
  298. package/src/resources/{alerts.ts → v1/alerts.ts} +31 -7
  299. package/src/resources/{audit-logs.ts → v1/audit-logs.ts} +13 -5
  300. package/src/resources/{billable-metrics.ts → v1/billable-metrics.ts} +61 -12
  301. package/src/resources/{contracts → v1/contracts}/contracts.ts +1848 -83
  302. package/src/resources/{contracts → v1/contracts}/index.ts +8 -4
  303. package/src/resources/{contracts → v1/contracts}/named-schedules.ts +25 -4
  304. package/src/resources/{contracts → v1/contracts}/products.ts +58 -14
  305. package/src/resources/{contracts → v1/contracts}/rate-cards/index.ts +6 -4
  306. package/src/resources/{contracts → v1/contracts}/rate-cards/named-schedules.ts +29 -4
  307. package/src/resources/{contracts → v1/contracts}/rate-cards/product-orders.ts +38 -5
  308. package/src/resources/{contracts → v1/contracts}/rate-cards/rate-cards.ts +137 -25
  309. package/src/resources/{contracts → v1/contracts}/rate-cards/rates.ts +105 -17
  310. package/src/resources/v1/contracts/rate-cards.ts +3 -0
  311. package/src/resources/v1/contracts.ts +3 -0
  312. package/src/resources/{credit-grants.ts → v1/credit-grants.ts} +86 -14
  313. package/src/resources/{custom-fields.ts → v1/custom-fields.ts} +62 -14
  314. package/src/resources/{customers → v1/customers}/alerts.ts +35 -6
  315. package/src/resources/{customers → v1/customers}/billing-config.ts +37 -5
  316. package/src/resources/{customers → v1/customers}/commits.ts +100 -13
  317. package/src/resources/{customers → v1/customers}/credits.ts +79 -9
  318. package/src/resources/{customers → v1/customers}/customers.ts +229 -40
  319. package/src/resources/{customers → v1/customers}/index.ts +10 -8
  320. package/src/resources/{customers → v1/customers}/invoices.ts +131 -62
  321. package/src/resources/{customers → v1/customers}/named-schedules.ts +25 -4
  322. package/src/resources/{customers → v1/customers}/plans.ts +55 -9
  323. package/src/resources/v1/customers.ts +3 -0
  324. package/src/resources/{dashboards.ts → v1/dashboards.ts} +31 -5
  325. package/src/resources/v1/index.ts +151 -0
  326. package/src/resources/{invoices.ts → v1/invoices.ts} +18 -4
  327. package/src/resources/{plans.ts → v1/plans.ts} +49 -14
  328. package/src/resources/{pricing-units.ts → v1/pricing-units.ts} +13 -5
  329. package/src/resources/{services.ts → v1/services.ts} +8 -3
  330. package/src/resources/v1/usage.ts +429 -0
  331. package/src/resources/v1/v1.ts +364 -0
  332. package/src/resources/v1.ts +3 -0
  333. package/src/resources/v2/contracts.ts +7677 -0
  334. package/src/resources/v2/index.ts +18 -0
  335. package/src/resources/v2/v2.ts +43 -0
  336. package/src/resources/v2.ts +3 -0
  337. package/src/resources/webhooks.ts +7 -7
  338. package/src/resources.ts +1 -0
  339. package/src/shims/node.ts +3 -3
  340. package/src/shims/web.ts +3 -3
  341. package/src/uploads.ts +4 -4
  342. package/src/version.ts +1 -1
  343. package/version.d.ts +1 -1
  344. package/version.d.ts.map +1 -1
  345. package/version.js +1 -1
  346. package/version.js.map +1 -1
  347. package/version.mjs +1 -1
  348. package/version.mjs.map +1 -1
  349. package/resources/alerts.d.ts.map +0 -1
  350. package/resources/alerts.js +0 -21
  351. package/resources/alerts.js.map +0 -1
  352. package/resources/alerts.mjs +0 -17
  353. package/resources/alerts.mjs.map +0 -1
  354. package/resources/audit-logs.d.ts.map +0 -1
  355. package/resources/audit-logs.js.map +0 -1
  356. package/resources/audit-logs.mjs.map +0 -1
  357. package/resources/billable-metrics.d.ts.map +0 -1
  358. package/resources/billable-metrics.js +0 -43
  359. package/resources/billable-metrics.js.map +0 -1
  360. package/resources/billable-metrics.mjs +0 -38
  361. package/resources/billable-metrics.mjs.map +0 -1
  362. package/resources/contracts/contracts.d.ts.map +0 -1
  363. package/resources/contracts/contracts.js +0 -135
  364. package/resources/contracts/contracts.js.map +0 -1
  365. package/resources/contracts/contracts.mjs +0 -108
  366. package/resources/contracts/contracts.mjs.map +0 -1
  367. package/resources/contracts/index.d.ts +0 -5
  368. package/resources/contracts/index.d.ts.map +0 -1
  369. package/resources/contracts/index.js.map +0 -1
  370. package/resources/contracts/index.mjs.map +0 -1
  371. package/resources/contracts/named-schedules.d.ts.map +0 -1
  372. package/resources/contracts/named-schedules.js +0 -27
  373. package/resources/contracts/named-schedules.js.map +0 -1
  374. package/resources/contracts/named-schedules.mjs +0 -23
  375. package/resources/contracts/named-schedules.mjs.map +0 -1
  376. package/resources/contracts/products.d.ts.map +0 -1
  377. package/resources/contracts/products.js +0 -51
  378. package/resources/contracts/products.js.map +0 -1
  379. package/resources/contracts/products.mjs +0 -46
  380. package/resources/contracts/products.mjs.map +0 -1
  381. package/resources/contracts/rate-cards/index.d.ts.map +0 -1
  382. package/resources/contracts/rate-cards/index.js.map +0 -1
  383. package/resources/contracts/rate-cards/index.mjs.map +0 -1
  384. package/resources/contracts/rate-cards/named-schedules.d.ts.map +0 -1
  385. package/resources/contracts/rate-cards/named-schedules.js +0 -27
  386. package/resources/contracts/rate-cards/named-schedules.js.map +0 -1
  387. package/resources/contracts/rate-cards/named-schedules.mjs +0 -23
  388. package/resources/contracts/rate-cards/named-schedules.mjs.map +0 -1
  389. package/resources/contracts/rate-cards/product-orders.d.ts.map +0 -1
  390. package/resources/contracts/rate-cards/product-orders.js +0 -21
  391. package/resources/contracts/rate-cards/product-orders.js.map +0 -1
  392. package/resources/contracts/rate-cards/product-orders.mjs +0 -17
  393. package/resources/contracts/rate-cards/product-orders.mjs.map +0 -1
  394. package/resources/contracts/rate-cards/rate-cards.d.ts.map +0 -1
  395. package/resources/contracts/rate-cards/rate-cards.js.map +0 -1
  396. package/resources/contracts/rate-cards/rate-cards.mjs +0 -69
  397. package/resources/contracts/rate-cards/rate-cards.mjs.map +0 -1
  398. package/resources/contracts/rate-cards/rates.d.ts.map +0 -1
  399. package/resources/contracts/rate-cards/rates.js +0 -38
  400. package/resources/contracts/rate-cards/rates.js.map +0 -1
  401. package/resources/contracts/rate-cards/rates.mjs +0 -33
  402. package/resources/contracts/rate-cards/rates.mjs.map +0 -1
  403. package/resources/credit-grants.d.ts.map +0 -1
  404. package/resources/credit-grants.js +0 -52
  405. package/resources/credit-grants.js.map +0 -1
  406. package/resources/credit-grants.mjs +0 -47
  407. package/resources/credit-grants.mjs.map +0 -1
  408. package/resources/custom-fields.d.ts.map +0 -1
  409. package/resources/custom-fields.js.map +0 -1
  410. package/resources/custom-fields.mjs.map +0 -1
  411. package/resources/customers/alerts.d.ts.map +0 -1
  412. package/resources/customers/alerts.js +0 -33
  413. package/resources/customers/alerts.js.map +0 -1
  414. package/resources/customers/alerts.mjs +0 -29
  415. package/resources/customers/alerts.mjs.map +0 -1
  416. package/resources/customers/billing-config.d.ts.map +0 -1
  417. package/resources/customers/billing-config.js +0 -38
  418. package/resources/customers/billing-config.js.map +0 -1
  419. package/resources/customers/billing-config.mjs +0 -34
  420. package/resources/customers/billing-config.mjs.map +0 -1
  421. package/resources/customers/commits.d.ts.map +0 -1
  422. package/resources/customers/commits.js +0 -27
  423. package/resources/customers/commits.js.map +0 -1
  424. package/resources/customers/commits.mjs +0 -23
  425. package/resources/customers/commits.mjs.map +0 -1
  426. package/resources/customers/credits.d.ts.map +0 -1
  427. package/resources/customers/credits.js +0 -27
  428. package/resources/customers/credits.js.map +0 -1
  429. package/resources/customers/credits.mjs +0 -23
  430. package/resources/customers/credits.mjs.map +0 -1
  431. package/resources/customers/customers.d.ts.map +0 -1
  432. package/resources/customers/customers.js.map +0 -1
  433. package/resources/customers/customers.mjs +0 -126
  434. package/resources/customers/customers.mjs.map +0 -1
  435. package/resources/customers/index.d.ts.map +0 -1
  436. package/resources/customers/index.js.map +0 -1
  437. package/resources/customers/index.mjs.map +0 -1
  438. package/resources/customers/invoices.d.ts.map +0 -1
  439. package/resources/customers/invoices.js +0 -51
  440. package/resources/customers/invoices.js.map +0 -1
  441. package/resources/customers/invoices.mjs +0 -45
  442. package/resources/customers/invoices.mjs.map +0 -1
  443. package/resources/customers/named-schedules.d.ts.map +0 -1
  444. package/resources/customers/named-schedules.js +0 -27
  445. package/resources/customers/named-schedules.js.map +0 -1
  446. package/resources/customers/named-schedules.mjs +0 -23
  447. package/resources/customers/named-schedules.mjs.map +0 -1
  448. package/resources/customers/plans.d.ts.map +0 -1
  449. package/resources/customers/plans.js +0 -53
  450. package/resources/customers/plans.js.map +0 -1
  451. package/resources/customers/plans.mjs +0 -47
  452. package/resources/customers/plans.mjs.map +0 -1
  453. package/resources/dashboards.d.ts.map +0 -1
  454. package/resources/dashboards.js +0 -17
  455. package/resources/dashboards.js.map +0 -1
  456. package/resources/dashboards.mjs +0 -13
  457. package/resources/dashboards.mjs.map +0 -1
  458. package/resources/invoices.d.ts.map +0 -1
  459. package/resources/invoices.js +0 -21
  460. package/resources/invoices.js.map +0 -1
  461. package/resources/invoices.mjs +0 -17
  462. package/resources/invoices.mjs.map +0 -1
  463. package/resources/plans.d.ts.map +0 -1
  464. package/resources/plans.js.map +0 -1
  465. package/resources/plans.mjs +0 -47
  466. package/resources/plans.mjs.map +0 -1
  467. package/resources/pricing-units.d.ts.map +0 -1
  468. package/resources/pricing-units.js.map +0 -1
  469. package/resources/pricing-units.mjs.map +0 -1
  470. package/resources/services.d.ts.map +0 -1
  471. package/resources/services.js.map +0 -1
  472. package/resources/services.mjs.map +0 -1
  473. package/resources/usage.d.ts +0 -166
  474. package/resources/usage.d.ts.map +0 -1
  475. package/resources/usage.js +0 -49
  476. package/resources/usage.js.map +0 -1
  477. package/resources/usage.mjs +0 -44
  478. package/resources/usage.mjs.map +0 -1
  479. package/src/resources/usage.ts +0 -239
  480. /package/resources/{contracts → v1/contracts}/index.js +0 -0
  481. /package/resources/{contracts → v1/contracts}/index.mjs +0 -0
  482. /package/resources/{contracts → v1/contracts}/rate-cards/index.js +0 -0
  483. /package/resources/{contracts → v1/contracts}/rate-cards/index.mjs +0 -0
  484. /package/resources/{customers → v1/customers}/index.js +0 -0
  485. /package/resources/{customers → v1/customers}/index.mjs +0 -0
@@ -0,0 +1,74 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../resource.mjs";
3
+ import { isRequestOptions } from "../../core.mjs";
4
+ import { CursorPage } from "../../pagination.mjs";
5
+ export class Plans extends APIResource {
6
+ list(query = {}, options) {
7
+ if (isRequestOptions(query)) {
8
+ return this.list({}, query);
9
+ }
10
+ return this._client.getAPIList('/v1/plans', PlanListResponsesCursorPage, { query, ...options });
11
+ }
12
+ /**
13
+ * Fetch high level details of a specific plan.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const response = await client.v1.plans.getDetails({
18
+ * plan_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
19
+ * });
20
+ * ```
21
+ */
22
+ getDetails(params, options) {
23
+ const { plan_id } = params;
24
+ return this._client.get(`/v1/planDetails/${plan_id}`, options);
25
+ }
26
+ /**
27
+ * Fetches a list of charges of a specific plan.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * // Automatically fetches more pages as needed.
32
+ * for await (const planListChargesResponse of client.v1.plans.listCharges(
33
+ * { plan_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc' },
34
+ * )) {
35
+ * // ...
36
+ * }
37
+ * ```
38
+ */
39
+ listCharges(params, options) {
40
+ const { plan_id, ...query } = params;
41
+ return this._client.getAPIList(`/v1/planDetails/${plan_id}/charges`, PlanListChargesResponsesCursorPage, {
42
+ query,
43
+ ...options,
44
+ });
45
+ }
46
+ /**
47
+ * Fetches a list of customers on a specific plan (by default, only currently
48
+ * active plans are included)
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * // Automatically fetches more pages as needed.
53
+ * for await (const planListCustomersResponse of client.v1.plans.listCustomers(
54
+ * { plan_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc' },
55
+ * )) {
56
+ * // ...
57
+ * }
58
+ * ```
59
+ */
60
+ listCustomers(params, options) {
61
+ const { plan_id, ...query } = params;
62
+ return this._client.getAPIList(`/v1/planDetails/${plan_id}/customers`, PlanListCustomersResponsesCursorPage, { query, ...options });
63
+ }
64
+ }
65
+ export class PlanListResponsesCursorPage extends CursorPage {
66
+ }
67
+ export class PlanListChargesResponsesCursorPage extends CursorPage {
68
+ }
69
+ export class PlanListCustomersResponsesCursorPage extends CursorPage {
70
+ }
71
+ Plans.PlanListResponsesCursorPage = PlanListResponsesCursorPage;
72
+ Plans.PlanListChargesResponsesCursorPage = PlanListChargesResponsesCursorPage;
73
+ Plans.PlanListCustomersResponsesCursorPage = PlanListCustomersResponsesCursorPage;
74
+ //# sourceMappingURL=plans.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plans.mjs","sourceRoot":"","sources":["../../src/resources/v1/plans.ts"],"names":[],"mappings":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,UAA4B;CAAG;AAEhF,MAAM,OAAO,kCAAmC,SAAQ,UAAmC;CAAG;AAE9F,MAAM,OAAO,oCAAqC,SAAQ,UAAqC;CAAG;AAyNlG,KAAK,CAAC,2BAA2B,GAAG,2BAA2B,CAAC;AAChE,KAAK,CAAC,kCAAkC,GAAG,kCAAkC,CAAC;AAC9E,KAAK,CAAC,oCAAoC,GAAG,oCAAoC,CAAC"}
@@ -1,9 +1,17 @@
1
- import { APIResource } from "../resource.js";
2
- import * as Core from "../core.js";
3
- import { CursorPage, type CursorPageParams } from "../pagination.js";
1
+ import { APIResource } from "../../resource.js";
2
+ import * as Core from "../../core.js";
3
+ import { CursorPage, type CursorPageParams } from "../../pagination.js";
4
4
  export declare class PricingUnits extends APIResource {
5
5
  /**
6
6
  * List all pricing units (known in the API by the legacy term "credit types").
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * // Automatically fetches more pages as needed.
11
+ * for await (const pricingUnitListResponse of client.v1.pricingUnits.list()) {
12
+ * // ...
13
+ * }
14
+ * ```
7
15
  */
8
16
  list(query?: PricingUnitListParams, options?: Core.RequestOptions): Core.PagePromise<PricingUnitListResponsesCursorPage, PricingUnitListResponse>;
9
17
  list(options?: Core.RequestOptions): Core.PagePromise<PricingUnitListResponsesCursorPage, PricingUnitListResponse>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pricing-units.d.ts","sourceRoot":"","sources":["../../src/resources/v1/pricing-units.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAErE,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;;OAUG;IACH,IAAI,CACF,KAAK,CAAC,EAAE,qBAAqB,EAC7B,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,WAAW,CAAC,kCAAkC,EAAE,uBAAuB,CAAC;IAChF,IAAI,CACF,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,WAAW,CAAC,kCAAkC,EAAE,uBAAuB,CAAC;CAajF;AAED,qBAAa,kCAAmC,SAAQ,UAAU,CAAC,uBAAuB,CAAC;CAAG;AAE9F,MAAM,WAAW,uBAAuB;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;CAAG;AAIlE,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,kCAAkC,IAAI,kCAAkC,EACxE,KAAK,qBAAqB,IAAI,qBAAqB,GACpD,CAAC;CACH"}
@@ -2,15 +2,15 @@
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.PricingUnitListResponsesCursorPage = exports.PricingUnits = void 0;
5
- const resource_1 = require("../resource.js");
6
- const core_1 = require("../core.js");
7
- const pagination_1 = require("../pagination.js");
5
+ const resource_1 = require("../../resource.js");
6
+ const core_1 = require("../../core.js");
7
+ const pagination_1 = require("../../pagination.js");
8
8
  class PricingUnits extends resource_1.APIResource {
9
9
  list(query = {}, options) {
10
10
  if ((0, core_1.isRequestOptions)(query)) {
11
11
  return this.list({}, query);
12
12
  }
13
- return this._client.getAPIList('/credit-types/list', PricingUnitListResponsesCursorPage, {
13
+ return this._client.getAPIList('/v1/credit-types/list', PricingUnitListResponsesCursorPage, {
14
14
  query,
15
15
  ...options,
16
16
  });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pricing-units.js","sourceRoot":"","sources":["../../src/resources/v1/pricing-units.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gDAA6C;AAC7C,wCAA8C;AAE9C,oDAAqE;AAErE,MAAa,YAAa,SAAQ,sBAAW;IAmB3C,IAAI,CACF,QAAqD,EAAE,EACvD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,uBAAuB,EAAE,kCAAkC,EAAE;YAC1F,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF;AA/BD,oCA+BC;AAED,MAAa,kCAAmC,SAAQ,uBAAmC;CAAG;AAA9F,gFAA8F;AAY9F,YAAY,CAAC,kCAAkC,GAAG,kCAAkC,CAAC"}
@@ -1,13 +1,13 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../resource.mjs";
3
- import { isRequestOptions } from "../core.mjs";
4
- import { CursorPage } from "../pagination.mjs";
2
+ import { APIResource } from "../../resource.mjs";
3
+ import { isRequestOptions } from "../../core.mjs";
4
+ import { CursorPage } from "../../pagination.mjs";
5
5
  export class PricingUnits extends APIResource {
6
6
  list(query = {}, options) {
7
7
  if (isRequestOptions(query)) {
8
8
  return this.list({}, query);
9
9
  }
10
- return this._client.getAPIList('/credit-types/list', PricingUnitListResponsesCursorPage, {
10
+ return this._client.getAPIList('/v1/credit-types/list', PricingUnitListResponsesCursorPage, {
11
11
  query,
12
12
  ...options,
13
13
  });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pricing-units.mjs","sourceRoot":"","sources":["../../src/resources/v1/pricing-units.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAEpB,EAAE,UAAU,EAAyB;AAE5C,MAAM,OAAO,YAAa,SAAQ,WAAW;IAmB3C,IAAI,CACF,QAAqD,EAAE,EACvD,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,uBAAuB,EAAE,kCAAkC,EAAE;YAC1F,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,kCAAmC,SAAQ,UAAmC;CAAG;AAY9F,YAAY,CAAC,kCAAkC,GAAG,kCAAkC,CAAC"}
@@ -1,11 +1,16 @@
1
- import { APIResource } from "../resource.js";
2
- import * as Core from "../core.js";
1
+ import { APIResource } from "../../resource.js";
2
+ import * as Core from "../../core.js";
3
3
  export declare class Services extends APIResource {
4
4
  /**
5
5
  * Fetches a list of services used by Metronome and the associated IP addresses. IP
6
6
  * addresses are not necessarily unique between services. In most cases, IP
7
7
  * addresses will appear in the list at least 30 days before they are used for the
8
8
  * first time.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const services = await client.v1.services.list();
13
+ * ```
9
14
  */
10
15
  list(options?: Core.RequestOptions): Core.APIPromise<ServiceListResponse>;
11
16
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/resources/v1/services.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;OAUG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC;CAG1E;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;CAC9C;AAED,yBAAiB,mBAAmB,CAAC;IACnC,UAAiB,OAAO;QACtB,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAEnB,IAAI,EAAE,MAAM,CAAC;QAEb,KAAK,EAAE,wBAAwB,GAAG,wBAAwB,CAAC;KAC5D;CACF;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;CAC5D"}
@@ -2,16 +2,21 @@
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Services = void 0;
5
- const resource_1 = require("../resource.js");
5
+ const resource_1 = require("../../resource.js");
6
6
  class Services extends resource_1.APIResource {
7
7
  /**
8
8
  * Fetches a list of services used by Metronome and the associated IP addresses. IP
9
9
  * addresses are not necessarily unique between services. In most cases, IP
10
10
  * addresses will appear in the list at least 30 days before they are used for the
11
11
  * first time.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const services = await client.v1.services.list();
16
+ * ```
12
17
  */
13
18
  list(options) {
14
- return this._client.get('/services', options);
19
+ return this._client.get('/v1/services', options);
15
20
  }
16
21
  }
17
22
  exports.Services = Services;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/resources/v1/services.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gDAA6C;AAG7C,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;;OAUG;IACH,IAAI,CAAC,OAA6B;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF;AAfD,4BAeC"}
@@ -1,14 +1,19 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../resource.mjs";
2
+ import { APIResource } from "../../resource.mjs";
3
3
  export class Services extends APIResource {
4
4
  /**
5
5
  * Fetches a list of services used by Metronome and the associated IP addresses. IP
6
6
  * addresses are not necessarily unique between services. In most cases, IP
7
7
  * addresses will appear in the list at least 30 days before they are used for the
8
8
  * first time.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const services = await client.v1.services.list();
13
+ * ```
9
14
  */
10
15
  list(options) {
11
- return this._client.get('/services', options);
16
+ return this._client.get('/v1/services', options);
12
17
  }
13
18
  }
14
19
  //# sourceMappingURL=services.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.mjs","sourceRoot":"","sources":["../../src/resources/v1/services.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAGtB,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;OAUG;IACH,IAAI,CAAC,OAA6B;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF"}
@@ -0,0 +1,325 @@
1
+ import { APIResource } from "../../resource.js";
2
+ import * as Core from "../../core.js";
3
+ import * as Shared from "../shared.js";
4
+ import { CursorPage, type CursorPageParams } from "../../pagination.js";
5
+ export declare class Usage extends APIResource {
6
+ /**
7
+ * Fetch aggregated usage data for multiple customers and billable-metrics, broken
8
+ * into intervals of the specified length.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const usages = await client.v1.usage.list({
13
+ * ending_before: '2021-01-03T00:00:00Z',
14
+ * starting_on: '2021-01-01T00:00:00Z',
15
+ * window_size: 'day',
16
+ * });
17
+ * ```
18
+ */
19
+ list(params: UsageListParams, options?: Core.RequestOptions): Core.APIPromise<UsageListResponse>;
20
+ /**
21
+ * Send usage events to Metronome. The body of this request is expected to be a
22
+ * JSON array of between 1 and 100 usage events. Compressed request bodies are
23
+ * supported with a `Content-Encoding: gzip` header. See
24
+ * [Getting usage into Metronome](https://docs.metronome.com/connect-metronome/) to
25
+ * learn more about usage events.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * await client.v1.usage.ingest([
30
+ * {
31
+ * customer_id: 'team@example.com',
32
+ * event_type: 'heartbeat',
33
+ * timestamp: '2021-01-01T00:00:00Z',
34
+ * transaction_id: '2021-01-01T00:00:00Z_cluster42',
35
+ * },
36
+ * ]);
37
+ * ```
38
+ */
39
+ ingest(body?: UsageIngestParams, options?: Core.RequestOptions): Core.APIPromise<void>;
40
+ ingest(options?: Core.RequestOptions): Core.APIPromise<void>;
41
+ /**
42
+ * Fetch aggregated usage data for the specified customer, billable-metric, and
43
+ * optional group, broken into intervals of the specified length.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * // Automatically fetches more pages as needed.
48
+ * for await (const usageListWithGroupsResponse of client.v1.usage.listWithGroups(
49
+ * {
50
+ * billable_metric_id:
51
+ * '222796fd-d29c-429e-89b2-549fabda4ed6',
52
+ * customer_id: '04ca7e72-4229-4a6e-ab11-9f7376fccbcb',
53
+ * window_size: 'day',
54
+ * ending_before: '2021-01-03T00:00:00Z',
55
+ * group_by: {
56
+ * key: 'region',
57
+ * values: ['US-East', 'US-West', 'EU-Central'],
58
+ * },
59
+ * starting_on: '2021-01-01T00:00:00Z',
60
+ * },
61
+ * )) {
62
+ * // ...
63
+ * }
64
+ * ```
65
+ */
66
+ listWithGroups(params: UsageListWithGroupsParams, options?: Core.RequestOptions): Core.PagePromise<UsageListWithGroupsResponsesCursorPage, UsageListWithGroupsResponse>;
67
+ /**
68
+ * For a set of events, look up matched billable metrics and customers by
69
+ * transaction id. This endpoint looks at transactions that occurred in the last 34
70
+ * days, and is intended for sampling-based testing workflows. It is heavily rate
71
+ * limited.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * const response = await client.v1.usage.search({
76
+ * transactionIds: ['2021-01-01T00:00:00Z_cluster42'],
77
+ * });
78
+ * ```
79
+ */
80
+ search(body: UsageSearchParams, options?: Core.RequestOptions): Core.APIPromise<UsageSearchResponse>;
81
+ }
82
+ export declare class UsageListWithGroupsResponsesCursorPage extends CursorPage<UsageListWithGroupsResponse> {
83
+ }
84
+ export interface UsageListResponse {
85
+ data: Array<UsageListResponse.Data>;
86
+ next_page: string | null;
87
+ }
88
+ export declare namespace UsageListResponse {
89
+ interface Data {
90
+ billable_metric_id: string;
91
+ billable_metric_name: string;
92
+ customer_id: string;
93
+ end_timestamp: string;
94
+ start_timestamp: string;
95
+ value: number | null;
96
+ /**
97
+ * Values will be either a number or null. Null indicates that there were no
98
+ * matches for the group_by value.
99
+ */
100
+ groups?: {
101
+ [key: string]: number | null;
102
+ };
103
+ }
104
+ }
105
+ export interface UsageListWithGroupsResponse {
106
+ ending_before: string;
107
+ group_key: string | null;
108
+ group_value: string | null;
109
+ starting_on: string;
110
+ value: number | null;
111
+ }
112
+ export type UsageSearchResponse = Array<UsageSearchResponse.UsageSearchResponseItem>;
113
+ export declare namespace UsageSearchResponse {
114
+ interface UsageSearchResponseItem {
115
+ id: string;
116
+ /**
117
+ * The ID of the customer in the ingest event body
118
+ */
119
+ customer_id: string;
120
+ event_type: string;
121
+ timestamp: string;
122
+ transaction_id: string;
123
+ is_duplicate?: boolean;
124
+ matched_billable_metrics?: Array<UsageSearchResponseItem.MatchedBillableMetric>;
125
+ /**
126
+ * The customer the event was matched to if a match was found
127
+ */
128
+ matched_customer?: UsageSearchResponseItem.MatchedCustomer;
129
+ processed_at?: string;
130
+ properties?: {
131
+ [key: string]: unknown;
132
+ };
133
+ }
134
+ namespace UsageSearchResponseItem {
135
+ interface MatchedBillableMetric {
136
+ id: string;
137
+ name: string;
138
+ /**
139
+ * (DEPRECATED) use aggregation_type instead
140
+ */
141
+ aggregate?: string;
142
+ /**
143
+ * (DEPRECATED) use aggregation_key instead
144
+ */
145
+ aggregate_keys?: Array<string>;
146
+ /**
147
+ * A key that specifies which property of the event is used to aggregate data. This
148
+ * key must be one of the property filter names and is not applicable when the
149
+ * aggregation type is 'count'.
150
+ */
151
+ aggregation_key?: string;
152
+ /**
153
+ * Specifies the type of aggregation performed on matching events.
154
+ */
155
+ aggregation_type?: 'COUNT' | 'LATEST' | 'MAX' | 'SUM' | 'UNIQUE';
156
+ /**
157
+ * RFC 3339 timestamp indicating when the billable metric was archived. If not
158
+ * provided, the billable metric is not archived.
159
+ */
160
+ archived_at?: string;
161
+ custom_fields?: {
162
+ [key: string]: string;
163
+ };
164
+ /**
165
+ * An optional filtering rule to match the 'event_type' property of an event.
166
+ */
167
+ event_type_filter?: Shared.EventTypeFilter;
168
+ /**
169
+ * (DEPRECATED) use property_filters & event_type_filter instead
170
+ */
171
+ filter?: {
172
+ [key: string]: unknown;
173
+ };
174
+ /**
175
+ * (DEPRECATED) use group_keys instead
176
+ */
177
+ group_by?: Array<string>;
178
+ /**
179
+ * Property names that are used to group usage costs on an invoice. Each entry
180
+ * represents a set of properties used to slice events into distinct buckets.
181
+ */
182
+ group_keys?: Array<Array<string>>;
183
+ /**
184
+ * A list of filters to match events to this billable metric. Each filter defines a
185
+ * rule on an event property. All rules must pass for the event to match the
186
+ * billable metric.
187
+ */
188
+ property_filters?: Array<Shared.PropertyFilter>;
189
+ /**
190
+ * The SQL query associated with the billable metric
191
+ */
192
+ sql?: string;
193
+ }
194
+ /**
195
+ * The customer the event was matched to if a match was found
196
+ */
197
+ interface MatchedCustomer {
198
+ id?: string;
199
+ name?: string;
200
+ }
201
+ }
202
+ }
203
+ export interface UsageListParams {
204
+ /**
205
+ * Body param:
206
+ */
207
+ ending_before: string;
208
+ /**
209
+ * Body param:
210
+ */
211
+ starting_on: string;
212
+ /**
213
+ * Body param: A window_size of "day" or "hour" will return the usage for the
214
+ * specified period segmented into daily or hourly aggregates. A window_size of
215
+ * "none" will return a single usage aggregate for the entirety of the specified
216
+ * period.
217
+ */
218
+ window_size: 'HOUR' | 'DAY' | 'NONE';
219
+ /**
220
+ * Query param: Cursor that indicates where the next page of results should start.
221
+ */
222
+ next_page?: string;
223
+ /**
224
+ * Body param: A list of billable metrics to fetch usage for. If absent, all
225
+ * billable metrics will be returned.
226
+ */
227
+ billable_metrics?: Array<UsageListParams.BillableMetric>;
228
+ /**
229
+ * Body param: A list of Metronome customer IDs to fetch usage for. If absent,
230
+ * usage for all customers will be returned.
231
+ */
232
+ customer_ids?: Array<string>;
233
+ }
234
+ export declare namespace UsageListParams {
235
+ interface BillableMetric {
236
+ id: string;
237
+ group_by?: BillableMetric.GroupBy;
238
+ }
239
+ namespace BillableMetric {
240
+ interface GroupBy {
241
+ /**
242
+ * The name of the group_by key to use
243
+ */
244
+ key: string;
245
+ /**
246
+ * Values of the group_by key to return in the query. If this field is omitted, all
247
+ * available values will be returned, up to a maximum of 200.
248
+ */
249
+ values?: Array<string>;
250
+ }
251
+ }
252
+ }
253
+ export type UsageIngestParams = Array<UsageIngestParams.Usage>;
254
+ export declare namespace UsageIngestParams {
255
+ interface Usage {
256
+ customer_id: string;
257
+ event_type: string;
258
+ /**
259
+ * RFC 3339 formatted
260
+ */
261
+ timestamp: string;
262
+ transaction_id: string;
263
+ properties?: {
264
+ [key: string]: unknown;
265
+ };
266
+ }
267
+ }
268
+ export interface UsageListWithGroupsParams extends CursorPageParams {
269
+ /**
270
+ * Body param:
271
+ */
272
+ billable_metric_id: string;
273
+ /**
274
+ * Body param:
275
+ */
276
+ customer_id: string;
277
+ /**
278
+ * Body param: A window_size of "day" or "hour" will return the usage for the
279
+ * specified period segmented into daily or hourly aggregates. A window_size of
280
+ * "none" will return a single usage aggregate for the entirety of the specified
281
+ * period.
282
+ */
283
+ window_size: 'HOUR' | 'DAY' | 'NONE';
284
+ /**
285
+ * Body param: If true, will return the usage for the current billing period. Will
286
+ * return an error if the customer is currently uncontracted or starting_on and
287
+ * ending_before are specified when this is true.
288
+ */
289
+ current_period?: boolean;
290
+ /**
291
+ * Body param:
292
+ */
293
+ ending_before?: string;
294
+ /**
295
+ * Body param:
296
+ */
297
+ group_by?: UsageListWithGroupsParams.GroupBy;
298
+ /**
299
+ * Body param:
300
+ */
301
+ starting_on?: string;
302
+ }
303
+ export declare namespace UsageListWithGroupsParams {
304
+ interface GroupBy {
305
+ /**
306
+ * The name of the group_by key to use
307
+ */
308
+ key: string;
309
+ /**
310
+ * Values of the group_by key to return in the query. Omit this if you'd like all
311
+ * values for the key returned.
312
+ */
313
+ values?: Array<string>;
314
+ }
315
+ }
316
+ export interface UsageSearchParams {
317
+ /**
318
+ * The transaction IDs of the events to retrieve
319
+ */
320
+ transactionIds: Array<string>;
321
+ }
322
+ export declare namespace Usage {
323
+ export { type UsageListResponse as UsageListResponse, type UsageListWithGroupsResponse as UsageListWithGroupsResponse, type UsageSearchResponse as UsageSearchResponse, UsageListWithGroupsResponsesCursorPage as UsageListWithGroupsResponsesCursorPage, type UsageListParams as UsageListParams, type UsageIngestParams as UsageIngestParams, type UsageListWithGroupsParams as UsageListWithGroupsParams, type UsageSearchParams as UsageSearchParams, };
324
+ }
325
+ //# sourceMappingURL=usage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/resources/v1/usage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAErE,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC;IAKhG;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IACtF,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,C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@ -0,0 +1,92 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.UsageListWithGroupsResponsesCursorPage = exports.Usage = void 0;
5
+ const resource_1 = require("../../resource.js");
6
+ const core_1 = require("../../core.js");
7
+ const pagination_1 = require("../../pagination.js");
8
+ class Usage extends resource_1.APIResource {
9
+ /**
10
+ * Fetch aggregated usage data for multiple customers and billable-metrics, broken
11
+ * into intervals of the specified length.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const usages = await client.v1.usage.list({
16
+ * ending_before: '2021-01-03T00:00:00Z',
17
+ * starting_on: '2021-01-01T00:00:00Z',
18
+ * window_size: 'day',
19
+ * });
20
+ * ```
21
+ */
22
+ list(params, options) {
23
+ const { next_page, ...body } = params;
24
+ return this._client.post('/v1/usage', { query: { next_page }, body, ...options });
25
+ }
26
+ ingest(body, options) {
27
+ if ((0, core_1.isRequestOptions)(body)) {
28
+ return this.ingest(undefined, body);
29
+ }
30
+ return this._client.post('/v1/ingest', {
31
+ body,
32
+ ...options,
33
+ headers: { Accept: '*/*', ...options?.headers },
34
+ });
35
+ }
36
+ /**
37
+ * Fetch aggregated usage data for the specified customer, billable-metric, and
38
+ * optional group, broken into intervals of the specified length.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * // Automatically fetches more pages as needed.
43
+ * for await (const usageListWithGroupsResponse of client.v1.usage.listWithGroups(
44
+ * {
45
+ * billable_metric_id:
46
+ * '222796fd-d29c-429e-89b2-549fabda4ed6',
47
+ * customer_id: '04ca7e72-4229-4a6e-ab11-9f7376fccbcb',
48
+ * window_size: 'day',
49
+ * ending_before: '2021-01-03T00:00:00Z',
50
+ * group_by: {
51
+ * key: 'region',
52
+ * values: ['US-East', 'US-West', 'EU-Central'],
53
+ * },
54
+ * starting_on: '2021-01-01T00:00:00Z',
55
+ * },
56
+ * )) {
57
+ * // ...
58
+ * }
59
+ * ```
60
+ */
61
+ listWithGroups(params, options) {
62
+ const { limit, next_page, ...body } = params;
63
+ return this._client.getAPIList('/v1/usage/groups', UsageListWithGroupsResponsesCursorPage, {
64
+ query: { limit, next_page },
65
+ body,
66
+ method: 'post',
67
+ ...options,
68
+ });
69
+ }
70
+ /**
71
+ * For a set of events, look up matched billable metrics and customers by
72
+ * transaction id. This endpoint looks at transactions that occurred in the last 34
73
+ * days, and is intended for sampling-based testing workflows. It is heavily rate
74
+ * limited.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const response = await client.v1.usage.search({
79
+ * transactionIds: ['2021-01-01T00:00:00Z_cluster42'],
80
+ * });
81
+ * ```
82
+ */
83
+ search(body, options) {
84
+ return this._client.post('/v1/events/search', { body, ...options });
85
+ }
86
+ }
87
+ exports.Usage = Usage;
88
+ class UsageListWithGroupsResponsesCursorPage extends pagination_1.CursorPage {
89
+ }
90
+ exports.UsageListWithGroupsResponsesCursorPage = UsageListWithGroupsResponsesCursorPage;
91
+ Usage.UsageListWithGroupsResponsesCursorPage = UsageListWithGroupsResponsesCursorPage;
92
+ //# sourceMappingURL=usage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/resources/v1/usage.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gDAA6C;AAC7C,wCAA8C;AAG9C,oDAAqE;AAErE,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,MAAuB,EAAE,OAA6B;QACzD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpF,CAAC;IAuBD,MAAM,CACJ,IAA8C,EAC9C,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,E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