export type DeleteApiApiV5HabitsHabitLogsArgs = {habit_log_id: number}; export type DeleteApiApiV5HabitsHabitLogsOptions = {baseUrl?: string | undefined, RWAPIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Habit log * * DELETE /api/v5/habits/habit-logs/ */ export const deleteApiApiV5HabitsHabitLogs = async (args: DeleteApiApiV5HabitsHabitLogsArgs, options?: DeleteApiApiV5HabitsHabitLogsOptions) => { const {baseUrl = "https://api.pavlok.com", fetch: fetchFn = fetch, RWAPIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.habit_log_id != null) query.append("habit_log_id", String(args.habit_log_id)) if (RWAPIKeyHeader !== undefined) headers.set("Authorization", RWAPIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/api/v5/habits/habit-logs/${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 };