export type GetApiApiV1ChecksPkCurrentStatusArgs = {pk: string}; export type GetApiApiV1ChecksPkCurrentStatusOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Shows the current check state and latest downtime event for a check * * GET /api/v1/checks/{pk}/current-status/ */ export const getApiApiV1ChecksPkCurrentStatus = async (args: GetApiApiV1ChecksPkCurrentStatusArgs, options: GetApiApiV1ChecksPkCurrentStatusOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/checks/${encodeURIComponent(String(args.pk))}/current-status/${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 };