export type DeleteApiApiV5SleepDatasetSleepDatasetIdArgs = {sleep_dataset_id: number}; export type DeleteApiApiV5SleepDatasetSleepDatasetIdOptions = {baseUrl?: string | undefined, RWAPIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete sleep dataset * * DELETE /api/v5/sleep-dataset/{sleep_dataset_id} */ export const deleteApiApiV5SleepDatasetSleepDatasetId = async (args: DeleteApiApiV5SleepDatasetSleepDatasetIdArgs, options?: DeleteApiApiV5SleepDatasetSleepDatasetIdOptions) => { const {baseUrl = "https://api.pavlok.com", fetch: fetchFn = fetch, RWAPIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (RWAPIKeyHeader !== undefined) headers.set("Authorization", RWAPIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/api/v5/sleep-dataset/${encodeURIComponent(String(args.sleep_dataset_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };