export type GetApiApiV1HealthCheckArgs = {'X-Requested-With': string}; export type GetApiApiV1HealthCheckOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Attempts to get a health check from the API * * GET /api/v1/health_check */ export const getApiApiV1HealthCheck = async (args: GetApiApiV1HealthCheckArgs, options?: GetApiApiV1HealthCheckOptions) => { const {baseUrl = "https://demo.invoiceninja.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-Requested-With'] != null) headers.set("X-Requested-With", String(args['X-Requested-With'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/health_check${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 };