// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../core/resource'; import { APIPromise } from '../../../core/api-promise'; import { RequestOptions } from '../../../internal/request-options'; export class BaseOutages extends APIResource { static override readonly _key: readonly ['radar', 'annotations', 'outages'] = Object.freeze([ 'radar', 'annotations', 'outages', ] as const); /** * Retrieves the latest Internet outages and anomalies. * * @example * ```ts * const outage = await client.radar.annotations.outages.get(); * ``` */ get( query: OutageGetParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return ( this._client.get('/radar/annotations/outages', { query, ...options }) as APIPromise<{ result: OutageGetResponse; }> )._thenUnwrap((obj) => obj.result); } /** * Retrieves the number of outages by location. * * @example * ```ts * const response = * await client.radar.annotations.outages.locations(); * ``` */ locations( query: OutageLocationsParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return ( this._client.get('/radar/annotations/outages/locations', { query, ...options }) as APIPromise<{ result: OutageLocationsResponse; }> )._thenUnwrap((obj) => obj.result); } } export class Outages extends BaseOutages {} export interface OutageGetResponse { annotations: Array; } export namespace OutageGetResponse { export interface Annotation { id: string; asns: Array; asnsDetails: Array; dataSource: string; eventType: string; locations: Array; locationsDetails: Array; origins: Array; originsDetails: Array; outage: Annotation.Outage; startDate: string; description?: string; endDate?: string; linkedUrl?: string; scope?: string; } export namespace Annotation { export interface ASNsDetail { asn: string; name: string; locations?: ASNsDetail.Locations; } export namespace ASNsDetail { export interface Locations { code: string; name: string; } } export interface LocationsDetail { code: string; name: string; } export interface OriginsDetail { name: string; origin: string; } export interface Outage { outageCause: string; outageType: string; } } } export interface OutageLocationsResponse { annotations: Array; } export namespace OutageLocationsResponse { export interface Annotation { clientCountryAlpha2: string; clientCountryName: string; /** * A numeric string. */ value: string; } } export interface OutageGetParams { /** * Filters results by Autonomous System. Specify a single Autonomous System Number * (ASN) as integer. */ asn?: number; /** * End of the date range (inclusive). Alternative to `dateRange`; provide together * with `dateStart`. */ dateEnd?: string; /** * Filters results by a relative date range ending at the current time. Use `d` * for days (up to `364d`) or `w` for weeks (up to `52w`), e.g. `7d`. Append * `control` to request the equivalent previous period for comparison: the * comparison window is shifted back by the current window's length rounded up to a * whole number of weeks, so it keeps the same weekday alignment and does not * overlap the current window (e.g. `3dcontrol` covers days -10 to -7, `7dcontrol` * covers days -14 to -7, `28dcontrol` covers days -56 to -28, and `10dcontrol` * covers days -24 to -14). Mutually exclusive with `dateStart`/`dateEnd`. */ dateRange?: string; /** * Start of the date range (inclusive). Alternative to `dateRange`; provide * together with `dateEnd`. */ dateStart?: string; /** * Format in which results will be returned. */ format?: 'JSON' | 'CSV'; /** * Limits the number of objects returned in the response. */ limit?: number; /** * Filters results by location. Specify an alpha-2 location code. */ location?: string; /** * Skips the specified number of objects before fetching the results. */ offset?: number; /** * Filters results by origin. */ origin?: string; } export interface OutageLocationsParams { /** * End of the date range (inclusive). Alternative to `dateRange`; provide together * with `dateStart`. */ dateEnd?: string; /** * Filters results by a relative date range ending at the current time. Use `d` * for days (up to `364d`) or `w` for weeks (up to `52w`), e.g. `7d`. Append * `control` to request the equivalent previous period for comparison: the * comparison window is shifted back by the current window's length rounded up to a * whole number of weeks, so it keeps the same weekday alignment and does not * overlap the current window (e.g. `3dcontrol` covers days -10 to -7, `7dcontrol` * covers days -14 to -7, `28dcontrol` covers days -56 to -28, and `10dcontrol` * covers days -24 to -14). Mutually exclusive with `dateStart`/`dateEnd`. */ dateRange?: string; /** * Start of the date range (inclusive). Alternative to `dateRange`; provide * together with `dateEnd`. */ dateStart?: string; /** * Format in which results will be returned. */ format?: 'JSON' | 'CSV'; /** * Limits the number of objects returned in the response. */ limit?: number; } export declare namespace Outages { export { type OutageGetResponse as OutageGetResponse, type OutageLocationsResponse as OutageLocationsResponse, type OutageGetParams as OutageGetParams, type OutageLocationsParams as OutageLocationsParams, }; }