metronome-sdk 0.3.0 → 2.0.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 (363) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +91 -0
  3. data/README.md +9 -9
  4. data/lib/metronome_sdk/errors.rb +25 -11
  5. data/lib/metronome_sdk/file_part.rb +10 -7
  6. data/lib/metronome_sdk/internal/body_cursor_page.rb +86 -0
  7. data/lib/metronome_sdk/internal/cursor_page.rb +1 -1
  8. data/lib/metronome_sdk/internal/cursor_page_without_limit.rb +86 -0
  9. data/lib/metronome_sdk/internal/transport/base_client.rb +12 -11
  10. data/lib/metronome_sdk/internal/transport/pooled_net_requester.rb +8 -19
  11. data/lib/metronome_sdk/internal/type/base_model.rb +6 -13
  12. data/lib/metronome_sdk/internal/type/base_page.rb +1 -1
  13. data/lib/metronome_sdk/internal/type/enum.rb +25 -0
  14. data/lib/metronome_sdk/internal/type/file_input.rb +7 -4
  15. data/lib/metronome_sdk/internal/type/union.rb +11 -0
  16. data/lib/metronome_sdk/internal/util.rb +9 -8
  17. data/lib/metronome_sdk/models/base_threshold_commit.rb +36 -0
  18. data/lib/metronome_sdk/models/commit.rb +26 -170
  19. data/lib/metronome_sdk/models/commit_hierarchy_configuration.rb +98 -0
  20. data/lib/metronome_sdk/models/commit_rate.rb +48 -0
  21. data/lib/metronome_sdk/models/commit_specifier.rb +42 -0
  22. data/lib/metronome_sdk/models/commit_specifier_input.rb +42 -0
  23. data/lib/metronome_sdk/models/contract.rb +404 -0
  24. data/lib/metronome_sdk/models/contract_v2.rb +3169 -0
  25. data/lib/metronome_sdk/models/contract_without_amendments.rb +38 -1128
  26. data/lib/metronome_sdk/models/credit.rb +9 -156
  27. data/lib/metronome_sdk/models/discount.rb +2 -1
  28. data/lib/metronome_sdk/models/hierarchy_configuration.rb +173 -0
  29. data/lib/metronome_sdk/models/override.rb +6 -101
  30. data/lib/metronome_sdk/models/override_tier.rb +21 -0
  31. data/lib/metronome_sdk/models/overwrite_rate.rb +82 -0
  32. data/lib/metronome_sdk/models/payment_gate_config.rb +150 -0
  33. data/lib/metronome_sdk/models/payment_gate_config_v2.rb +150 -0
  34. data/lib/metronome_sdk/models/prepaid_balance_threshold_configuration.rb +100 -0
  35. data/lib/metronome_sdk/models/prepaid_balance_threshold_configuration_v2.rb +102 -0
  36. data/lib/metronome_sdk/models/pro_service.rb +2 -1
  37. data/lib/metronome_sdk/models/recurring_commit_subscription_config.rb +51 -0
  38. data/lib/metronome_sdk/models/scheduled_charge.rb +2 -1
  39. data/lib/metronome_sdk/models/spend_threshold_configuration.rb +44 -0
  40. data/lib/metronome_sdk/models/spend_threshold_configuration_v2.rb +44 -0
  41. data/lib/metronome_sdk/models/subscription.rb +311 -0
  42. data/lib/metronome_sdk/models/update_base_threshold_commit.rb +36 -0
  43. data/lib/metronome_sdk/models/v1/alert_archive_params.rb +8 -4
  44. data/lib/metronome_sdk/models/v1/alert_create_params.rb +42 -42
  45. data/lib/metronome_sdk/models/v1/billable_metric_create_params.rb +1 -2
  46. data/lib/metronome_sdk/models/v1/billable_metric_list_response.rb +3 -3
  47. data/lib/metronome_sdk/models/v1/billable_metric_retrieve_response.rb +4 -7
  48. data/lib/metronome_sdk/models/v1/contract_amend_params.rb +58 -411
  49. data/lib/metronome_sdk/models/v1/contract_create_historical_invoices_params.rb +7 -16
  50. data/lib/metronome_sdk/models/v1/contract_create_params.rb +315 -1459
  51. data/lib/metronome_sdk/models/v1/contract_list_balances_response.rb +6 -23
  52. data/lib/metronome_sdk/models/v1/contract_list_response.rb +3 -1153
  53. data/lib/metronome_sdk/models/v1/contract_retrieve_rate_schedule_params.rb +2 -6
  54. data/lib/metronome_sdk/models/v1/contract_retrieve_rate_schedule_response.rb +5 -50
  55. data/lib/metronome_sdk/models/v1/contract_retrieve_response.rb +3 -1154
  56. data/lib/metronome_sdk/models/v1/contract_schedule_pro_services_invoice_params.rb +1 -3
  57. data/lib/metronome_sdk/models/v1/contracts/product_create_params.rb +2 -1
  58. data/lib/metronome_sdk/models/v1/contracts/product_list_response.rb +8 -1
  59. data/lib/metronome_sdk/models/v1/contracts/product_retrieve_response.rb +8 -1
  60. data/lib/metronome_sdk/models/v1/contracts/quantity_rounding.rb +1 -4
  61. data/lib/metronome_sdk/models/v1/contracts/rate_card_create_params.rb +4 -7
  62. data/lib/metronome_sdk/models/v1/contracts/rate_card_list_response.rb +10 -1
  63. data/lib/metronome_sdk/models/v1/contracts/rate_card_retrieve_rate_schedule_params.rb +2 -6
  64. data/lib/metronome_sdk/models/v1/contracts/rate_card_retrieve_rate_schedule_response.rb +5 -50
  65. data/lib/metronome_sdk/models/v1/contracts/rate_card_retrieve_response.rb +10 -1
  66. data/lib/metronome_sdk/models/v1/contracts/rate_card_update_params.rb +1 -3
  67. data/lib/metronome_sdk/models/v1/contracts/rate_cards/product_order_update_params.rb +1 -3
  68. data/lib/metronome_sdk/models/v1/contracts/rate_cards/rate_add_many_params.rb +6 -61
  69. data/lib/metronome_sdk/models/v1/contracts/rate_cards/rate_add_params.rb +3 -49
  70. data/lib/metronome_sdk/models/v1/contracts/rate_cards/rate_add_response.rb +4 -51
  71. data/lib/metronome_sdk/models/v1/contracts/rate_cards/rate_list_params.rb +2 -6
  72. data/lib/metronome_sdk/models/v1/contracts/rate_cards/rate_list_response.rb +5 -49
  73. data/lib/metronome_sdk/models/v1/credit_grant_list_entries_response.rb +103 -123
  74. data/lib/metronome_sdk/models/v1/credit_grant_list_response.rb +3 -5
  75. data/lib/metronome_sdk/models/v1/custom_field_list_keys_params.rb +1 -3
  76. data/lib/metronome_sdk/models/v1/custom_field_list_keys_response.rb +41 -58
  77. data/lib/metronome_sdk/models/v1/custom_field_set_values_params.rb +5 -1
  78. data/lib/metronome_sdk/models/v1/customer.rb +2 -1
  79. data/lib/metronome_sdk/models/v1/customer_create_params.rb +37 -11
  80. data/lib/metronome_sdk/models/v1/customer_detail.rb +11 -2
  81. data/lib/metronome_sdk/models/v1/customer_list_billable_metrics_response.rb +3 -3
  82. data/lib/metronome_sdk/models/v1/customer_preview_events_params.rb +6 -18
  83. data/lib/metronome_sdk/models/v1/customer_preview_events_response.rb +3 -3
  84. data/lib/metronome_sdk/models/v1/customer_retrieve_billing_configurations_params.rb +28 -0
  85. data/lib/metronome_sdk/models/v1/customer_retrieve_billing_configurations_response.rb +128 -0
  86. data/lib/metronome_sdk/models/v1/customer_set_billing_configurations_params.rb +143 -0
  87. data/lib/metronome_sdk/models/v1/customers/alert_list_params.rb +4 -6
  88. data/lib/metronome_sdk/models/v1/customers/alert_reset_params.rb +2 -2
  89. data/lib/metronome_sdk/models/v1/customers/alert_retrieve_params.rb +37 -8
  90. data/lib/metronome_sdk/models/v1/customers/billing_config_create_params.rb +2 -0
  91. data/lib/metronome_sdk/models/v1/customers/billing_config_retrieve_response.rb +2 -0
  92. data/lib/metronome_sdk/models/v1/customers/commit_create_params.rb +10 -60
  93. data/lib/metronome_sdk/models/v1/customers/credit_create_params.rb +6 -48
  94. data/lib/metronome_sdk/models/v1/customers/customer_alert.rb +48 -54
  95. data/lib/metronome_sdk/models/v1/customers/invoice.rb +197 -66
  96. data/lib/metronome_sdk/models/v1/customers/invoice_list_breakdowns_params.rb +1 -4
  97. data/lib/metronome_sdk/models/v1/customers/invoice_retrieve_pdf_params.rb +30 -0
  98. data/lib/metronome_sdk/models/v1/customers/plan_add_params.rb +2 -6
  99. data/lib/metronome_sdk/models/v1/customers/plan_list_response.rb +2 -1
  100. data/lib/metronome_sdk/models/v1/dashboard_get_embeddable_url_params.rb +4 -11
  101. data/lib/metronome_sdk/models/v1/payment.rb +151 -0
  102. data/lib/metronome_sdk/models/v1/payment_attempt_params.rb +28 -0
  103. data/lib/metronome_sdk/models/v1/payment_attempt_response.rb +18 -0
  104. data/lib/metronome_sdk/models/v1/payment_cancel_params.rb +28 -0
  105. data/lib/metronome_sdk/models/v1/payment_cancel_response.rb +18 -0
  106. data/lib/metronome_sdk/models/v1/payment_list_params.rb +53 -0
  107. data/lib/metronome_sdk/models/v1/payment_status.rb +19 -0
  108. data/lib/metronome_sdk/models/v1/plan_detail.rb +9 -5
  109. data/lib/metronome_sdk/models/v1/plan_list_charges_response.rb +2 -1
  110. data/lib/metronome_sdk/models/v1/plan_list_customers_response.rb +2 -1
  111. data/lib/metronome_sdk/models/v1/plan_list_response.rb +5 -1
  112. data/lib/metronome_sdk/models/v1/usage_ingest_params.rb +1 -4
  113. data/lib/metronome_sdk/models/v1/usage_list_params.rb +1 -3
  114. data/lib/metronome_sdk/models/v1/usage_list_response.rb +45 -62
  115. data/lib/metronome_sdk/models/v1/usage_search_response.rb +4 -7
  116. data/lib/metronome_sdk/models/v2/contract_edit_commit_params.rb +37 -58
  117. data/lib/metronome_sdk/models/v2/contract_edit_credit_params.rb +34 -49
  118. data/lib/metronome_sdk/models/v2/contract_edit_params.rb +552 -2265
  119. data/lib/metronome_sdk/models/v2/contract_get_edit_history_response.rb +417 -2317
  120. data/lib/metronome_sdk/models/v2/contract_list_response.rb +3 -4520
  121. data/lib/metronome_sdk/models/v2/contract_retrieve_response.rb +3 -4528
  122. data/lib/metronome_sdk/models.rb +38 -0
  123. data/lib/metronome_sdk/resources/v1/alerts.rb +90 -16
  124. data/lib/metronome_sdk/resources/v1/audit_logs.rb +39 -4
  125. data/lib/metronome_sdk/resources/v1/billable_metrics.rb +54 -4
  126. data/lib/metronome_sdk/resources/v1/contracts/products.rb +25 -6
  127. data/lib/metronome_sdk/resources/v1/contracts/rate_cards/product_orders.rb +7 -2
  128. data/lib/metronome_sdk/resources/v1/contracts/rate_cards/rates.rb +10 -2
  129. data/lib/metronome_sdk/resources/v1/contracts/rate_cards.rb +109 -10
  130. data/lib/metronome_sdk/resources/v1/contracts.rb +255 -18
  131. data/lib/metronome_sdk/resources/v1/credit_grants.rb +2 -1
  132. data/lib/metronome_sdk/resources/v1/custom_fields.rb +51 -14
  133. data/lib/metronome_sdk/resources/v1/customers/alerts.rb +127 -13
  134. data/lib/metronome_sdk/resources/v1/customers/commits.rb +119 -9
  135. data/lib/metronome_sdk/resources/v1/customers/credits.rb +104 -8
  136. data/lib/metronome_sdk/resources/v1/customers/invoices.rb +179 -8
  137. data/lib/metronome_sdk/resources/v1/customers.rb +175 -15
  138. data/lib/metronome_sdk/resources/v1/dashboards.rb +29 -3
  139. data/lib/metronome_sdk/resources/v1/invoices.rb +23 -2
  140. data/lib/metronome_sdk/resources/v1/payments.rb +102 -0
  141. data/lib/metronome_sdk/resources/v1/pricing_units.rb +6 -1
  142. data/lib/metronome_sdk/resources/v1/services.rb +6 -4
  143. data/lib/metronome_sdk/resources/v1/usage.rb +188 -13
  144. data/lib/metronome_sdk/resources/v1.rb +4 -0
  145. data/lib/metronome_sdk/resources/v2/contracts.rb +120 -18
  146. data/lib/metronome_sdk/version.rb +1 -1
  147. data/lib/metronome_sdk.rb +33 -3
  148. data/rbi/metronome_sdk/errors.rbi +31 -4
  149. data/rbi/metronome_sdk/file_part.rbi +1 -1
  150. data/rbi/metronome_sdk/internal/body_cursor_page.rbi +22 -0
  151. data/rbi/metronome_sdk/internal/cursor_page_without_limit.rbi +22 -0
  152. data/rbi/metronome_sdk/internal/transport/base_client.rbi +4 -5
  153. data/rbi/metronome_sdk/internal/type/base_page.rbi +1 -1
  154. data/rbi/metronome_sdk/internal/util.rbi +1 -1
  155. data/rbi/metronome_sdk/models/base_threshold_commit.rbi +58 -0
  156. data/rbi/metronome_sdk/models/commit.rbi +26 -348
  157. data/rbi/metronome_sdk/models/commit_hierarchy_configuration.rbi +280 -0
  158. data/rbi/metronome_sdk/models/commit_rate.rbi +85 -0
  159. data/rbi/metronome_sdk/models/commit_specifier.rbi +71 -0
  160. data/rbi/metronome_sdk/models/commit_specifier_input.rbi +74 -0
  161. data/rbi/metronome_sdk/models/contract.rbi +768 -0
  162. data/rbi/metronome_sdk/models/contract_v2.rbi +6415 -0
  163. data/rbi/metronome_sdk/models/contract_without_amendments.rbi +186 -2509
  164. data/rbi/metronome_sdk/models/credit.rbi +10 -348
  165. data/rbi/metronome_sdk/models/discount.rbi +2 -0
  166. data/rbi/metronome_sdk/models/hierarchy_configuration.rbi +424 -0
  167. data/rbi/metronome_sdk/models/override.rbi +8 -193
  168. data/rbi/metronome_sdk/models/override_tier.rbi +29 -0
  169. data/rbi/metronome_sdk/models/overwrite_rate.rbi +137 -0
  170. data/rbi/metronome_sdk/models/payment_gate_config.rbi +317 -0
  171. data/rbi/metronome_sdk/models/payment_gate_config_v2.rbi +326 -0
  172. data/rbi/metronome_sdk/models/prepaid_balance_threshold_configuration.rbi +183 -0
  173. data/rbi/metronome_sdk/models/prepaid_balance_threshold_configuration_v2.rbi +188 -0
  174. data/rbi/metronome_sdk/models/pro_service.rbi +2 -0
  175. data/rbi/metronome_sdk/models/recurring_commit_subscription_config.rbi +125 -0
  176. data/rbi/metronome_sdk/models/scheduled_charge.rbi +2 -0
  177. data/rbi/metronome_sdk/models/spend_threshold_configuration.rbi +76 -0
  178. data/rbi/metronome_sdk/models/spend_threshold_configuration_v2.rbi +78 -0
  179. data/rbi/metronome_sdk/models/subscription.rbi +635 -0
  180. data/rbi/metronome_sdk/models/update_base_threshold_commit.rbi +61 -0
  181. data/rbi/metronome_sdk/models/v1/alert_archive_params.rbi +6 -4
  182. data/rbi/metronome_sdk/models/v1/alert_create_params.rbi +57 -50
  183. data/rbi/metronome_sdk/models/v1/billable_metric_list_response.rbi +2 -0
  184. data/rbi/metronome_sdk/models/v1/billable_metric_retrieve_response.rbi +2 -0
  185. data/rbi/metronome_sdk/models/v1/contract_amend_params.rbi +49 -768
  186. data/rbi/metronome_sdk/models/v1/contract_create_historical_invoices_params.rbi +2 -0
  187. data/rbi/metronome_sdk/models/v1/contract_create_params.rbi +1843 -4119
  188. data/rbi/metronome_sdk/models/v1/contract_list_balances_response.rbi +8 -59
  189. data/rbi/metronome_sdk/models/v1/contract_list_response.rbi +5 -2420
  190. data/rbi/metronome_sdk/models/v1/contract_retrieve_rate_schedule_response.rbi +6 -129
  191. data/rbi/metronome_sdk/models/v1/contract_retrieve_response.rbi +4 -2419
  192. data/rbi/metronome_sdk/models/v1/contracts/product_create_params.rbi +2 -0
  193. data/rbi/metronome_sdk/models/v1/contracts/product_list_response.rbi +2 -0
  194. data/rbi/metronome_sdk/models/v1/contracts/product_retrieve_response.rbi +2 -0
  195. data/rbi/metronome_sdk/models/v1/contracts/rate_card_create_params.rbi +2 -0
  196. data/rbi/metronome_sdk/models/v1/contracts/rate_card_list_response.rbi +2 -0
  197. data/rbi/metronome_sdk/models/v1/contracts/rate_card_retrieve_rate_schedule_response.rbi +6 -129
  198. data/rbi/metronome_sdk/models/v1/contracts/rate_card_retrieve_response.rbi +2 -0
  199. data/rbi/metronome_sdk/models/v1/contracts/rate_cards/rate_add_many_params.rbi +4 -129
  200. data/rbi/metronome_sdk/models/v1/contracts/rate_cards/rate_add_params.rbi +4 -129
  201. data/rbi/metronome_sdk/models/v1/contracts/rate_cards/rate_add_response.rbi +4 -129
  202. data/rbi/metronome_sdk/models/v1/contracts/rate_cards/rate_list_response.rbi +6 -129
  203. data/rbi/metronome_sdk/models/v1/credit_grant_list_entries_response.rbi +147 -198
  204. data/rbi/metronome_sdk/models/v1/credit_grant_list_response.rbi +2 -0
  205. data/rbi/metronome_sdk/models/v1/custom_field_list_keys_response.rbi +117 -165
  206. data/rbi/metronome_sdk/models/v1/custom_field_set_values_params.rbi +8 -1
  207. data/rbi/metronome_sdk/models/v1/customer.rbi +2 -0
  208. data/rbi/metronome_sdk/models/v1/customer_create_params.rbi +88 -3
  209. data/rbi/metronome_sdk/models/v1/customer_detail.rbi +10 -0
  210. data/rbi/metronome_sdk/models/v1/customer_list_billable_metrics_response.rbi +2 -0
  211. data/rbi/metronome_sdk/models/v1/customer_preview_events_params.rbi +6 -21
  212. data/rbi/metronome_sdk/models/v1/customer_preview_events_response.rbi +10 -9
  213. data/rbi/metronome_sdk/models/v1/customer_retrieve_billing_configurations_params.rbi +51 -0
  214. data/rbi/metronome_sdk/models/v1/customer_retrieve_billing_configurations_response.rbi +265 -0
  215. data/rbi/metronome_sdk/models/v1/customer_set_billing_configurations_params.rbi +348 -0
  216. data/rbi/metronome_sdk/models/v1/customers/alert_list_params.rbi +4 -4
  217. data/rbi/metronome_sdk/models/v1/customers/alert_reset_params.rbi +2 -2
  218. data/rbi/metronome_sdk/models/v1/customers/alert_retrieve_params.rbi +68 -8
  219. data/rbi/metronome_sdk/models/v1/customers/billing_config_create_params.rbi +10 -0
  220. data/rbi/metronome_sdk/models/v1/customers/billing_config_retrieve_response.rbi +10 -0
  221. data/rbi/metronome_sdk/models/v1/customers/commit_create_params.rbi +6 -90
  222. data/rbi/metronome_sdk/models/v1/customers/credit_create_params.rbi +6 -90
  223. data/rbi/metronome_sdk/models/v1/customers/customer_alert.rbi +54 -47
  224. data/rbi/metronome_sdk/models/v1/customers/invoice.rbi +316 -68
  225. data/rbi/metronome_sdk/models/v1/customers/invoice_retrieve_pdf_params.rbi +50 -0
  226. data/rbi/metronome_sdk/models/v1/customers/plan_list_response.rbi +2 -0
  227. data/rbi/metronome_sdk/models/v1/payment.rbi +316 -0
  228. data/rbi/metronome_sdk/models/v1/payment_attempt_params.rbi +48 -0
  229. data/rbi/metronome_sdk/models/v1/payment_attempt_response.rbi +35 -0
  230. data/rbi/metronome_sdk/models/v1/payment_cancel_params.rbi +48 -0
  231. data/rbi/metronome_sdk/models/v1/payment_cancel_response.rbi +35 -0
  232. data/rbi/metronome_sdk/models/v1/payment_list_params.rbi +91 -0
  233. data/rbi/metronome_sdk/models/v1/payment_status.rbi +33 -0
  234. data/rbi/metronome_sdk/models/v1/plan_detail.rbi +2 -0
  235. data/rbi/metronome_sdk/models/v1/plan_list_charges_response.rbi +2 -0
  236. data/rbi/metronome_sdk/models/v1/plan_list_customers_response.rbi +2 -0
  237. data/rbi/metronome_sdk/models/v1/plan_list_response.rbi +8 -1
  238. data/rbi/metronome_sdk/models/v1/usage_list_response.rbi +45 -86
  239. data/rbi/metronome_sdk/models/v1/usage_search_response.rbi +2 -0
  240. data/rbi/metronome_sdk/models/v2/contract_edit_commit_params.rbi +74 -76
  241. data/rbi/metronome_sdk/models/v2/contract_edit_credit_params.rbi +74 -76
  242. data/rbi/metronome_sdk/models/v2/contract_edit_params.rbi +3875 -7234
  243. data/rbi/metronome_sdk/models/v2/contract_get_edit_history_response.rbi +1733 -6207
  244. data/rbi/metronome_sdk/models/v2/contract_list_response.rbi +5 -9867
  245. data/rbi/metronome_sdk/models/v2/contract_retrieve_response.rbi +6 -9866
  246. data/rbi/metronome_sdk/models.rbi +44 -0
  247. data/rbi/metronome_sdk/resources/v1/alerts.rbi +101 -27
  248. data/rbi/metronome_sdk/resources/v1/audit_logs.rbi +39 -4
  249. data/rbi/metronome_sdk/resources/v1/billable_metrics.rbi +54 -4
  250. data/rbi/metronome_sdk/resources/v1/contracts/products.rbi +25 -5
  251. data/rbi/metronome_sdk/resources/v1/contracts/rate_cards/product_orders.rbi +7 -2
  252. data/rbi/metronome_sdk/resources/v1/contracts/rate_cards/rates.rbi +10 -3
  253. data/rbi/metronome_sdk/resources/v1/contracts/rate_cards.rbi +109 -9
  254. data/rbi/metronome_sdk/resources/v1/contracts.rbi +258 -16
  255. data/rbi/metronome_sdk/resources/v1/credit_grants.rbi +5 -1
  256. data/rbi/metronome_sdk/resources/v1/custom_fields.rbi +57 -14
  257. data/rbi/metronome_sdk/resources/v1/customers/alerts.rbi +133 -11
  258. data/rbi/metronome_sdk/resources/v1/customers/commits.rbi +119 -10
  259. data/rbi/metronome_sdk/resources/v1/customers/credits.rbi +104 -9
  260. data/rbi/metronome_sdk/resources/v1/customers/invoices.rbi +159 -7
  261. data/rbi/metronome_sdk/resources/v1/customers.rbi +162 -14
  262. data/rbi/metronome_sdk/resources/v1/dashboards.rbi +29 -3
  263. data/rbi/metronome_sdk/resources/v1/invoices.rbi +23 -2
  264. data/rbi/metronome_sdk/resources/v1/payments.rbi +72 -0
  265. data/rbi/metronome_sdk/resources/v1/pricing_units.rbi +6 -1
  266. data/rbi/metronome_sdk/resources/v1/services.rbi +6 -4
  267. data/rbi/metronome_sdk/resources/v1/usage.rbi +191 -13
  268. data/rbi/metronome_sdk/resources/v1.rbi +3 -0
  269. data/rbi/metronome_sdk/resources/v2/contracts.rbi +134 -23
  270. data/sig/metronome_sdk/errors.rbs +7 -0
  271. data/sig/metronome_sdk/file_part.rbs +1 -1
  272. data/sig/metronome_sdk/internal/body_cursor_page.rbs +13 -0
  273. data/sig/metronome_sdk/internal/cursor_page_without_limit.rbs +13 -0
  274. data/sig/metronome_sdk/models/base_threshold_commit.rbs +26 -0
  275. data/sig/metronome_sdk/models/commit.rbs +17 -170
  276. data/sig/metronome_sdk/models/commit_hierarchy_configuration.rbs +117 -0
  277. data/sig/metronome_sdk/models/commit_rate.rbs +48 -0
  278. data/sig/metronome_sdk/models/commit_specifier.rbs +47 -0
  279. data/sig/metronome_sdk/models/commit_specifier_input.rbs +47 -0
  280. data/sig/metronome_sdk/models/contract.rbs +398 -0
  281. data/sig/metronome_sdk/models/contract_v2.rbs +3108 -0
  282. data/sig/metronome_sdk/models/contract_without_amendments.rbs +54 -976
  283. data/sig/metronome_sdk/models/credit.rbs +12 -170
  284. data/sig/metronome_sdk/models/hierarchy_configuration.rbs +152 -0
  285. data/sig/metronome_sdk/models/override.rbs +12 -101
  286. data/sig/metronome_sdk/models/override_tier.rbs +17 -0
  287. data/sig/metronome_sdk/models/overwrite_rate.rbs +78 -0
  288. data/sig/metronome_sdk/models/payment_gate_config.rbs +124 -0
  289. data/sig/metronome_sdk/models/payment_gate_config_v2.rbs +124 -0
  290. data/sig/metronome_sdk/models/prepaid_balance_threshold_configuration.rbs +82 -0
  291. data/sig/metronome_sdk/models/prepaid_balance_threshold_configuration_v2.rbs +82 -0
  292. data/sig/metronome_sdk/models/recurring_commit_subscription_config.rbs +51 -0
  293. data/sig/metronome_sdk/models/spend_threshold_configuration.rbs +35 -0
  294. data/sig/metronome_sdk/models/spend_threshold_configuration_v2.rbs +35 -0
  295. data/sig/metronome_sdk/models/subscription.rbs +295 -0
  296. data/sig/metronome_sdk/models/update_base_threshold_commit.rbs +28 -0
  297. data/sig/metronome_sdk/models/v1/alert_create_params.rbs +4 -2
  298. data/sig/metronome_sdk/models/v1/contract_amend_params.rbs +26 -341
  299. data/sig/metronome_sdk/models/v1/contract_create_params.rbs +219 -1184
  300. data/sig/metronome_sdk/models/v1/contract_list_balances_response.rbs +4 -25
  301. data/sig/metronome_sdk/models/v1/contract_list_response.rbs +4 -1041
  302. data/sig/metronome_sdk/models/v1/contract_retrieve_rate_schedule_response.rbs +6 -54
  303. data/sig/metronome_sdk/models/v1/contract_retrieve_response.rbs +4 -1041
  304. data/sig/metronome_sdk/models/v1/contracts/rate_card_retrieve_rate_schedule_response.rbs +6 -54
  305. data/sig/metronome_sdk/models/v1/contracts/rate_cards/rate_add_many_params.rbs +6 -54
  306. data/sig/metronome_sdk/models/v1/contracts/rate_cards/rate_add_params.rbs +6 -54
  307. data/sig/metronome_sdk/models/v1/contracts/rate_cards/rate_add_response.rbs +6 -54
  308. data/sig/metronome_sdk/models/v1/contracts/rate_cards/rate_list_response.rbs +6 -54
  309. data/sig/metronome_sdk/models/v1/credit_grant_list_entries_response.rbs +72 -94
  310. data/sig/metronome_sdk/models/v1/custom_field_list_keys_response.rbs +53 -75
  311. data/sig/metronome_sdk/models/v1/customer_create_params.rbs +31 -4
  312. data/sig/metronome_sdk/models/v1/customer_detail.rbs +5 -0
  313. data/sig/metronome_sdk/models/v1/customer_preview_events_params.rbs +0 -7
  314. data/sig/metronome_sdk/models/v1/customer_preview_events_response.rbs +6 -4
  315. data/sig/metronome_sdk/models/v1/customer_retrieve_billing_configurations_params.rbs +32 -0
  316. data/sig/metronome_sdk/models/v1/customer_retrieve_billing_configurations_response.rbs +113 -0
  317. data/sig/metronome_sdk/models/v1/customer_set_billing_configurations_params.rbs +133 -0
  318. data/sig/metronome_sdk/models/v1/customers/alert_retrieve_params.rbs +21 -0
  319. data/sig/metronome_sdk/models/v1/customers/billing_config_create_params.rbs +7 -1
  320. data/sig/metronome_sdk/models/v1/customers/billing_config_retrieve_response.rbs +6 -1
  321. data/sig/metronome_sdk/models/v1/customers/commit_create_params.rbs +6 -50
  322. data/sig/metronome_sdk/models/v1/customers/credit_create_params.rbs +6 -50
  323. data/sig/metronome_sdk/models/v1/customers/customer_alert.rbs +4 -2
  324. data/sig/metronome_sdk/models/v1/customers/invoice.rbs +137 -24
  325. data/sig/metronome_sdk/models/v1/customers/invoice_retrieve_pdf_params.rbs +32 -0
  326. data/sig/metronome_sdk/models/v1/payment.rbs +191 -0
  327. data/sig/metronome_sdk/models/v1/payment_attempt_params.rbs +30 -0
  328. data/sig/metronome_sdk/models/v1/payment_attempt_response.rbs +15 -0
  329. data/sig/metronome_sdk/models/v1/payment_cancel_params.rbs +30 -0
  330. data/sig/metronome_sdk/models/v1/payment_cancel_response.rbs +15 -0
  331. data/sig/metronome_sdk/models/v1/payment_list_params.rbs +56 -0
  332. data/sig/metronome_sdk/models/v1/payment_status.rbs +19 -0
  333. data/sig/metronome_sdk/models/v1/usage_list_response.rbs +33 -55
  334. data/sig/metronome_sdk/models/v2/contract_edit_commit_params.rbs +28 -43
  335. data/sig/metronome_sdk/models/v2/contract_edit_credit_params.rbs +28 -43
  336. data/sig/metronome_sdk/models/v2/contract_edit_params.rbs +412 -1793
  337. data/sig/metronome_sdk/models/v2/contract_get_edit_history_response.rbs +342 -2149
  338. data/sig/metronome_sdk/models/v2/contract_list_response.rbs +4 -4426
  339. data/sig/metronome_sdk/models/v2/contract_retrieve_response.rbs +4 -4426
  340. data/sig/metronome_sdk/models.rbs +38 -0
  341. data/sig/metronome_sdk/resources/v1/contracts/rate_cards/rates.rbs +1 -1
  342. data/sig/metronome_sdk/resources/v1/contracts.rbs +3 -3
  343. data/sig/metronome_sdk/resources/v1/credit_grants.rbs +1 -1
  344. data/sig/metronome_sdk/resources/v1/custom_fields.rbs +1 -1
  345. data/sig/metronome_sdk/resources/v1/customers/alerts.rbs +2 -1
  346. data/sig/metronome_sdk/resources/v1/customers/commits.rbs +2 -2
  347. data/sig/metronome_sdk/resources/v1/customers/credits.rbs +2 -2
  348. data/sig/metronome_sdk/resources/v1/customers/invoices.rbs +6 -0
  349. data/sig/metronome_sdk/resources/v1/customers.rbs +11 -0
  350. data/sig/metronome_sdk/resources/v1/payments.rbs +30 -0
  351. data/sig/metronome_sdk/resources/v1/usage.rbs +1 -1
  352. data/sig/metronome_sdk/resources/v1.rbs +2 -0
  353. data/sig/metronome_sdk/resources/v2/contracts.rbs +10 -4
  354. metadata +101 -11
  355. data/lib/metronome_sdk/models/v1/customers/alert_list_response.rb +0 -29
  356. data/lib/metronome_sdk/models/v1/customers/commit_list_response.rb +0 -26
  357. data/lib/metronome_sdk/models/v1/customers/credit_list_response.rb +0 -26
  358. data/rbi/metronome_sdk/models/v1/customers/alert_list_response.rbi +0 -46
  359. data/rbi/metronome_sdk/models/v1/customers/commit_list_response.rbi +0 -45
  360. data/rbi/metronome_sdk/models/v1/customers/credit_list_response.rbi +0 -45
  361. data/sig/metronome_sdk/models/v1/customers/alert_list_response.rbs +0 -29
  362. data/sig/metronome_sdk/models/v1/customers/commit_list_response.rbs +0 -26
  363. data/sig/metronome_sdk/models/v1/customers/credit_list_response.rbs +0 -26
@@ -4,8 +4,35 @@ module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
6
  class CustomFields
7
- # Add a key to the allow list for a given entity. There is a 100 character limit
8
- # on custom field keys.
7
+ # Creates a new custom field key for a given entity (e.g. billable metric,
8
+ # contract, alert).
9
+ #
10
+ # Custom fields are properties that you can add to Metronome objects to store
11
+ # metadata like foreign keys or other descriptors. This metadata can get
12
+ # transferred to or accessed by other systems to contextualize Metronome data and
13
+ # power business processes. For example, to service workflows like revenue
14
+ # recognition, reconciliation, and invoicing, custom fields help Metronome know
15
+ # the relationship between entities in the platform and third-party systems.
16
+ #
17
+ # ### Use this endpoint to:
18
+ #
19
+ # - Create a new custom field key for Customer objects in Metronome. You can then
20
+ # use the Set Custom Field Values endpoint to set the value of this key for a
21
+ # specific customer.
22
+ # - Specify whether the key should enforce uniqueness. If the key is set to
23
+ # enforce uniqueness and you attempt to set a custom field value for the key
24
+ # that already exists, it will fail.
25
+ #
26
+ # ### Usage guidelines:
27
+ #
28
+ # - Custom fields set on commits, credits, and contracts can be used to scope
29
+ # alert evaluation. For example, you can create a spend threshold alert that
30
+ # only considers spend associated with contracts with custom field key
31
+ # `contract_type` and value `paygo`
32
+ # - Custom fields set on products can be used in the Stripe integration to set
33
+ # metadata on invoices.
34
+ # - Custom fields for customers, contracts, invoices, products, commits, scheduled
35
+ # charges, and subscriptions are passed down to the invoice.
9
36
  sig do
10
37
  params(
11
38
  enforce_uniqueness: T::Boolean,
@@ -17,7 +44,10 @@ module MetronomeSDK
17
44
  def add_key(enforce_uniqueness:, entity:, key:, request_options: {})
18
45
  end
19
46
 
20
- # Deletes one or more custom fields on an instance of a Metronome entity.
47
+ # Remove specific custom field values from a Metronome entity instance by
48
+ # specifying the field keys to delete. Use this endpoint to clean up unwanted
49
+ # custom field data while preserving other fields on the same entity. Requires the
50
+ # entity type, entity ID, and array of keys to remove.
21
51
  sig do
22
52
  params(
23
53
  entity:
@@ -30,7 +60,10 @@ module MetronomeSDK
30
60
  def delete_values(entity:, entity_id:, keys:, request_options: {})
31
61
  end
32
62
 
33
- # List all active custom field keys, optionally filtered by entity type.
63
+ # Retrieve all your active custom field keys, with optional filtering by entity
64
+ # type (customer, contract, product, etc.). Use this endpoint to discover what
65
+ # custom field keys are available before setting values on entities or to audit
66
+ # your custom field configuration across different entity types.
34
67
  sig do
35
68
  params(
36
69
  next_page: String,
@@ -39,7 +72,11 @@ module MetronomeSDK
39
72
  MetronomeSDK::V1::CustomFieldListKeysParams::Entity::OrSymbol
40
73
  ],
41
74
  request_options: MetronomeSDK::RequestOptions::OrHash
42
- ).returns(MetronomeSDK::Models::V1::CustomFieldListKeysResponse)
75
+ ).returns(
76
+ MetronomeSDK::Internal::CursorPageWithoutLimit[
77
+ MetronomeSDK::Models::V1::CustomFieldListKeysResponse
78
+ ]
79
+ )
43
80
  end
44
81
  def list_keys(
45
82
  # Query param: Cursor that indicates where the next page of results should start.
@@ -50,7 +87,10 @@ module MetronomeSDK
50
87
  )
51
88
  end
52
89
 
53
- # Remove a key from the allow list for a given entity.
90
+ # Removes a custom field key from the allowlist for a specific entity type,
91
+ # preventing future use of that key across all instances of the entity. Existing
92
+ # values for this key on entity instances will no longer be accessible once the
93
+ # key is removed.
54
94
  sig do
55
95
  params(
56
96
  entity:
@@ -62,13 +102,10 @@ module MetronomeSDK
62
102
  def remove_key(entity:, key:, request_options: {})
63
103
  end
64
104
 
65
- # Sets one or more custom fields on an instance of a Metronome entity. If a
66
- # key/value pair passed in this request matches one already set on the entity, its
67
- # value will be overwritten. Any key/value pairs that exist on the entity that do
68
- # not match those passed in this request will remain untouched. This endpoint is
69
- # transactional and will update all key/value pairs or no key/value pairs. Partial
70
- # updates are not supported. There is a 200 character limit on custom field
71
- # values.
105
+ # Sets custom field values on a specific Metronome entity instance. Overwrites
106
+ # existing values for matching keys while preserving other fields. All updates are
107
+ # transactional—either all values are set or none are. Custom field values are
108
+ # limited to 200 characters each.
72
109
  sig do
73
110
  params(
74
111
  custom_fields: T::Hash[Symbol, String],
@@ -78,7 +115,13 @@ module MetronomeSDK
78
115
  request_options: MetronomeSDK::RequestOptions::OrHash
79
116
  ).void
80
117
  end
81
- def set_values(custom_fields:, entity:, entity_id:, request_options: {})
118
+ def set_values(
119
+ # Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
120
+ custom_fields:,
121
+ entity:,
122
+ entity_id:,
123
+ request_options: {}
124
+ )
82
125
  end
83
126
 
84
127
  # @api private
@@ -5,12 +5,69 @@ module MetronomeSDK
5
5
  class V1
6
6
  class Customers
7
7
  class Alerts
8
- # Get the customer alert status and alert information for the specified customer
9
- # and alert
8
+ # Retrieve the real-time evaluation status for a specific threshold
9
+ # notification-customer pair. This endpoint provides instant visibility into
10
+ # whether a customer has triggered a threshold notification condition, enabling
11
+ # you to monitor account health and take proactive action based on current
12
+ # threshold notification states.
13
+ #
14
+ # ### Use this endpoint to:
15
+ #
16
+ # - Check if a specific customer is currently violating an threshold notification
17
+ # (`in_alarm` status)
18
+ # - Verify threshold notification configuration details and threshold values for a
19
+ # customer
20
+ # - Monitor the evaluation state of newly created or recently modified threshold
21
+ # notification
22
+ # - Build dashboards or automated workflows that respond to specific threshold
23
+ # notification conditions
24
+ # - Validate threshold notification behavior before deploying to production
25
+ # customers
26
+ # - Integrate threshold notification status checks into customer support tools or
27
+ # admin interfaces
28
+ #
29
+ # ### Key response fields:
30
+ #
31
+ # A CustomerAlert object containing:
32
+ #
33
+ # - `customer_status`: The current evaluation state
34
+ #
35
+ # - `ok` - Customer is within acceptable thresholds
36
+ # - `in_alarm` - Customer has breached the threshold for the notification
37
+ # - `evaluating` - Notification is currently being evaluated (typically during
38
+ # initial setup)
39
+ # - `null` - Notification has been archived
40
+ # - `triggered_by`: Additional context about what caused the notification to
41
+ # trigger (when applicable)
42
+ # - alert: Complete threshold notification configuration including:
43
+ # - Notification ID, name, and type
44
+ # - Current threshold values and credit type information
45
+ # - Notification status (enabled, disabled, or archived)
46
+ # - Last update timestamp
47
+ # - Any applied filters (credit grant types, custom fields, group values)
48
+ #
49
+ # ### Usage guidelines:
50
+ #
51
+ # - Customer status: Returns the current evaluation state, not historical data.
52
+ # For threshold notification history, use webhook notifications or event logs
53
+ # - Required parameters: Both customer_id and alert_id must be valid UUIDs that
54
+ # exist in your organization
55
+ # - Archived notifications: Returns null for customer_status if the notification
56
+ # has been archived, but still includes the notification configuration details
57
+ # - Performance considerations: This endpoint queries live evaluation state,
58
+ # making it ideal for real-time monitoring but not for bulk status checks
59
+ # - Integration patterns: Best used for on-demand status checks in response to
60
+ # user actions or as part of targeted monitoring workflows
61
+ # - Error handling: Returns 404 if either the customer or alert_id doesn't exist
62
+ # or isn't accessible to your organization
10
63
  sig do
11
64
  params(
12
65
  alert_id: String,
13
66
  customer_id: String,
67
+ group_values:
68
+ T::Array[
69
+ MetronomeSDK::V1::Customers::AlertRetrieveParams::GroupValue::OrHash
70
+ ],
14
71
  plans_or_contracts:
15
72
  MetronomeSDK::V1::Customers::AlertRetrieveParams::PlansOrContracts::OrSymbol,
16
73
  request_options: MetronomeSDK::RequestOptions::OrHash
@@ -19,18 +76,51 @@ module MetronomeSDK
19
76
  )
20
77
  end
21
78
  def retrieve(
22
- # The Metronome ID of the alert
79
+ # The Metronome ID of the threshold notification
23
80
  alert_id:,
24
81
  # The Metronome ID of the customer
25
82
  customer_id:,
26
- # When parallel alerts are enabled during migration, this flag denotes whether to
27
- # fetch alerts for plans or contracts.
83
+ # Only present for `spend_threshold_reached` notifications. Retrieve the
84
+ # notification for a specific group key-value pair.
85
+ group_values: nil,
86
+ # When parallel threshold notifications are enabled during migration, this flag
87
+ # denotes whether to fetch notifications for plans or contracts.
28
88
  plans_or_contracts: nil,
29
89
  request_options: {}
30
90
  )
31
91
  end
32
92
 
33
- # Fetch all customer alert statuses and alert information for a customer
93
+ # Retrieve all threshold notification configurations and their current statuses
94
+ # for a specific customer in a single API call. This endpoint provides a
95
+ # comprehensive view of all threshold notification monitoring a customer account.
96
+ #
97
+ # ### Use this endpoint to:
98
+ #
99
+ # - Display all active threshold notifications for a customer in dashboards or
100
+ # admin panels
101
+ # - Quickly identify which threshold notifications a customer is currently
102
+ # triggering
103
+ # - Audit threshold notification coverage for specific accounts
104
+ # - Filter threshold notifications by status (enabled, disabled, or archived)
105
+ #
106
+ # ### Key response fields:
107
+ #
108
+ # - data: Array of CustomerAlert objects, each containing:
109
+ # - Current evaluation status (`ok`, `in_alarm`, `evaluating`, or `null`)
110
+ # - Complete threshold notification configuration and threshold details
111
+ # - Threshold notification metadata including type, name, and last update time
112
+ # - next_page: Pagination cursor for retrieving additional results
113
+ #
114
+ # ### Usage guidelines:
115
+ #
116
+ # - Default behavior: Returns only enabled threshold notifications unless
117
+ # `alert_statuses` filter is specified
118
+ # - Pagination: Use the `next_page` cursor to retrieve all results for customers
119
+ # with many notifications
120
+ # - Performance: Efficiently retrieves multiple threshold notification statuses in
121
+ # a single request instead of making individual calls
122
+ # - Filtering: Pass the `alert_statuses` array to include disabled or archived
123
+ # threshold notifications in results
34
124
  sig do
35
125
  params(
36
126
  customer_id: String,
@@ -40,21 +130,53 @@ module MetronomeSDK
40
130
  MetronomeSDK::V1::Customers::AlertListParams::AlertStatus::OrSymbol
41
131
  ],
42
132
  request_options: MetronomeSDK::RequestOptions::OrHash
43
- ).returns(MetronomeSDK::Models::V1::Customers::AlertListResponse)
133
+ ).returns(
134
+ MetronomeSDK::Internal::CursorPageWithoutLimit[
135
+ MetronomeSDK::V1::Customers::CustomerAlert
136
+ ]
137
+ )
44
138
  end
45
139
  def list(
46
140
  # Body param: The Metronome ID of the customer
47
141
  customer_id:,
48
142
  # Query param: Cursor that indicates where the next page of results should start.
49
143
  next_page: nil,
50
- # Body param: Optionally filter by alert status. If absent, only enabled alerts
51
- # will be returned.
144
+ # Body param: Optionally filter by threshold notification status. If absent, only
145
+ # enabled notifications will be returned.
52
146
  alert_statuses: nil,
53
147
  request_options: {}
54
148
  )
55
149
  end
56
150
 
57
- # Reset state for an alert by customer id and force re-evaluation
151
+ # Force an immediate re-evaluation of a specific threshold notification for a
152
+ # customer, clearing any previous state and triggering a fresh assessment against
153
+ # current thresholds. This endpoint ensures threshold notification accuracy after
154
+ # configuration changes or data corrections.
155
+ #
156
+ # ### Use this endpoint to:
157
+ #
158
+ # - Clear false positive threshold notifications after fixing data issues
159
+ # - Re-evaluate threshold notifications after adjusting customer balances or
160
+ # credits
161
+ # - Test threshold notification behavior during development and debugging
162
+ # - Resolve stuck threshold notification that may be in an incorrect state
163
+ # - Trigger immediate evaluation after threshold modifications
164
+ #
165
+ # ### Key response fields:
166
+ #
167
+ # - 200 Success: Confirmation that the threshold notification has been reset and
168
+ # re-evaluation initiated
169
+ # - No response body is returned - the operation completes asynchronously
170
+ #
171
+ # ### Usage guidelines:
172
+ #
173
+ # - Immediate effect: Triggers re-evaluation instantly, which may result in new
174
+ # webhook notifications if thresholds are breached
175
+ # - State clearing: Removes any cached evaluation state, ensuring a fresh
176
+ # assessment
177
+ # - Use sparingly: Intended for exceptional cases, not routine operations
178
+ # - Asynchronous processing: The reset completes immediately, but re-evaluation
179
+ # happens in the background
58
180
  sig do
59
181
  params(
60
182
  alert_id: String,
@@ -63,7 +185,7 @@ module MetronomeSDK
63
185
  ).void
64
186
  end
65
187
  def reset(
66
- # The Metronome ID of the alert
188
+ # The Metronome ID of the threshold notification
67
189
  alert_id:,
68
190
  # The Metronome ID of the customer
69
191
  customer_id:,
@@ -5,7 +5,68 @@ module MetronomeSDK
5
5
  class V1
6
6
  class Customers
7
7
  class Commits
8
- # Create a new commit at the customer level.
8
+ # Creates customer-level commits that establish spending commitments for customers
9
+ # across their Metronome usage. Commits represent contracted spending obligations
10
+ # that can be either prepaid (paid upfront) or postpaid (billed later).
11
+ #
12
+ # Note: In most cases, you should add commitments directly to customer contracts
13
+ # using the contract/create or contract/edit APIs.
14
+ #
15
+ # ### Use this endpoint to:
16
+ #
17
+ # Use this endpoint when you need to establish customer-level spending commitments
18
+ # that can be applied across multiple contracts or scoped to specific contracts.
19
+ # Customer-level commits are ideal for:
20
+ #
21
+ # - Enterprise-wide minimum spending agreements that span multiple contracts
22
+ # - Multi-contract volume commitments with shared spending pools
23
+ # - Cross-contract discount tiers based on aggregate usage
24
+ #
25
+ # #### Commit type Requirements:
26
+ #
27
+ # - You must specify either "prepaid" or "postpaid" as the commit type:
28
+ # - Prepaid commits: Customer pays upfront; invoice_schedule is optional (if
29
+ # omitted, creates a commit without an invoice)
30
+ # - Postpaid commits: Customer pays when the commitment expires (the end of the
31
+ # access_schedule); invoice_schedule is required and must match access_schedule
32
+ # totals.
33
+ #
34
+ # #### Billing configuration:
35
+ #
36
+ # - invoice_contract_id is required for postpaid commits and for prepaid commits
37
+ # with billing (only optional for free prepaid commits)
38
+ # - For postpaid commits: access_schedule and invoice_schedule must have matching
39
+ # amounts
40
+ # - For postpaid commits: only one schedule item is allowed in both schedules.
41
+ #
42
+ # #### Scoping flexibility:
43
+ #
44
+ # Customer-level commits can be configured in a few ways:
45
+ #
46
+ # - Contract-specific: Use the `applicable_contract_ids` field to limit the commit
47
+ # to specific contracts
48
+ # - Cross-contract: Leave `applicable_contract_ids` empty to allow the commit to
49
+ # be used across all of the customer's contracts
50
+ #
51
+ # #### Product targeting:
52
+ #
53
+ # Commits can be scoped to specific products using applicable_product_ids,
54
+ # applicable_product_tags, or specifiers, or left unrestricted to apply to all
55
+ # products.
56
+ #
57
+ # #### Priority considerations:
58
+ #
59
+ # When multiple commits are applicable, the one with the lower priority value will
60
+ # be consumed first. If there is a tie, contract level commits and credits will be
61
+ # applied before customer level commits and credits. Plan your priority scheme
62
+ # carefully to ensure commits are applied in the desired order.
63
+ #
64
+ # ### Usage guidelines:
65
+ #
66
+ # ⚠️ Preferred Alternative: In most cases, you should add commits directly to
67
+ # contracts using the create contract or edit contract APIs instead of creating
68
+ # customer-level commits. Contract-level commits provide better organization and
69
+ # are the recommended approach for standard use cases.
9
70
  sig do
10
71
  params(
11
72
  access_schedule:
@@ -28,10 +89,7 @@ module MetronomeSDK
28
89
  rate_type:
29
90
  MetronomeSDK::V1::Customers::CommitCreateParams::RateType::OrSymbol,
30
91
  salesforce_opportunity_id: String,
31
- specifiers:
32
- T::Array[
33
- MetronomeSDK::V1::Customers::CommitCreateParams::Specifier::OrHash
34
- ],
92
+ specifiers: T::Array[MetronomeSDK::CommitSpecifierInput::OrHash],
35
93
  uniqueness_key: String,
36
94
  request_options: MetronomeSDK::RequestOptions::OrHash
37
95
  ).returns(MetronomeSDK::Models::V1::Customers::CommitCreateResponse)
@@ -59,6 +117,7 @@ module MetronomeSDK
59
117
  # applicable_product_tags or specifiers are not provided, the commit applies to
60
118
  # all products.
61
119
  applicable_product_tags: nil,
120
+ # Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
62
121
  custom_fields: nil,
63
122
  # Used only in UI/API. It is not exposed to end customers.
64
123
  description: nil,
@@ -92,7 +151,49 @@ module MetronomeSDK
92
151
  )
93
152
  end
94
153
 
95
- # List commits.
154
+ # Retrieve all commit agreements for a customer, including both prepaid and
155
+ # postpaid commitments. This endpoint provides comprehensive visibility into
156
+ # contractual spending obligations, enabling you to track commitment utilization
157
+ # and manage customer contracts effectively.
158
+ #
159
+ # ### Use this endpoint to:
160
+ #
161
+ # - Display commitment balances and utilization in customer dashboards
162
+ # - Track prepaid commitment drawdown and remaining balances
163
+ # - Monitor postpaid commitment progress toward minimum thresholds
164
+ # - Build commitment tracking and forecasting tools
165
+ # - Show commitment history with optional ledger details
166
+ # - Manage rollover balances between contract periods
167
+ #
168
+ # ### Key response fields:
169
+ #
170
+ # An array of Commit objects containing:
171
+ #
172
+ # - Commit type: PREPAID (pay upfront) or POSTPAID (pay at true-up)
173
+ # - Rate type: COMMIT_RATE (discounted) or LIST_RATE (standard pricing)
174
+ # - Access schedule: When commitment funds become available
175
+ # - Invoice schedule: When the customer is billed
176
+ # - Product targeting: Which product(s) usage is eligible to draw from this commit
177
+ # - Optional ledger entries: Transaction history (if `include_ledgers=true`)
178
+ # - Balance information: Current available amount (if `include_balance=true`)
179
+ # - Rollover settings: Fraction of unused amount that carries forward
180
+ #
181
+ # ### Usage guidelines:
182
+ #
183
+ # - Pagination: Results limited to 25 commits per page; use 'next_page' for more
184
+ # - Date filtering options:
185
+ # - `covering_date`: Commits active on a specific date
186
+ # - `starting_at`: Commits with access on/after a date
187
+ # - `effective_before`: Commits with access before a date (exclusive)
188
+ # - Scope options:
189
+ # - `include_contract_commits`: Include contract-level commits (not just
190
+ # customer-level)
191
+ # - `include_archived`: Include archived commits and commits from archived
192
+ # contracts
193
+ # - Performance considerations:
194
+ # - include_ledgers: Adds detailed transaction history (slower)
195
+ # - include_balance: Adds current balance calculation (slower)
196
+ # - Optional filtering: Use commit_id to retrieve a specific commit
96
197
  sig do
97
198
  params(
98
199
  customer_id: String,
@@ -107,7 +208,9 @@ module MetronomeSDK
107
208
  next_page: String,
108
209
  starting_at: Time,
109
210
  request_options: MetronomeSDK::RequestOptions::OrHash
110
- ).returns(MetronomeSDK::Models::V1::Customers::CommitListResponse)
211
+ ).returns(
212
+ MetronomeSDK::Internal::BodyCursorPage[MetronomeSDK::Commit]
213
+ )
111
214
  end
112
215
  def list(
113
216
  customer_id:,
@@ -136,9 +239,15 @@ module MetronomeSDK
136
239
  )
137
240
  end
138
241
 
139
- # Pull forward the end date of a prepaid commit. Use the "edit a commit" endpoint
140
- # to extend the end date of a prepaid commit, or to make other edits to the
141
- # commit.
242
+ # Shortens the end date of a prepaid commit to terminate it earlier than
243
+ # originally scheduled. Use this endpoint when you need to cancel or reduce the
244
+ # duration of an existing prepaid commit. Only works with prepaid commit types and
245
+ # can only move the end date forward (earlier), not extend it.
246
+ #
247
+ # ### Usage guidelines:
248
+ #
249
+ # To extend commit end dates or make other comprehensive edits, use the 'edit
250
+ # commit' endpoint instead.
142
251
  sig do
143
252
  params(
144
253
  commit_id: String,
@@ -5,7 +5,55 @@ module MetronomeSDK
5
5
  class V1
6
6
  class Customers
7
7
  class Credits
8
- # Create a new credit at the customer level.
8
+ # Creates customer-level credits that provide spending allowances or free credit
9
+ # balances for customers across their Metronome usage. Note: In most cases, you
10
+ # should add credits directly to customer contracts using the contract/create or
11
+ # contract/edit APIs.
12
+ #
13
+ # ### Use this endpoint to:
14
+ #
15
+ # Use this endpoint when you need to provision credits directly at the customer
16
+ # level that can be applied across multiple contracts or scoped to specific
17
+ # contracts. Customer-level credits are ideal for:
18
+ #
19
+ # - Customer onboarding incentives that apply globally
20
+ # - Flexible spending allowances that aren't tied to a single contract
21
+ # - Migration scenarios where you need to preserve existing customer balances
22
+ #
23
+ # #### Scoping flexibility:
24
+ #
25
+ # Customer-level credits can be configured in two ways:
26
+ #
27
+ # - Contract-specific: Use the applicable_contract_ids field to limit the credit
28
+ # to specific contracts
29
+ # - Cross-contract: Leave applicable_contract_ids empty to allow the credit to be
30
+ # used across all of the customer's contracts
31
+ #
32
+ # #### Product Targeting:
33
+ #
34
+ # Credits can be scoped to specific products using `applicable_product_ids` or
35
+ # `applicable_product_tags`, or left unrestricted to apply to all products.
36
+ #
37
+ # #### Priority considerations:
38
+ #
39
+ # When multiple credits are applicable, the one with the lower priority value will
40
+ # be consumed first. If there is a tie, contract level commits and credits will be
41
+ # applied before customer level commits and credits. Plan your priority scheme
42
+ # carefully to ensure credits are applied in the desired order.
43
+ #
44
+ # #### Access Schedule Required:
45
+ #
46
+ # You must provide an `access_schedule` that defines when and how much credit
47
+ # becomes available to the customer over time. This usually is aligned to the
48
+ # contract schedule or starts immediately and is set to expire in the future.
49
+ #
50
+ # ### Usage Guidelines:
51
+ #
52
+ # ⚠️ Preferred Alternative: In most cases, you should add credits directly to
53
+ # contracts using the contract/create or contract/edit APIs instead of creating
54
+ # customer-level credits. Contract-level credits provide better organization, and
55
+ # are easier for finance teams to recognize revenue, and are the recommended
56
+ # approach for most use cases.
9
57
  sig do
10
58
  params(
11
59
  access_schedule:
@@ -23,10 +71,7 @@ module MetronomeSDK
23
71
  rate_type:
24
72
  MetronomeSDK::V1::Customers::CreditCreateParams::RateType::OrSymbol,
25
73
  salesforce_opportunity_id: String,
26
- specifiers:
27
- T::Array[
28
- MetronomeSDK::V1::Customers::CreditCreateParams::Specifier::OrHash
29
- ],
74
+ specifiers: T::Array[MetronomeSDK::CommitSpecifierInput::OrHash],
30
75
  uniqueness_key: String,
31
76
  request_options: MetronomeSDK::RequestOptions::OrHash
32
77
  ).returns(MetronomeSDK::Models::V1::Customers::CreditCreateResponse)
@@ -48,6 +93,7 @@ module MetronomeSDK
48
93
  # Which tags the credit applies to. If both applicable_product_ids and
49
94
  # applicable_product_tags are not provided, the credit applies to all products.
50
95
  applicable_product_tags: nil,
96
+ # Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
51
97
  custom_fields: nil,
52
98
  # Used only in UI/API. It is not exposed to end customers.
53
99
  description: nil,
@@ -72,7 +118,50 @@ module MetronomeSDK
72
118
  )
73
119
  end
74
120
 
75
- # List credits.
121
+ # Retrieve a detailed list of all credits available to a customer, including
122
+ # promotional credits and contract-specific credits. This endpoint provides
123
+ # comprehensive visibility into credit balances, access schedules, and usage
124
+ # rules, enabling you to build credit management interfaces and track available
125
+ # funding.
126
+ #
127
+ # ### Use this endpoint to:
128
+ #
129
+ # - Display all available credits in customer billing dashboards
130
+ # - Show credit balances and expiration dates
131
+ # - Track credit usage history with optional ledger details
132
+ # - Build credit management and reporting tools
133
+ # - Monitor promotional credit utilization • Support customer inquiries about
134
+ # available credits
135
+ #
136
+ # ### Key response fields:
137
+ #
138
+ # An array of Credit objects containing:
139
+ #
140
+ # - Credit details: Name, priority, and which applicable products/tags it applies
141
+ # to
142
+ # - Product ID: The `product_id` of the credit. This is for external mapping into
143
+ # your quote-to-cash stack, not the product it applies to.
144
+ # - Access schedule: When credits become available and expire
145
+ # - Optional ledger entries: Transaction history (if `include_ledgers=true`)
146
+ # - Balance information: Current available amount (if `include_balance=true`)
147
+ # - Metadata: Custom fields and usage specifiers
148
+ #
149
+ # ### Usage guidelines:
150
+ #
151
+ # - Pagination: Results limited to 25 commits per page; use next_page for more
152
+ # - Date filtering options:
153
+ # - `covering_date`: Credits active on a specific date
154
+ # - `starting_at`: Credits with access on/after a date
155
+ # - `effective_before`: Credits with access before a date (exclusive)
156
+ # - Scope options:
157
+ # - `include_contract_credits`: Include contract-level credits (not just
158
+ # customer-level)
159
+ # - `include_archived`: Include archived credits and credits from archived
160
+ # contracts
161
+ # - Performance considerations:
162
+ # - `include_ledgers`: Adds detailed transaction history (slower)
163
+ # - `include_balance`: Adds current balance calculation (slower)
164
+ # - Optional filtering: Use credit_id to retrieve a specific commit
76
165
  sig do
77
166
  params(
78
167
  customer_id: String,
@@ -87,7 +176,9 @@ module MetronomeSDK
87
176
  next_page: String,
88
177
  starting_at: Time,
89
178
  request_options: MetronomeSDK::RequestOptions::OrHash
90
- ).returns(MetronomeSDK::Models::V1::Customers::CreditListResponse)
179
+ ).returns(
180
+ MetronomeSDK::Internal::BodyCursorPage[MetronomeSDK::Credit]
181
+ )
91
182
  end
92
183
  def list(
93
184
  customer_id:,
@@ -116,8 +207,12 @@ module MetronomeSDK
116
207
  )
117
208
  end
118
209
 
119
- # Pull forward the end date of a credit. Use the "edit a credit" endpoint to
120
- # extend the end date of a credit, or to make other edits to the credit.
210
+ # Shortens the end date of an existing customer credit to terminate it earlier
211
+ # than originally scheduled. Only allows moving end dates forward (earlier), not
212
+ # extending them.
213
+ #
214
+ # Note: To extend credit end dates or make comprehensive edits, use the 'edit
215
+ # credit' endpoint instead.
121
216
  sig do
122
217
  params(
123
218
  access_ending_before: Time,