UNPKG

updown.io

Version:

An updown.io API client

56 lines (55 loc) 1.95 kB
import type { AxiosInstance } from 'axios'; import type { Check, CheckOptions, Deleted, Downtime, Metrics, MetricsOptions } from '../interfaces'; export declare class ChecksAPI { private readonly apiClient; constructor(apiClient: AxiosInstance); /** * Add a new check. * @param url The URL you want to monitor. * @param options Further check adding options */ addCheck(url: string, options?: CheckOptions): Promise<Check>; /** * Delete a check. * @param token The check unique token */ deleteCheck(token: string): Promise<Deleted>; /** * Show a single check. * @param token The check unique token * @param metrics Include performance metrics (last hour only) */ getCheck(token: string, metrics?: boolean): Promise<Check>; /** List all your checks. */ getChecks(): Promise<Check[]>; /** * Get all the downtimes of a check. * * @param token The check unique token * @param page The page to fetch (100 per page) */ getDowntimes(token: string, page?: number): Promise<Downtime[]>; /** * Get detailed metrics about the check. * * Statistic are aggregated per hour which means you can't get more * precise results than this. For example all requests performed * between 5:00 and 5:59 will be reported at 5:00 in this API. * The time range needs to be at least one hour to get data. * * @param token The check unique token * @param page The page to fetch (100 per page) */ getMetrics(token: string, options?: MetricsOptions): Promise<Metrics>; /** * Set a new API URL. * @param newUrl The new API url */ setApiUrl(newUrl: string): void; /** * Update a check. * @param token The check unique token * @param options Further check updating options */ updateCheck(token: string, options?: CheckOptions): Promise<Check>; }