export type DeleteApiApiLibraryPresetsPresetIdArgs = {preset_id: string}; export type DeleteApiApiLibraryPresetsPresetIdOptions = {baseUrl: string, HTTPBearerJWT?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a preset * * DELETE /api/library/presets/{preset_id} */ export const deleteApiApiLibraryPresetsPresetId = async (args: DeleteApiApiLibraryPresetsPresetIdArgs, options: DeleteApiApiLibraryPresetsPresetIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, HTTPBearerJWT} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (HTTPBearerJWT !== undefined) headers.set('authorization', `Bearer ${HTTPBearerJWT}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/library/presets/${encodeURIComponent(String(args.preset_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 };