metronome-sdk 3.7.0 → 3.8.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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +38 -0
  3. data/README.md +1 -1
  4. data/lib/metronome_sdk/internal/transport/base_client.rb +4 -1
  5. data/lib/metronome_sdk/models/commit.rb +10 -1
  6. data/lib/metronome_sdk/models/contract_v2.rb +290 -7
  7. data/lib/metronome_sdk/models/contract_without_amendments.rb +178 -4
  8. data/lib/metronome_sdk/models/credit.rb +10 -1
  9. data/lib/metronome_sdk/models/override.rb +7 -1
  10. data/lib/metronome_sdk/models/prepaid_balance_threshold_configuration.rb +10 -2
  11. data/lib/metronome_sdk/models/prepaid_balance_threshold_configuration_v2.rb +3 -1
  12. data/lib/metronome_sdk/models/subscription.rb +90 -2
  13. data/lib/metronome_sdk/models/v1/alert_create_params.rb +127 -1
  14. data/lib/metronome_sdk/models/v1/contract_amend_params.rb +17 -4
  15. data/lib/metronome_sdk/models/v1/contract_create_params.rb +290 -10
  16. data/lib/metronome_sdk/models/v1/contract_create_response.rb +178 -4
  17. data/lib/metronome_sdk/models/v1/contract_get_subscription_seats_history_params.rb +88 -0
  18. data/lib/metronome_sdk/models/v1/contract_get_subscription_seats_history_response.rb +62 -0
  19. data/lib/metronome_sdk/models/v1/contract_list_seat_balances_params.rb +10 -1
  20. data/lib/metronome_sdk/models/v1/customers/alert_retrieve_params.rb +127 -1
  21. data/lib/metronome_sdk/models/v1/customers/customer_alert.rb +130 -3
  22. data/lib/metronome_sdk/models/v1/customers/invoice_list_params.rb +10 -1
  23. data/lib/metronome_sdk/models/v1/dashboard_get_embeddable_url_params.rb +2 -0
  24. data/lib/metronome_sdk/models/v1/package_create_params.rb +279 -10
  25. data/lib/metronome_sdk/models/v1/package_list_response.rb +264 -7
  26. data/lib/metronome_sdk/models/v1/package_retrieve_response.rb +264 -7
  27. data/lib/metronome_sdk/models/v2/contract_edit_params.rb +515 -9
  28. data/lib/metronome_sdk/models/v2/contract_edit_response.rb +456 -8
  29. data/lib/metronome_sdk/models/v2/contract_get_edit_history_response.rb +456 -8
  30. data/lib/metronome_sdk/resources/v1/alerts.rb +3 -1
  31. data/lib/metronome_sdk/resources/v1/contracts/rate_cards/rates.rb +4 -0
  32. data/lib/metronome_sdk/resources/v1/contracts.rb +68 -1
  33. data/lib/metronome_sdk/resources/v1/customers/alerts.rb +4 -2
  34. data/lib/metronome_sdk/resources/v1/customers/invoices.rb +3 -1
  35. data/lib/metronome_sdk/resources/v1/dashboards.rb +7 -2
  36. data/lib/metronome_sdk/version.rb +1 -1
  37. data/lib/metronome_sdk.rb +2 -0
  38. data/rbi/metronome_sdk/models/commit.rbi +13 -0
  39. data/rbi/metronome_sdk/models/contract_v2.rbi +715 -3
  40. data/rbi/metronome_sdk/models/contract_without_amendments.rbi +463 -0
  41. data/rbi/metronome_sdk/models/credit.rbi +13 -0
  42. data/rbi/metronome_sdk/models/override.rbi +9 -0
  43. data/rbi/metronome_sdk/models/prepaid_balance_threshold_configuration.rbi +11 -1
  44. data/rbi/metronome_sdk/models/prepaid_balance_threshold_configuration_v2.rbi +4 -0
  45. data/rbi/metronome_sdk/models/subscription.rbi +212 -3
  46. data/rbi/metronome_sdk/models/v1/alert_create_params.rbi +373 -0
  47. data/rbi/metronome_sdk/models/v1/contract_amend_params.rbi +27 -6
  48. data/rbi/metronome_sdk/models/v1/contract_create_params.rbi +719 -9
  49. data/rbi/metronome_sdk/models/v1/contract_create_response.rbi +463 -0
  50. data/rbi/metronome_sdk/models/v1/contract_get_subscription_seats_history_params.rbi +112 -0
  51. data/rbi/metronome_sdk/models/v1/contract_get_subscription_seats_history_response.rbi +119 -0
  52. data/rbi/metronome_sdk/models/v1/contract_list_seat_balances_params.rbi +13 -0
  53. data/rbi/metronome_sdk/models/v1/customers/alert_retrieve_params.rbi +360 -0
  54. data/rbi/metronome_sdk/models/v1/customers/customer_alert.rbi +379 -2
  55. data/rbi/metronome_sdk/models/v1/customers/invoice_list_params.rbi +13 -0
  56. data/rbi/metronome_sdk/models/v1/dashboard_get_embeddable_url_params.rbi +10 -0
  57. data/rbi/metronome_sdk/models/v1/package_create_params.rbi +706 -9
  58. data/rbi/metronome_sdk/models/v1/package_list_response.rbi +693 -3
  59. data/rbi/metronome_sdk/models/v1/package_retrieve_response.rbi +693 -3
  60. data/rbi/metronome_sdk/models/v2/contract_edit_params.rbi +1333 -40
  61. data/rbi/metronome_sdk/models/v2/contract_edit_response.rbi +1204 -67
  62. data/rbi/metronome_sdk/models/v2/contract_get_edit_history_response.rbi +1204 -67
  63. data/rbi/metronome_sdk/resources/v1/alerts.rbi +8 -0
  64. data/rbi/metronome_sdk/resources/v1/contracts/rate_cards/rates.rbi +4 -0
  65. data/rbi/metronome_sdk/resources/v1/contracts.rbi +70 -0
  66. data/rbi/metronome_sdk/resources/v1/customers/alerts.rbi +8 -1
  67. data/rbi/metronome_sdk/resources/v1/customers/invoices.rbi +4 -0
  68. data/rbi/metronome_sdk/resources/v1/dashboards.rbi +7 -2
  69. data/sig/metronome_sdk/models/commit.rbs +7 -0
  70. data/sig/metronome_sdk/models/contract_v2.rbs +278 -5
  71. data/sig/metronome_sdk/models/contract_without_amendments.rbs +169 -2
  72. data/sig/metronome_sdk/models/credit.rbs +7 -0
  73. data/sig/metronome_sdk/models/override.rbs +7 -0
  74. data/sig/metronome_sdk/models/subscription.rbs +88 -3
  75. data/sig/metronome_sdk/models/v1/alert_create_params.rbs +144 -0
  76. data/sig/metronome_sdk/models/v1/contract_amend_params.rbs +7 -0
  77. data/sig/metronome_sdk/models/v1/contract_create_params.rbs +278 -5
  78. data/sig/metronome_sdk/models/v1/contract_create_response.rbs +167 -2
  79. data/sig/metronome_sdk/models/v1/contract_get_subscription_seats_history_params.rbs +63 -0
  80. data/sig/metronome_sdk/models/v1/contract_get_subscription_seats_history_response.rbs +59 -0
  81. data/sig/metronome_sdk/models/v1/contract_list_seat_balances_params.rbs +7 -0
  82. data/sig/metronome_sdk/models/v1/customers/alert_retrieve_params.rbs +141 -0
  83. data/sig/metronome_sdk/models/v1/customers/customer_alert.rbs +150 -0
  84. data/sig/metronome_sdk/models/v1/customers/invoice_list_params.rbs +8 -1
  85. data/sig/metronome_sdk/models/v1/dashboard_get_embeddable_url_params.rbs +4 -0
  86. data/sig/metronome_sdk/models/v1/package_create_params.rbs +271 -5
  87. data/sig/metronome_sdk/models/v1/package_list_response.rbs +265 -5
  88. data/sig/metronome_sdk/models/v1/package_retrieve_response.rbs +263 -5
  89. data/sig/metronome_sdk/models/v2/contract_edit_params.rbs +468 -5
  90. data/sig/metronome_sdk/models/v2/contract_edit_response.rbs +428 -5
  91. data/sig/metronome_sdk/models/v2/contract_get_edit_history_response.rbs +427 -5
  92. data/sig/metronome_sdk/resources/v1/alerts.rbs +1 -0
  93. data/sig/metronome_sdk/resources/v1/contracts.rbs +13 -0
  94. data/sig/metronome_sdk/resources/v1/customers/alerts.rbs +1 -0
  95. data/sig/metronome_sdk/resources/v1/customers/invoices.rbs +1 -0
  96. metadata +8 -2
@@ -58,7 +58,7 @@ module MetronomeSDK
58
58
  # threshold notification evaluations in real-time as usage events stream in,
59
59
  # unlike competitors who rely on periodic polling or batch evaluation cycles
60
60
  #
61
- # @overload create(alert_type:, name:, threshold:, billable_metric_id: nil, credit_grant_type_filters: nil, credit_type_id: nil, custom_field_filters: nil, customer_id: nil, evaluate_on_create: nil, group_values: nil, invoice_types_filter: nil, plan_id: nil, seat_filter: nil, uniqueness_key: nil, request_options: {})
61
+ # @overload create(alert_type:, name:, threshold:, alert_specifiers: nil, billable_metric_id: nil, credit_grant_type_filters: nil, credit_type_id: nil, custom_field_filters: nil, customer_id: nil, evaluate_on_create: nil, group_values: nil, invoice_types_filter: nil, plan_id: nil, seat_filter: nil, uniqueness_key: nil, request_options: {})
62
62
  #
63
63
  # @param alert_type [Symbol, MetronomeSDK::Models::V1::AlertCreateParams::AlertType] Type of the threshold notification
64
64
  #
@@ -66,6 +66,8 @@ module MetronomeSDK
66
66
  #
67
67
  # @param threshold [Float] Threshold value of the notification policy. Depending upon the notification typ
68
68
  #
69
+ # @param alert_specifiers [Array<MetronomeSDK::Models::V1::AlertCreateParams::AlertSpecifier>] Can be used with only `low_remaining_contract_credit_and_commit_balance_reached`
70
+ #
69
71
  # @param billable_metric_id [String] For threshold notifications of type `usage_threshold_reached`, specifies which b
70
72
  #
71
73
  # @param credit_grant_type_filters [Array<String>] An array of strings, representing a way to filter the credit grant this threshol
@@ -59,6 +59,10 @@ module MetronomeSDK
59
59
  #
60
60
  # Add a new rate
61
61
  #
62
+ # This endpoint is heavily rate limited. For adding multiple rates, using the
63
+ # [addRates](https://docs.metronome.com/api-reference/rate-cards/add-rates)
64
+ # endpoint is strongly encouraged.
65
+ #
62
66
  # @overload add(entitled:, product_id:, rate_card_id:, rate_type:, starting_at:, billing_frequency: nil, commit_rate: nil, credit_type_id: nil, custom_rate: nil, ending_before: nil, is_prorated: nil, price: nil, pricing_group_values: nil, quantity: nil, tiers: nil, request_options: {})
63
67
  #
64
68
  # @param entitled [Boolean]
@@ -568,6 +568,71 @@ module MetronomeSDK
568
568
  )
569
569
  end
570
570
 
571
+ # Some parameter documentations has been truncated, see
572
+ # {MetronomeSDK::Models::V1::ContractGetSubscriptionSeatsHistoryParams} for more
573
+ # details.
574
+ #
575
+ # Get the history of subscription seats schedule over time for a given
576
+ # `subscription_id`. This endpoint provides information about seat assignments and
577
+ # total quantities for different time periods, allowing you to track how seat
578
+ # assignments have changed over time.
579
+ #
580
+ # ### Use this endpoint to:
581
+ #
582
+ # - Track changes to seat assignments over time
583
+ # - Get seat schedule for a specific date using the `covering_date` parameter
584
+ # - Get seat schedule history with optional date range filtering using
585
+ # `starting_at` and `ending_before`
586
+ #
587
+ # ### Key response fields:
588
+ #
589
+ # - data: array of seat schedule entries with time periods, quantity, and
590
+ # assignments
591
+ # - next_page: cursor for pagination to retrieve additional results
592
+ #
593
+ # ### Usage guidelines:
594
+ #
595
+ # - Use `covering_date` to get the active seats for a specific point in time.
596
+ # `covering_date` cannot be used with `starting_at` or `ending_before`.
597
+ # - Use `starting_at` and `ending_before` to filter results by time range.
598
+ # `starting_at` and `ending_before` cannot be used with `covering_date`.
599
+ # - Maximum limit is 10 seat schedule entries per request
600
+ # - Results are ordered by `starting_at` timestamp
601
+ #
602
+ # @overload get_subscription_seats_history(contract_id:, customer_id:, subscription_id:, covering_date: nil, cursor: nil, ending_before: nil, limit: nil, starting_at: nil, request_options: {})
603
+ #
604
+ # @param contract_id [String]
605
+ #
606
+ # @param customer_id [String]
607
+ #
608
+ # @param subscription_id [String]
609
+ #
610
+ # @param covering_date [Time, nil] Get the seats history segment for the covering date. Cannot be used with `starti
611
+ #
612
+ # @param cursor [String, nil] Cursor for pagination. Use the value from the `next_page` field of the previous
613
+ #
614
+ # @param ending_before [Time, nil] Include seats history segments that are active at or before this timestamp. Use
615
+ #
616
+ # @param limit [Integer, nil] Maximum number of seat schedule entries to return. Defaults to 10. Required rang
617
+ #
618
+ # @param starting_at [Time, nil] Include seats history segments that are active at or after this timestamp. Use w
619
+ #
620
+ # @param request_options [MetronomeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
621
+ #
622
+ # @return [MetronomeSDK::Models::V1::ContractGetSubscriptionSeatsHistoryResponse]
623
+ #
624
+ # @see MetronomeSDK::Models::V1::ContractGetSubscriptionSeatsHistoryParams
625
+ def get_subscription_seats_history(params)
626
+ parsed, options = MetronomeSDK::V1::ContractGetSubscriptionSeatsHistoryParams.dump_request(params)
627
+ @client.request(
628
+ method: :post,
629
+ path: "v1/contracts/getSubscriptionSeatsHistory",
630
+ body: parsed,
631
+ model: MetronomeSDK::Models::V1::ContractGetSubscriptionSeatsHistoryResponse,
632
+ options: options
633
+ )
634
+ end
635
+
571
636
  # Some parameter documentations has been truncated, see
572
637
  # {MetronomeSDK::Models::V1::ContractListBalancesParams} for more details.
573
638
  #
@@ -679,7 +744,7 @@ module MetronomeSDK
679
744
  # - Set `include_ledgers=true` for detailed transaction history per commit/credit
680
745
  # per seat
681
746
  #
682
- # @overload list_seat_balances(contract_id:, customer_id:, covering_date: nil, cursor: nil, effective_before: nil, include_credits_and_commits: nil, include_ledgers: nil, limit: nil, seat_ids: nil, starting_at: nil, subscription_ids: nil, request_options: {})
747
+ # @overload list_seat_balances(contract_id:, customer_id:, covering_date: nil, cursor: nil, effective_before: nil, include_credits_and_commits: nil, include_ledgers: nil, limit: nil, seat_ids: nil, skip_missing_seat_ids: nil, starting_at: nil, subscription_ids: nil, request_options: {})
683
748
  #
684
749
  # @param contract_id [String] The contract ID to retrieve seat balances for
685
750
  #
@@ -699,6 +764,8 @@ module MetronomeSDK
699
764
  #
700
765
  # @param seat_ids [Array<String>] Optional filter to only include specific seats.
701
766
  #
767
+ # @param skip_missing_seat_ids [Boolean] When true, any seat_ids not found in contract subscriptions will be silently omi
768
+ #
702
769
  # @param starting_at [Time] Include only commits or credits with access effective on or after this date (can
703
770
  #
704
771
  # @param subscription_ids [Array<String>] Optional filter to only include seats from specific subscriptions. If subscripti
@@ -47,11 +47,11 @@ module MetronomeSDK
47
47
  # - `null` - Notification has been archived
48
48
  # - `triggered_by`: Additional context about what caused the notification to
49
49
  # trigger (when applicable)
50
+ # - `updated_at`: Timestamp of when the `customer_status` was last updated
50
51
  # - alert: Complete threshold notification configuration including:
51
52
  # - Notification ID, name, and type
52
53
  # - Current threshold values and credit type information
53
54
  # - Notification status (enabled, disabled, or archived)
54
- # - Last update timestamp
55
55
  # - Any applied filters (credit grant types, custom fields, group values)
56
56
  #
57
57
  # ### Usage guidelines:
@@ -69,12 +69,14 @@ module MetronomeSDK
69
69
  # - Error handling: Returns 404 if either the customer or alert_id doesn't exist
70
70
  # or isn't accessible to your organization
71
71
  #
72
- # @overload retrieve(alert_id:, customer_id:, group_values: nil, plans_or_contracts: nil, seat_filter: nil, request_options: {})
72
+ # @overload retrieve(alert_id:, customer_id:, alert_specifiers: nil, group_values: nil, plans_or_contracts: nil, seat_filter: nil, request_options: {})
73
73
  #
74
74
  # @param alert_id [String] The Metronome ID of the threshold notification
75
75
  #
76
76
  # @param customer_id [String] The Metronome ID of the customer
77
77
  #
78
+ # @param alert_specifiers [Array<MetronomeSDK::Models::V1::Customers::AlertRetrieveParams::AlertSpecifier>] Can be used with only `low_remaining_contract_credit_and_commit_balance_reached`
79
+ #
78
80
  # @param group_values [Array<MetronomeSDK::Models::V1::Customers::AlertRetrieveParams::GroupValue>] Only present for `spend_threshold_reached` notifications. Retrieve the notificat
79
81
  #
80
82
  # @param plans_or_contracts [Symbol, MetronomeSDK::Models::V1::Customers::AlertRetrieveParams::PlansOrContracts] When parallel threshold notifications are enabled during migration, this flag de
@@ -136,7 +136,7 @@ module MetronomeSDK
136
136
  # - Voided invoices are included in results by default unless filtered out by
137
137
  # status
138
138
  #
139
- # @overload list(customer_id:, contract_id: nil, 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, type: nil, request_options: {})
139
+ # @overload list(customer_id:, contract_id: nil, 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, type: nil, webhook_notification_id: nil, request_options: {})
140
140
  #
141
141
  # @param customer_id [String] Path param
142
142
  #
@@ -160,6 +160,8 @@ module MetronomeSDK
160
160
  #
161
161
  # @param type [Symbol, MetronomeSDK::Models::V1::Customers::InvoiceListParams::Type] Query param: Filter invoices by type. Defaults to returning all invoice types.
162
162
  #
163
+ # @param webhook_notification_id [String] Query param: Indicates that this API request was triggered by a webhook notifica
164
+ #
163
165
  # @param request_options [MetronomeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
164
166
  #
165
167
  # @return [MetronomeSDK::Internal::CursorPage<MetronomeSDK::Models::V1::Customers::Invoice>]
@@ -30,8 +30,13 @@ module MetronomeSDK
30
30
  #
31
31
  # - Dashboard types: Choose from `invoices`, `usage`, or `commits_and_credits`
32
32
  # - Customization options:
33
- # - `dashboard_options`: Configure whether you want invoices to show zero usage
34
- # line items
33
+ # - `dashboard_options`: Configure dashboard behavior. For the invoices
34
+ # dashboard, supported keys include: `show_zero_usage_line_items`
35
+ # ("true"/"false"), `hide_voided_invoices` ("true"/"false"), `contract_id`
36
+ # (UUID, filters invoices by contract), `invoice_type` ("USAGE" or
37
+ # "SCHEDULED", filters by invoice type), `invoice_status_filter` ("VOID",
38
+ # "FINALIZED", "DRAFT", "FINALIZED_AND_DRAFT", or "ALL"), and
39
+ # `billable_status_filter` ("BILLABLE", "UNBILLABLE", or "ALL")
35
40
  # - `color_overrides`: Match your brand's color palette
36
41
  # - `bm_group_key_overrides`: Customize how dimensions are displayed (for the
37
42
  # usage embeddable dashboard)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MetronomeSDK
4
- VERSION = "3.7.0"
4
+ VERSION = "3.8.0"
5
5
  end
data/lib/metronome_sdk.rb CHANGED
@@ -117,6 +117,8 @@ require_relative "metronome_sdk/models/v1/contract_create_params"
117
117
  require_relative "metronome_sdk/models/v1/contract_create_response"
118
118
  require_relative "metronome_sdk/models/v1/contract_get_net_balance_params"
119
119
  require_relative "metronome_sdk/models/v1/contract_get_net_balance_response"
120
+ require_relative "metronome_sdk/models/v1/contract_get_subscription_seats_history_params"
121
+ require_relative "metronome_sdk/models/v1/contract_get_subscription_seats_history_response"
120
122
  require_relative "metronome_sdk/models/v1/contract_list_balances_params"
121
123
  require_relative "metronome_sdk/models/v1/contract_list_balances_response"
122
124
  require_relative "metronome_sdk/models/v1/contract_list_params"
@@ -91,6 +91,14 @@ module MetronomeSDK
91
91
  sig { params(contract: MetronomeSDK::Commit::Contract::OrHash).void }
92
92
  attr_writer :contract
93
93
 
94
+ # The actor who created this commit. Omitted for system-generated commits such as
95
+ # recurring commits, rollover commits, and threshold commits.
96
+ sig { returns(T.nilable(String)) }
97
+ attr_reader :created_by
98
+
99
+ sig { params(created_by: String).void }
100
+ attr_writer :created_by
101
+
94
102
  # Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
95
103
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
96
104
  attr_reader :custom_fields
@@ -285,6 +293,7 @@ module MetronomeSDK
285
293
  archived_at: Time,
286
294
  balance: Float,
287
295
  contract: MetronomeSDK::Commit::Contract::OrHash,
296
+ created_by: String,
288
297
  custom_fields: T::Hash[Symbol, String],
289
298
  description: String,
290
299
  hierarchy_configuration:
@@ -356,6 +365,9 @@ module MetronomeSDK
356
365
  # included in the balance, including future-dated manual ledger entries.
357
366
  balance: nil,
358
367
  contract: nil,
368
+ # The actor who created this commit. Omitted for system-generated commits such as
369
+ # recurring commits, rollover commits, and threshold commits.
370
+ created_by: nil,
359
371
  # Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
360
372
  custom_fields: nil,
361
373
  description: nil,
@@ -414,6 +426,7 @@ module MetronomeSDK
414
426
  archived_at: Time,
415
427
  balance: Float,
416
428
  contract: MetronomeSDK::Commit::Contract,
429
+ created_by: String,
417
430
  custom_fields: T::Hash[Symbol, String],
418
431
  description: String,
419
432
  hierarchy_configuration: MetronomeSDK::CommitHierarchyConfiguration,