export type GetApiV1PricesWidgetPingOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Widget health check * * GET /v1/prices/widget/ping */ export const getApiV1PricesWidgetPing = async (options?: GetApiV1PricesWidgetPingOptions) => { const {baseUrl = "https://api.oilpriceapi.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/v1/prices/widget/ping${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 };