export type CreateApiDeletePresetArgs = {id: number}; export type CreateApiDeletePresetOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete Preset * * POST /delete_preset */ export const createApiDeletePreset = async (args: CreateApiDeletePresetArgs, options: CreateApiDeletePresetOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.id != null) query.append("id", String(args.id)) const url = `${baseUrl.replace(/\/+$/, '')}/delete_preset${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };