@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.
- package/CHANGELOG.md +65 -0
- package/bin/cli +5 -12
- package/internal/to-file.d.mts +1 -1
- package/internal/to-file.d.ts +1 -1
- package/internal/to-file.js +1 -1
- package/internal/to-file.mjs +1 -1
- package/package.json +1 -1
- package/resources/shared.d.mts +129 -5
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +129 -5
- package/resources/shared.d.ts.map +1 -1
- package/resources/v1/alerts.d.mts +68 -64
- package/resources/v1/alerts.d.mts.map +1 -1
- package/resources/v1/alerts.d.ts +68 -64
- package/resources/v1/alerts.d.ts.map +1 -1
- package/resources/v1/alerts.js +40 -39
- package/resources/v1/alerts.js.map +1 -1
- package/resources/v1/alerts.mjs +40 -39
- package/resources/v1/alerts.mjs.map +1 -1
- package/resources/v1/contracts/contracts.d.mts +28 -6
- package/resources/v1/contracts/contracts.d.mts.map +1 -1
- package/resources/v1/contracts/contracts.d.ts +28 -6
- package/resources/v1/contracts/contracts.d.ts.map +1 -1
- package/resources/v1/contracts/contracts.js +4 -3
- package/resources/v1/contracts/contracts.js.map +1 -1
- package/resources/v1/contracts/contracts.mjs +4 -3
- package/resources/v1/contracts/contracts.mjs.map +1 -1
- package/resources/v1/customers/alerts.d.mts +98 -77
- package/resources/v1/customers/alerts.d.mts.map +1 -1
- package/resources/v1/customers/alerts.d.ts +98 -77
- package/resources/v1/customers/alerts.d.ts.map +1 -1
- package/resources/v1/customers/alerts.js +65 -46
- package/resources/v1/customers/alerts.js.map +1 -1
- package/resources/v1/customers/alerts.mjs +65 -46
- package/resources/v1/customers/alerts.mjs.map +1 -1
- package/resources/v1/customers/customers.d.mts +17 -16
- package/resources/v1/customers/customers.d.mts.map +1 -1
- package/resources/v1/customers/customers.d.ts +17 -16
- package/resources/v1/customers/customers.d.ts.map +1 -1
- package/resources/v1/customers/customers.js +7 -4
- package/resources/v1/customers/customers.js.map +1 -1
- package/resources/v1/customers/customers.mjs +7 -4
- package/resources/v1/customers/customers.mjs.map +1 -1
- package/resources/v1/customers/index.d.mts +1 -1
- package/resources/v1/customers/index.d.mts.map +1 -1
- package/resources/v1/customers/index.d.ts +1 -1
- package/resources/v1/customers/index.d.ts.map +1 -1
- package/resources/v1/customers/index.js.map +1 -1
- package/resources/v1/customers/index.mjs.map +1 -1
- package/resources/v1/customers/invoices.d.mts +117 -2
- package/resources/v1/customers/invoices.d.mts.map +1 -1
- package/resources/v1/customers/invoices.d.ts +117 -2
- package/resources/v1/customers/invoices.d.ts.map +1 -1
- package/resources/v1/customers/invoices.js +49 -0
- package/resources/v1/customers/invoices.js.map +1 -1
- package/resources/v1/customers/invoices.mjs +49 -0
- package/resources/v1/customers/invoices.mjs.map +1 -1
- package/resources/v1/index.d.mts +1 -0
- package/resources/v1/index.d.mts.map +1 -1
- package/resources/v1/index.d.ts +1 -0
- package/resources/v1/index.d.ts.map +1 -1
- package/resources/v1/index.js +3 -1
- package/resources/v1/index.js.map +1 -1
- package/resources/v1/index.mjs +1 -0
- package/resources/v1/index.mjs.map +1 -1
- package/resources/v1/payments.d.mts +116 -0
- package/resources/v1/payments.d.mts.map +1 -0
- package/resources/v1/payments.d.ts +116 -0
- package/resources/v1/payments.d.ts.map +1 -0
- package/resources/v1/payments.js +71 -0
- package/resources/v1/payments.js.map +1 -0
- package/resources/v1/payments.mjs +67 -0
- package/resources/v1/payments.mjs.map +1 -0
- package/resources/v1/usage.d.mts +4 -2
- package/resources/v1/usage.d.mts.map +1 -1
- package/resources/v1/usage.d.ts +4 -2
- package/resources/v1/usage.d.ts.map +1 -1
- package/resources/v1/usage.js +4 -2
- package/resources/v1/usage.js.map +1 -1
- package/resources/v1/usage.mjs +4 -2
- package/resources/v1/usage.mjs.map +1 -1
- package/resources/v1/v1.d.mts +4 -0
- package/resources/v1/v1.d.mts.map +1 -1
- package/resources/v1/v1.d.ts +4 -0
- package/resources/v1/v1.d.ts.map +1 -1
- package/resources/v1/v1.js +4 -0
- package/resources/v1/v1.js.map +1 -1
- package/resources/v1/v1.mjs +4 -0
- package/resources/v1/v1.mjs.map +1 -1
- package/resources/v2/contracts.d.mts +109 -3
- package/resources/v2/contracts.d.mts.map +1 -1
- package/resources/v2/contracts.d.ts +109 -3
- package/resources/v2/contracts.d.ts.map +1 -1
- package/src/internal/to-file.ts +1 -1
- package/src/resources/shared.ts +160 -5
- package/src/resources/v1/alerts.ts +68 -64
- package/src/resources/v1/contracts/contracts.ts +32 -6
- package/src/resources/v1/customers/alerts.ts +98 -77
- package/src/resources/v1/customers/customers.ts +18 -15
- package/src/resources/v1/customers/index.ts +1 -0
- package/src/resources/v1/customers/invoices.ts +142 -1
- package/src/resources/v1/index.ts +11 -0
- package/src/resources/v1/payments.ts +170 -0
- package/src/resources/v1/usage.ts +4 -2
- package/src/resources/v1/v1.ts +26 -0
- package/src/resources/v2/contracts.ts +144 -3
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -5,17 +5,26 @@ import { CursorPageWithoutLimit, type CursorPageWithoutLimitParams, PagePromise
|
|
|
5
5
|
import { RequestOptions } from "../../../internal/request-options.js";
|
|
6
6
|
export declare class Alerts extends APIResource {
|
|
7
7
|
/**
|
|
8
|
-
* Retrieve the real-time evaluation status for a specific
|
|
9
|
-
* This endpoint provides instant visibility into
|
|
10
|
-
*
|
|
11
|
-
* action based on current
|
|
8
|
+
* Retrieve the real-time evaluation status for a specific threshold
|
|
9
|
+
* notification-customer pair. This endpoint provides instant visibility into
|
|
10
|
+
* whether a customer has triggered a threshold notification condition, enabling
|
|
11
|
+
* you to monitor account health and take proactive action based on current
|
|
12
|
+
* threshold notification states.
|
|
12
13
|
*
|
|
13
14
|
* ### Use this endpoint to:
|
|
14
15
|
*
|
|
15
|
-
* - Check if a specific customer is currently violating an
|
|
16
|
+
* - Check if a specific customer is currently violating an threshold notification
|
|
16
17
|
* (`in_alarm` status)
|
|
17
|
-
* - Verify
|
|
18
|
-
*
|
|
18
|
+
* - Verify threshold notification configuration details and threshold values for a
|
|
19
|
+
* customer
|
|
20
|
+
* - Monitor the evaluation state of newly created or recently modified threshold
|
|
21
|
+
* notification
|
|
22
|
+
* - Build dashboards or automated workflows that respond to specific threshold
|
|
23
|
+
* notification conditions
|
|
24
|
+
* - Validate threshold notification behavior before deploying to production
|
|
25
|
+
* customers
|
|
26
|
+
* - Integrate threshold notification status checks into customer support tools or
|
|
27
|
+
* admin interfaces
|
|
19
28
|
*
|
|
20
29
|
* ### Key response fields:
|
|
21
30
|
*
|
|
@@ -24,29 +33,32 @@ export declare class Alerts extends APIResource {
|
|
|
24
33
|
* - `customer_status`: The current evaluation state
|
|
25
34
|
*
|
|
26
35
|
* - `ok` - Customer is within acceptable thresholds
|
|
27
|
-
* - `in_alarm
|
|
28
|
-
* - `evaluating` -
|
|
29
|
-
*
|
|
30
|
-
* - `null` -
|
|
31
|
-
* - `triggered_by`: Additional context about what caused the
|
|
32
|
-
* (when applicable)
|
|
33
|
-
* - alert: Complete
|
|
34
|
-
* -
|
|
36
|
+
* - `in_alarm` - Customer has breached the threshold for the notification
|
|
37
|
+
* - `evaluating` - Notification is currently being evaluated (typically during
|
|
38
|
+
* initial setup)
|
|
39
|
+
* - `null` - Notification has been archived
|
|
40
|
+
* - `triggered_by`: Additional context about what caused the notification to
|
|
41
|
+
* trigger (when applicable)
|
|
42
|
+
* - alert: Complete threshold notification configuration including:
|
|
43
|
+
* - Notification ID, name, and type
|
|
35
44
|
* - Current threshold values and credit type information
|
|
36
|
-
* -
|
|
45
|
+
* - Notification status (enabled, disabled, or archived)
|
|
37
46
|
* - Last update timestamp
|
|
38
47
|
* - Any applied filters (credit grant types, custom fields, group values)
|
|
39
48
|
*
|
|
40
49
|
* ### Usage guidelines:
|
|
41
50
|
*
|
|
42
51
|
* - Customer status: Returns the current evaluation state, not historical data.
|
|
43
|
-
* For
|
|
44
|
-
* -
|
|
45
|
-
*
|
|
46
|
-
* -
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
52
|
+
* For threshold notification history, use webhook notifications or event logs
|
|
53
|
+
* - Required parameters: Both customer_id and alert_id must be valid UUIDs that
|
|
54
|
+
* exist in your organization
|
|
55
|
+
* - Archived notifications: Returns null for customer_status if the notification
|
|
56
|
+
* has been archived, but still includes the notification configuration details
|
|
57
|
+
* - Performance considerations: This endpoint queries live evaluation state,
|
|
58
|
+
* making it ideal for real-time monitoring but not for bulk status checks
|
|
59
|
+
* - Integration patterns: Best used for on-demand status checks in response to
|
|
60
|
+
* user actions or as part of targeted monitoring workflows
|
|
61
|
+
* - Error handling: Returns 404 if either the customer or alert_id doesn't exist
|
|
50
62
|
* or isn't accessible to your organization
|
|
51
63
|
*
|
|
52
64
|
* @example
|
|
@@ -59,31 +71,37 @@ export declare class Alerts extends APIResource {
|
|
|
59
71
|
*/
|
|
60
72
|
retrieve(body: AlertRetrieveParams, options?: RequestOptions): APIPromise<AlertRetrieveResponse>;
|
|
61
73
|
/**
|
|
62
|
-
* Retrieve all
|
|
63
|
-
* customer in a single API call. This endpoint provides a
|
|
64
|
-
* all
|
|
74
|
+
* Retrieve all threshold notification configurations and their current statuses
|
|
75
|
+
* for a specific customer in a single API call. This endpoint provides a
|
|
76
|
+
* comprehensive view of all threshold notification monitoring a customer account.
|
|
65
77
|
*
|
|
66
78
|
* ### Use this endpoint to:
|
|
67
79
|
*
|
|
68
|
-
* - Display all active
|
|
69
|
-
*
|
|
70
|
-
* -
|
|
71
|
-
*
|
|
80
|
+
* - Display all active threshold notifications for a customer in dashboards or
|
|
81
|
+
* admin panels
|
|
82
|
+
* - Quickly identify which threshold notifications a customer is currently
|
|
83
|
+
* triggering
|
|
84
|
+
* - Audit threshold notification coverage for specific accounts
|
|
85
|
+
* - Filter threshold notifications by status (enabled, disabled, or archived)
|
|
72
86
|
*
|
|
73
87
|
* ### Key response fields:
|
|
74
88
|
*
|
|
75
89
|
* - data: Array of CustomerAlert objects, each containing:
|
|
76
90
|
* - Current evaluation status (`ok`, `in_alarm`, `evaluating`, or `null`)
|
|
77
|
-
* - Complete
|
|
78
|
-
* -
|
|
79
|
-
* -
|
|
91
|
+
* - Complete threshold notification configuration and threshold details
|
|
92
|
+
* - Threshold notification metadata including type, name, and last update time
|
|
93
|
+
* - next_page: Pagination cursor for retrieving additional results
|
|
80
94
|
*
|
|
81
95
|
* ### Usage guidelines:
|
|
82
96
|
*
|
|
83
|
-
* - Default behavior: Returns only enabled
|
|
84
|
-
* specified
|
|
97
|
+
* - Default behavior: Returns only enabled threshold notifications unless
|
|
98
|
+
* `alert_statuses` filter is specified
|
|
85
99
|
* - Pagination: Use the `next_page` cursor to retrieve all results for customers
|
|
86
|
-
* with many
|
|
100
|
+
* with many notifications
|
|
101
|
+
* - Performance: Efficiently retrieves multiple threshold notification statuses in
|
|
102
|
+
* a single request instead of making individual calls
|
|
103
|
+
* - Filtering: Pass the `alert_statuses` array to include disabled or archived
|
|
104
|
+
* threshold notifications in results
|
|
87
105
|
*
|
|
88
106
|
* @example
|
|
89
107
|
* ```ts
|
|
@@ -97,23 +115,24 @@ export declare class Alerts extends APIResource {
|
|
|
97
115
|
*/
|
|
98
116
|
list(params: AlertListParams, options?: RequestOptions): PagePromise<CustomerAlertsCursorPageWithoutLimit, CustomerAlert>;
|
|
99
117
|
/**
|
|
100
|
-
* Force an immediate re-evaluation of a specific
|
|
101
|
-
* any previous state and triggering a fresh assessment against
|
|
102
|
-
* This endpoint ensures
|
|
103
|
-
* corrections.
|
|
118
|
+
* Force an immediate re-evaluation of a specific threshold notification for a
|
|
119
|
+
* customer, clearing any previous state and triggering a fresh assessment against
|
|
120
|
+
* current thresholds. This endpoint ensures threshold notification accuracy after
|
|
121
|
+
* configuration changes or data corrections.
|
|
104
122
|
*
|
|
105
123
|
* ### Use this endpoint to:
|
|
106
124
|
*
|
|
107
|
-
* - Clear false positive
|
|
108
|
-
* - Re-evaluate
|
|
109
|
-
*
|
|
110
|
-
* -
|
|
125
|
+
* - Clear false positive threshold notifications after fixing data issues
|
|
126
|
+
* - Re-evaluate threshold notifications after adjusting customer balances or
|
|
127
|
+
* credits
|
|
128
|
+
* - Test threshold notification behavior during development and debugging
|
|
129
|
+
* - Resolve stuck threshold notification that may be in an incorrect state
|
|
111
130
|
* - Trigger immediate evaluation after threshold modifications
|
|
112
131
|
*
|
|
113
132
|
* ### Key response fields:
|
|
114
133
|
*
|
|
115
|
-
* - 200 Success: Confirmation that the
|
|
116
|
-
* initiated
|
|
134
|
+
* - 200 Success: Confirmation that the threshold notification has been reset and
|
|
135
|
+
* re-evaluation initiated
|
|
117
136
|
* - No response body is returned - the operation completes asynchronously
|
|
118
137
|
*
|
|
119
138
|
* ### Usage guidelines:
|
|
@@ -140,65 +159,67 @@ export type CustomerAlertsCursorPageWithoutLimit = CursorPageWithoutLimit<Custom
|
|
|
140
159
|
export interface CustomerAlert {
|
|
141
160
|
alert: CustomerAlert.Alert;
|
|
142
161
|
/**
|
|
143
|
-
* The status of the
|
|
144
|
-
* returned.
|
|
162
|
+
* The status of the threshold notification. If the notification is archived, null
|
|
163
|
+
* will be returned.
|
|
145
164
|
*/
|
|
146
165
|
customer_status: 'ok' | 'in_alarm' | 'evaluating' | null;
|
|
147
166
|
/**
|
|
148
|
-
* If present, indicates the reason the
|
|
167
|
+
* If present, indicates the reason the threshold notification was triggered.
|
|
149
168
|
*/
|
|
150
169
|
triggered_by?: string | null;
|
|
151
170
|
}
|
|
152
171
|
export declare namespace CustomerAlert {
|
|
153
172
|
interface Alert {
|
|
154
173
|
/**
|
|
155
|
-
* the Metronome ID of the
|
|
174
|
+
* the Metronome ID of the threshold notification
|
|
156
175
|
*/
|
|
157
176
|
id: string;
|
|
158
177
|
/**
|
|
159
|
-
* Name of the
|
|
178
|
+
* Name of the threshold notification
|
|
160
179
|
*/
|
|
161
180
|
name: string;
|
|
162
181
|
/**
|
|
163
|
-
* Status of the
|
|
182
|
+
* Status of the threshold notification
|
|
164
183
|
*/
|
|
165
184
|
status: 'enabled' | 'archived' | 'disabled';
|
|
166
185
|
/**
|
|
167
|
-
* Threshold value of the
|
|
186
|
+
* Threshold value of the notification policy
|
|
168
187
|
*/
|
|
169
188
|
threshold: number;
|
|
170
189
|
/**
|
|
171
|
-
* Type of the
|
|
190
|
+
* Type of the threshold notification
|
|
172
191
|
*/
|
|
173
192
|
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';
|
|
174
193
|
/**
|
|
175
|
-
* Timestamp for when the
|
|
194
|
+
* Timestamp for when the threshold notification was last updated
|
|
176
195
|
*/
|
|
177
196
|
updated_at: string;
|
|
178
197
|
/**
|
|
179
|
-
* An array of strings, representing a way to filter the credit grant this
|
|
180
|
-
* applies to, by looking at the credit_grant_type field on
|
|
181
|
-
* field is only defined for CreditPercentage and
|
|
198
|
+
* An array of strings, representing a way to filter the credit grant this
|
|
199
|
+
* threshold notification applies to, by looking at the credit_grant_type field on
|
|
200
|
+
* the credit grant. This field is only defined for CreditPercentage and
|
|
201
|
+
* CreditBalance notifications
|
|
182
202
|
*/
|
|
183
203
|
credit_grant_type_filters?: Array<string>;
|
|
184
204
|
credit_type?: Shared.CreditTypeData | null;
|
|
185
205
|
/**
|
|
186
|
-
* A list of custom field filters for
|
|
206
|
+
* A list of custom field filters for notification types that support advanced
|
|
207
|
+
* filtering
|
|
187
208
|
*/
|
|
188
209
|
custom_field_filters?: Array<Alert.CustomFieldFilter>;
|
|
189
210
|
/**
|
|
190
|
-
* Scopes
|
|
191
|
-
* items. Only present for spend
|
|
211
|
+
* Scopes threshold notification evaluation to a specific presentation group key on
|
|
212
|
+
* individual line items. Only present for spend notifications.
|
|
192
213
|
*/
|
|
193
214
|
group_key_filter?: Alert.GroupKeyFilter;
|
|
194
215
|
/**
|
|
195
|
-
* Only present for `spend_threshold_reached`
|
|
196
|
-
* group key on individual line items.
|
|
216
|
+
* Only present for `spend_threshold_reached` notifications. Scope notification to
|
|
217
|
+
* a specific group key on individual line items.
|
|
197
218
|
*/
|
|
198
219
|
group_values?: Array<Alert.GroupValue>;
|
|
199
220
|
/**
|
|
200
|
-
* Only supported for invoice_total_reached
|
|
201
|
-
* evaluate.
|
|
221
|
+
* Only supported for invoice_total_reached threshold notifications. A list of
|
|
222
|
+
* invoice types to evaluate.
|
|
202
223
|
*/
|
|
203
224
|
invoice_types_filter?: Array<string>;
|
|
204
225
|
/**
|
|
@@ -215,8 +236,8 @@ export declare namespace CustomerAlert {
|
|
|
215
236
|
value: string;
|
|
216
237
|
}
|
|
217
238
|
/**
|
|
218
|
-
* Scopes
|
|
219
|
-
* items. Only present for spend
|
|
239
|
+
* Scopes threshold notification evaluation to a specific presentation group key on
|
|
240
|
+
* individual line items. Only present for spend notifications.
|
|
220
241
|
*/
|
|
221
242
|
interface GroupKeyFilter {
|
|
222
243
|
key: string;
|
|
@@ -233,7 +254,7 @@ export interface AlertRetrieveResponse {
|
|
|
233
254
|
}
|
|
234
255
|
export interface AlertRetrieveParams {
|
|
235
256
|
/**
|
|
236
|
-
* The Metronome ID of the
|
|
257
|
+
* The Metronome ID of the threshold notification
|
|
237
258
|
*/
|
|
238
259
|
alert_id: string;
|
|
239
260
|
/**
|
|
@@ -241,20 +262,20 @@ export interface AlertRetrieveParams {
|
|
|
241
262
|
*/
|
|
242
263
|
customer_id: string;
|
|
243
264
|
/**
|
|
244
|
-
* Only present for `spend_threshold_reached`
|
|
245
|
-
* specific group key-value pair.
|
|
265
|
+
* Only present for `spend_threshold_reached` notifications. Retrieve the
|
|
266
|
+
* notification for a specific group key-value pair.
|
|
246
267
|
*/
|
|
247
268
|
group_values?: Array<AlertRetrieveParams.GroupValue>;
|
|
248
269
|
/**
|
|
249
|
-
* When parallel
|
|
250
|
-
* fetch
|
|
270
|
+
* When parallel threshold notifications are enabled during migration, this flag
|
|
271
|
+
* denotes whether to fetch notifications for plans or contracts.
|
|
251
272
|
*/
|
|
252
273
|
plans_or_contracts?: 'PLANS' | 'CONTRACTS';
|
|
253
274
|
}
|
|
254
275
|
export declare namespace AlertRetrieveParams {
|
|
255
276
|
/**
|
|
256
|
-
* Scopes
|
|
257
|
-
* items. Only present for spend
|
|
277
|
+
* Scopes threshold notification evaluation to a specific presentation group key on
|
|
278
|
+
* individual line items. Only present for spend notifications.
|
|
258
279
|
*/
|
|
259
280
|
interface GroupValue {
|
|
260
281
|
key: string;
|
|
@@ -267,14 +288,14 @@ export interface AlertListParams extends CursorPageWithoutLimitParams {
|
|
|
267
288
|
*/
|
|
268
289
|
customer_id: string;
|
|
269
290
|
/**
|
|
270
|
-
* Body param: Optionally filter by
|
|
271
|
-
* will be returned.
|
|
291
|
+
* Body param: Optionally filter by threshold notification status. If absent, only
|
|
292
|
+
* enabled notifications will be returned.
|
|
272
293
|
*/
|
|
273
294
|
alert_statuses?: Array<'ENABLED' | 'DISABLED' | 'ARCHIVED'>;
|
|
274
295
|
}
|
|
275
296
|
export interface AlertResetParams {
|
|
276
297
|
/**
|
|
277
|
-
* The Metronome ID of the
|
|
298
|
+
* The Metronome ID of the threshold notification
|
|
278
299
|
*/
|
|
279
300
|
alert_id: string;
|
|
280
301
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../../../src/resources/v1/customers/alerts.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EACL,sBAAsB,EACtB,KAAK,4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YACzB,GAAG,EAAE,MAAM,CAAC;YAEZ,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB;KACF;CACF;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAErD;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;CAC5C;AAED,yBAAiB,mBAAmB,CAAC;IACnC;;;OAGG;IACH,UAAiB,UAAU;QACzB,GAAG,EAAE,MAAM,CAAC;QAEZ,KAAK,EAAE,MAAM,CAAC;KACf;CACF;AAED,MAAM,WAAW,eAAgB,SAAQ,4BAA4B;IACnE;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC;CAC7D;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,oCAAoC,IAAI,oCAAoC,EACjF,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
|
|
@@ -7,17 +7,26 @@ const pagination_1 = require("../../../core/pagination.js");
|
|
|
7
7
|
const headers_1 = require("../../../internal/headers.js");
|
|
8
8
|
class Alerts extends resource_1.APIResource {
|
|
9
9
|
/**
|
|
10
|
-
* Retrieve the real-time evaluation status for a specific
|
|
11
|
-
* This endpoint provides instant visibility into
|
|
12
|
-
*
|
|
13
|
-
* action based on current
|
|
10
|
+
* Retrieve the real-time evaluation status for a specific threshold
|
|
11
|
+
* notification-customer pair. This endpoint provides instant visibility into
|
|
12
|
+
* whether a customer has triggered a threshold notification condition, enabling
|
|
13
|
+
* you to monitor account health and take proactive action based on current
|
|
14
|
+
* threshold notification states.
|
|
14
15
|
*
|
|
15
16
|
* ### Use this endpoint to:
|
|
16
17
|
*
|
|
17
|
-
* - Check if a specific customer is currently violating an
|
|
18
|
+
* - Check if a specific customer is currently violating an threshold notification
|
|
18
19
|
* (`in_alarm` status)
|
|
19
|
-
* - Verify
|
|
20
|
-
*
|
|
20
|
+
* - Verify threshold notification configuration details and threshold values for a
|
|
21
|
+
* customer
|
|
22
|
+
* - Monitor the evaluation state of newly created or recently modified threshold
|
|
23
|
+
* notification
|
|
24
|
+
* - Build dashboards or automated workflows that respond to specific threshold
|
|
25
|
+
* notification conditions
|
|
26
|
+
* - Validate threshold notification behavior before deploying to production
|
|
27
|
+
* customers
|
|
28
|
+
* - Integrate threshold notification status checks into customer support tools or
|
|
29
|
+
* admin interfaces
|
|
21
30
|
*
|
|
22
31
|
* ### Key response fields:
|
|
23
32
|
*
|
|
@@ -26,29 +35,32 @@ class Alerts extends resource_1.APIResource {
|
|
|
26
35
|
* - `customer_status`: The current evaluation state
|
|
27
36
|
*
|
|
28
37
|
* - `ok` - Customer is within acceptable thresholds
|
|
29
|
-
* - `in_alarm
|
|
30
|
-
* - `evaluating` -
|
|
31
|
-
*
|
|
32
|
-
* - `null` -
|
|
33
|
-
* - `triggered_by`: Additional context about what caused the
|
|
34
|
-
* (when applicable)
|
|
35
|
-
* - alert: Complete
|
|
36
|
-
* -
|
|
38
|
+
* - `in_alarm` - Customer has breached the threshold for the notification
|
|
39
|
+
* - `evaluating` - Notification is currently being evaluated (typically during
|
|
40
|
+
* initial setup)
|
|
41
|
+
* - `null` - Notification has been archived
|
|
42
|
+
* - `triggered_by`: Additional context about what caused the notification to
|
|
43
|
+
* trigger (when applicable)
|
|
44
|
+
* - alert: Complete threshold notification configuration including:
|
|
45
|
+
* - Notification ID, name, and type
|
|
37
46
|
* - Current threshold values and credit type information
|
|
38
|
-
* -
|
|
47
|
+
* - Notification status (enabled, disabled, or archived)
|
|
39
48
|
* - Last update timestamp
|
|
40
49
|
* - Any applied filters (credit grant types, custom fields, group values)
|
|
41
50
|
*
|
|
42
51
|
* ### Usage guidelines:
|
|
43
52
|
*
|
|
44
53
|
* - Customer status: Returns the current evaluation state, not historical data.
|
|
45
|
-
* For
|
|
46
|
-
* -
|
|
47
|
-
*
|
|
48
|
-
* -
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
54
|
+
* For threshold notification history, use webhook notifications or event logs
|
|
55
|
+
* - Required parameters: Both customer_id and alert_id must be valid UUIDs that
|
|
56
|
+
* exist in your organization
|
|
57
|
+
* - Archived notifications: Returns null for customer_status if the notification
|
|
58
|
+
* has been archived, but still includes the notification configuration details
|
|
59
|
+
* - Performance considerations: This endpoint queries live evaluation state,
|
|
60
|
+
* making it ideal for real-time monitoring but not for bulk status checks
|
|
61
|
+
* - Integration patterns: Best used for on-demand status checks in response to
|
|
62
|
+
* user actions or as part of targeted monitoring workflows
|
|
63
|
+
* - Error handling: Returns 404 if either the customer or alert_id doesn't exist
|
|
52
64
|
* or isn't accessible to your organization
|
|
53
65
|
*
|
|
54
66
|
* @example
|
|
@@ -63,31 +75,37 @@ class Alerts extends resource_1.APIResource {
|
|
|
63
75
|
return this._client.post('/v1/customer-alerts/get', { body, ...options });
|
|
64
76
|
}
|
|
65
77
|
/**
|
|
66
|
-
* Retrieve all
|
|
67
|
-
* customer in a single API call. This endpoint provides a
|
|
68
|
-
* all
|
|
78
|
+
* Retrieve all threshold notification configurations and their current statuses
|
|
79
|
+
* for a specific customer in a single API call. This endpoint provides a
|
|
80
|
+
* comprehensive view of all threshold notification monitoring a customer account.
|
|
69
81
|
*
|
|
70
82
|
* ### Use this endpoint to:
|
|
71
83
|
*
|
|
72
|
-
* - Display all active
|
|
73
|
-
*
|
|
74
|
-
* -
|
|
75
|
-
*
|
|
84
|
+
* - Display all active threshold notifications for a customer in dashboards or
|
|
85
|
+
* admin panels
|
|
86
|
+
* - Quickly identify which threshold notifications a customer is currently
|
|
87
|
+
* triggering
|
|
88
|
+
* - Audit threshold notification coverage for specific accounts
|
|
89
|
+
* - Filter threshold notifications by status (enabled, disabled, or archived)
|
|
76
90
|
*
|
|
77
91
|
* ### Key response fields:
|
|
78
92
|
*
|
|
79
93
|
* - data: Array of CustomerAlert objects, each containing:
|
|
80
94
|
* - Current evaluation status (`ok`, `in_alarm`, `evaluating`, or `null`)
|
|
81
|
-
* - Complete
|
|
82
|
-
* -
|
|
83
|
-
* -
|
|
95
|
+
* - Complete threshold notification configuration and threshold details
|
|
96
|
+
* - Threshold notification metadata including type, name, and last update time
|
|
97
|
+
* - next_page: Pagination cursor for retrieving additional results
|
|
84
98
|
*
|
|
85
99
|
* ### Usage guidelines:
|
|
86
100
|
*
|
|
87
|
-
* - Default behavior: Returns only enabled
|
|
88
|
-
* specified
|
|
101
|
+
* - Default behavior: Returns only enabled threshold notifications unless
|
|
102
|
+
* `alert_statuses` filter is specified
|
|
89
103
|
* - Pagination: Use the `next_page` cursor to retrieve all results for customers
|
|
90
|
-
* with many
|
|
104
|
+
* with many notifications
|
|
105
|
+
* - Performance: Efficiently retrieves multiple threshold notification statuses in
|
|
106
|
+
* a single request instead of making individual calls
|
|
107
|
+
* - Filtering: Pass the `alert_statuses` array to include disabled or archived
|
|
108
|
+
* threshold notifications in results
|
|
91
109
|
*
|
|
92
110
|
* @example
|
|
93
111
|
* ```ts
|
|
@@ -109,23 +127,24 @@ class Alerts extends resource_1.APIResource {
|
|
|
109
127
|
});
|
|
110
128
|
}
|
|
111
129
|
/**
|
|
112
|
-
* Force an immediate re-evaluation of a specific
|
|
113
|
-
* any previous state and triggering a fresh assessment against
|
|
114
|
-
* This endpoint ensures
|
|
115
|
-
* corrections.
|
|
130
|
+
* Force an immediate re-evaluation of a specific threshold notification for a
|
|
131
|
+
* customer, clearing any previous state and triggering a fresh assessment against
|
|
132
|
+
* current thresholds. This endpoint ensures threshold notification accuracy after
|
|
133
|
+
* configuration changes or data corrections.
|
|
116
134
|
*
|
|
117
135
|
* ### Use this endpoint to:
|
|
118
136
|
*
|
|
119
|
-
* - Clear false positive
|
|
120
|
-
* - Re-evaluate
|
|
121
|
-
*
|
|
122
|
-
* -
|
|
137
|
+
* - Clear false positive threshold notifications after fixing data issues
|
|
138
|
+
* - Re-evaluate threshold notifications after adjusting customer balances or
|
|
139
|
+
* credits
|
|
140
|
+
* - Test threshold notification behavior during development and debugging
|
|
141
|
+
* - Resolve stuck threshold notification that may be in an incorrect state
|
|
123
142
|
* - Trigger immediate evaluation after threshold modifications
|
|
124
143
|
*
|
|
125
144
|
* ### Key response fields:
|
|
126
145
|
*
|
|
127
|
-
* - 200 Success: Confirmation that the
|
|
128
|
-
* initiated
|
|
146
|
+
* - 200 Success: Confirmation that the threshold notification has been reset and
|
|
147
|
+
* re-evaluation initiated
|
|
129
148
|
* - No response body is returned - the operation completes asynchronously
|
|
130
149
|
*
|
|
131
150
|
* ### Usage guidelines:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alerts.js","sourceRoot":"","sources":["../../../src/resources/v1/customers/alerts.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAGrD,4DAIkC;AAClC,0DAAyD;AAGzD,MAAa,MAAO,SAAQ,sBAAW;IACrC
|
|
1
|
+
{"version":3,"file":"alerts.js","sourceRoot":"","sources":["../../../src/resources/v1/customers/alerts.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAGrD,4DAIkC;AAClC,0DAAyD;AAGzD,MAAa,MAAO,SAAQ,sBAAW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