export type GetApiV1DataSourcesOuraWebhookArgs = {verificationToken: string, challenge: string}; export type GetApiV1DataSourcesOuraWebhookOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * GET /v1/data-sources/oura/webhook */ export const getApiV1DataSourcesOuraWebhook = async (args: GetApiV1DataSourcesOuraWebhookArgs, options: GetApiV1DataSourcesOuraWebhookOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.verificationToken != null) query.append("verificationToken", String(args.verificationToken)) if (args.challenge != null) query.append("challenge", String(args.challenge)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/data-sources/oura/webhook${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 };