export type ProbeIngest = {component?: (string | null) | undefined, ok?: boolean | undefined, latency_ms?: (number | null) | undefined, detail?: (string | null) | undefined}; export type CreateApiV1StatusProbeArgs = {body: ProbeIngest}; export type CreateApiV1StatusProbeOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /v1/status/probe */ export const createApiV1StatusProbe = async (args: CreateApiV1StatusProbeArgs, options: CreateApiV1StatusProbeOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKey !== undefined) headers.set("X-Api-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/status/probe${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };