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
@@ -8,7 +8,46 @@ module MetronomeSDK
8
8
  # Some parameter documentations has been truncated, see
9
9
  # {MetronomeSDK::Models::V1::Customers::InvoiceRetrieveParams} for more details.
10
10
  #
11
- # Fetch a specific invoice for a given customer.
11
+ # Retrieve detailed information for a specific invoice by its unique identifier.
12
+ # This endpoint returns comprehensive invoice data including line items, applied
13
+ # credits, totals, and billing period details for both finalized and draft
14
+ # invoices.
15
+ #
16
+ # ### Use this endpoint to:
17
+ #
18
+ # - Display historical invoice details in customer-facing dashboards or billing
19
+ # portals.
20
+ # - Retrieve current month draft invoices to show customers their month-to-date
21
+ # spend.
22
+ # - Access finalized invoices for historical billing records and payment
23
+ # reconciliation.
24
+ # - Validate customer pricing and credit applications for customer support
25
+ # queries.
26
+ #
27
+ # ### Key response fields:
28
+ #
29
+ # Invoice status (DRAFT, FINALIZED, VOID) Billing period start and end dates Total
30
+ # amount and amount due after credits Detailed line items broken down by:
31
+ #
32
+ # - Customer and contract information
33
+ # - Invoice line item type
34
+ # - Product/service name and ID
35
+ # - Quantity consumed
36
+ # - Unit and total price
37
+ # - Time period for usage-based charges
38
+ # - Applied credits or prepaid commitments
39
+ #
40
+ # ### Usage guidelines:
41
+ #
42
+ # - Draft invoices update in real-time as usage is reported and may change before
43
+ # finalization
44
+ # - The response includes both usage-based line items (e.g., API calls, data
45
+ # processed) and scheduled charges (e.g., monthly subscriptions, commitment
46
+ # fees)
47
+ # - Credit and commitment applications are shown as separate line items with
48
+ # negative amounts
49
+ # - For voided invoices, the response will indicate VOID status but retain all
50
+ # original line item details
12
51
  #
13
52
  # @overload retrieve(customer_id:, invoice_id:, skip_zero_qty_line_items: nil, request_options: {})
14
53
  #
@@ -45,8 +84,52 @@ module MetronomeSDK
45
84
  # Some parameter documentations has been truncated, see
46
85
  # {MetronomeSDK::Models::V1::Customers::InvoiceListParams} for more details.
47
86
  #
48
- # List all invoices for a given customer, optionally filtered by status, date
49
- # range, and/or credit type.
87
+ # Retrieves a paginated list of invoices for a specific customer, with flexible
88
+ # filtering options to narrow results by status, date range, credit type, and
89
+ # more. This endpoint provides a comprehensive view of a customer's billing
90
+ # history and current charges, supporting both real-time billing dashboards and
91
+ # historical reporting needs.
92
+ #
93
+ # ### Use this endpoint to:
94
+ #
95
+ # - Display historical invoice details in customer-facing dashboards or billing
96
+ # portals.
97
+ # - Retrieve current month draft invoices to show customers their month-to-date
98
+ # spend.
99
+ # - Access finalized invoices for historical billing records and payment
100
+ # reconciliation.
101
+ # - Validate customer pricing and credit applications for customer support
102
+ # queries.
103
+ # - Generate financial reports by filtering invoices within specific date ranges
104
+ #
105
+ # ### Key response fields:
106
+ #
107
+ # Array of invoice objects containing:
108
+ #
109
+ # - Invoice ID and status (DRAFT, FINALIZED, VOID)
110
+ # - Invoice type (USAGE, SCHEDULED)
111
+ # - Billing period start and end dates
112
+ # - Issue date and due date
113
+ # - Total amount, subtotal, and amount due
114
+ # - Applied credits summary
115
+ # - Contract ID reference
116
+ # - External billing provider status (if integrated with Stripe, etc.)
117
+ # - Pagination metadata `next_page` cursor
118
+ #
119
+ # ### Usage guidelines:
120
+ #
121
+ # - The endpoint returns invoice summaries; use the Get Invoice endpoint for
122
+ # detailed line items
123
+ # - Draft invoices are continuously updated as new usage is reported and will show
124
+ # real-time spend
125
+ # - Results are ordered by creation date descending by default (newest first)
126
+ # - When filtering by date range, the filter applies to the billing period, not
127
+ # the issue date
128
+ # - For customers with many invoices, implement pagination to ensure all results
129
+ # are retrieved External billing provider statuses (like Stripe payment status)
130
+ # are included when applicable
131
+ # - Voided invoices are included in results by default unless filtered out by
132
+ # status
50
133
  #
51
134
  # @overload list(customer_id:, credit_type_id: nil, ending_before: nil, limit: nil, next_page: nil, skip_zero_qty_line_items: nil, sort: nil, starting_on: nil, status: nil, request_options: {})
52
135
  #
@@ -134,11 +217,44 @@ module MetronomeSDK
134
217
  # {MetronomeSDK::Models::V1::Customers::InvoiceListBreakdownsParams} for more
135
218
  # details.
136
219
  #
137
- # List daily or hourly invoice breakdowns for a given customer, optionally
138
- # filtered by status, date range, and/or credit type. Important considerations:
139
- #
140
- # - If we receive backdated usage after an invoice has been finalized, the
141
- # backdated usage will be included in the response and usage numbers may differ.
220
+ # Retrieve granular time-series breakdowns of invoice data at hourly or daily
221
+ # intervals. This endpoint transforms standard invoices into detailed timelines,
222
+ # enabling you to track usage patterns, identify consumption spikes, and provide
223
+ # customers with transparency into their billing details throughout the billing
224
+ # period.
225
+ #
226
+ # ### Use this endpoint to:
227
+ #
228
+ # - Build usage analytics dashboards showing daily or hourly consumption trends
229
+ # - Identify peak usage periods for capacity planning and cost optimization
230
+ # - Generate detailed billing reports for finance teams and customer success
231
+ # - Troubleshoot billing disputes by examining usage patterns at specific times
232
+ # - Power real-time cost monitoring and alerting systems
233
+ #
234
+ # ### Key response fields:
235
+ #
236
+ # An array of BreakdownInvoice objects, each containing:
237
+ #
238
+ # - All standard invoice fields (ID, customer, commit, line items, totals, status)
239
+ # - Line items with quantities and costs for that specific period
240
+ # - `breakdown_start_timestamp`: Start of the specific time window
241
+ # - `breakdown_end_timestamp`: End of the specific time window
242
+ # - `next_page`: Pagination cursor for large result sets
243
+ #
244
+ # ### Usage guidelines:
245
+ #
246
+ # - Time granularity: Set `window_size` to hour or day based on your analysis
247
+ # needs
248
+ # - Response limits: Daily breakdowns return up to 35 days; hourly breakdowns
249
+ # return up to 24 hours per request
250
+ # - Date filtering: Use `starting_on` and `ending_before` to focus on specific
251
+ # periods
252
+ # - Performance: For large date ranges, use pagination to retrieve all data
253
+ # efficiently
254
+ # - Backdated usage: If usage events arrive after invoice finalization, breakdowns
255
+ # will reflect the updated usage
256
+ # - Zero quantity filtering: Use `skip_zero_qty_line_items=true` to exclude
257
+ # periods with no usage
142
258
  #
143
259
  # @overload list_breakdowns(customer_id:, ending_before:, starting_on:, credit_type_id: nil, limit: nil, next_page: nil, skip_zero_qty_line_items: nil, sort: nil, status: nil, window_size: nil, request_options: {})
144
260
  #
@@ -183,6 +299,61 @@ module MetronomeSDK
183
299
  )
184
300
  end
185
301
 
302
+ # Retrieve a PDF version of a specific invoice by its unique identifier. This
303
+ # endpoint generates a professionally formatted invoice document suitable for
304
+ # sharing with customers, accounting teams, or for record-keeping purposes.
305
+ #
306
+ # ### Use this endpoint to:
307
+ #
308
+ # - Provide customers with downloadable or emailable copies of their invoices
309
+ # - Support accounting and finance teams with official billing documents
310
+ # - Maintain accurate records of billing transactions for audits and compliance
311
+ #
312
+ # ### Key response details:
313
+ #
314
+ # - The response is a binary PDF file representing the full invoice
315
+ # - The PDF includes all standard invoice information such as line items, totals,
316
+ # billing period, and customer details
317
+ # - The document is formatted for clarity and professionalism, suitable for
318
+ # official use
319
+ #
320
+ # ### Usage guidelines:
321
+ #
322
+ # - Ensure the `invoice_id` corresponds to an existing invoice for the specified
323
+ # `customer_id`
324
+ # - The PDF is generated on-demand; frequent requests for the same invoice may
325
+ # impact performance
326
+ # - Use appropriate headers to handle the binary response in your application
327
+ # (e.g., setting `Content-Type: application/pdf`)
328
+ #
329
+ # @overload retrieve_pdf(customer_id:, invoice_id:, request_options: {})
330
+ #
331
+ # @param customer_id [String]
332
+ # @param invoice_id [String]
333
+ # @param request_options [MetronomeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
334
+ #
335
+ # @return [StringIO]
336
+ #
337
+ # @see MetronomeSDK::Models::V1::Customers::InvoiceRetrievePdfParams
338
+ def retrieve_pdf(params)
339
+ parsed, options = MetronomeSDK::V1::Customers::InvoiceRetrievePdfParams.dump_request(params)
340
+ customer_id =
341
+ parsed.delete(:customer_id) do
342
+ raise ArgumentError.new("missing required path argument #{_1}")
343
+ end
344
+ invoice_id =
345
+ parsed.delete(:invoice_id) do
346
+ raise ArgumentError.new("missing required path argument #{_1}")
347
+ end
348
+ @client.request(
349
+ method: :get,
350
+ path: ["v1/customers/%1$s/invoices/%2$s/pdf", customer_id, invoice_id],
351
+ headers: {"accept" => "application/pdf"},
352
+ model: StringIO,
353
+ options: options
354
+ )
355
+ end
356
+
186
357
  # @api private
187
358
  #
188
359
  # @param client [MetronomeSDK::Client]
@@ -28,7 +28,40 @@ module MetronomeSDK
28
28
  # Some parameter documentations has been truncated, see
29
29
  # {MetronomeSDK::Models::V1::CustomerCreateParams} for more details.
30
30
  #
31
- # Create a new customer
31
+ # Create a new customer in Metronome and optionally the billing configuration
32
+ # (recommended) which dictates where invoices for the customer will be sent or
33
+ # where payment will be collected.
34
+ #
35
+ # ### Use this endpoint to:
36
+ #
37
+ # Execute your customer provisioning workflows for either PLG motions, where
38
+ # customers originate in your platform, or SLG motions, where customers originate
39
+ # in your sales system.
40
+ #
41
+ # ### Key response fields:
42
+ #
43
+ # This end-point returns the `customer_id` created by the request. This id can be
44
+ # used to fetch relevant billing configurations and create contracts.
45
+ #
46
+ # ### Example workflow:
47
+ #
48
+ # - Generally, Metronome recommends first creating the customer in the downstream
49
+ # payment / ERP system when payment method is collected and then creating the
50
+ # customer in Metronome using the response (i.e. `customer_id`) from the
51
+ # downstream system. If you do not create a billing configuration on customer
52
+ # creation, you can add it later.
53
+ # - Once a customer is created, you can then create a contract for the customer.
54
+ # In the contract creation process, you will need to add the customer billing
55
+ # configuration to the contract to ensure Metronome invoices the customer
56
+ # correctly. This is because a customer can have multiple configurations.
57
+ # - As part of the customer creation process, set the ingest alias for the
58
+ # customer which will ensure usage is accurately mapped to the customer. Ingest
59
+ # aliases can be added or changed after the creation process as well.
60
+ #
61
+ # ### Usage guidelines:
62
+ #
63
+ # For details on different billing configurations for different systems, review
64
+ # the `/setCustomerBillingConfiguration` end-point.
32
65
  #
33
66
  # @overload create(name:, billing_config: nil, custom_fields: nil, customer_billing_provider_configurations: nil, external_id: nil, ingest_aliases: nil, request_options: {})
34
67
  #
@@ -36,7 +69,7 @@ module MetronomeSDK
36
69
  #
37
70
  # @param billing_config [MetronomeSDK::Models::V1::CustomerCreateParams::BillingConfig]
38
71
  #
39
- # @param custom_fields [Hash{Symbol=>String}]
72
+ # @param custom_fields [Hash{Symbol=>String}] Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
40
73
  #
41
74
  # @param customer_billing_provider_configurations [Array<MetronomeSDK::Models::V1::CustomerCreateParams::CustomerBillingProviderConfiguration>]
42
75
  #
@@ -60,7 +93,13 @@ module MetronomeSDK
60
93
  )
61
94
  end
62
95
 
63
- # Get a customer by Metronome ID.
96
+ # Get detailed information for a specific customer by their Metronome ID. Returns
97
+ # customer profile data including name, creation date, ingest aliases,
98
+ # configuration settings, and custom fields. Use this endpoint to fetch complete
99
+ # customer details for billing operations or account management.
100
+ #
101
+ # Note: If searching for a customer billing configuration, use the
102
+ # `/getCustomerBillingConfigurations` endpoint.
64
103
  #
65
104
  # @overload retrieve(customer_id:, request_options: {})
66
105
  #
@@ -87,7 +126,11 @@ module MetronomeSDK
87
126
  # Some parameter documentations has been truncated, see
88
127
  # {MetronomeSDK::Models::V1::CustomerListParams} for more details.
89
128
  #
90
- # List all customers.
129
+ # Gets a paginated list of all customers in your Metronome account. Use this
130
+ # endpoint to browse your customer base, implement customer search functionality,
131
+ # or sync customer data with external systems. Returns customer details including
132
+ # IDs, names, and configuration settings. Supports filtering and pagination
133
+ # parameters for efficient data retrieval.
91
134
  #
92
135
  # @overload list(customer_ids: nil, ingest_alias: nil, limit: nil, next_page: nil, only_archived: nil, salesforce_account_ids: nil, request_options: {})
93
136
  #
@@ -120,8 +163,20 @@ module MetronomeSDK
120
163
  )
121
164
  end
122
165
 
123
- # Archive a customer Note: any alerts associated with the customer will not be
124
- # triggered.
166
+ # Use this endpoint to archive a customer while preserving auditability. Archiving
167
+ # a customer will automatically archive all contracts as of the current date and
168
+ # void all corresponding invoices. Use this endpoint if a customer is onboarded by
169
+ # mistake.
170
+ #
171
+ # ### Usage guidelines:
172
+ #
173
+ # - Once a customer is archived, it cannot be unarchived.
174
+ # - Archived customers can still be viewed through the API or the UI for audit
175
+ # purposes.
176
+ # - Ingest aliases remain idempotent for archived customers. In order to reuse an
177
+ # ingest alias, first remove the ingest alias from the customer prior to
178
+ # archiving.
179
+ # - Any notifications associated with the customer will no longer be triggered.
125
180
  #
126
181
  # @overload archive(id:, request_options: {})
127
182
  #
@@ -145,7 +200,10 @@ module MetronomeSDK
145
200
  # Some parameter documentations has been truncated, see
146
201
  # {MetronomeSDK::Models::V1::CustomerListBillableMetricsParams} for more details.
147
202
  #
148
- # Get all billable metrics for a given customer.
203
+ # Get all billable metrics available for a specific customer. Supports pagination
204
+ # and filtering by current plan status or archived metrics. Use this endpoint to
205
+ # see which metrics are being tracked for billing calculations for a given
206
+ # customer.
149
207
  #
150
208
  # @overload list_billable_metrics(customer_id:, include_archived: nil, limit: nil, next_page: nil, on_current_plan: nil, request_options: {})
151
209
  #
@@ -220,10 +278,10 @@ module MetronomeSDK
220
278
  # Some parameter documentations has been truncated, see
221
279
  # {MetronomeSDK::Models::V1::CustomerPreviewEventsParams} for more details.
222
280
  #
223
- # Preview how a set of events will affect a customer's invoice. Generates a draft
224
- # invoice for a customer using their current contract configuration and the
281
+ # Preview how a set of events will affect a customer's invoices. Generates draft
282
+ # invoices for a customer using their current contract configuration and the
225
283
  # provided events. This is useful for testing how new events will affect the
226
- # customer's invoice before they are actually processed.
284
+ # customer's invoices before they are actually processed.
227
285
  #
228
286
  # @overload preview_events(customer_id:, events:, mode: nil, skip_zero_qty_line_items: nil, request_options: {})
229
287
  #
@@ -255,9 +313,104 @@ module MetronomeSDK
255
313
  )
256
314
  end
257
315
 
258
- # Sets the ingest aliases for a customer. Ingest aliases can be used in the
259
- # `customer_id` field when sending usage events to Metronome. This call is
260
- # idempotent. It fully replaces the set of ingest aliases for the given customer.
316
+ # Returns all billing configurations previously set for the customer. Use during
317
+ # the contract provisioning process to fetch the
318
+ # `billing_provider_configuration_id` needed to set the contract billing
319
+ # configuration.
320
+ #
321
+ # @overload retrieve_billing_configurations(customer_id:, include_archived: nil, request_options: {})
322
+ #
323
+ # @param customer_id [String]
324
+ # @param include_archived [Boolean]
325
+ # @param request_options [MetronomeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
326
+ #
327
+ # @return [MetronomeSDK::Models::V1::CustomerRetrieveBillingConfigurationsResponse]
328
+ #
329
+ # @see MetronomeSDK::Models::V1::CustomerRetrieveBillingConfigurationsParams
330
+ def retrieve_billing_configurations(params)
331
+ parsed, options = MetronomeSDK::V1::CustomerRetrieveBillingConfigurationsParams.dump_request(params)
332
+ @client.request(
333
+ method: :post,
334
+ path: "v1/getCustomerBillingProviderConfigurations",
335
+ body: parsed,
336
+ model: MetronomeSDK::Models::V1::CustomerRetrieveBillingConfigurationsResponse,
337
+ options: options
338
+ )
339
+ end
340
+
341
+ # Create a billing configuration for a customer. Once created, these
342
+ # configurations are available to associate to a contract and dictates which
343
+ # downstream system to collect payment in or send the invoice to. You can create
344
+ # multiple configurations per customer. The configuration formats are distinct for
345
+ # each downstream provider.
346
+ #
347
+ # ### Use this endpoint to:
348
+ #
349
+ # - Add the initial configuration to an existing customer. Once created, the
350
+ # billing configuration can then be associated to the customer's contract.
351
+ # - Add a new configuration to an existing customer. This might be used as part of
352
+ # an upgrade or downgrade workflow where the customer was previously billed
353
+ # through system A (e.g. Stripe) but will now be billed through system B (e.g.
354
+ # AWS). Once created, the new configuration can then be associated to the
355
+ # customer's contract.
356
+ # - Multiple configurations can be added per destination. For example, you can
357
+ # create two Stripe billing configurations for a Metronome customer that each
358
+ # have a distinct `collection_method`.
359
+ #
360
+ # ### Delivery method options:
361
+ #
362
+ # - `direct_to_billing_provider`: Use when Metronome should send invoices directly
363
+ # to the billing provider's API (e.g., Stripe, NetSuite). This is the most
364
+ # common method for automated billing workflows.
365
+ # - `tackle`: Use specifically for AWS Marketplace transactions that require
366
+ # Tackle's co-selling platform for partner attribution and commission tracking.
367
+ # - `aws_sqs`: Use when you want invoice data delivered to an AWS SQS queue for
368
+ # custom processing before sending to your billing system.
369
+ # - `aws_sns`: Use when you want invoice notifications published to an AWS SNS
370
+ # topic for event-driven billing workflows.
371
+ #
372
+ # ### Key response fields:
373
+ #
374
+ # The id for the customer billing configuration. This id can be used to associate
375
+ # the billing configuration to a contract.
376
+ #
377
+ # ### Usage guidelines:
378
+ #
379
+ # Must use the `delivery_method_id` if you have multiple Stripe accounts connected
380
+ # to Metronome.
381
+ #
382
+ # @overload set_billing_configurations(data:, request_options: {})
383
+ #
384
+ # @param data [Array<MetronomeSDK::Models::V1::CustomerSetBillingConfigurationsParams::Data>]
385
+ # @param request_options [MetronomeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
386
+ #
387
+ # @return [nil]
388
+ #
389
+ # @see MetronomeSDK::Models::V1::CustomerSetBillingConfigurationsParams
390
+ def set_billing_configurations(params)
391
+ parsed, options = MetronomeSDK::V1::CustomerSetBillingConfigurationsParams.dump_request(params)
392
+ @client.request(
393
+ method: :post,
394
+ path: "v1/setCustomerBillingProviderConfigurations",
395
+ body: parsed,
396
+ model: NilClass,
397
+ options: options
398
+ )
399
+ end
400
+
401
+ # Sets the ingest aliases for a customer. Use this endpoint to associate a
402
+ # Metronome customer with an internal ID for easier tracking between systems.
403
+ # Ingest aliases can be used in the `customer_id` field when sending usage events
404
+ # to Metronome.
405
+ #
406
+ # ### Usage guidelines:
407
+ #
408
+ # - This call is idempotent and fully replaces the set of ingest aliases for the
409
+ # given customer.
410
+ # - Switching an ingest alias from one customer to another will associate all
411
+ # corresponding usage to the new customer.
412
+ # - Use multiple ingest aliases to model child organizations within a single
413
+ # Metronome customer.
261
414
  #
262
415
  # @overload set_ingest_aliases(customer_id:, ingest_aliases:, request_options: {})
263
416
  #
@@ -288,7 +441,11 @@ module MetronomeSDK
288
441
  # Some parameter documentations has been truncated, see
289
442
  # {MetronomeSDK::Models::V1::CustomerSetNameParams} for more details.
290
443
  #
291
- # Updates the specified customer's name.
444
+ # Updates the display name for a customer record. Use this to correct customer
445
+ # names, update business names after rebranding, or maintain accurate customer
446
+ # information for invoicing and reporting. Returns the updated customer object
447
+ # with the new name applied immediately across all billing documents and
448
+ # interfaces.
292
449
  #
293
450
  # @overload set_name(customer_id:, name:, request_options: {})
294
451
  #
@@ -319,7 +476,10 @@ module MetronomeSDK
319
476
  # Some parameter documentations has been truncated, see
320
477
  # {MetronomeSDK::Models::V1::CustomerUpdateConfigParams} for more details.
321
478
  #
322
- # Updates the specified customer's config.
479
+ # Update configuration settings for a specific customer, such as external system
480
+ # integrations (e.g., Salesforce account ID) and other customer-specific billing
481
+ # parameters. Use this endpoint to modify customer configurations without
482
+ # affecting core customer data like name or ingest aliases.
323
483
  #
324
484
  # @overload update_config(customer_id:, leave_stripe_invoices_in_draft: nil, salesforce_account_id: nil, request_options: {})
325
485
  #
@@ -4,9 +4,35 @@ module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
6
  class Dashboards
7
- # Retrieve an embeddable dashboard url for a customer. The dashboard can be
8
- # embedded using an iframe in a website. This will show information such as usage
9
- # data and customer invoices.
7
+ # Generate secure, embeddable dashboard URLs that allow you to seamlessly
8
+ # integrate Metronome's billing visualizations directly into your application.
9
+ # This endpoint creates authenticated iframe-ready URLs for customer-specific
10
+ # dashboards, providing a white-labeled billing experience without building custom
11
+ # UI.
12
+ #
13
+ # ### Use this endpoint to:
14
+ #
15
+ # - Embed billing dashboards directly in your customer portal or admin interface
16
+ # - Provide self-service access to invoices, usage data, and credit balances
17
+ # - Build white-labeled billing experiences with minimal development effort
18
+ #
19
+ # ### Key response fields:
20
+ #
21
+ # - A secure, time-limited URL that can be embedded in an iframe
22
+ # - The URL includes authentication tokens and configuration parameters
23
+ # - URLs are customer-specific and respect your security settings
24
+ #
25
+ # ### Usage guidelines:
26
+ #
27
+ # - Dashboard types: Choose from `invoices`, `usage`, or `commits_and_credits`
28
+ # - Customization options:
29
+ # - `dashboard_options`: Configure whether you want invoices to show zero usage
30
+ # line items
31
+ # - `color_overrides`: Match your brand's color palette
32
+ # - `bm_group_key_overrides`: Customize how dimensions are displayed (for the
33
+ # usage embeddable dashboard)
34
+ # - Iframe implementation: Embed the returned URL directly in an iframe element
35
+ # - Responsive design: Dashboards automatically adapt to container dimensions
10
36
  #
11
37
  # @overload get_embeddable_url(customer_id:, dashboard:, bm_group_key_overrides: nil, color_overrides: nil, dashboard_options: nil, request_options: {})
12
38
  #
@@ -4,7 +4,24 @@ module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
6
  class Invoices
7
- # Regenerate a voided contract invoice
7
+ # This endpoint regenerates a voided invoice and recalculates the invoice based on
8
+ # up-to-date rates, available balances, and other fees regardless of the billing
9
+ # period.
10
+ #
11
+ # ### Use this endpoint to:
12
+ #
13
+ # Recalculate an invoice with updated rate terms, available balance, and fees to
14
+ # correct billing disputes or discrepancies
15
+ #
16
+ # ### Key response fields:
17
+ #
18
+ # The regenerated invoice id, which is distinct from the previously voided
19
+ # invoice.
20
+ #
21
+ # ### Usage guidelines:
22
+ #
23
+ # If an invoice is attached to a contract with a billing provider on it, the
24
+ # regenerated invoice will be distributed based on the configuration.
8
25
  #
9
26
  # @overload regenerate(id:, request_options: {})
10
27
  #
@@ -26,7 +43,11 @@ module MetronomeSDK
26
43
  )
27
44
  end
28
45
 
29
- # Void an invoice
46
+ # Permanently cancels an invoice by setting its status to voided, preventing
47
+ # collection and removing it from customer billing. Use this to correct billing
48
+ # errors, cancel incorrect charges, or handle disputed invoices that should not be
49
+ # collected. Returns the voided invoice ID with the status change applied
50
+ # immediately to stop any payment processing.
30
51
  #
31
52
  # @overload void(id:, request_options: {})
32
53
  #
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MetronomeSDK
4
+ module Resources
5
+ class V1
6
+ class Payments
7
+ # Fetch all payment attempts for the given invoice.
8
+ #
9
+ # @overload list(customer_id:, invoice_id:, limit: nil, next_page: nil, statuses: nil, request_options: {})
10
+ #
11
+ # @param customer_id [String]
12
+ #
13
+ # @param invoice_id [String]
14
+ #
15
+ # @param limit [Integer] The maximum number of payments to return. Defaults to 25.
16
+ #
17
+ # @param next_page [String] The next page token from a previous response.
18
+ #
19
+ # @param statuses [Array<Symbol, MetronomeSDK::Models::V1::PaymentStatus>]
20
+ #
21
+ # @param request_options [MetronomeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
22
+ #
23
+ # @return [MetronomeSDK::Internal::BodyCursorPage<MetronomeSDK::Models::V1::Payment>]
24
+ #
25
+ # @see MetronomeSDK::Models::V1::PaymentListParams
26
+ def list(params)
27
+ parsed, options = MetronomeSDK::V1::PaymentListParams.dump_request(params)
28
+ @client.request(
29
+ method: :post,
30
+ path: "v1/payments/list",
31
+ body: parsed,
32
+ page: MetronomeSDK::Internal::BodyCursorPage,
33
+ model: MetronomeSDK::V1::Payment,
34
+ options: options
35
+ )
36
+ end
37
+
38
+ # Trigger a new attempt by canceling any existing attempts for this invoice and
39
+ # creating a new Payment. This will trigger another attempt to charge the
40
+ # Customer's configured Payment Gateway. Payment can only be attempted if all of
41
+ # the following are true:
42
+ #
43
+ # - The Metronome Invoice is finalized
44
+ # - PLG Invoicing is configured for the Customer
45
+ # - You cannot attempt payments for invoices that have already been `paid` or
46
+ # `voided`.
47
+ #
48
+ # Attempting to payment on an ineligible Invoice or Customer will result in a
49
+ # `400` response.
50
+ #
51
+ # @overload attempt(customer_id:, invoice_id:, request_options: {})
52
+ #
53
+ # @param customer_id [String]
54
+ # @param invoice_id [String]
55
+ # @param request_options [MetronomeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
56
+ #
57
+ # @return [MetronomeSDK::Models::V1::PaymentAttemptResponse]
58
+ #
59
+ # @see MetronomeSDK::Models::V1::PaymentAttemptParams
60
+ def attempt(params)
61
+ parsed, options = MetronomeSDK::V1::PaymentAttemptParams.dump_request(params)
62
+ @client.request(
63
+ method: :post,
64
+ path: "v1/payments/attempt",
65
+ body: parsed,
66
+ model: MetronomeSDK::Models::V1::PaymentAttemptResponse,
67
+ options: options
68
+ )
69
+ end
70
+
71
+ # Cancel an existing payment attempt for an invoice.
72
+ #
73
+ # @overload cancel(customer_id:, invoice_id:, request_options: {})
74
+ #
75
+ # @param customer_id [String]
76
+ # @param invoice_id [String]
77
+ # @param request_options [MetronomeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
78
+ #
79
+ # @return [MetronomeSDK::Models::V1::PaymentCancelResponse]
80
+ #
81
+ # @see MetronomeSDK::Models::V1::PaymentCancelParams
82
+ def cancel(params)
83
+ parsed, options = MetronomeSDK::V1::PaymentCancelParams.dump_request(params)
84
+ @client.request(
85
+ method: :post,
86
+ path: "v1/payments/cancel",
87
+ body: parsed,
88
+ model: MetronomeSDK::Models::V1::PaymentCancelResponse,
89
+ options: options
90
+ )
91
+ end
92
+
93
+ # @api private
94
+ #
95
+ # @param client [MetronomeSDK::Client]
96
+ def initialize(client:)
97
+ @client = client
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
@@ -4,7 +4,12 @@ module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
6
  class PricingUnits
7
- # List all pricing units (known in the API by the legacy term "credit types").
7
+ # List all pricing units. All fiat currency types (for example, USD or GBP) will
8
+ # be included, as well as any custom pricing units that were configured. Custom
9
+ # pricing units can be used to charge for usage in a non-fiat pricing unit, for
10
+ # example AI credits.
11
+ #
12
+ # Note: The USD (cents) pricing unit is 2714e483-4ff1-48e4-9e25-ac732e8f24f2.
8
13
  #
9
14
  # @overload list(limit: nil, next_page: nil, request_options: {})
10
15
  #