33import { APIResource } from '../resource' ;
44import { isRequestOptions } from '../core' ;
55import * as Core from '../core' ;
6+ import * as Shared from './shared' ;
67import { Page , type PageParams } from '../pagination' ;
78
89export class Alerts extends APIResource {
@@ -187,7 +188,7 @@ export interface Alert {
187188 /**
188189 * The customer the alert applies to.
189190 */
190- customer : Alert . Customer | null ;
191+ customer : Shared . CustomerMinified | null ;
191192
192193 /**
193194 * Whether the alert is enabled or disabled.
@@ -207,13 +208,13 @@ export interface Alert {
207208 /**
208209 * The subscription the alert applies to.
209210 */
210- subscription : Alert . Subscription | null ;
211+ subscription : Shared . SubscriptionMinified | null ;
211212
212213 /**
213214 * The thresholds that define the conditions under which the alert will be
214215 * triggered.
215216 */
216- thresholds : Array < Alert . Threshold > | null ;
217+ thresholds : Array < Threshold > | null ;
217218
218219 /**
219220 * The type of alert. This must be a valid alert type.
@@ -233,15 +234,6 @@ export interface Alert {
233234}
234235
235236export namespace Alert {
236- /**
237- * The customer the alert applies to.
238- */
239- export interface Customer {
240- id : string ;
241-
242- external_customer_id : string | null ;
243- }
244-
245237 /**
246238 * The metric the alert applies to.
247239 */
@@ -267,26 +259,6 @@ export namespace Alert {
267259 plan_version : string ;
268260 }
269261
270- /**
271- * The subscription the alert applies to.
272- */
273- export interface Subscription {
274- id : string ;
275- }
276-
277- /**
278- * Thresholds are used to define the conditions under which an alert will be
279- * triggered.
280- */
281- export interface Threshold {
282- /**
283- * The value at which an alert will fire. For credit balance alerts, the alert will
284- * fire at or below this value. For usage and cost alerts, the alert will fire at
285- * or above this value.
286- */
287- value : number ;
288- }
289-
290262 /**
291263 * Alert status is used to determine if an alert is currently in-alert or not.
292264 */
@@ -303,26 +275,24 @@ export namespace Alert {
303275 }
304276}
305277
306- export interface AlertUpdateParams {
278+ /**
279+ * Thresholds are used to define the conditions under which an alert will be
280+ * triggered.
281+ */
282+ export interface Threshold {
307283 /**
308- * The thresholds that define the values at which the alert will be triggered.
284+ * The value at which an alert will fire. For credit balance alerts, the alert will
285+ * fire at or below this value. For usage and cost alerts, the alert will fire at
286+ * or above this value.
309287 */
310- thresholds : Array < AlertUpdateParams . Threshold > ;
288+ value : number ;
311289}
312290
313- export namespace AlertUpdateParams {
291+ export interface AlertUpdateParams {
314292 /**
315- * Thresholds are used to define the conditions under which an alert will be
316- * triggered.
293+ * The thresholds that define the values at which the alert will be triggered.
317294 */
318- export interface Threshold {
319- /**
320- * The value at which an alert will fire. For credit balance alerts, the alert will
321- * fire at or below this value. For usage and cost alerts, the alert will fire at
322- * or above this value.
323- */
324- value : number ;
325- }
295+ thresholds : Array < Threshold > ;
326296}
327297
328298export interface AlertListParams extends PageParams {
@@ -364,22 +334,7 @@ export interface AlertCreateForCustomerParams {
364334 /**
365335 * The thresholds that define the values at which the alert will be triggered.
366336 */
367- thresholds ?: Array < AlertCreateForCustomerParams . Threshold > | null ;
368- }
369-
370- export namespace AlertCreateForCustomerParams {
371- /**
372- * Thresholds are used to define the conditions under which an alert will be
373- * triggered.
374- */
375- export interface Threshold {
376- /**
377- * The value at which an alert will fire. For credit balance alerts, the alert will
378- * fire at or below this value. For usage and cost alerts, the alert will fire at
379- * or above this value.
380- */
381- value : number ;
382- }
337+ thresholds ?: Array < Threshold > | null ;
383338}
384339
385340export interface AlertCreateForExternalCustomerParams {
@@ -396,29 +351,14 @@ export interface AlertCreateForExternalCustomerParams {
396351 /**
397352 * The thresholds that define the values at which the alert will be triggered.
398353 */
399- thresholds ?: Array < AlertCreateForExternalCustomerParams . Threshold > | null ;
400- }
401-
402- export namespace AlertCreateForExternalCustomerParams {
403- /**
404- * Thresholds are used to define the conditions under which an alert will be
405- * triggered.
406- */
407- export interface Threshold {
408- /**
409- * The value at which an alert will fire. For credit balance alerts, the alert will
410- * fire at or below this value. For usage and cost alerts, the alert will fire at
411- * or above this value.
412- */
413- value : number ;
414- }
354+ thresholds ?: Array < Threshold > | null ;
415355}
416356
417357export interface AlertCreateForSubscriptionParams {
418358 /**
419359 * The thresholds that define the values at which the alert will be triggered.
420360 */
421- thresholds : Array < AlertCreateForSubscriptionParams . Threshold > ;
361+ thresholds : Array < Threshold > ;
422362
423363 /**
424364 * The type of alert to create. This must be a valid alert type.
@@ -431,21 +371,6 @@ export interface AlertCreateForSubscriptionParams {
431371 metric_id ?: string | null ;
432372}
433373
434- export namespace AlertCreateForSubscriptionParams {
435- /**
436- * Thresholds are used to define the conditions under which an alert will be
437- * triggered.
438- */
439- export interface Threshold {
440- /**
441- * The value at which an alert will fire. For credit balance alerts, the alert will
442- * fire at or below this value. For usage and cost alerts, the alert will fire at
443- * or above this value.
444- */
445- value : number ;
446- }
447- }
448-
449374export interface AlertDisableParams {
450375 /**
451376 * Used to update the status of a plan alert scoped to this subscription_id
@@ -465,6 +390,7 @@ Alerts.AlertsPage = AlertsPage;
465390export declare namespace Alerts {
466391 export {
467392 type Alert as Alert ,
393+ type Threshold as Threshold ,
468394 AlertsPage as AlertsPage ,
469395 type AlertUpdateParams as AlertUpdateParams ,
470396 type AlertListParams as AlertListParams ,
0 commit comments