export type GetApiIncidentsStatuspageIdArgs = {statuspage_id: string, 'x-api-id': string, 'x-api-key': string}; export type GetApiIncidentsStatuspageIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * List Incidents * * GET /incidents/{statuspage_id} */ export const getApiIncidentsStatuspageId = async (args: GetApiIncidentsStatuspageIdArgs, options?: GetApiIncidentsStatuspageIdOptions) => { const {baseUrl = "https://api.status.io/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['x-api-id'] != null) headers.set("x-api-id", String(args['x-api-id'])) if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/incidents/${encodeURIComponent(String(args.statuspage_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };