metronome-sdk 1.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +91 -0
  3. data/README.md +1 -1
  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 +1 -1
  7. data/lib/metronome_sdk/internal/cursor_page.rb +1 -1
  8. data/lib/metronome_sdk/internal/cursor_page_without_limit.rb +1 -1
  9. data/lib/metronome_sdk/internal/transport/base_client.rb +11 -7
  10. data/lib/metronome_sdk/internal/transport/pooled_net_requester.rb +34 -31
  11. data/lib/metronome_sdk/internal/type/base_page.rb +1 -1
  12. data/lib/metronome_sdk/internal/type/enum.rb +25 -0
  13. data/lib/metronome_sdk/internal/type/file_input.rb +7 -4
  14. data/lib/metronome_sdk/internal/util.rb +8 -7
  15. data/lib/metronome_sdk/models/contract.rb +1 -0
  16. data/lib/metronome_sdk/models/contract_v2.rb +275 -6
  17. data/lib/metronome_sdk/models/contract_without_amendments.rb +2 -2
  18. data/lib/metronome_sdk/models/hierarchy_configuration.rb +123 -2
  19. data/lib/metronome_sdk/models/payment_gate_config.rb +1 -0
  20. data/lib/metronome_sdk/models/payment_gate_config_v2.rb +1 -0
  21. data/lib/metronome_sdk/models/subscription.rb +95 -1
  22. data/lib/metronome_sdk/models/v1/alert_archive_params.rb +8 -4
  23. data/lib/metronome_sdk/models/v1/alert_create_params.rb +38 -36
  24. data/lib/metronome_sdk/models/v1/contract_amend_params.rb +1 -0
  25. data/lib/metronome_sdk/models/v1/contract_create_params.rb +157 -9
  26. data/lib/metronome_sdk/models/v1/contract_list_balances_params.rb +9 -1
  27. data/lib/metronome_sdk/models/v1/customer_create_params.rb +11 -1
  28. data/lib/metronome_sdk/models/v1/customer_detail.rb +9 -1
  29. data/lib/metronome_sdk/models/v1/customer_preview_events_params.rb +19 -25
  30. data/lib/metronome_sdk/models/v1/customer_preview_events_response.rb +3 -3
  31. data/lib/metronome_sdk/models/v1/customer_retrieve_billing_configurations_response.rb +1 -0
  32. data/lib/metronome_sdk/models/v1/customer_set_billing_configurations_params.rb +1 -0
  33. data/lib/metronome_sdk/models/v1/customers/alert_list_params.rb +3 -3
  34. data/lib/metronome_sdk/models/v1/customers/alert_reset_params.rb +2 -2
  35. data/lib/metronome_sdk/models/v1/customers/alert_retrieve_params.rb +12 -12
  36. data/lib/metronome_sdk/models/v1/customers/billing_config_create_params.rb +6 -1
  37. data/lib/metronome_sdk/models/v1/customers/billing_config_delete_params.rb +1 -0
  38. data/lib/metronome_sdk/models/v1/customers/billing_config_retrieve_params.rb +1 -0
  39. data/lib/metronome_sdk/models/v1/customers/billing_config_retrieve_response.rb +6 -1
  40. data/lib/metronome_sdk/models/v1/customers/commit_create_params.rb +1 -1
  41. data/lib/metronome_sdk/models/v1/customers/customer_alert.rb +41 -38
  42. data/lib/metronome_sdk/models/v1/customers/invoice.rb +256 -16
  43. data/lib/metronome_sdk/models/v1/customers/invoice_retrieve_pdf_params.rb +30 -0
  44. data/lib/metronome_sdk/models/v1/payment.rb +157 -0
  45. data/lib/metronome_sdk/models/v1/payment_attempt_params.rb +28 -0
  46. data/lib/metronome_sdk/models/v1/payment_attempt_response.rb +18 -0
  47. data/lib/metronome_sdk/models/v1/payment_cancel_params.rb +28 -0
  48. data/lib/metronome_sdk/models/v1/payment_cancel_response.rb +18 -0
  49. data/lib/metronome_sdk/models/v1/payment_list_params.rb +53 -0
  50. data/lib/metronome_sdk/models/v1/payment_status.rb +19 -0
  51. data/lib/metronome_sdk/models/v1/setting_upsert_avalara_credentials_params.rb +65 -0
  52. data/lib/metronome_sdk/models/v1/setting_upsert_avalara_credentials_response.rb +12 -0
  53. data/lib/metronome_sdk/models/v1/settings/billing_provider_create_params.rb +73 -0
  54. data/lib/metronome_sdk/models/v1/settings/billing_provider_create_response.rb +31 -0
  55. data/lib/metronome_sdk/models/v1/settings/billing_provider_list_params.rb +26 -0
  56. data/lib/metronome_sdk/models/v1/settings/billing_provider_list_response.rb +105 -0
  57. data/lib/metronome_sdk/models/v2/contract_edit_commit_params.rb +9 -1
  58. data/lib/metronome_sdk/models/v2/contract_edit_credit_params.rb +9 -1
  59. data/lib/metronome_sdk/models/v2/contract_edit_params.rb +219 -9
  60. data/lib/metronome_sdk/models/v2/contract_get_edit_history_response.rb +195 -8
  61. data/lib/metronome_sdk/resources/v1/alerts.rb +57 -53
  62. data/lib/metronome_sdk/resources/v1/contracts.rb +8 -5
  63. data/lib/metronome_sdk/resources/v1/credit_grants.rb +10 -5
  64. data/lib/metronome_sdk/resources/v1/customers/alerts.rb +70 -51
  65. data/lib/metronome_sdk/resources/v1/customers/billing_config.rb +7 -4
  66. data/lib/metronome_sdk/resources/v1/customers/commits.rb +2 -1
  67. data/lib/metronome_sdk/resources/v1/customers/invoices.rb +57 -1
  68. data/lib/metronome_sdk/resources/v1/customers/plans.rb +8 -4
  69. data/lib/metronome_sdk/resources/v1/customers.rb +13 -8
  70. data/lib/metronome_sdk/resources/v1/payments.rb +102 -0
  71. data/lib/metronome_sdk/resources/v1/plans.rb +8 -4
  72. data/lib/metronome_sdk/resources/v1/settings/billing_providers.rb +75 -0
  73. data/lib/metronome_sdk/resources/v1/settings.rb +55 -0
  74. data/lib/metronome_sdk/resources/v1/usage.rb +4 -2
  75. data/lib/metronome_sdk/resources/v1.rb +8 -0
  76. data/lib/metronome_sdk/resources/v2/contracts.rb +9 -3
  77. data/lib/metronome_sdk/version.rb +1 -1
  78. data/lib/metronome_sdk.rb +17 -0
  79. data/rbi/metronome_sdk/errors.rbi +29 -2
  80. data/rbi/metronome_sdk/file_part.rbi +1 -1
  81. data/rbi/metronome_sdk/internal/transport/base_client.rbi +4 -5
  82. data/rbi/metronome_sdk/internal/type/base_page.rbi +1 -1
  83. data/rbi/metronome_sdk/internal/util.rbi +1 -1
  84. data/rbi/metronome_sdk/models/contract.rbi +5 -0
  85. data/rbi/metronome_sdk/models/contract_v2.rbi +635 -10
  86. data/rbi/metronome_sdk/models/contract_without_amendments.rbi +2 -2
  87. data/rbi/metronome_sdk/models/hierarchy_configuration.rbi +286 -6
  88. data/rbi/metronome_sdk/models/payment_gate_config.rbi +5 -0
  89. data/rbi/metronome_sdk/models/payment_gate_config_v2.rbi +5 -0
  90. data/rbi/metronome_sdk/models/subscription.rbi +190 -0
  91. data/rbi/metronome_sdk/models/v1/alert_archive_params.rbi +6 -4
  92. data/rbi/metronome_sdk/models/v1/alert_create_params.rbi +51 -47
  93. data/rbi/metronome_sdk/models/v1/contract_amend_params.rbi +5 -0
  94. data/rbi/metronome_sdk/models/v1/contract_create_params.rbi +326 -10
  95. data/rbi/metronome_sdk/models/v1/contract_list_balances_params.rbi +11 -0
  96. data/rbi/metronome_sdk/models/v1/customer_create_params.rbi +11 -0
  97. data/rbi/metronome_sdk/models/v1/customer_detail.rbi +8 -0
  98. data/rbi/metronome_sdk/models/v1/customer_preview_events_params.rbi +24 -32
  99. data/rbi/metronome_sdk/models/v1/customer_preview_events_response.rbi +10 -9
  100. data/rbi/metronome_sdk/models/v1/customer_retrieve_billing_configurations_response.rbi +5 -0
  101. data/rbi/metronome_sdk/models/v1/customer_set_billing_configurations_params.rbi +5 -0
  102. data/rbi/metronome_sdk/models/v1/customers/alert_list_params.rbi +4 -4
  103. data/rbi/metronome_sdk/models/v1/customers/alert_reset_params.rbi +2 -2
  104. data/rbi/metronome_sdk/models/v1/customers/alert_retrieve_params.rbi +14 -14
  105. data/rbi/metronome_sdk/models/v1/customers/billing_config_create_params.rbi +11 -0
  106. data/rbi/metronome_sdk/models/v1/customers/billing_config_delete_params.rbi +5 -0
  107. data/rbi/metronome_sdk/models/v1/customers/billing_config_retrieve_params.rbi +5 -0
  108. data/rbi/metronome_sdk/models/v1/customers/billing_config_retrieve_response.rbi +6 -0
  109. data/rbi/metronome_sdk/models/v1/customers/commit_create_params.rbi +2 -2
  110. data/rbi/metronome_sdk/models/v1/customers/customer_alert.rbi +53 -44
  111. data/rbi/metronome_sdk/models/v1/customers/invoice.rbi +462 -38
  112. data/rbi/metronome_sdk/models/v1/customers/invoice_retrieve_pdf_params.rbi +50 -0
  113. data/rbi/metronome_sdk/models/v1/payment.rbi +324 -0
  114. data/rbi/metronome_sdk/models/v1/payment_attempt_params.rbi +48 -0
  115. data/rbi/metronome_sdk/models/v1/payment_attempt_response.rbi +35 -0
  116. data/rbi/metronome_sdk/models/v1/payment_cancel_params.rbi +48 -0
  117. data/rbi/metronome_sdk/models/v1/payment_cancel_response.rbi +35 -0
  118. data/rbi/metronome_sdk/models/v1/payment_list_params.rbi +91 -0
  119. data/rbi/metronome_sdk/models/v1/payment_status.rbi +33 -0
  120. data/rbi/metronome_sdk/models/v1/setting_upsert_avalara_credentials_params.rbi +115 -0
  121. data/rbi/metronome_sdk/models/v1/setting_upsert_avalara_credentials_response.rbi +25 -0
  122. data/rbi/metronome_sdk/models/v1/settings/billing_provider_create_params.rbi +157 -0
  123. data/rbi/metronome_sdk/models/v1/settings/billing_provider_create_response.rbi +75 -0
  124. data/rbi/metronome_sdk/models/v1/settings/billing_provider_list_params.rbi +50 -0
  125. data/rbi/metronome_sdk/models/v1/settings/billing_provider_list_response.rbi +245 -0
  126. data/rbi/metronome_sdk/models/v2/contract_edit_commit_params.rbi +18 -0
  127. data/rbi/metronome_sdk/models/v2/contract_edit_credit_params.rbi +18 -0
  128. data/rbi/metronome_sdk/models/v2/contract_edit_params.rbi +536 -12
  129. data/rbi/metronome_sdk/models/v2/contract_get_edit_history_response.rbi +462 -14
  130. data/rbi/metronome_sdk/resources/v1/alerts.rbi +68 -64
  131. data/rbi/metronome_sdk/resources/v1/contracts.rbi +8 -4
  132. data/rbi/metronome_sdk/resources/v1/credit_grants.rbi +10 -5
  133. data/rbi/metronome_sdk/resources/v1/customers/alerts.rbi +73 -54
  134. data/rbi/metronome_sdk/resources/v1/customers/billing_config.rbi +8 -4
  135. data/rbi/metronome_sdk/resources/v1/customers/commits.rbi +3 -2
  136. data/rbi/metronome_sdk/resources/v1/customers/invoices.rbi +38 -1
  137. data/rbi/metronome_sdk/resources/v1/customers/plans.rbi +8 -4
  138. data/rbi/metronome_sdk/resources/v1/customers.rbi +17 -11
  139. data/rbi/metronome_sdk/resources/v1/payments.rbi +72 -0
  140. data/rbi/metronome_sdk/resources/v1/plans.rbi +8 -4
  141. data/rbi/metronome_sdk/resources/v1/settings/billing_providers.rbi +63 -0
  142. data/rbi/metronome_sdk/resources/v1/settings.rbi +47 -0
  143. data/rbi/metronome_sdk/resources/v1/usage.rbi +4 -2
  144. data/rbi/metronome_sdk/resources/v1.rbi +6 -0
  145. data/rbi/metronome_sdk/resources/v2/contracts.rbi +14 -0
  146. data/sig/metronome_sdk/errors.rbs +7 -0
  147. data/sig/metronome_sdk/file_part.rbs +1 -1
  148. data/sig/metronome_sdk/models/contract.rbs +2 -0
  149. data/sig/metronome_sdk/models/contract_v2.rbs +241 -12
  150. data/sig/metronome_sdk/models/hierarchy_configuration.rbs +87 -6
  151. data/sig/metronome_sdk/models/payment_gate_config.rbs +2 -1
  152. data/sig/metronome_sdk/models/payment_gate_config_v2.rbs +2 -1
  153. data/sig/metronome_sdk/models/subscription.rbs +80 -0
  154. data/sig/metronome_sdk/models/v1/contract_amend_params.rbs +2 -1
  155. data/sig/metronome_sdk/models/v1/contract_create_params.rbs +91 -5
  156. data/sig/metronome_sdk/models/v1/contract_list_balances_params.rbs +7 -0
  157. data/sig/metronome_sdk/models/v1/customer_create_params.rbs +2 -0
  158. data/sig/metronome_sdk/models/v1/customer_detail.rbs +5 -0
  159. data/sig/metronome_sdk/models/v1/customer_preview_events_params.rbs +0 -7
  160. data/sig/metronome_sdk/models/v1/customer_preview_events_response.rbs +6 -4
  161. data/sig/metronome_sdk/models/v1/customer_retrieve_billing_configurations_response.rbs +2 -0
  162. data/sig/metronome_sdk/models/v1/customer_set_billing_configurations_params.rbs +2 -0
  163. data/sig/metronome_sdk/models/v1/customers/billing_config_create_params.rbs +2 -0
  164. data/sig/metronome_sdk/models/v1/customers/billing_config_delete_params.rbs +2 -0
  165. data/sig/metronome_sdk/models/v1/customers/billing_config_retrieve_params.rbs +2 -0
  166. data/sig/metronome_sdk/models/v1/customers/customer_alert.rbs +2 -0
  167. data/sig/metronome_sdk/models/v1/customers/invoice.rbs +244 -19
  168. data/sig/metronome_sdk/models/v1/customers/invoice_retrieve_pdf_params.rbs +32 -0
  169. data/sig/metronome_sdk/models/v1/payment.rbs +198 -0
  170. data/sig/metronome_sdk/models/v1/payment_attempt_params.rbs +30 -0
  171. data/sig/metronome_sdk/models/v1/payment_attempt_response.rbs +15 -0
  172. data/sig/metronome_sdk/models/v1/payment_cancel_params.rbs +30 -0
  173. data/sig/metronome_sdk/models/v1/payment_cancel_response.rbs +15 -0
  174. data/sig/metronome_sdk/models/v1/payment_list_params.rbs +56 -0
  175. data/sig/metronome_sdk/models/v1/payment_status.rbs +19 -0
  176. data/sig/metronome_sdk/models/v1/setting_upsert_avalara_credentials_params.rbs +54 -0
  177. data/sig/metronome_sdk/models/v1/setting_upsert_avalara_credentials_response.rbs +13 -0
  178. data/sig/metronome_sdk/models/v1/settings/billing_provider_create_params.rbs +64 -0
  179. data/sig/metronome_sdk/models/v1/settings/billing_provider_create_response.rbs +34 -0
  180. data/sig/metronome_sdk/models/v1/settings/billing_provider_list_params.rbs +28 -0
  181. data/sig/metronome_sdk/models/v1/settings/billing_provider_list_response.rbs +102 -0
  182. data/sig/metronome_sdk/models/v2/contract_edit_commit_params.rbs +9 -0
  183. data/sig/metronome_sdk/models/v2/contract_edit_credit_params.rbs +9 -0
  184. data/sig/metronome_sdk/models/v2/contract_edit_params.rbs +184 -7
  185. data/sig/metronome_sdk/models/v2/contract_get_edit_history_response.rbs +221 -18
  186. data/sig/metronome_sdk/resources/v1/contracts.rbs +1 -0
  187. data/sig/metronome_sdk/resources/v1/customers/invoices.rbs +6 -0
  188. data/sig/metronome_sdk/resources/v1/payments.rbs +30 -0
  189. data/sig/metronome_sdk/resources/v1/settings/billing_providers.rbs +23 -0
  190. data/sig/metronome_sdk/resources/v1/settings.rbs +19 -0
  191. data/sig/metronome_sdk/resources/v1.rbs +4 -0
  192. data/sig/metronome_sdk/resources/v2/contracts.rbs +3 -0
  193. metadata +53 -2
@@ -156,7 +156,7 @@ module MetronomeSDK
156
156
  # - Ingest aliases remain idempotent for archived customers. In order to reuse an
157
157
  # ingest alias, first remove the ingest alias from the customer prior to
158
158
  # archiving.
159
- # - Any alerts associated with the customer will no longer be triggered.
159
+ # - Any notifications associated with the customer will no longer be triggered.
160
160
  sig do
161
161
  params(
162
162
  id: String,
@@ -202,7 +202,8 @@ module MetronomeSDK
202
202
 
203
203
  # Fetch daily pending costs for the specified customer, broken down by credit type
204
204
  # and line items. Note: this is not supported for customers whose plan includes a
205
- # UNIQUE-type billable metric.
205
+ # UNIQUE-type billable metric. This is a Plans (deprecated) endpoint. New clients
206
+ # should implement using Contracts.
206
207
  sig do
207
208
  params(
208
209
  customer_id: String,
@@ -232,10 +233,11 @@ module MetronomeSDK
232
233
  )
233
234
  end
234
235
 
235
- # Preview how a set of events will affect a customer's invoice. Generates a draft
236
- # invoice for a customer using their current contract configuration and the
236
+ # Preview how a set of events will affect a customer's invoices. Generates draft
237
+ # invoices for a customer using their current contract configuration and the
237
238
  # provided events. This is useful for testing how new events will affect the
238
- # customer's invoice before they are actually processed.
239
+ # customer's invoices before they are actually processed. Customers on contracts
240
+ # with SQL billable metrics are not supported.
239
241
  sig do
240
242
  params(
241
243
  customer_id: String,
@@ -251,14 +253,15 @@ module MetronomeSDK
251
253
  def preview_events(
252
254
  # Path param:
253
255
  customer_id:,
254
- # Body param:
256
+ # Body param: Array of usage events to include in the preview calculation. Must
257
+ # contain at least one event in `merge` mode.
255
258
  events:,
256
- # Body param: If set to "replace", the preview will be generated as if those were
257
- # the only events for the specified customer. If set to "merge", the events will
258
- # be merged with any existing events for the specified customer. Defaults to
259
- # "replace".
259
+ # Body param: Controls how the provided events are combined with existing usage
260
+ # data. Use `replace` to calculate the preview as if these are the only events for
261
+ # the customer, ignoring all historical usage. Use `merge` to combine these events
262
+ # with the customer's existing usage. Defaults to `replace`.
260
263
  mode: nil,
261
- # Body param: If set, all zero quantity line items will be filtered out of the
264
+ # Body param: When `true`, line items with zero quantity are excluded from the
262
265
  # response.
263
266
  skip_zero_qty_line_items: nil,
264
267
  request_options: {}
@@ -300,6 +303,9 @@ module MetronomeSDK
300
303
  # through system A (e.g. Stripe) but will now be billed through system B (e.g.
301
304
  # AWS). Once created, the new configuration can then be associated to the
302
305
  # customer's contract.
306
+ # - Multiple configurations can be added per destination. For example, you can
307
+ # create two Stripe billing configurations for a Metronome customer that each
308
+ # have a distinct `collection_method`.
303
309
  #
304
310
  # ### Delivery method options:
305
311
  #
@@ -0,0 +1,72 @@
1
+ # typed: strong
2
+
3
+ module MetronomeSDK
4
+ module Resources
5
+ class V1
6
+ class Payments
7
+ # Fetch all payment attempts for the given invoice.
8
+ sig do
9
+ params(
10
+ customer_id: String,
11
+ invoice_id: String,
12
+ limit: Integer,
13
+ next_page: String,
14
+ statuses: T::Array[MetronomeSDK::V1::PaymentStatus::OrSymbol],
15
+ request_options: MetronomeSDK::RequestOptions::OrHash
16
+ ).returns(
17
+ MetronomeSDK::Internal::BodyCursorPage[MetronomeSDK::V1::Payment]
18
+ )
19
+ end
20
+ def list(
21
+ customer_id:,
22
+ invoice_id:,
23
+ # The maximum number of payments to return. Defaults to 25.
24
+ limit: nil,
25
+ # The next page token from a previous response.
26
+ next_page: nil,
27
+ statuses: nil,
28
+ request_options: {}
29
+ )
30
+ end
31
+
32
+ # Trigger a new attempt by canceling any existing attempts for this invoice and
33
+ # creating a new Payment. This will trigger another attempt to charge the
34
+ # Customer's configured Payment Gateway. Payment can only be attempted if all of
35
+ # the following are true:
36
+ #
37
+ # - The Metronome Invoice is finalized
38
+ # - PLG Invoicing is configured for the Customer
39
+ # - You cannot attempt payments for invoices that have already been `paid` or
40
+ # `voided`.
41
+ #
42
+ # Attempting to payment on an ineligible Invoice or Customer will result in a
43
+ # `400` response.
44
+ sig do
45
+ params(
46
+ customer_id: String,
47
+ invoice_id: String,
48
+ request_options: MetronomeSDK::RequestOptions::OrHash
49
+ ).returns(MetronomeSDK::Models::V1::PaymentAttemptResponse)
50
+ end
51
+ def attempt(customer_id:, invoice_id:, request_options: {})
52
+ end
53
+
54
+ # Cancel an existing payment attempt for an invoice.
55
+ sig do
56
+ params(
57
+ customer_id: String,
58
+ invoice_id: String,
59
+ request_options: MetronomeSDK::RequestOptions::OrHash
60
+ ).returns(MetronomeSDK::Models::V1::PaymentCancelResponse)
61
+ end
62
+ def cancel(customer_id:, invoice_id:, request_options: {})
63
+ end
64
+
65
+ # @api private
66
+ sig { params(client: MetronomeSDK::Client).returns(T.attached_class) }
67
+ def self.new(client:)
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -4,7 +4,8 @@ module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
6
  class Plans
7
- # List all available plans.
7
+ # List all available plans. This is a Plans (deprecated) endpoint. New clients
8
+ # should implement using Contracts.
8
9
  sig do
9
10
  params(
10
11
  limit: Integer,
@@ -25,7 +26,8 @@ module MetronomeSDK
25
26
  )
26
27
  end
27
28
 
28
- # Fetch high level details of a specific plan.
29
+ # Fetch high level details of a specific plan. This is a Plans (deprecated)
30
+ # endpoint. New clients should implement using Contracts.
29
31
  sig do
30
32
  params(
31
33
  plan_id: String,
@@ -35,7 +37,8 @@ module MetronomeSDK
35
37
  def get_details(plan_id:, request_options: {})
36
38
  end
37
39
 
38
- # Fetches a list of charges of a specific plan.
40
+ # Fetches a list of charges of a specific plan. This is a Plans (deprecated)
41
+ # endpoint. New clients should implement using Contracts.
39
42
  sig do
40
43
  params(
41
44
  plan_id: String,
@@ -60,7 +63,8 @@ module MetronomeSDK
60
63
  end
61
64
 
62
65
  # Fetches a list of customers on a specific plan (by default, only currently
63
- # active plans are included)
66
+ # active plans are included). This is a Plans (deprecated) endpoint. New clients
67
+ # should implement using Contracts.
64
68
  sig do
65
69
  params(
66
70
  plan_id: String,
@@ -0,0 +1,63 @@
1
+ # typed: strong
2
+
3
+ module MetronomeSDK
4
+ module Resources
5
+ class V1
6
+ class Settings
7
+ class BillingProviders
8
+ # Set up account-level configuration for a billing provider. Once configured,
9
+ # individual contracts across customers can be mapped to this configuration using
10
+ # the returned delivery_method_id.
11
+ sig do
12
+ params(
13
+ billing_provider:
14
+ MetronomeSDK::V1::Settings::BillingProviderCreateParams::BillingProvider::OrSymbol,
15
+ configuration: T::Hash[Symbol, T.anything],
16
+ delivery_method:
17
+ MetronomeSDK::V1::Settings::BillingProviderCreateParams::DeliveryMethod::OrSymbol,
18
+ request_options: MetronomeSDK::RequestOptions::OrHash
19
+ ).returns(
20
+ MetronomeSDK::Models::V1::Settings::BillingProviderCreateResponse
21
+ )
22
+ end
23
+ def create(
24
+ # The billing provider set for this configuration.
25
+ billing_provider:,
26
+ # Account-level configuration for the billing provider. The structure of this
27
+ # object is specific to the billing provider and delivery provider combination.
28
+ # See examples below.
29
+ configuration:,
30
+ # The method to use for delivering invoices for this configuration.
31
+ delivery_method:,
32
+ request_options: {}
33
+ )
34
+ end
35
+
36
+ # Lists all configured billing providers and their delivery method configurations
37
+ # for your account. Returns provider details, delivery method IDs, and
38
+ # configuration settings needed for mapping individual customer contracts to
39
+ # billing integrations.
40
+ sig do
41
+ params(
42
+ next_page: T.nilable(String),
43
+ request_options: MetronomeSDK::RequestOptions::OrHash
44
+ ).returns(
45
+ MetronomeSDK::Models::V1::Settings::BillingProviderListResponse
46
+ )
47
+ end
48
+ def list(
49
+ # The cursor to the next page of results
50
+ next_page: nil,
51
+ request_options: {}
52
+ )
53
+ end
54
+
55
+ # @api private
56
+ sig { params(client: MetronomeSDK::Client).returns(T.attached_class) }
57
+ def self.new(client:)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,47 @@
1
+ # typed: strong
2
+
3
+ module MetronomeSDK
4
+ module Resources
5
+ class V1
6
+ class Settings
7
+ sig { returns(MetronomeSDK::Resources::V1::Settings::BillingProviders) }
8
+ attr_reader :billing_providers
9
+
10
+ # Set the Avalara credentials for some specified `delivery_method_ids`, which can
11
+ # be found in the `/listConfiguredBillingProviders` response. This maps the
12
+ # Avalara credentials to the appropriate billing entity. These credentials are
13
+ # only used for PLG Invoicing today.
14
+ sig do
15
+ params(
16
+ avalara_environment:
17
+ MetronomeSDK::V1::SettingUpsertAvalaraCredentialsParams::AvalaraEnvironment::OrSymbol,
18
+ avalara_password: String,
19
+ avalara_username: String,
20
+ delivery_method_ids: T::Array[String],
21
+ request_options: MetronomeSDK::RequestOptions::OrHash
22
+ ).returns(
23
+ MetronomeSDK::Models::V1::SettingUpsertAvalaraCredentialsResponse
24
+ )
25
+ end
26
+ def upsert_avalara_credentials(
27
+ # The Avalara environment to use (SANDBOX or PRODUCTION).
28
+ avalara_environment:,
29
+ # The password for the Avalara account.
30
+ avalara_password:,
31
+ # The username for the Avalara account.
32
+ avalara_username:,
33
+ # The delivery method IDs of the billing provider configurations to update, can be
34
+ # found in the response of the `/listConfiguredBillingProviders` endpoint.
35
+ delivery_method_ids:,
36
+ request_options: {}
37
+ )
38
+ end
39
+
40
+ # @api private
41
+ sig { params(client: MetronomeSDK::Client).returns(T.attached_class) }
42
+ def self.new(client:)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -84,8 +84,7 @@ module MetronomeSDK
84
84
  # ingestion, supports backdating 34 days, and is built to handle mission-critical
85
85
  # usage data with enterprise-grade reliability. Metronome supports 100,000 events
86
86
  # per second without requiring pre-aggregation or rollups and can scale up from
87
- # there. See
88
- # [Getting usage into Metronome](https://docs.metronome.com/connect-metronome/) to
87
+ # there. See the [Send usage events](/guides/events/send-usage-events) guide to
89
88
  # learn more about usage events.
90
89
  #
91
90
  # ### Use this endpoint to:
@@ -128,6 +127,9 @@ module MetronomeSDK
128
127
  # }
129
128
  # ```
130
129
  #
130
+ # Learn more about
131
+ # [usage event structure definitions](/guides/events/design-usage-events).
132
+ #
131
133
  # #### Transaction ID
132
134
  #
133
135
  # The transaction_id serves as your idempotency key, ensuring events are processed
@@ -42,6 +42,12 @@ module MetronomeSDK
42
42
  sig { returns(MetronomeSDK::Resources::V1::Contracts) }
43
43
  attr_reader :contracts
44
44
 
45
+ sig { returns(MetronomeSDK::Resources::V1::Payments) }
46
+ attr_reader :payments
47
+
48
+ sig { returns(MetronomeSDK::Resources::V1::Settings) }
49
+ attr_reader :settings
50
+
45
51
  # @api private
46
52
  sig { params(client: MetronomeSDK::Client).returns(T.attached_class) }
47
53
  def self.new(client:)
@@ -119,6 +119,8 @@ module MetronomeSDK
119
119
  params(
120
120
  contract_id: String,
121
121
  customer_id: String,
122
+ add_billing_provider_configuration_update:
123
+ MetronomeSDK::V2::ContractEditParams::AddBillingProviderConfigurationUpdate::OrHash,
122
124
  add_commits:
123
125
  T::Array[MetronomeSDK::V2::ContractEditParams::AddCommit::OrHash],
124
126
  add_credits:
@@ -215,6 +217,10 @@ module MetronomeSDK
215
217
  contract_id:,
216
218
  # ID of the customer whose contract is being edited
217
219
  customer_id:,
220
+ # Update the billing provider configuration on the contract. Currently only
221
+ # supports adding a billing provider configuration to a contract that does not
222
+ # already have one.
223
+ add_billing_provider_configuration_update: nil,
218
224
  add_commits: nil,
219
225
  add_credits: nil,
220
226
  add_discounts: nil,
@@ -294,6 +300,8 @@ module MetronomeSDK
294
300
  MetronomeSDK::V2::ContractEditCommitParams::AccessSchedule::OrHash,
295
301
  applicable_product_ids: T.nilable(T::Array[String]),
296
302
  applicable_product_tags: T.nilable(T::Array[String]),
303
+ hierarchy_configuration:
304
+ MetronomeSDK::CommitHierarchyConfiguration::OrHash,
297
305
  invoice_contract_id: String,
298
306
  invoice_schedule:
299
307
  MetronomeSDK::V2::ContractEditCommitParams::InvoiceSchedule::OrHash,
@@ -320,6 +328,8 @@ module MetronomeSDK
320
328
  # applicable_product_tags or specifiers are not provided, the commit applies to
321
329
  # all products.
322
330
  applicable_product_tags: nil,
331
+ # Optional configuration for commit hierarchy access control
332
+ hierarchy_configuration: nil,
323
333
  # ID of contract to use for invoicing
324
334
  invoice_contract_id: nil,
325
335
  invoice_schedule: nil,
@@ -366,6 +376,8 @@ module MetronomeSDK
366
376
  MetronomeSDK::V2::ContractEditCreditParams::AccessSchedule::OrHash,
367
377
  applicable_product_ids: T.nilable(T::Array[String]),
368
378
  applicable_product_tags: T.nilable(T::Array[String]),
379
+ hierarchy_configuration:
380
+ MetronomeSDK::CommitHierarchyConfiguration::OrHash,
369
381
  priority: T.nilable(Float),
370
382
  product_id: String,
371
383
  rate_type:
@@ -387,6 +399,8 @@ module MetronomeSDK
387
399
  # Which tags the credit applies to. If both applicable_product_ids and
388
400
  # applicable_product_tags are not provided, the credit applies to all products.
389
401
  applicable_product_tags: nil,
402
+ # Optional configuration for credit hierarchy access control
403
+ hierarchy_configuration: nil,
390
404
  # If multiple commits are applicable, the one with the lower priority will apply
391
405
  # first.
392
406
  priority: nil,
@@ -21,11 +21,14 @@ module MetronomeSDK
21
21
 
22
22
  attr_accessor status: Integer?
23
23
 
24
+ attr_accessor headers: ::Hash[String, String]?
25
+
24
26
  attr_accessor body: top?
25
27
 
26
28
  def initialize: (
27
29
  url: URI::Generic,
28
30
  ?status: Integer?,
31
+ ?headers: ::Hash[String, String]?,
29
32
  ?body: Object?,
30
33
  ?request: nil,
31
34
  ?response: nil,
@@ -37,6 +40,7 @@ module MetronomeSDK
37
40
  def initialize: (
38
41
  url: URI::Generic,
39
42
  ?status: nil,
43
+ ?headers: ::Hash[String, String]?,
40
44
  ?body: nil,
41
45
  ?request: nil,
42
46
  ?response: nil,
@@ -48,6 +52,7 @@ module MetronomeSDK
48
52
  def initialize: (
49
53
  url: URI::Generic,
50
54
  ?status: nil,
55
+ ?headers: ::Hash[String, String]?,
51
56
  ?body: nil,
52
57
  ?request: nil,
53
58
  ?response: nil,
@@ -59,6 +64,7 @@ module MetronomeSDK
59
64
  def self.for: (
60
65
  url: URI::Generic,
61
66
  status: Integer,
67
+ headers: ::Hash[String, String]?,
62
68
  body: Object?,
63
69
  request: nil,
64
70
  response: nil,
@@ -68,6 +74,7 @@ module MetronomeSDK
68
74
  def initialize: (
69
75
  url: URI::Generic,
70
76
  status: Integer,
77
+ headers: ::Hash[String, String]?,
71
78
  body: Object?,
72
79
  request: nil,
73
80
  response: nil,
@@ -14,7 +14,7 @@ module MetronomeSDK
14
14
 
15
15
  def initialize: (
16
16
  Pathname | StringIO | IO | String content,
17
- ?filename: String?,
17
+ ?filename: (Pathname | String)?,
18
18
  ?content_type: String?
19
19
  ) -> void
20
20
  end
@@ -353,6 +353,7 @@ module MetronomeSDK
353
353
  | :quickbooks_online
354
354
  | :workday
355
355
  | :gcp_marketplace
356
+ | :metronome
356
357
 
357
358
  module BillingProvider
358
359
  extend MetronomeSDK::Internal::Type::Enum
@@ -365,6 +366,7 @@ module MetronomeSDK
365
366
  QUICKBOOKS_ONLINE: :quickbooks_online
366
367
  WORKDAY: :workday
367
368
  GCP_MARKETPLACE: :gcp_marketplace
369
+ METRONOME: :metronome
368
370
 
369
371
  def self?.values: -> ::Array[MetronomeSDK::Models::Contract::CustomerBillingProviderConfiguration::billing_provider]
370
372
  end