@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
@@ -6,13 +6,13 @@ export {
6
6
  type AlertArchiveResponse,
7
7
  type AlertCreateParams,
8
8
  type AlertArchiveParams,
9
- } from './alerts';
9
+ } from "./alerts.js";
10
10
  export {
11
11
  AuditLogListResponsesCursorPage,
12
12
  AuditLogs,
13
13
  type AuditLogListResponse,
14
14
  type AuditLogListParams,
15
- } from './audit-logs';
15
+ } from "./audit-logs.js";
16
16
  export {
17
17
  BillableMetricListResponsesCursorPage,
18
18
  BillableMetrics,
@@ -24,7 +24,7 @@ export {
24
24
  type BillableMetricRetrieveParams,
25
25
  type BillableMetricListParams,
26
26
  type BillableMetricArchiveParams,
27
- } from './billable-metrics';
27
+ } from "./billable-metrics.js";
28
28
  export {
29
29
  Contracts,
30
30
  type ContractCreateResponse,
@@ -35,6 +35,7 @@ export {
35
35
  type ContractCreateHistoricalInvoicesResponse,
36
36
  type ContractListBalancesResponse,
37
37
  type ContractRetrieveRateScheduleResponse,
38
+ type ContractRetrieveSubscriptionQuantityHistoryResponse,
38
39
  type ContractScheduleProServicesInvoiceResponse,
39
40
  type ContractUpdateEndDateResponse,
40
41
  type ContractCreateParams,
@@ -46,10 +47,11 @@ export {
46
47
  type ContractCreateHistoricalInvoicesParams,
47
48
  type ContractListBalancesParams,
48
49
  type ContractRetrieveRateScheduleParams,
50
+ type ContractRetrieveSubscriptionQuantityHistoryParams,
49
51
  type ContractScheduleProServicesInvoiceParams,
50
52
  type ContractSetUsageFilterParams,
51
53
  type ContractUpdateEndDateParams,
52
- } from './contracts/index';
54
+ } from "./contracts/index.js";
53
55
  export {
54
56
  CreditGrantListResponsesCursorPage,
55
57
  CreditGrants,
@@ -66,7 +68,7 @@ export {
66
68
  type CreditGrantEditParams,
67
69
  type CreditGrantListEntriesParams,
68
70
  type CreditGrantVoidParams,
69
- } from './credit-grants';
71
+ } from "./credit-grants.js";
70
72
  export {
71
73
  CustomFields,
72
74
  type CustomFieldListKeysResponse,
@@ -75,7 +77,7 @@ export {
75
77
  type CustomFieldListKeysParams,
76
78
  type CustomFieldRemoveKeyParams,
77
79
  type CustomFieldSetValuesParams,
78
- } from './custom-fields';
80
+ } from "./custom-fields.js";
79
81
  export {
80
82
  CustomerDetailsCursorPage,
81
83
  CustomerListBillableMetricsResponsesCursorPage,
@@ -88,6 +90,7 @@ export {
88
90
  type CustomerArchiveResponse,
89
91
  type CustomerListBillableMetricsResponse,
90
92
  type CustomerListCostsResponse,
93
+ type CustomerPreviewEventsResponse,
91
94
  type CustomerSetNameResponse,
92
95
  type CustomerCreateParams,
93
96
  type CustomerRetrieveParams,
@@ -95,22 +98,23 @@ export {
95
98
  type CustomerArchiveParams,
96
99
  type CustomerListBillableMetricsParams,
97
100
  type CustomerListCostsParams,
101
+ type CustomerPreviewEventsParams,
98
102
  type CustomerSetIngestAliasesParams,
99
103
  type CustomerSetNameParams,
100
104
  type CustomerUpdateConfigParams,
101
- } from './customers/index';
105
+ } from "./customers/index.js";
102
106
  export {
103
107
  Dashboards,
104
108
  type DashboardGetEmbeddableURLResponse,
105
109
  type DashboardGetEmbeddableURLParams,
106
- } from './dashboards';
110
+ } from "./dashboards.js";
107
111
  export {
108
112
  Invoices,
109
113
  type InvoiceRegenerateResponse,
110
114
  type InvoiceVoidResponse,
111
115
  type InvoiceRegenerateParams,
112
116
  type InvoiceVoidParams,
113
- } from './invoices';
117
+ } from "./invoices.js";
114
118
  export {
115
119
  PlanListResponsesCursorPage,
116
120
  PlanListChargesResponsesCursorPage,
@@ -125,21 +129,23 @@ export {
125
129
  type PlanGetDetailsParams,
126
130
  type PlanListChargesParams,
127
131
  type PlanListCustomersParams,
128
- } from './plans';
132
+ } from "./plans.js";
129
133
  export {
130
134
  PricingUnitListResponsesCursorPage,
131
135
  PricingUnits,
132
136
  type PricingUnitListResponse,
133
137
  type PricingUnitListParams,
134
- } from './pricing-units';
135
- export { Services, type ServiceListResponse } from './services';
138
+ } from "./pricing-units.js";
139
+ export { Services, type ServiceListResponse } from "./services.js";
136
140
  export {
137
141
  UsageListWithGroupsResponsesCursorPage,
138
142
  Usage,
139
143
  type UsageListResponse,
140
144
  type UsageListWithGroupsResponse,
145
+ type UsageSearchResponse,
141
146
  type UsageListParams,
142
147
  type UsageIngestParams,
143
148
  type UsageListWithGroupsParams,
144
- } from './usage';
145
- export { V1 } from './v1';
149
+ type UsageSearchParams,
150
+ } from "./usage.js";
151
+ export { V1 } from "./v1.js";
@@ -1,11 +1,18 @@
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 Invoices extends APIResource {
7
7
  /**
8
8
  * Regenerate a voided contract invoice
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const response = await client.v1.invoices.regenerate({
13
+ * id: '6a37bb88-8538-48c5-b37b-a41c836328bd',
14
+ * });
15
+ * ```
9
16
  */
10
17
  regenerate(
11
18
  body: InvoiceRegenerateParams,
@@ -16,6 +23,13 @@ export class Invoices extends APIResource {
16
23
 
17
24
  /**
18
25
  * Void an invoice
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const response = await client.v1.invoices.void({
30
+ * id: '6a37bb88-8538-48c5-b37b-a41c836328bd',
31
+ * });
32
+ * ```
19
33
  */
20
34
  void(body: InvoiceVoidParams, options?: Core.RequestOptions): Core.APIPromise<InvoiceVoidResponse> {
21
35
  return this._client.post('/v1/invoices/void', { body, ...options });
@@ -1,15 +1,23 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../resource';
4
- import { isRequestOptions } from '../../core';
5
- import * as Core from '../../core';
6
- import * as Shared from '../shared';
7
- import * as CustomersAPI from './customers/customers';
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 Shared from "../shared.js";
7
+ import * as CustomersAPI from "./customers/customers.js";
8
+ import { CursorPage, type CursorPageParams } from "../../pagination.js";
9
9
 
10
10
  export class Plans extends APIResource {
11
11
  /**
12
12
  * List all available plans.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // Automatically fetches more pages as needed.
17
+ * for await (const planListResponse of client.v1.plans.list()) {
18
+ * // ...
19
+ * }
20
+ * ```
13
21
  */
14
22
  list(
15
23
  query?: PlanListParams,
@@ -28,6 +36,13 @@ export class Plans extends APIResource {
28
36
 
29
37
  /**
30
38
  * Fetch high level details of a specific plan.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const response = await client.v1.plans.getDetails({
43
+ * plan_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
44
+ * });
45
+ * ```
31
46
  */
32
47
  getDetails(
33
48
  params: PlanGetDetailsParams,
@@ -39,6 +54,16 @@ export class Plans extends APIResource {
39
54
 
40
55
  /**
41
56
  * Fetches a list of charges of a specific plan.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * // Automatically fetches more pages as needed.
61
+ * for await (const planListChargesResponse of client.v1.plans.listCharges(
62
+ * { plan_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc' },
63
+ * )) {
64
+ * // ...
65
+ * }
66
+ * ```
42
67
  */
43
68
  listCharges(
44
69
  params: PlanListChargesParams,
@@ -54,6 +79,16 @@ export class Plans extends APIResource {
54
79
  /**
55
80
  * Fetches a list of customers on a specific plan (by default, only currently
56
81
  * active plans are included)
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * // Automatically fetches more pages as needed.
86
+ * for await (const planListCustomersResponse of client.v1.plans.listCustomers(
87
+ * { plan_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc' },
88
+ * )) {
89
+ * // ...
90
+ * }
91
+ * ```
57
92
  */
58
93
  listCustomers(
59
94
  params: PlanListCustomersParams,
@@ -77,7 +112,7 @@ export class PlanListCustomersResponsesCursorPage extends CursorPage<PlanListCus
77
112
  export interface PlanDetail {
78
113
  id: string;
79
114
 
80
- custom_fields: Record<string, string>;
115
+ custom_fields: { [key: string]: string };
81
116
 
82
117
  name: string;
83
118
 
@@ -151,7 +186,7 @@ export interface PlanListResponse {
151
186
 
152
187
  name: string;
153
188
 
154
- custom_fields?: Record<string, string>;
189
+ custom_fields?: { [key: string]: string };
155
190
  }
156
191
 
157
192
  export interface PlanGetDetailsResponse {
@@ -165,7 +200,7 @@ export interface PlanListChargesResponse {
165
200
 
166
201
  credit_type: Shared.CreditTypeData;
167
202
 
168
- custom_fields: Record<string, string>;
203
+ custom_fields: { [key: string]: string };
169
204
 
170
205
  name: string;
171
206
 
@@ -238,7 +273,7 @@ export namespace PlanListCustomersResponse {
238
273
  export interface PlanDetails {
239
274
  id: string;
240
275
 
241
- custom_fields: Record<string, string>;
276
+ custom_fields: { [key: string]: string };
242
277
 
243
278
  customer_plan_id: string;
244
279
 
@@ -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 { isRequestOptions } from '../../core';
5
- import * as Core from '../../core';
6
- 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 { CursorPage, type CursorPageParams } from "../../pagination.js";
7
7
 
8
8
  export class PricingUnits extends APIResource {
9
9
  /**
10
10
  * List all pricing units (known in the API by the legacy term "credit types").
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * // Automatically fetches more pages as needed.
15
+ * for await (const pricingUnitListResponse of client.v1.pricingUnits.list()) {
16
+ * // ...
17
+ * }
18
+ * ```
11
19
  */
12
20
  list(
13
21
  query?: PricingUnitListParams,
@@ -1,7 +1,7 @@
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 Services extends APIResource {
7
7
  /**
@@ -9,6 +9,11 @@ export class Services extends APIResource {
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?: Core.RequestOptions): Core.APIPromise<ServiceListResponse> {
14
19
  return this._client.get('/v1/services', options);
@@ -1,14 +1,24 @@
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 { 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 Shared from "../shared.js";
7
+ import { CursorPage, type CursorPageParams } from "../../pagination.js";
7
8
 
8
9
  export class Usage extends APIResource {
9
10
  /**
10
11
  * Fetch aggregated usage data for multiple customers and billable-metrics, broken
11
12
  * into intervals of the specified length.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const usages = await client.v1.usage.list({
17
+ * ending_before: '2021-01-03T00:00:00Z',
18
+ * starting_on: '2021-01-01T00:00:00Z',
19
+ * window_size: 'day',
20
+ * });
21
+ * ```
12
22
  */
13
23
  list(params: UsageListParams, options?: Core.RequestOptions): Core.APIPromise<UsageListResponse> {
14
24
  const { next_page, ...body } = params;
@@ -21,6 +31,18 @@ export class Usage extends APIResource {
21
31
  * supported with a `Content-Encoding: gzip` header. See
22
32
  * [Getting usage into Metronome](https://docs.metronome.com/connect-metronome/) to
23
33
  * learn more about usage events.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * await client.v1.usage.ingest([
38
+ * {
39
+ * customer_id: 'team@example.com',
40
+ * event_type: 'heartbeat',
41
+ * timestamp: '2021-01-01T00:00:00Z',
42
+ * transaction_id: '2021-01-01T00:00:00Z_cluster42',
43
+ * },
44
+ * ]);
45
+ * ```
24
46
  */
25
47
  ingest(body?: UsageIngestParams, options?: Core.RequestOptions): Core.APIPromise<void>;
26
48
  ingest(options?: Core.RequestOptions): Core.APIPromise<void>;
@@ -41,6 +63,27 @@ export class Usage extends APIResource {
41
63
  /**
42
64
  * Fetch aggregated usage data for the specified customer, billable-metric, and
43
65
  * optional group, broken into intervals of the specified length.
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * // Automatically fetches more pages as needed.
70
+ * for await (const usageListWithGroupsResponse of client.v1.usage.listWithGroups(
71
+ * {
72
+ * billable_metric_id:
73
+ * '222796fd-d29c-429e-89b2-549fabda4ed6',
74
+ * customer_id: '04ca7e72-4229-4a6e-ab11-9f7376fccbcb',
75
+ * window_size: 'day',
76
+ * ending_before: '2021-01-03T00:00:00Z',
77
+ * group_by: {
78
+ * key: 'region',
79
+ * values: ['US-East', 'US-West', 'EU-Central'],
80
+ * },
81
+ * starting_on: '2021-01-01T00:00:00Z',
82
+ * },
83
+ * )) {
84
+ * // ...
85
+ * }
86
+ * ```
44
87
  */
45
88
  listWithGroups(
46
89
  params: UsageListWithGroupsParams,
@@ -54,6 +97,23 @@ export class Usage extends APIResource {
54
97
  ...options,
55
98
  });
56
99
  }
100
+
101
+ /**
102
+ * For a set of events, look up matched billable metrics and customers by
103
+ * transaction id. This endpoint looks at transactions that occurred in the last 34
104
+ * days, and is intended for sampling-based testing workflows. It is heavily rate
105
+ * limited.
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * const response = await client.v1.usage.search({
110
+ * transactionIds: ['2021-01-01T00:00:00Z_cluster42'],
111
+ * });
112
+ * ```
113
+ */
114
+ search(body: UsageSearchParams, options?: Core.RequestOptions): Core.APIPromise<UsageSearchResponse> {
115
+ return this._client.post('/v1/events/search', { body, ...options });
116
+ }
57
117
  }
58
118
 
59
119
  export class UsageListWithGroupsResponsesCursorPage extends CursorPage<UsageListWithGroupsResponse> {}
@@ -82,7 +142,7 @@ export namespace UsageListResponse {
82
142
  * Values will be either a number or null. Null indicates that there were no
83
143
  * matches for the group_by value.
84
144
  */
85
- groups?: Record<string, number | null>;
145
+ groups?: { [key: string]: number | null };
86
146
  }
87
147
  }
88
148
 
@@ -98,6 +158,118 @@ export interface UsageListWithGroupsResponse {
98
158
  value: number | null;
99
159
  }
100
160
 
161
+ export type UsageSearchResponse = Array<UsageSearchResponse.UsageSearchResponseItem>;
162
+
163
+ export namespace UsageSearchResponse {
164
+ export interface UsageSearchResponseItem {
165
+ id: string;
166
+
167
+ /**
168
+ * The ID of the customer in the ingest event body
169
+ */
170
+ customer_id: string;
171
+
172
+ event_type: string;
173
+
174
+ timestamp: string;
175
+
176
+ transaction_id: string;
177
+
178
+ is_duplicate?: boolean;
179
+
180
+ matched_billable_metrics?: Array<UsageSearchResponseItem.MatchedBillableMetric>;
181
+
182
+ /**
183
+ * The customer the event was matched to if a match was found
184
+ */
185
+ matched_customer?: UsageSearchResponseItem.MatchedCustomer;
186
+
187
+ processed_at?: string;
188
+
189
+ properties?: { [key: string]: unknown };
190
+ }
191
+
192
+ export namespace UsageSearchResponseItem {
193
+ export interface MatchedBillableMetric {
194
+ id: string;
195
+
196
+ name: string;
197
+
198
+ /**
199
+ * (DEPRECATED) use aggregation_type instead
200
+ */
201
+ aggregate?: string;
202
+
203
+ /**
204
+ * (DEPRECATED) use aggregation_key instead
205
+ */
206
+ aggregate_keys?: Array<string>;
207
+
208
+ /**
209
+ * A key that specifies which property of the event is used to aggregate data. This
210
+ * key must be one of the property filter names and is not applicable when the
211
+ * aggregation type is 'count'.
212
+ */
213
+ aggregation_key?: string;
214
+
215
+ /**
216
+ * Specifies the type of aggregation performed on matching events.
217
+ */
218
+ aggregation_type?: 'COUNT' | 'LATEST' | 'MAX' | 'SUM' | 'UNIQUE';
219
+
220
+ /**
221
+ * RFC 3339 timestamp indicating when the billable metric was archived. If not
222
+ * provided, the billable metric is not archived.
223
+ */
224
+ archived_at?: string;
225
+
226
+ custom_fields?: { [key: string]: string };
227
+
228
+ /**
229
+ * An optional filtering rule to match the 'event_type' property of an event.
230
+ */
231
+ event_type_filter?: Shared.EventTypeFilter;
232
+
233
+ /**
234
+ * (DEPRECATED) use property_filters & event_type_filter instead
235
+ */
236
+ filter?: { [key: string]: unknown };
237
+
238
+ /**
239
+ * (DEPRECATED) use group_keys instead
240
+ */
241
+ group_by?: Array<string>;
242
+
243
+ /**
244
+ * Property names that are used to group usage costs on an invoice. Each entry
245
+ * represents a set of properties used to slice events into distinct buckets.
246
+ */
247
+ group_keys?: Array<Array<string>>;
248
+
249
+ /**
250
+ * A list of filters to match events to this billable metric. Each filter defines a
251
+ * rule on an event property. All rules must pass for the event to match the
252
+ * billable metric.
253
+ */
254
+ property_filters?: Array<Shared.PropertyFilter>;
255
+
256
+ /**
257
+ * The SQL query associated with the billable metric
258
+ */
259
+ sql?: string;
260
+ }
261
+
262
+ /**
263
+ * The customer the event was matched to if a match was found
264
+ */
265
+ export interface MatchedCustomer {
266
+ id?: string;
267
+
268
+ name?: string;
269
+ }
270
+ }
271
+ }
272
+
101
273
  export interface UsageListParams {
102
274
  /**
103
275
  * Body param:
@@ -173,7 +345,7 @@ export namespace UsageIngestParams {
173
345
 
174
346
  transaction_id: string;
175
347
 
176
- properties?: Record<string, unknown>;
348
+ properties?: { [key: string]: unknown };
177
349
  }
178
350
  }
179
351
 
@@ -234,15 +406,24 @@ export namespace UsageListWithGroupsParams {
234
406
  }
235
407
  }
236
408
 
409
+ export interface UsageSearchParams {
410
+ /**
411
+ * The transaction IDs of the events to retrieve
412
+ */
413
+ transactionIds: Array<string>;
414
+ }
415
+
237
416
  Usage.UsageListWithGroupsResponsesCursorPage = UsageListWithGroupsResponsesCursorPage;
238
417
 
239
418
  export declare namespace Usage {
240
419
  export {
241
420
  type UsageListResponse as UsageListResponse,
242
421
  type UsageListWithGroupsResponse as UsageListWithGroupsResponse,
422
+ type UsageSearchResponse as UsageSearchResponse,
243
423
  UsageListWithGroupsResponsesCursorPage as UsageListWithGroupsResponsesCursorPage,
244
424
  type UsageListParams as UsageListParams,
245
425
  type UsageIngestParams as UsageIngestParams,
246
426
  type UsageListWithGroupsParams as UsageListWithGroupsParams,
427
+ type UsageSearchParams as UsageSearchParams,
247
428
  };
248
429
  }