@metronome/sdk 1.0.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 (111) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/bin/cli +5 -12
  3. package/internal/to-file.d.mts +1 -1
  4. package/internal/to-file.d.ts +1 -1
  5. package/internal/to-file.js +1 -1
  6. package/internal/to-file.mjs +1 -1
  7. package/package.json +1 -1
  8. package/resources/shared.d.mts +129 -5
  9. package/resources/shared.d.mts.map +1 -1
  10. package/resources/shared.d.ts +129 -5
  11. package/resources/shared.d.ts.map +1 -1
  12. package/resources/v1/alerts.d.mts +68 -64
  13. package/resources/v1/alerts.d.mts.map +1 -1
  14. package/resources/v1/alerts.d.ts +68 -64
  15. package/resources/v1/alerts.d.ts.map +1 -1
  16. package/resources/v1/alerts.js +40 -39
  17. package/resources/v1/alerts.js.map +1 -1
  18. package/resources/v1/alerts.mjs +40 -39
  19. package/resources/v1/alerts.mjs.map +1 -1
  20. package/resources/v1/contracts/contracts.d.mts +28 -6
  21. package/resources/v1/contracts/contracts.d.mts.map +1 -1
  22. package/resources/v1/contracts/contracts.d.ts +28 -6
  23. package/resources/v1/contracts/contracts.d.ts.map +1 -1
  24. package/resources/v1/contracts/contracts.js +4 -3
  25. package/resources/v1/contracts/contracts.js.map +1 -1
  26. package/resources/v1/contracts/contracts.mjs +4 -3
  27. package/resources/v1/contracts/contracts.mjs.map +1 -1
  28. package/resources/v1/customers/alerts.d.mts +98 -77
  29. package/resources/v1/customers/alerts.d.mts.map +1 -1
  30. package/resources/v1/customers/alerts.d.ts +98 -77
  31. package/resources/v1/customers/alerts.d.ts.map +1 -1
  32. package/resources/v1/customers/alerts.js +65 -46
  33. package/resources/v1/customers/alerts.js.map +1 -1
  34. package/resources/v1/customers/alerts.mjs +65 -46
  35. package/resources/v1/customers/alerts.mjs.map +1 -1
  36. package/resources/v1/customers/customers.d.mts +17 -16
  37. package/resources/v1/customers/customers.d.mts.map +1 -1
  38. package/resources/v1/customers/customers.d.ts +17 -16
  39. package/resources/v1/customers/customers.d.ts.map +1 -1
  40. package/resources/v1/customers/customers.js +7 -4
  41. package/resources/v1/customers/customers.js.map +1 -1
  42. package/resources/v1/customers/customers.mjs +7 -4
  43. package/resources/v1/customers/customers.mjs.map +1 -1
  44. package/resources/v1/customers/index.d.mts +1 -1
  45. package/resources/v1/customers/index.d.mts.map +1 -1
  46. package/resources/v1/customers/index.d.ts +1 -1
  47. package/resources/v1/customers/index.d.ts.map +1 -1
  48. package/resources/v1/customers/index.js.map +1 -1
  49. package/resources/v1/customers/index.mjs.map +1 -1
  50. package/resources/v1/customers/invoices.d.mts +117 -2
  51. package/resources/v1/customers/invoices.d.mts.map +1 -1
  52. package/resources/v1/customers/invoices.d.ts +117 -2
  53. package/resources/v1/customers/invoices.d.ts.map +1 -1
  54. package/resources/v1/customers/invoices.js +49 -0
  55. package/resources/v1/customers/invoices.js.map +1 -1
  56. package/resources/v1/customers/invoices.mjs +49 -0
  57. package/resources/v1/customers/invoices.mjs.map +1 -1
  58. package/resources/v1/index.d.mts +1 -0
  59. package/resources/v1/index.d.mts.map +1 -1
  60. package/resources/v1/index.d.ts +1 -0
  61. package/resources/v1/index.d.ts.map +1 -1
  62. package/resources/v1/index.js +3 -1
  63. package/resources/v1/index.js.map +1 -1
  64. package/resources/v1/index.mjs +1 -0
  65. package/resources/v1/index.mjs.map +1 -1
  66. package/resources/v1/payments.d.mts +116 -0
  67. package/resources/v1/payments.d.mts.map +1 -0
  68. package/resources/v1/payments.d.ts +116 -0
  69. package/resources/v1/payments.d.ts.map +1 -0
  70. package/resources/v1/payments.js +71 -0
  71. package/resources/v1/payments.js.map +1 -0
  72. package/resources/v1/payments.mjs +67 -0
  73. package/resources/v1/payments.mjs.map +1 -0
  74. package/resources/v1/usage.d.mts +4 -2
  75. package/resources/v1/usage.d.mts.map +1 -1
  76. package/resources/v1/usage.d.ts +4 -2
  77. package/resources/v1/usage.d.ts.map +1 -1
  78. package/resources/v1/usage.js +4 -2
  79. package/resources/v1/usage.js.map +1 -1
  80. package/resources/v1/usage.mjs +4 -2
  81. package/resources/v1/usage.mjs.map +1 -1
  82. package/resources/v1/v1.d.mts +4 -0
  83. package/resources/v1/v1.d.mts.map +1 -1
  84. package/resources/v1/v1.d.ts +4 -0
  85. package/resources/v1/v1.d.ts.map +1 -1
  86. package/resources/v1/v1.js +4 -0
  87. package/resources/v1/v1.js.map +1 -1
  88. package/resources/v1/v1.mjs +4 -0
  89. package/resources/v1/v1.mjs.map +1 -1
  90. package/resources/v2/contracts.d.mts +109 -3
  91. package/resources/v2/contracts.d.mts.map +1 -1
  92. package/resources/v2/contracts.d.ts +109 -3
  93. package/resources/v2/contracts.d.ts.map +1 -1
  94. package/src/internal/to-file.ts +1 -1
  95. package/src/resources/shared.ts +160 -5
  96. package/src/resources/v1/alerts.ts +68 -64
  97. package/src/resources/v1/contracts/contracts.ts +32 -6
  98. package/src/resources/v1/customers/alerts.ts +98 -77
  99. package/src/resources/v1/customers/customers.ts +18 -15
  100. package/src/resources/v1/customers/index.ts +1 -0
  101. package/src/resources/v1/customers/invoices.ts +142 -1
  102. package/src/resources/v1/index.ts +11 -0
  103. package/src/resources/v1/payments.ts +170 -0
  104. package/src/resources/v1/usage.ts +4 -2
  105. package/src/resources/v1/v1.ts +26 -0
  106. package/src/resources/v2/contracts.ts +144 -3
  107. package/src/version.ts +1 -1
  108. package/version.d.mts +1 -1
  109. package/version.d.ts +1 -1
  110. package/version.js +1 -1
  111. package/version.mjs +1 -1
@@ -4,16 +4,15 @@ import { APIPromise } from "../../core/api-promise.js";
4
4
  import { RequestOptions } from "../../internal/request-options.js";
5
5
  export declare class Alerts extends APIResource {
6
6
  /**
7
- * Create a new alert to monitor customer spending, balances, and billing metrics
8
- * in real-time. Metronome's alert system provides industry-leading speed with
9
- * immediate evaluation capabilities, enabling you to proactively manage customer
10
- * accounts and prevent revenue leakage.
7
+ * Create a new threshold notification to monitor customer spending, balances, and
8
+ * billing metrics in real-time. Metronome's notification system provides
9
+ * industry-leading speed with immediate evaluation capabilities, enabling you to
10
+ * proactively manage customer accounts and prevent revenue leakage.
11
11
  *
12
- * This endpoint creates configurable alerts that continuously monitor various
13
- * billing thresholds including spend limits, credit balances, commitment
14
- * utilization, and invoice totals. Alerts can be configured globally for all
15
- * customers or targeted to specific customer accounts. Custom fields can be used
16
- * on certain alert types to further target alerts to groups of customers.
12
+ * This endpoint creates configurable threshold notifications that continuously
13
+ * monitor various billing thresholds including spend limits, credit balances,
14
+ * commitment utilization, and invoice totals. Threshold notifications can be
15
+ * configured globally for all customers or targeted to specific customer accounts.
17
16
  *
18
17
  * ### Use this endpoint to:
19
18
  *
@@ -29,26 +28,27 @@ export declare class Alerts extends APIResource {
29
28
  *
30
29
  * A successful response returns a CustomerAlert object containing:
31
30
  *
32
- * - The alert configuration with its unique ID and current status
31
+ * - The threshold notification configuration with its unique ID and current status
33
32
  * - The customer's evaluation status (ok, in_alarm, or evaluating)
34
- * - Alert metadata including type, threshold values, and update timestamps
33
+ * - Threshold notification metadata including type, threshold values, and update
34
+ * timestamps
35
35
  *
36
36
  * ### Usage guidelines:
37
37
  *
38
38
  * - Immediate evaluation: Set `evaluate_on_create` : `true` (default) for instant
39
39
  * evaluation against existing customers
40
- * - Uniqueness constraints: Each alert must have a unique `uniqueness_key` within
41
- * your organization. Use `release_uniqueness_key` : `true` when archiving to
42
- * reuse keys
43
- * - Alert type requirements: Different alert types require specific fields (e.g.,
44
- * `billable_metric_id` for usage alerts, `credit_type_id` for credit-based
45
- * alerts)
46
- * - Webhook delivery: Alerts trigger webhook notifications for real-time
47
- * integration with your systems. Configure webhook endpoints before creating
48
- * alerts
49
- * - Performance at scale: Metronome's event-driven architecture processes alert
50
- * evaluations in real-time as usage events stream in, unlike competitors who
51
- * rely on periodic polling or batch evaluation cycles
40
+ * - Uniqueness constraints: Each threshold notification must have a unique
41
+ * `uniqueness_key` within your organization. Use `release_uniqueness_key` :
42
+ * `true` when archiving to reuse keys
43
+ * - Notification type requirements: Different threshold notification types require
44
+ * specific fields (e.g., `billable_metric_id` for usage notifications,
45
+ * `credit_type_id` for credit-based threshold notifications)
46
+ * - Webhook delivery: Threshold notifications trigger webhook notifications for
47
+ * real-time integration with your systems. Configure webhook endpoints before
48
+ * creating threshold notifications
49
+ * - Performance at scale: Metronome's event-driven architecture processes
50
+ * threshold notification evaluations in real-time as usage events stream in,
51
+ * unlike competitors who rely on periodic polling or batch evaluation cycles
52
52
  *
53
53
  * @example
54
54
  * ```ts
@@ -64,33 +64,34 @@ export declare class Alerts extends APIResource {
64
64
  */
65
65
  create(body: AlertCreateParams, options?: RequestOptions): APIPromise<AlertCreateResponse>;
66
66
  /**
67
- * Permanently disable an alert and remove it from active monitoring across all
68
- * customers. Archived alerts stop evaluating immediately and can optionally
69
- * release their uniqueness key for reuse in future alert configurations.
67
+ * Permanently disable a threshold notification and remove it from active
68
+ * monitoring across all customers. Archived threshold notifications stop
69
+ * evaluating immediately and can optionally release their uniqueness key for reuse
70
+ * in future threshold notification configurations.
70
71
  *
71
72
  * ### Use this endpoint to:
72
73
  *
73
- * - Decommission alerts that are no longer needed
74
- * - Clean up test or deprecated alert configurations
75
- * - Free up uniqueness keys for reuse with new alerts
76
- * - Stop alert evaluations without losing historical configuration data
74
+ * - Decommission threshold notifications that are no longer needed
75
+ * - Clean up test or deprecated threshold notification configurations
76
+ * - Free up uniqueness keys for reuse with new threshold notifications
77
+ * - Stop threshold notification evaluations without losing historical
78
+ * configuration data
77
79
  * - Disable outdated monitoring rules during pricing model transitions
78
80
  *
79
81
  * ### Key response fields:
80
82
  *
81
- * - data: Object containing the archived alert's ID
82
- * - Alert evaluation stops immediately for all affected customers
83
- * - Historical alert data and configurations remain accessible for audit purposes
83
+ * - data: Object containing the archived threshold notification's ID
84
84
  *
85
85
  * ### Usage guidelines:
86
86
  *
87
- * - Irreversible for evaluation: Archived alerts cannot be re-enabled; create a
88
- * new alert to resume monitoring
87
+ * - Irreversible for evaluation: Archived threshold notifications cannot be
88
+ * re-enabled; create a new threshold notification to resume monitoring
89
89
  * - Uniqueness key handling: Set `release_uniqueness_key` : `true` to reuse the
90
- * key in future alerts
91
- * - Immediate effect: Alert evaluation stops instantly across all customers
92
- * - Historical preservation: Archive operation maintains alert history and
93
- * configuration for compliance and auditing
90
+ * key in future threshold notifications
91
+ * - Immediate effect: Threshold notification evaluation stops instantly across all
92
+ * customers
93
+ * - Historical preservation: Archive operation maintains threshold notification
94
+ * history and configuration for compliance and auditing
94
95
  *
95
96
  * @example
96
97
  * ```ts
@@ -109,64 +110,66 @@ export interface AlertArchiveResponse {
109
110
  }
110
111
  export interface AlertCreateParams {
111
112
  /**
112
- * Type of the alert
113
+ * Type of the threshold notification
113
114
  */
114
115
  alert_type: 'low_credit_balance_reached' | 'spend_threshold_reached' | 'monthly_invoice_total_spend_threshold_reached' | 'low_remaining_days_in_plan_reached' | 'low_remaining_credit_percentage_reached' | 'usage_threshold_reached' | 'low_remaining_days_for_commit_segment_reached' | 'low_remaining_commit_balance_reached' | 'low_remaining_commit_percentage_reached' | 'low_remaining_days_for_contract_credit_segment_reached' | 'low_remaining_contract_credit_balance_reached' | 'low_remaining_contract_credit_percentage_reached' | 'low_remaining_contract_credit_and_commit_balance_reached' | 'invoice_total_reached';
115
116
  /**
116
- * Name of the alert
117
+ * Name of the threshold notification
117
118
  */
118
119
  name: string;
119
120
  /**
120
- * Threshold value of the alert policy. Depending upon the alert type, this number
121
- * may represent a financial amount, the days remaining, or a percentage reached.
121
+ * Threshold value of the notification policy. Depending upon the notification
122
+ * type, this number may represent a financial amount, the days remaining, or a
123
+ * percentage reached.
122
124
  */
123
125
  threshold: number;
124
126
  /**
125
- * For alerts of type `usage_threshold_reached`, specifies which billable metric to
126
- * track the usage for.
127
+ * For threshold notifications of type `usage_threshold_reached`, specifies which
128
+ * billable metric to track the usage for.
127
129
  */
128
130
  billable_metric_id?: string;
129
131
  /**
130
- * An array of strings, representing a way to filter the credit grant this alert
131
- * applies to, by looking at the credit_grant_type field on the credit grant. This
132
- * field is only defined for CreditPercentage and CreditBalance alerts
132
+ * An array of strings, representing a way to filter the credit grant this
133
+ * threshold notification applies to, by looking at the credit_grant_type field on
134
+ * the credit grant. This field is only defined for CreditPercentage and
135
+ * CreditBalance notifications
133
136
  */
134
137
  credit_grant_type_filters?: Array<string>;
135
138
  /**
136
- * ID of the credit's currency, defaults to USD. If the specific alert type
139
+ * ID of the credit's currency, defaults to USD. If the specific notification type
137
140
  * requires a pricing unit/currency, find the ID in the
138
141
  * [Metronome app](https://app.metronome.com/offering/pricing-units).
139
142
  */
140
143
  credit_type_id?: string;
141
144
  /**
142
- * A list of custom field filters for alert types that support advanced filtering.
143
- * Only present for contract invoices.
145
+ * A list of custom field filters for threshold notification types that support
146
+ * advanced filtering. Only present for contract invoices.
144
147
  */
145
148
  custom_field_filters?: Array<AlertCreateParams.CustomFieldFilter>;
146
149
  /**
147
- * If provided, will create this alert for this specific customer. To create an
148
- * alert for all customers, do not specify a `customer_id`.
150
+ * If provided, will create this threshold notification for this specific customer.
151
+ * To create a notification for all customers, do not specify a `customer_id`.
149
152
  */
150
153
  customer_id?: string;
151
154
  /**
152
- * If true, the alert will evaluate immediately on customers that already meet the
153
- * alert threshold. If false, it will only evaluate on future customers that
154
- * trigger the alert threshold. Defaults to true.
155
+ * If true, the threshold notification will evaluate immediately on customers that
156
+ * already meet the notification threshold. If false, it will only evaluate on
157
+ * future customers that trigger the threshold. Defaults to true.
155
158
  */
156
159
  evaluate_on_create?: boolean;
157
160
  /**
158
- * Only present for `spend_threshold_reached` alerts. Scope alert to a specific
159
- * group key on individual line items.
161
+ * Only present for `spend_threshold_reached` notifications. Scope notification to
162
+ * a specific group key on individual line items.
160
163
  */
161
164
  group_values?: Array<AlertCreateParams.GroupValue>;
162
165
  /**
163
- * Only supported for invoice_total_reached alerts. A list of invoice types to
164
- * evaluate.
166
+ * Only supported for invoice_total_reached threshold notifications. A list of
167
+ * invoice types to evaluate.
165
168
  */
166
169
  invoice_types_filter?: Array<string>;
167
170
  /**
168
- * If provided, will create this alert for this specific plan. To create an alert
169
- * for all customers, do not specify a `plan_id`.
171
+ * If provided, will create this threshold notification for this specific plan. To
172
+ * create a notification for all customers, do not specify a `plan_id`.
170
173
  */
171
174
  plan_id?: string;
172
175
  /**
@@ -189,11 +192,12 @@ export declare namespace AlertCreateParams {
189
192
  }
190
193
  export interface AlertArchiveParams {
191
194
  /**
192
- * The Metronome ID of the alert
195
+ * The Metronome ID of the threshold notification
193
196
  */
194
197
  id: string;
195
198
  /**
196
- * If true, resets the uniqueness key on this alert so it can be re-used
199
+ * If true, resets the uniqueness key on this threshold notification so it can be
200
+ * re-used
197
201
  */
198
202
  release_uniqueness_key?: boolean;
199
203
  }
@@ -1 +1 @@
1
- {"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../../src/resources/v1/alerts.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0DG;IACH,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;IAI1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,OAAO,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,oBAAoB,CAAC;CAG9F;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IAC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AC/C,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;CACH"}
@@ -5,16 +5,15 @@ exports.Alerts = void 0;
5
5
  const resource_1 = require("../../core/resource.js");
6
6
  class Alerts extends resource_1.APIResource {
7
7
  /**
8
- * Create a new alert to monitor customer spending, balances, and billing metrics
9
- * in real-time. Metronome's alert system provides industry-leading speed with
10
- * immediate evaluation capabilities, enabling you to proactively manage customer
11
- * accounts and prevent revenue leakage.
8
+ * Create a new threshold notification to monitor customer spending, balances, and
9
+ * billing metrics in real-time. Metronome's notification system provides
10
+ * industry-leading speed with immediate evaluation capabilities, enabling you to
11
+ * proactively manage customer accounts and prevent revenue leakage.
12
12
  *
13
- * This endpoint creates configurable alerts that continuously monitor various
14
- * billing thresholds including spend limits, credit balances, commitment
15
- * utilization, and invoice totals. Alerts can be configured globally for all
16
- * customers or targeted to specific customer accounts. Custom fields can be used
17
- * on certain alert types to further target alerts to groups of customers.
13
+ * This endpoint creates configurable threshold notifications that continuously
14
+ * monitor various billing thresholds including spend limits, credit balances,
15
+ * commitment utilization, and invoice totals. Threshold notifications can be
16
+ * configured globally for all customers or targeted to specific customer accounts.
18
17
  *
19
18
  * ### Use this endpoint to:
20
19
  *
@@ -30,26 +29,27 @@ class Alerts extends resource_1.APIResource {
30
29
  *
31
30
  * A successful response returns a CustomerAlert object containing:
32
31
  *
33
- * - The alert configuration with its unique ID and current status
32
+ * - The threshold notification configuration with its unique ID and current status
34
33
  * - The customer's evaluation status (ok, in_alarm, or evaluating)
35
- * - Alert metadata including type, threshold values, and update timestamps
34
+ * - Threshold notification metadata including type, threshold values, and update
35
+ * timestamps
36
36
  *
37
37
  * ### Usage guidelines:
38
38
  *
39
39
  * - Immediate evaluation: Set `evaluate_on_create` : `true` (default) for instant
40
40
  * evaluation against existing customers
41
- * - Uniqueness constraints: Each alert must have a unique `uniqueness_key` within
42
- * your organization. Use `release_uniqueness_key` : `true` when archiving to
43
- * reuse keys
44
- * - Alert type requirements: Different alert types require specific fields (e.g.,
45
- * `billable_metric_id` for usage alerts, `credit_type_id` for credit-based
46
- * alerts)
47
- * - Webhook delivery: Alerts trigger webhook notifications for real-time
48
- * integration with your systems. Configure webhook endpoints before creating
49
- * alerts
50
- * - Performance at scale: Metronome's event-driven architecture processes alert
51
- * evaluations in real-time as usage events stream in, unlike competitors who
52
- * rely on periodic polling or batch evaluation cycles
41
+ * - Uniqueness constraints: Each threshold notification must have a unique
42
+ * `uniqueness_key` within your organization. Use `release_uniqueness_key` :
43
+ * `true` when archiving to reuse keys
44
+ * - Notification type requirements: Different threshold notification types require
45
+ * specific fields (e.g., `billable_metric_id` for usage notifications,
46
+ * `credit_type_id` for credit-based threshold notifications)
47
+ * - Webhook delivery: Threshold notifications trigger webhook notifications for
48
+ * real-time integration with your systems. Configure webhook endpoints before
49
+ * creating threshold notifications
50
+ * - Performance at scale: Metronome's event-driven architecture processes
51
+ * threshold notification evaluations in real-time as usage events stream in,
52
+ * unlike competitors who rely on periodic polling or batch evaluation cycles
53
53
  *
54
54
  * @example
55
55
  * ```ts
@@ -67,33 +67,34 @@ class Alerts extends resource_1.APIResource {
67
67
  return this._client.post('/v1/alerts/create', { body, ...options });
68
68
  }
69
69
  /**
70
- * Permanently disable an alert and remove it from active monitoring across all
71
- * customers. Archived alerts stop evaluating immediately and can optionally
72
- * release their uniqueness key for reuse in future alert configurations.
70
+ * Permanently disable a threshold notification and remove it from active
71
+ * monitoring across all customers. Archived threshold notifications stop
72
+ * evaluating immediately and can optionally release their uniqueness key for reuse
73
+ * in future threshold notification configurations.
73
74
  *
74
75
  * ### Use this endpoint to:
75
76
  *
76
- * - Decommission alerts that are no longer needed
77
- * - Clean up test or deprecated alert configurations
78
- * - Free up uniqueness keys for reuse with new alerts
79
- * - Stop alert evaluations without losing historical configuration data
77
+ * - Decommission threshold notifications that are no longer needed
78
+ * - Clean up test or deprecated threshold notification configurations
79
+ * - Free up uniqueness keys for reuse with new threshold notifications
80
+ * - Stop threshold notification evaluations without losing historical
81
+ * configuration data
80
82
  * - Disable outdated monitoring rules during pricing model transitions
81
83
  *
82
84
  * ### Key response fields:
83
85
  *
84
- * - data: Object containing the archived alert's ID
85
- * - Alert evaluation stops immediately for all affected customers
86
- * - Historical alert data and configurations remain accessible for audit purposes
86
+ * - data: Object containing the archived threshold notification's ID
87
87
  *
88
88
  * ### Usage guidelines:
89
89
  *
90
- * - Irreversible for evaluation: Archived alerts cannot be re-enabled; create a
91
- * new alert to resume monitoring
90
+ * - Irreversible for evaluation: Archived threshold notifications cannot be
91
+ * re-enabled; create a new threshold notification to resume monitoring
92
92
  * - Uniqueness key handling: Set `release_uniqueness_key` : `true` to reuse the
93
- * key in future alerts
94
- * - Immediate effect: Alert evaluation stops instantly across all customers
95
- * - Historical preservation: Archive operation maintains alert history and
96
- * configuration for compliance and auditing
93
+ * key in future threshold notifications
94
+ * - Immediate effect: Threshold notification evaluation stops instantly across all
95
+ * customers
96
+ * - Historical preservation: Archive operation maintains threshold notification
97
+ * history and configuration for compliance and auditing
97
98
  *
98
99
  * @example
99
100
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"alerts.js","sourceRoot":"","sources":["../../src/resources/v1/alerts.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAKlD,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0DG;IACH,MAAM,CAAC,IAAuB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,OAAO,CAAC,IAAwB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;CACF;AAvGD,wBAuGC"}
1
+ {"version":3,"file":"alerts.js","sourceRoot":"","sources":["../../src/resources/v1/alerts.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAKlD,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0DG;IACH,MAAM,CAAC,IAAuB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,OAAO,CAAC,IAAwB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;CACF;AAxGD,wBAwGC"}
@@ -2,16 +2,15 @@
2
2
  import { APIResource } from "../../core/resource.mjs";
3
3
  export class Alerts extends APIResource {
4
4
  /**
5
- * Create a new alert to monitor customer spending, balances, and billing metrics
6
- * in real-time. Metronome's alert system provides industry-leading speed with
7
- * immediate evaluation capabilities, enabling you to proactively manage customer
8
- * accounts and prevent revenue leakage.
5
+ * Create a new threshold notification to monitor customer spending, balances, and
6
+ * billing metrics in real-time. Metronome's notification system provides
7
+ * industry-leading speed with immediate evaluation capabilities, enabling you to
8
+ * proactively manage customer accounts and prevent revenue leakage.
9
9
  *
10
- * This endpoint creates configurable alerts that continuously monitor various
11
- * billing thresholds including spend limits, credit balances, commitment
12
- * utilization, and invoice totals. Alerts can be configured globally for all
13
- * customers or targeted to specific customer accounts. Custom fields can be used
14
- * on certain alert types to further target alerts to groups of customers.
10
+ * This endpoint creates configurable threshold notifications that continuously
11
+ * monitor various billing thresholds including spend limits, credit balances,
12
+ * commitment utilization, and invoice totals. Threshold notifications can be
13
+ * configured globally for all customers or targeted to specific customer accounts.
15
14
  *
16
15
  * ### Use this endpoint to:
17
16
  *
@@ -27,26 +26,27 @@ export class Alerts extends APIResource {
27
26
  *
28
27
  * A successful response returns a CustomerAlert object containing:
29
28
  *
30
- * - The alert configuration with its unique ID and current status
29
+ * - The threshold notification configuration with its unique ID and current status
31
30
  * - The customer's evaluation status (ok, in_alarm, or evaluating)
32
- * - Alert metadata including type, threshold values, and update timestamps
31
+ * - Threshold notification metadata including type, threshold values, and update
32
+ * timestamps
33
33
  *
34
34
  * ### Usage guidelines:
35
35
  *
36
36
  * - Immediate evaluation: Set `evaluate_on_create` : `true` (default) for instant
37
37
  * evaluation against existing customers
38
- * - Uniqueness constraints: Each alert must have a unique `uniqueness_key` within
39
- * your organization. Use `release_uniqueness_key` : `true` when archiving to
40
- * reuse keys
41
- * - Alert type requirements: Different alert types require specific fields (e.g.,
42
- * `billable_metric_id` for usage alerts, `credit_type_id` for credit-based
43
- * alerts)
44
- * - Webhook delivery: Alerts trigger webhook notifications for real-time
45
- * integration with your systems. Configure webhook endpoints before creating
46
- * alerts
47
- * - Performance at scale: Metronome's event-driven architecture processes alert
48
- * evaluations in real-time as usage events stream in, unlike competitors who
49
- * rely on periodic polling or batch evaluation cycles
38
+ * - Uniqueness constraints: Each threshold notification must have a unique
39
+ * `uniqueness_key` within your organization. Use `release_uniqueness_key` :
40
+ * `true` when archiving to reuse keys
41
+ * - Notification type requirements: Different threshold notification types require
42
+ * specific fields (e.g., `billable_metric_id` for usage notifications,
43
+ * `credit_type_id` for credit-based threshold notifications)
44
+ * - Webhook delivery: Threshold notifications trigger webhook notifications for
45
+ * real-time integration with your systems. Configure webhook endpoints before
46
+ * creating threshold notifications
47
+ * - Performance at scale: Metronome's event-driven architecture processes
48
+ * threshold notification evaluations in real-time as usage events stream in,
49
+ * unlike competitors who rely on periodic polling or batch evaluation cycles
50
50
  *
51
51
  * @example
52
52
  * ```ts
@@ -64,33 +64,34 @@ export class Alerts extends APIResource {
64
64
  return this._client.post('/v1/alerts/create', { body, ...options });
65
65
  }
66
66
  /**
67
- * Permanently disable an alert and remove it from active monitoring across all
68
- * customers. Archived alerts stop evaluating immediately and can optionally
69
- * release their uniqueness key for reuse in future alert configurations.
67
+ * Permanently disable a threshold notification and remove it from active
68
+ * monitoring across all customers. Archived threshold notifications stop
69
+ * evaluating immediately and can optionally release their uniqueness key for reuse
70
+ * in future threshold notification configurations.
70
71
  *
71
72
  * ### Use this endpoint to:
72
73
  *
73
- * - Decommission alerts that are no longer needed
74
- * - Clean up test or deprecated alert configurations
75
- * - Free up uniqueness keys for reuse with new alerts
76
- * - Stop alert evaluations without losing historical configuration data
74
+ * - Decommission threshold notifications that are no longer needed
75
+ * - Clean up test or deprecated threshold notification configurations
76
+ * - Free up uniqueness keys for reuse with new threshold notifications
77
+ * - Stop threshold notification evaluations without losing historical
78
+ * configuration data
77
79
  * - Disable outdated monitoring rules during pricing model transitions
78
80
  *
79
81
  * ### Key response fields:
80
82
  *
81
- * - data: Object containing the archived alert's ID
82
- * - Alert evaluation stops immediately for all affected customers
83
- * - Historical alert data and configurations remain accessible for audit purposes
83
+ * - data: Object containing the archived threshold notification's ID
84
84
  *
85
85
  * ### Usage guidelines:
86
86
  *
87
- * - Irreversible for evaluation: Archived alerts cannot be re-enabled; create a
88
- * new alert to resume monitoring
87
+ * - Irreversible for evaluation: Archived threshold notifications cannot be
88
+ * re-enabled; create a new threshold notification to resume monitoring
89
89
  * - Uniqueness key handling: Set `release_uniqueness_key` : `true` to reuse the
90
- * key in future alerts
91
- * - Immediate effect: Alert evaluation stops instantly across all customers
92
- * - Historical preservation: Archive operation maintains alert history and
93
- * configuration for compliance and auditing
90
+ * key in future threshold notifications
91
+ * - Immediate effect: Threshold notification evaluation stops instantly across all
92
+ * customers
93
+ * - Historical preservation: Archive operation maintains threshold notification
94
+ * history and configuration for compliance and auditing
94
95
  *
95
96
  * @example
96
97
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"alerts.mjs","sourceRoot":"","sources":["../../src/resources/v1/alerts.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAKtB,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0DG;IACH,MAAM,CAAC,IAAuB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,OAAO,CAAC,IAAwB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;CACF"}
1
+ {"version":3,"file":"alerts.mjs","sourceRoot":"","sources":["../../src/resources/v1/alerts.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAKtB,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0DG;IACH,MAAM,CAAC,IAAuB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,OAAO,CAAC,IAAwB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;CACF"}
@@ -462,11 +462,12 @@ export declare class Contracts extends APIResource {
462
462
  */
463
463
  setUsageFilter(body: ContractSetUsageFilterParams, options?: RequestOptions): APIPromise<void>;
464
464
  /**
465
- * Update or and an end date to a contract. Ending a contract early will impact
465
+ * Update or add an end date to a contract. Ending a contract early will impact
466
466
  * draft usage statements, truncate any terms, and remove upcoming scheduled
467
467
  * invoices. Moving the date into the future will only extend the contract length.
468
- * Terms and scheduled invoices are not extended. Use this if a contract's end date
469
- * has changed or if a perpetual contract ends.
468
+ * Terms and scheduled invoices are not extended. In-advance subscriptions will not
469
+ * be extended. Use this if a contract's end date has changed or if a perpetual
470
+ * contract ends.
470
471
  *
471
472
  * @example
472
473
  * ```ts
@@ -897,7 +898,7 @@ export declare namespace ContractCreateParams {
897
898
  * not wish Metronome to calculate tax on your behalf. Leaving this field blank
898
899
  * will default to NONE.
899
900
  */
900
- tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
901
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'AVALARA' | 'PRECALCULATED';
901
902
  }
902
903
  namespace PaymentGateConfig {
903
904
  /**
@@ -1130,13 +1131,34 @@ export declare namespace ContractCreateParams {
1130
1131
  }
1131
1132
  }
1132
1133
  interface HierarchyConfiguration {
1133
- parent: HierarchyConfiguration.Parent;
1134
+ parent?: HierarchyConfiguration.Parent;
1135
+ parent_behavior?: HierarchyConfiguration.ParentBehavior;
1136
+ /**
1137
+ * Indicates whether the parent should pay for the child's invoice charges
1138
+ */
1139
+ payer?: 'SELF' | 'PARENT';
1140
+ /**
1141
+ * Indicates the behavior of the child's invoice statements on the parent's
1142
+ * invoices **CONSOLIDATE**: Child's invoice statements will be added to parent's
1143
+ * consolidated invoices **SEPARATE**: Child's invoice statements will appear not
1144
+ * appear on parent's consolidated invoices
1145
+ */
1146
+ usage_statement_behavior?: 'CONSOLIDATE' | 'SEPARATE';
1134
1147
  }
1135
1148
  namespace HierarchyConfiguration {
1136
1149
  interface Parent {
1137
1150
  contract_id: string;
1138
1151
  customer_id: string;
1139
1152
  }
1153
+ interface ParentBehavior {
1154
+ /**
1155
+ * Indicates the desired behavior of consolidated invoices generated by the parent
1156
+ * in a customer hierarchy **CONCATENATE**: Statements on the invoices of child
1157
+ * customers will be appended to the consolidated invoice **NONE**: Do not generate
1158
+ * consolidated invoices
1159
+ */
1160
+ invoice_consolidation_type?: 'CONCATENATE' | 'NONE';
1161
+ }
1140
1162
  }
1141
1163
  interface Override {
1142
1164
  /**
@@ -2177,7 +2199,7 @@ export declare namespace ContractAmendParams {
2177
2199
  * not wish Metronome to calculate tax on your behalf. Leaving this field blank
2178
2200
  * will default to NONE.
2179
2201
  */
2180
- tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
2202
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'AVALARA' | 'PRECALCULATED';
2181
2203
  }
2182
2204
  namespace PaymentGateConfig {
2183
2205
  /**