export type GetApiIncidentStatuspageIdIncidentIdArgs = {statuspage_id: string, incident_id: string, 'x-api-id': string, 'x-api-key': string}; export type GetApiIncidentStatuspageIdIncidentIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Incident * * GET /incident/{statuspage_id}/{incident_id} */ export const getApiIncidentStatuspageIdIncidentId = async (args: GetApiIncidentStatuspageIdIncidentIdArgs, options?: GetApiIncidentStatuspageIdIncidentIdOptions) => { 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(/\/+$/, '')}/incident/${encodeURIComponent(String(args.statuspage_id))}/${encodeURIComponent(String(args.incident_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 };