metronome-sdk 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/README.md +1 -1
  4. data/lib/metronome_sdk/internal/util.rb +32 -1
  5. data/lib/metronome_sdk/models/commit_rate.rb +29 -3
  6. data/lib/metronome_sdk/models/contract.rb +1 -9
  7. data/lib/metronome_sdk/models/contract_v2.rb +22 -1
  8. data/lib/metronome_sdk/models/overwrite_rate.rb +22 -1
  9. data/lib/metronome_sdk/models/payment_gate_config.rb +0 -1
  10. data/lib/metronome_sdk/models/payment_gate_config_v2.rb +0 -1
  11. data/lib/metronome_sdk/models/rate.rb +22 -1
  12. data/lib/metronome_sdk/models/v1/contract_amend_params.rb +23 -2
  13. data/lib/metronome_sdk/models/v1/contract_create_params.rb +24 -11
  14. data/lib/metronome_sdk/models/v1/contracts/rate_cards/rate_add_many_params.rb +23 -1
  15. data/lib/metronome_sdk/models/v1/contracts/rate_cards/rate_add_params.rb +21 -1
  16. data/lib/metronome_sdk/models/v1/customers/invoice.rb +10 -1
  17. data/lib/metronome_sdk/models/v1/package_archive_params.rb +24 -0
  18. data/lib/metronome_sdk/models/v1/package_archive_response.rb +18 -0
  19. data/lib/metronome_sdk/models/v1/package_create_params.rb +2719 -0
  20. data/lib/metronome_sdk/models/v1/package_create_response.rb +18 -0
  21. data/lib/metronome_sdk/models/v1/package_list_contracts_on_package_params.rb +69 -0
  22. data/lib/metronome_sdk/models/v1/package_list_contracts_on_package_response.rb +42 -0
  23. data/lib/metronome_sdk/models/v1/package_list_params.rb +52 -0
  24. data/lib/metronome_sdk/models/v1/package_list_response.rb +2446 -0
  25. data/lib/metronome_sdk/models/v1/package_retrieve_params.rb +22 -0
  26. data/lib/metronome_sdk/models/v1/package_retrieve_response.rb +2479 -0
  27. data/lib/metronome_sdk/models/v1/usage_list_with_groups_params.rb +39 -2
  28. data/lib/metronome_sdk/models/v1/usage_list_with_groups_response.rb +27 -3
  29. data/lib/metronome_sdk/models/v2/contract_edit_params.rb +23 -2
  30. data/lib/metronome_sdk/models/v2/contract_get_edit_history_response.rb +23 -1
  31. data/lib/metronome_sdk/resources/v1/alerts.rb +5 -0
  32. data/lib/metronome_sdk/resources/v1/audit_logs.rb +4 -1
  33. data/lib/metronome_sdk/resources/v1/billable_metrics.rb +5 -1
  34. data/lib/metronome_sdk/resources/v1/contracts/named_schedules.rb +2 -0
  35. data/lib/metronome_sdk/resources/v1/contracts/products.rb +4 -2
  36. data/lib/metronome_sdk/resources/v1/contracts/rate_cards/named_schedules.rb +2 -0
  37. data/lib/metronome_sdk/resources/v1/contracts/rate_cards/product_orders.rb +1 -0
  38. data/lib/metronome_sdk/resources/v1/contracts/rate_cards/rates.rb +7 -3
  39. data/lib/metronome_sdk/resources/v1/contracts/rate_cards.rb +10 -3
  40. data/lib/metronome_sdk/resources/v1/contracts.rb +8 -5
  41. data/lib/metronome_sdk/resources/v1/credit_grants.rb +9 -4
  42. data/lib/metronome_sdk/resources/v1/custom_fields.rb +6 -2
  43. data/lib/metronome_sdk/resources/v1/customers/alerts.rb +8 -2
  44. data/lib/metronome_sdk/resources/v1/customers/billing_config.rb +4 -0
  45. data/lib/metronome_sdk/resources/v1/customers/commits.rb +1 -0
  46. data/lib/metronome_sdk/resources/v1/customers/credits.rb +1 -0
  47. data/lib/metronome_sdk/resources/v1/customers/invoices.rb +10 -3
  48. data/lib/metronome_sdk/resources/v1/customers/named_schedules.rb +2 -0
  49. data/lib/metronome_sdk/resources/v1/customers/plans.rb +8 -2
  50. data/lib/metronome_sdk/resources/v1/customers.rb +27 -3
  51. data/lib/metronome_sdk/resources/v1/dashboards.rb +4 -0
  52. data/lib/metronome_sdk/resources/v1/invoices.rb +4 -0
  53. data/lib/metronome_sdk/resources/v1/packages.rb +269 -0
  54. data/lib/metronome_sdk/resources/v1/plans.rb +10 -3
  55. data/lib/metronome_sdk/resources/v1/pricing_units.rb +4 -1
  56. data/lib/metronome_sdk/resources/v1/services.rb +2 -0
  57. data/lib/metronome_sdk/resources/v1/settings/billing_providers.rb +2 -0
  58. data/lib/metronome_sdk/resources/v1/settings.rb +4 -0
  59. data/lib/metronome_sdk/resources/v1/usage.rb +26 -13
  60. data/lib/metronome_sdk/resources/v1.rb +41 -0
  61. data/lib/metronome_sdk/version.rb +1 -1
  62. data/lib/metronome_sdk.rb +11 -0
  63. data/rbi/metronome_sdk/internal/util.rbi +21 -1
  64. data/rbi/metronome_sdk/models/commit_rate.rbi +43 -2
  65. data/rbi/metronome_sdk/models/contract.rbi +0 -11
  66. data/rbi/metronome_sdk/models/contract_v2.rbi +46 -0
  67. data/rbi/metronome_sdk/models/overwrite_rate.rbi +37 -0
  68. data/rbi/metronome_sdk/models/payment_gate_config.rbi +0 -5
  69. data/rbi/metronome_sdk/models/payment_gate_config_v2.rbi +0 -5
  70. data/rbi/metronome_sdk/models/rate.rbi +35 -0
  71. data/rbi/metronome_sdk/models/v1/contract_amend_params.rbi +46 -5
  72. data/rbi/metronome_sdk/models/v1/contract_create_params.rbi +46 -16
  73. data/rbi/metronome_sdk/models/v1/contracts/rate_cards/rate_add_many_params.rbi +46 -0
  74. data/rbi/metronome_sdk/models/v1/contracts/rate_cards/rate_add_params.rbi +46 -0
  75. data/rbi/metronome_sdk/models/v1/customers/invoice.rbi +13 -0
  76. data/rbi/metronome_sdk/models/v1/package_archive_params.rbi +48 -0
  77. data/rbi/metronome_sdk/models/v1/package_archive_response.rbi +31 -0
  78. data/rbi/metronome_sdk/models/v1/package_create_params.rbi +6362 -0
  79. data/rbi/metronome_sdk/models/v1/package_create_response.rbi +31 -0
  80. data/rbi/metronome_sdk/models/v1/package_list_contracts_on_package_params.rbi +105 -0
  81. data/rbi/metronome_sdk/models/v1/package_list_contracts_on_package_response.rbi +70 -0
  82. data/rbi/metronome_sdk/models/v1/package_list_params.rbi +123 -0
  83. data/rbi/metronome_sdk/models/v1/package_list_response.rbi +5796 -0
  84. data/rbi/metronome_sdk/models/v1/package_retrieve_params.rbi +43 -0
  85. data/rbi/metronome_sdk/models/v1/package_retrieve_response.rbi +5864 -0
  86. data/rbi/metronome_sdk/models/v1/usage_list_with_groups_params.rbi +52 -0
  87. data/rbi/metronome_sdk/models/v1/usage_list_with_groups_response.rbi +24 -3
  88. data/rbi/metronome_sdk/models/v2/contract_edit_params.rbi +46 -5
  89. data/rbi/metronome_sdk/models/v2/contract_get_edit_history_response.rbi +46 -0
  90. data/rbi/metronome_sdk/resources/v1/alerts.rbi +5 -0
  91. data/rbi/metronome_sdk/resources/v1/audit_logs.rbi +2 -0
  92. data/rbi/metronome_sdk/resources/v1/billable_metrics.rbi +3 -0
  93. data/rbi/metronome_sdk/resources/v1/contracts/named_schedules.rbi +2 -0
  94. data/rbi/metronome_sdk/resources/v1/contracts/products.rbi +1 -0
  95. data/rbi/metronome_sdk/resources/v1/contracts/rate_cards/named_schedules.rbi +2 -0
  96. data/rbi/metronome_sdk/resources/v1/contracts/rate_cards/product_orders.rbi +1 -0
  97. data/rbi/metronome_sdk/resources/v1/contracts/rate_cards/rates.rbi +5 -0
  98. data/rbi/metronome_sdk/resources/v1/contracts/rate_cards.rbi +5 -0
  99. data/rbi/metronome_sdk/resources/v1/contracts.rbi +4 -3
  100. data/rbi/metronome_sdk/resources/v1/credit_grants.rbi +3 -0
  101. data/rbi/metronome_sdk/resources/v1/custom_fields.rbi +3 -0
  102. data/rbi/metronome_sdk/resources/v1/customers/alerts.rbi +5 -0
  103. data/rbi/metronome_sdk/resources/v1/customers/billing_config.rbi +4 -0
  104. data/rbi/metronome_sdk/resources/v1/customers/commits.rbi +1 -0
  105. data/rbi/metronome_sdk/resources/v1/customers/credits.rbi +1 -0
  106. data/rbi/metronome_sdk/resources/v1/customers/invoices.rbi +4 -0
  107. data/rbi/metronome_sdk/resources/v1/customers/named_schedules.rbi +2 -0
  108. data/rbi/metronome_sdk/resources/v1/customers/plans.rbi +4 -0
  109. data/rbi/metronome_sdk/resources/v1/customers.rbi +21 -0
  110. data/rbi/metronome_sdk/resources/v1/dashboards.rbi +4 -0
  111. data/rbi/metronome_sdk/resources/v1/invoices.rbi +4 -0
  112. data/rbi/metronome_sdk/resources/v1/packages.rbi +268 -0
  113. data/rbi/metronome_sdk/resources/v1/plans.rbi +4 -0
  114. data/rbi/metronome_sdk/resources/v1/pricing_units.rbi +2 -0
  115. data/rbi/metronome_sdk/resources/v1/services.rbi +2 -0
  116. data/rbi/metronome_sdk/resources/v1/settings/billing_providers.rbi +2 -0
  117. data/rbi/metronome_sdk/resources/v1/settings.rbi +4 -0
  118. data/rbi/metronome_sdk/resources/v1/usage.rbi +35 -8
  119. data/rbi/metronome_sdk/resources/v1.rbi +40 -0
  120. data/sig/metronome_sdk/internal/util.rbs +10 -0
  121. data/sig/metronome_sdk/models/commit_rate.rbs +19 -0
  122. data/sig/metronome_sdk/models/contract.rbs +0 -7
  123. data/sig/metronome_sdk/models/contract_v2.rbs +19 -0
  124. data/sig/metronome_sdk/models/overwrite_rate.rbs +19 -0
  125. data/sig/metronome_sdk/models/payment_gate_config.rbs +1 -2
  126. data/sig/metronome_sdk/models/payment_gate_config_v2.rbs +1 -2
  127. data/sig/metronome_sdk/models/rate.rbs +19 -0
  128. data/sig/metronome_sdk/models/v1/contract_amend_params.rbs +20 -2
  129. data/sig/metronome_sdk/models/v1/contract_create_params.rbs +20 -9
  130. data/sig/metronome_sdk/models/v1/contracts/rate_cards/rate_add_many_params.rbs +19 -0
  131. data/sig/metronome_sdk/models/v1/contracts/rate_cards/rate_add_params.rbs +19 -0
  132. data/sig/metronome_sdk/models/v1/customers/invoice.rbs +7 -0
  133. data/sig/metronome_sdk/models/v1/package_archive_params.rbs +26 -0
  134. data/sig/metronome_sdk/models/v1/package_archive_response.rbs +15 -0
  135. data/sig/metronome_sdk/models/v1/package_create_params.rbs +2532 -0
  136. data/sig/metronome_sdk/models/v1/package_create_response.rbs +15 -0
  137. data/sig/metronome_sdk/models/v1/package_list_contracts_on_package_params.rbs +63 -0
  138. data/sig/metronome_sdk/models/v1/package_list_contracts_on_package_response.rbs +46 -0
  139. data/sig/metronome_sdk/models/v1/package_list_params.rbs +58 -0
  140. data/sig/metronome_sdk/models/v1/package_list_response.rbs +2441 -0
  141. data/sig/metronome_sdk/models/v1/package_retrieve_params.rbs +26 -0
  142. data/sig/metronome_sdk/models/v1/package_retrieve_response.rbs +2467 -0
  143. data/sig/metronome_sdk/models/v1/usage_list_with_groups_params.rbs +16 -0
  144. data/sig/metronome_sdk/models/v1/usage_list_with_groups_response.rbs +10 -3
  145. data/sig/metronome_sdk/models/v2/contract_edit_params.rbs +20 -2
  146. data/sig/metronome_sdk/models/v2/contract_get_edit_history_response.rbs +19 -0
  147. data/sig/metronome_sdk/resources/v1/contracts/rate_cards/rates.rbs +1 -0
  148. data/sig/metronome_sdk/resources/v1/contracts.rbs +0 -1
  149. data/sig/metronome_sdk/resources/v1/packages.rbs +63 -0
  150. data/sig/metronome_sdk/resources/v1/usage.rbs +2 -0
  151. data/sig/metronome_sdk/resources/v1.rbs +2 -0
  152. metadata +35 -2
@@ -0,0 +1,268 @@
1
+ # typed: strong
2
+
3
+ module MetronomeSDK
4
+ module Resources
5
+ class V1
6
+ class Packages
7
+ # Create a package that defines a set of reusable, time-relative contract terms
8
+ # that can be used across cohorts of customers. Packages provide an abstraction
9
+ # layer on top of rate cards to provide an easy way to provision customers with
10
+ # standard pricing.
11
+ #
12
+ # ### **Use this endpoint to:**
13
+ #
14
+ # - Model standard pay-as-you-go pricing packages that can be easily reused across
15
+ # customers
16
+ # - Define standardized contract terms and discounting for sales-led motions
17
+ # - Set aliases for the package to facilitate easy package transition. Aliases are
18
+ # human-readable names that you can use in the place of the id of the package
19
+ # when provisioning a customer’s contract. By using an alias, you can easily
20
+ # create a contract and provision a customer by choosing the “Starter Plan”
21
+ # package, without storing the package ID in your internal systems. This is
22
+ # helpful when launching terms for a package, as you can create a new package
23
+ # with the “Starter Plan” alias scheduled to be assigned without updating your
24
+ # provisioning code.
25
+ #
26
+ # ### Key input fields:
27
+ #
28
+ # - `starting_at_offset`: Starting date relative to contract start. Generates the
29
+ # `starting_at` date when a contract is provisioned using a package.
30
+ # - `duration`: Duration starting from `starting_at_offset`. Generates the
31
+ # `ending_before` date when a contract is provisioned using a package.
32
+ # - `date_offset`: Date relative to contract start. Used for point-in-time dates
33
+ # without a duration.
34
+ # - `aliases`: Human-readable name to use when provisioning contracts with a
35
+ # package.
36
+ #
37
+ # ### Usage guidelines:
38
+ #
39
+ # - Use packages for standard self-serve use cases where customers have consistent
40
+ # terms. For customers with negotiated custom contract terms, use the
41
+ # `createContract` endpoint for maximum flexibility.
42
+ # - Billing provider configuration can be set when creating a package by using
43
+ # `billing_provider` and `delivery_method`. To provision a customer successfully
44
+ # with a package, the customer must have one and only one billing provider
45
+ # configuration that matches the billing provider configuration set on the
46
+ # package.
47
+ # - A package alias can only be used by one package at a time. If you create a new
48
+ # package with an alias that is already in use by another package, the original
49
+ # package’s alias schedule will be updated. The alias will reference the package
50
+ # to which it was most recently assigned.
51
+ # - Terms can only be specified using times relative to the contract start date.
52
+ # Supported granularities are: `days`, `weeks`, `months`, `years`
53
+ # - Packages cannot be edited once created. Use the rate card to easily add new
54
+ # rates across all of your customers or make direct edits to a contract after
55
+ # provisioning with a package. Edited contracts will still be associated with
56
+ # the package used during provisioning.
57
+ sig do
58
+ params(
59
+ name: String,
60
+ aliases:
61
+ T::Array[MetronomeSDK::V1::PackageCreateParams::Alias::OrHash],
62
+ billing_anchor_date:
63
+ MetronomeSDK::V1::PackageCreateParams::BillingAnchorDate::OrSymbol,
64
+ billing_provider:
65
+ MetronomeSDK::V1::PackageCreateParams::BillingProvider::OrSymbol,
66
+ commits:
67
+ T::Array[MetronomeSDK::V1::PackageCreateParams::Commit::OrHash],
68
+ contract_name: String,
69
+ credits:
70
+ T::Array[MetronomeSDK::V1::PackageCreateParams::Credit::OrHash],
71
+ delivery_method:
72
+ MetronomeSDK::V1::PackageCreateParams::DeliveryMethod::OrSymbol,
73
+ duration: MetronomeSDK::V1::PackageCreateParams::Duration::OrHash,
74
+ multiplier_override_prioritization:
75
+ MetronomeSDK::V1::PackageCreateParams::MultiplierOverridePrioritization::OrSymbol,
76
+ net_payment_terms_days: Float,
77
+ overrides:
78
+ T::Array[MetronomeSDK::V1::PackageCreateParams::Override::OrHash],
79
+ prepaid_balance_threshold_configuration:
80
+ MetronomeSDK::PrepaidBalanceThresholdConfiguration::OrHash,
81
+ rate_card_alias: String,
82
+ rate_card_id: String,
83
+ recurring_commits:
84
+ T::Array[
85
+ MetronomeSDK::V1::PackageCreateParams::RecurringCommit::OrHash
86
+ ],
87
+ recurring_credits:
88
+ T::Array[
89
+ MetronomeSDK::V1::PackageCreateParams::RecurringCredit::OrHash
90
+ ],
91
+ scheduled_charges:
92
+ T::Array[
93
+ MetronomeSDK::V1::PackageCreateParams::ScheduledCharge::OrHash
94
+ ],
95
+ scheduled_charges_on_usage_invoices:
96
+ MetronomeSDK::V1::PackageCreateParams::ScheduledChargesOnUsageInvoices::OrSymbol,
97
+ spend_threshold_configuration:
98
+ MetronomeSDK::SpendThresholdConfiguration::OrHash,
99
+ subscriptions:
100
+ T::Array[
101
+ MetronomeSDK::V1::PackageCreateParams::Subscription::OrHash
102
+ ],
103
+ uniqueness_key: String,
104
+ usage_statement_schedule:
105
+ MetronomeSDK::V1::PackageCreateParams::UsageStatementSchedule::OrHash,
106
+ request_options: MetronomeSDK::RequestOptions::OrHash
107
+ ).returns(MetronomeSDK::Models::V1::PackageCreateResponse)
108
+ end
109
+ def create(
110
+ name:,
111
+ # Reference this alias when creating a contract. If the same alias is assigned to
112
+ # multiple packages, it will reference the package to which it was most recently
113
+ # assigned. It is not exposed to end customers.
114
+ aliases: nil,
115
+ billing_anchor_date: nil,
116
+ billing_provider: nil,
117
+ commits: nil,
118
+ contract_name: nil,
119
+ credits: nil,
120
+ delivery_method: nil,
121
+ duration: nil,
122
+ # Defaults to LOWEST_MULTIPLIER, which applies the greatest discount to list
123
+ # prices automatically. EXPLICIT prioritization requires specifying priorities for
124
+ # each multiplier; the one with the lowest priority value will be prioritized
125
+ # first. If tiered overrides are used, prioritization must be explicit.
126
+ multiplier_override_prioritization: nil,
127
+ net_payment_terms_days: nil,
128
+ overrides: nil,
129
+ prepaid_balance_threshold_configuration: nil,
130
+ # Selects the rate card linked to the specified alias as of the contract's start
131
+ # date.
132
+ rate_card_alias: nil,
133
+ rate_card_id: nil,
134
+ recurring_commits: nil,
135
+ recurring_credits: nil,
136
+ scheduled_charges: nil,
137
+ # Determines which scheduled and commit charges to consolidate onto the Contract's
138
+ # usage invoice. The charge's `timestamp` must match the usage invoice's
139
+ # `ending_before` date for consolidation to occur. This field cannot be modified
140
+ # after a Contract has been created. If this field is omitted, charges will appear
141
+ # on a separate invoice from usage charges.
142
+ scheduled_charges_on_usage_invoices: nil,
143
+ spend_threshold_configuration: nil,
144
+ subscriptions: nil,
145
+ # Prevents the creation of duplicates. If a request to create a record is made
146
+ # with a previously used uniqueness key, a new record will not be created and the
147
+ # request will fail with a 409 error.
148
+ uniqueness_key: nil,
149
+ usage_statement_schedule: nil,
150
+ request_options: {}
151
+ )
152
+ end
153
+
154
+ # Gets the details for a specific package, including name, aliases, duration, and
155
+ # terms. Use this endpoint to understand a package’s alias schedule, or display a
156
+ # specific package’s details to end customers.
157
+ sig do
158
+ params(
159
+ package_id: String,
160
+ request_options: MetronomeSDK::RequestOptions::OrHash
161
+ ).returns(MetronomeSDK::Models::V1::PackageRetrieveResponse)
162
+ end
163
+ def retrieve(package_id:, request_options: {})
164
+ end
165
+
166
+ # Lists all packages with details including name, aliases, duration, and terms. To
167
+ # view contracts on a specific package, use the `listContractsOnPackage` endpoint.
168
+ sig do
169
+ params(
170
+ limit: Integer,
171
+ next_page: String,
172
+ archive_filter:
173
+ MetronomeSDK::V1::PackageListParams::ArchiveFilter::OrSymbol,
174
+ request_options: MetronomeSDK::RequestOptions::OrHash
175
+ ).returns(
176
+ MetronomeSDK::Internal::CursorPage[
177
+ MetronomeSDK::Models::V1::PackageListResponse
178
+ ]
179
+ )
180
+ end
181
+ def list(
182
+ # Query param: The maximum number of packages to return. Defaults to 10.
183
+ limit: nil,
184
+ # Query param: Cursor that indicates where the next page of results should start.
185
+ next_page: nil,
186
+ # Body param: Filter packages by archived status. Defaults to NOT_ARCHIVED.
187
+ archive_filter: nil,
188
+ request_options: {}
189
+ )
190
+ end
191
+
192
+ # Archive a package. Archived packages cannot be used to create new contracts.
193
+ # However, existing contracts associated with the package will continue to
194
+ # function as normal. Once you archive a package, you can still retrieve it in the
195
+ # UI and API, but you cannot unarchive it.
196
+ sig do
197
+ params(
198
+ package_id: String,
199
+ request_options: MetronomeSDK::RequestOptions::OrHash
200
+ ).returns(MetronomeSDK::Models::V1::PackageArchiveResponse)
201
+ end
202
+ def archive(
203
+ # ID of the package to archive
204
+ package_id:,
205
+ request_options: {}
206
+ )
207
+ end
208
+
209
+ # For a given package, returns all contract IDs and customer IDs associated with
210
+ # the package over a specific time period.
211
+ #
212
+ # ### Use this endpoint to:
213
+ #
214
+ # - Understand which customers are provisioned on a package at any given time for
215
+ # internal cohort management
216
+ # - Manage customer migrations to a new package. For example, to migrate all
217
+ # active customers to a new package, call this endpoint, end contracts, and
218
+ # provision customers on a new package.
219
+ #
220
+ # ### **Usage guidelines:**
221
+ #
222
+ # Use the **`starting_at`**, **`covering_date`**,
223
+ # and **`include_archived`** parameters to filter the list of returned contracts.
224
+ # For example, to list only currently active contracts,
225
+ # pass **`covering_date`** equal to the current time.
226
+ sig do
227
+ params(
228
+ package_id: String,
229
+ limit: Integer,
230
+ next_page: String,
231
+ covering_date: Time,
232
+ include_archived: T::Boolean,
233
+ starting_at: Time,
234
+ request_options: MetronomeSDK::RequestOptions::OrHash
235
+ ).returns(
236
+ MetronomeSDK::Internal::CursorPage[
237
+ MetronomeSDK::Models::V1::PackageListContractsOnPackageResponse
238
+ ]
239
+ )
240
+ end
241
+ def list_contracts_on_package(
242
+ # Body param
243
+ package_id:,
244
+ # Query param: Max number of results that should be returned
245
+ limit: nil,
246
+ # Query param: Cursor that indicates where the next page of results should start.
247
+ next_page: nil,
248
+ # Body param: Optional RFC 3339 timestamp. Only include contracts active on the
249
+ # provided date. This cannot be provided if starting_at filter is provided.
250
+ covering_date: nil,
251
+ # Body param: Default false. Determines whether to include archived contracts in
252
+ # the results
253
+ include_archived: nil,
254
+ # Body param: Optional RFC 3339 timestamp. Only include contracts that started on
255
+ # or after this date. This cannot be provided if covering_date filter is provided.
256
+ starting_at: nil,
257
+ request_options: {}
258
+ )
259
+ end
260
+
261
+ # @api private
262
+ sig { params(client: MetronomeSDK::Client).returns(T.attached_class) }
263
+ def self.new(client:)
264
+ end
265
+ end
266
+ end
267
+ end
268
+ end
@@ -3,6 +3,10 @@
3
3
  module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
+ # [Plans](https://docs.metronome.com/pricing-and-packaging/create-plans/)
7
+ # determine the base pricing for a customer. Use these endpoints to add a plan to
8
+ # a customer, end a customer plan, retrieve plans, and retrieve plan details.
9
+ # Create plans in the [Metronome app](https://app.metronome.com/plans).
6
10
  class Plans
7
11
  # List all available plans. This is a Plans (deprecated) endpoint. New clients
8
12
  # should implement using Contracts.
@@ -3,6 +3,8 @@
3
3
  module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
+ # Use these endpoints to configure a billing API key, a webhook secret, or invoice
7
+ # finalization behavior.
6
8
  class PricingUnits
7
9
  # List all pricing units. All fiat currency types (for example, USD or GBP) will
8
10
  # be included, as well as any custom pricing units that were configured. Custom
@@ -3,6 +3,8 @@
3
3
  module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
+ # [Security](https://docs.metronome.com/developer-resources/security/) endpoints
7
+ # allow you to retrieve security-related data.
6
8
  class Services
7
9
  # Gets Metronome's service registry with associated IP addresses for security
8
10
  # allowlisting and firewall configuration. Use this endpoint to maintain an
@@ -4,6 +4,8 @@ module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
6
  class Settings
7
+ # Use these endpoints to configure a billing API key, a webhook secret, or invoice
8
+ # finalization behavior.
7
9
  class BillingProviders
8
10
  # Set up account-level configuration for a billing provider. Once configured,
9
11
  # individual contracts across customers can be mapped to this configuration using
@@ -3,7 +3,11 @@
3
3
  module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
+ # Use these endpoints to configure a billing API key, a webhook secret, or invoice
7
+ # finalization behavior.
6
8
  class Settings
9
+ # Use these endpoints to configure a billing API key, a webhook secret, or invoice
10
+ # finalization behavior.
7
11
  sig { returns(MetronomeSDK::Resources::V1::Settings::BillingProviders) }
8
12
  attr_reader :billing_providers
9
13
 
@@ -3,6 +3,9 @@
3
3
  module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
+ # [Usage events](https://docs.metronome.com/connecting-metronome/send-usage-data/)
7
+ # are the basis for billable metrics. Use these endpoints to send usage events to
8
+ # Metronome and retrieve aggregated event data.
6
9
  class Usage
7
10
  # Retrieve aggregated usage data across multiple customers and billable metrics in
8
11
  # a single query. This batch endpoint enables you to fetch usage patterns at
@@ -190,8 +193,11 @@ module MetronomeSDK
190
193
  # An array of `PagedUsageAggregate` objects containing:
191
194
  #
192
195
  # - `starting_on` and `ending_before`: Time window boundaries
193
- # - `group_key`: The dimension being grouped by (e.g., "region")
194
- # - `group_value`: The specific value for this group (e.g., "US-East")
196
+ # - `group`: Object mapping group keys to their values
197
+ # - For simple groups, this will be a map with a single key-value pair (e.g.,
198
+ # `{"region": "US-East"}`)
199
+ # - For compound groups, this will be a map with multiple key-value pairs (e.g.,
200
+ # `{"region": "US-East", "team": "engineering"}`)
195
201
  # - `value`: Aggregated usage for this group and time window
196
202
  # - `next_page`: Pagination cursor for large datasets
197
203
  #
@@ -201,12 +207,13 @@ module MetronomeSDK
201
207
  # `window_size`
202
208
  # - Time windows: Set `window_size` to hour, day, or none for different
203
209
  # granularities
204
- # - Group filtering: Use `group_by` to specify:
205
- # - key: The dimension to group by (must be set on the billable metric as a
206
- # group key)
207
- # - values: Optional array to filter to specific values only
210
+ # - Group filtering: Use `group_key` and `group_filters` to specify groups and
211
+ # group filters
212
+ # - Limits: When using compound group keys (2+ keys in `group_key`), the default
213
+ # and max limit is 100
208
214
  # - Pagination: Use limit and `next_page` for large result sets
209
- # - Null handling: `group_value` may be null for unmatched data
215
+ # - Null handling: Group values may be null for events missing the group key
216
+ # property
210
217
  sig do
211
218
  params(
212
219
  billable_metric_id: String,
@@ -219,6 +226,8 @@ module MetronomeSDK
219
226
  ending_before: Time,
220
227
  group_by:
221
228
  MetronomeSDK::V1::UsageListWithGroupsParams::GroupBy::OrHash,
229
+ group_filters: T::Hash[Symbol, T::Array[String]],
230
+ group_key: T::Array[String],
222
231
  starting_on: Time,
223
232
  request_options: MetronomeSDK::RequestOptions::OrHash
224
233
  ).returns(
@@ -247,8 +256,26 @@ module MetronomeSDK
247
256
  current_period: nil,
248
257
  # Body param
249
258
  ending_before: nil,
250
- # Body param
259
+ # Body param: Use group_key and group_filters instead. Use a single group key to
260
+ # group by. Compound group keys are not supported.
251
261
  group_by: nil,
262
+ # Body param: Object mapping group keys to arrays of values to filter on. Only
263
+ # usage matching these filter values will be returned. Keys must be present in
264
+ # group_key. Omit a key or use an empty array to include all values for that
265
+ # dimension.
266
+ group_filters: nil,
267
+ # Body param: Group key to group usage by. Supports both simple (single key) and
268
+ # compound (multiple keys) group keys.
269
+ #
270
+ # For simple group keys, provide a single key e.g. `["region"]`. For compound
271
+ # group keys, provide multiple keys e.g. `["region", "team"]`.
272
+ #
273
+ # For streaming metrics, the keys must be defined as a simple or compound group
274
+ # key on the billable metric. For compound group keys, all keys must match an
275
+ # exact compound group key definition — partial matches are not allowed.
276
+ #
277
+ # Cannot be used together with `group_by`.
278
+ group_key: nil,
252
279
  # Body param
253
280
  starting_on: nil,
254
281
  request_options: {}
@@ -3,48 +3,88 @@
3
3
  module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
+ # [Alerts](https://docs.metronome.com/connecting-metronome/alerts/) monitor
7
+ # customer spending, balances, and other billing factors. Use these endpoints to
8
+ # create, retrieve, and archive customer alerts. To view sample alert payloads by
9
+ # alert type, navigate
10
+ # [here.](https://docs.metronome.com/manage-product-access/create-manage-alerts/#webhook-notifications)
6
11
  sig { returns(MetronomeSDK::Resources::V1::Alerts) }
7
12
  attr_reader :alerts
8
13
 
14
+ # [Plans](https://docs.metronome.com/pricing-and-packaging/create-plans/)
15
+ # determine the base pricing for a customer. Use these endpoints to add a plan to
16
+ # a customer, end a customer plan, retrieve plans, and retrieve plan details.
17
+ # Create plans in the [Metronome app](https://app.metronome.com/plans).
9
18
  sig { returns(MetronomeSDK::Resources::V1::Plans) }
10
19
  attr_reader :plans
11
20
 
21
+ # [Credit grants](https://docs.metronome.com/invoicing/how-billing-works/manage-credits/)
22
+ # adjust a customer balance for prepayments, reimbursements, promotions, and so
23
+ # on. Use these endpoints to create, retrieve, update, and delete credit grants.
12
24
  sig { returns(MetronomeSDK::Resources::V1::CreditGrants) }
13
25
  attr_reader :credit_grants
14
26
 
27
+ # Use these endpoints to configure a billing API key, a webhook secret, or invoice
28
+ # finalization behavior.
15
29
  sig { returns(MetronomeSDK::Resources::V1::PricingUnits) }
16
30
  attr_reader :pricing_units
17
31
 
18
32
  sig { returns(MetronomeSDK::Resources::V1::Customers) }
19
33
  attr_reader :customers
20
34
 
35
+ # [Customers](https://docs.metronome.com/provisioning/create-customers/) in
36
+ # Metronome represent your users for all billing and reporting. Use these
37
+ # endpoints to create, retrieve, update, and archive customers and their billing
38
+ # configuration.
21
39
  sig { returns(MetronomeSDK::Resources::V1::Dashboards) }
22
40
  attr_reader :dashboards
23
41
 
42
+ # [Usage events](https://docs.metronome.com/connecting-metronome/send-usage-data/)
43
+ # are the basis for billable metrics. Use these endpoints to send usage events to
44
+ # Metronome and retrieve aggregated event data.
24
45
  sig { returns(MetronomeSDK::Resources::V1::Usage) }
25
46
  attr_reader :usage
26
47
 
48
+ # [Security](https://docs.metronome.com/developer-resources/security/) endpoints
49
+ # allow you to retrieve security-related data.
27
50
  sig { returns(MetronomeSDK::Resources::V1::AuditLogs) }
28
51
  attr_reader :audit_logs
29
52
 
53
+ # [Custom fields](https://docs.metronome.com/integrations/custom-fields/) enable
54
+ # adding additional data to Metronome entities. Use these endpoints to create,
55
+ # retrieve, update, and delete custom fields.
30
56
  sig { returns(MetronomeSDK::Resources::V1::CustomFields) }
31
57
  attr_reader :custom_fields
32
58
 
59
+ # [Billable metrics](https://docs.metronome.com/understanding-metronome/how-metronome-works#billable-metrics)
60
+ # in Metronome represent the various consumption components that Metronome meters
61
+ # and aggregates.
33
62
  sig { returns(MetronomeSDK::Resources::V1::BillableMetrics) }
34
63
  attr_reader :billable_metrics
35
64
 
65
+ # [Security](https://docs.metronome.com/developer-resources/security/) endpoints
66
+ # allow you to retrieve security-related data.
36
67
  sig { returns(MetronomeSDK::Resources::V1::Services) }
37
68
  attr_reader :services
38
69
 
70
+ # [Invoices](https://docs.metronome.com/invoicing/) reflect how much a customer
71
+ # spent during a period, which is the basis for billing. Metronome automatically
72
+ # generates invoices based upon your pricing, packaging, and usage events. Use
73
+ # these endpoints to retrieve invoices.
39
74
  sig { returns(MetronomeSDK::Resources::V1::Invoices) }
40
75
  attr_reader :invoices
41
76
 
42
77
  sig { returns(MetronomeSDK::Resources::V1::Contracts) }
43
78
  attr_reader :contracts
44
79
 
80
+ sig { returns(MetronomeSDK::Resources::V1::Packages) }
81
+ attr_reader :packages
82
+
45
83
  sig { returns(MetronomeSDK::Resources::V1::Payments) }
46
84
  attr_reader :payments
47
85
 
86
+ # Use these endpoints to configure a billing API key, a webhook secret, or invoice
87
+ # finalization behavior.
48
88
  sig { returns(MetronomeSDK::Resources::V1::Settings) }
49
89
  attr_reader :settings
50
90
 
@@ -106,6 +106,16 @@ module MetronomeSDK
106
106
  JSON_CONTENT: Regexp
107
107
  JSONL_CONTENT: Regexp
108
108
 
109
+ def encode_query_params: (
110
+ ::Hash[Symbol, top] query
111
+ ) -> ::Hash[Symbol, top]
112
+
113
+ private def write_query_param_element!: (
114
+ ::Hash[Symbol, top] collection,
115
+ String key,
116
+ top element
117
+ ) -> nil
118
+
109
119
  def self?.write_multipart_content: (
110
120
  Enumerator::Yielder y,
111
121
  val: top,
@@ -3,6 +3,7 @@ module MetronomeSDK
3
3
  type commit_rate =
4
4
  {
5
5
  rate_type: MetronomeSDK::Models::CommitRate::rate_type,
6
+ minimum_config: MetronomeSDK::CommitRate::MinimumConfig,
6
7
  price: Float,
7
8
  tiers: ::Array[MetronomeSDK::Tier]
8
9
  }
@@ -10,6 +11,12 @@ module MetronomeSDK
10
11
  class CommitRate < MetronomeSDK::Internal::Type::BaseModel
11
12
  attr_accessor rate_type: MetronomeSDK::Models::CommitRate::rate_type
12
13
 
14
+ attr_reader minimum_config: MetronomeSDK::CommitRate::MinimumConfig?
15
+
16
+ def minimum_config=: (
17
+ MetronomeSDK::CommitRate::MinimumConfig
18
+ ) -> MetronomeSDK::CommitRate::MinimumConfig
19
+
13
20
  attr_reader price: Float?
14
21
 
15
22
  def price=: (Float) -> Float
@@ -20,12 +27,14 @@ module MetronomeSDK
20
27
 
21
28
  def initialize: (
22
29
  rate_type: MetronomeSDK::Models::CommitRate::rate_type,
30
+ ?minimum_config: MetronomeSDK::CommitRate::MinimumConfig,
23
31
  ?price: Float,
24
32
  ?tiers: ::Array[MetronomeSDK::Tier]
25
33
  ) -> void
26
34
 
27
35
  def to_hash: -> {
28
36
  rate_type: MetronomeSDK::Models::CommitRate::rate_type,
37
+ minimum_config: MetronomeSDK::CommitRate::MinimumConfig,
29
38
  price: Float,
30
39
  tiers: ::Array[MetronomeSDK::Tier]
31
40
  }
@@ -50,6 +59,16 @@ module MetronomeSDK
50
59
 
51
60
  def self?.values: -> ::Array[MetronomeSDK::Models::CommitRate::rate_type]
52
61
  end
62
+
63
+ type minimum_config = { minimum: Float }
64
+
65
+ class MinimumConfig < MetronomeSDK::Internal::Type::BaseModel
66
+ attr_accessor minimum: Float
67
+
68
+ def initialize: (minimum: Float) -> void
69
+
70
+ def to_hash: -> { minimum: Float }
71
+ end
53
72
  end
54
73
  end
55
74
  end
@@ -12,7 +12,6 @@ module MetronomeSDK
12
12
  customer_billing_provider_configuration: MetronomeSDK::Contract::CustomerBillingProviderConfiguration,
13
13
  package_id: String,
14
14
  prepaid_balance_threshold_configuration: MetronomeSDK::PrepaidBalanceThresholdConfiguration,
15
- priority: Float,
16
15
  scheduled_charges_on_usage_invoices: MetronomeSDK::Models::Contract::scheduled_charges_on_usage_invoices,
17
16
  spend_threshold_configuration: MetronomeSDK::SpendThresholdConfiguration,
18
17
  subscriptions: ::Array[MetronomeSDK::Subscription],
@@ -54,10 +53,6 @@ module MetronomeSDK
54
53
  MetronomeSDK::PrepaidBalanceThresholdConfiguration
55
54
  ) -> MetronomeSDK::PrepaidBalanceThresholdConfiguration
56
55
 
57
- attr_reader priority: Float?
58
-
59
- def priority=: (Float) -> Float
60
-
61
56
  attr_reader scheduled_charges_on_usage_invoices: MetronomeSDK::Models::Contract::scheduled_charges_on_usage_invoices?
62
57
 
63
58
  def scheduled_charges_on_usage_invoices=: (
@@ -91,7 +86,6 @@ module MetronomeSDK
91
86
  ?customer_billing_provider_configuration: MetronomeSDK::Contract::CustomerBillingProviderConfiguration,
92
87
  ?package_id: String,
93
88
  ?prepaid_balance_threshold_configuration: MetronomeSDK::PrepaidBalanceThresholdConfiguration,
94
- ?priority: Float,
95
89
  ?scheduled_charges_on_usage_invoices: MetronomeSDK::Models::Contract::scheduled_charges_on_usage_invoices,
96
90
  ?spend_threshold_configuration: MetronomeSDK::SpendThresholdConfiguration,
97
91
  ?subscriptions: ::Array[MetronomeSDK::Subscription],
@@ -109,7 +103,6 @@ module MetronomeSDK
109
103
  customer_billing_provider_configuration: MetronomeSDK::Contract::CustomerBillingProviderConfiguration,
110
104
  package_id: String,
111
105
  prepaid_balance_threshold_configuration: MetronomeSDK::PrepaidBalanceThresholdConfiguration,
112
- priority: Float,
113
106
  scheduled_charges_on_usage_invoices: MetronomeSDK::Models::Contract::scheduled_charges_on_usage_invoices,
114
107
  spend_threshold_configuration: MetronomeSDK::SpendThresholdConfiguration,
115
108
  subscriptions: ::Array[MetronomeSDK::Subscription],
@@ -1423,6 +1423,7 @@ module MetronomeSDK
1423
1423
  credit_type: MetronomeSDK::CreditTypeData,
1424
1424
  custom_rate: ::Hash[Symbol, top],
1425
1425
  is_prorated: bool,
1426
+ minimum_config: MetronomeSDK::ContractV2::Override::OverwriteRate::MinimumConfig,
1426
1427
  price: Float,
1427
1428
  quantity: Float,
1428
1429
  tiers: ::Array[MetronomeSDK::Tier]
@@ -1445,6 +1446,12 @@ module MetronomeSDK
1445
1446
 
1446
1447
  def is_prorated=: (bool) -> bool
1447
1448
 
1449
+ attr_reader minimum_config: MetronomeSDK::ContractV2::Override::OverwriteRate::MinimumConfig?
1450
+
1451
+ def minimum_config=: (
1452
+ MetronomeSDK::ContractV2::Override::OverwriteRate::MinimumConfig
1453
+ ) -> MetronomeSDK::ContractV2::Override::OverwriteRate::MinimumConfig
1454
+
1448
1455
  attr_reader price: Float?
1449
1456
 
1450
1457
  def price=: (Float) -> Float
@@ -1464,6 +1471,7 @@ module MetronomeSDK
1464
1471
  ?credit_type: MetronomeSDK::CreditTypeData,
1465
1472
  ?custom_rate: ::Hash[Symbol, top],
1466
1473
  ?is_prorated: bool,
1474
+ ?minimum_config: MetronomeSDK::ContractV2::Override::OverwriteRate::MinimumConfig,
1467
1475
  ?price: Float,
1468
1476
  ?quantity: Float,
1469
1477
  ?tiers: ::Array[MetronomeSDK::Tier]
@@ -1474,6 +1482,7 @@ module MetronomeSDK
1474
1482
  credit_type: MetronomeSDK::CreditTypeData,
1475
1483
  custom_rate: ::Hash[Symbol, top],
1476
1484
  is_prorated: bool,
1485
+ minimum_config: MetronomeSDK::ContractV2::Override::OverwriteRate::MinimumConfig,
1477
1486
  price: Float,
1478
1487
  quantity: Float,
1479
1488
  tiers: ::Array[MetronomeSDK::Tier]
@@ -1499,6 +1508,16 @@ module MetronomeSDK
1499
1508
 
1500
1509
  def self?.values: -> ::Array[MetronomeSDK::Models::ContractV2::Override::OverwriteRate::rate_type]
1501
1510
  end
1511
+
1512
+ type minimum_config = { minimum: Float }
1513
+
1514
+ class MinimumConfig < MetronomeSDK::Internal::Type::BaseModel
1515
+ attr_accessor minimum: Float
1516
+
1517
+ def initialize: (minimum: Float) -> void
1518
+
1519
+ def to_hash: -> { minimum: Float }
1520
+ end
1502
1521
  end
1503
1522
 
1504
1523
  type product = { id: String, name: String }