export type UpdateApiAutofeederCatOptions = {baseUrl?: string | undefined, LegacyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Example of PUT operation * * PUT /autofeeder/{cat} */ export const updateApiAutofeederCat = async (options?: UpdateApiAutofeederCatOptions) => { const {baseUrl = "http://localhost:3000", fetch: fetchFn = fetch, LegacyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (LegacyAuth !== undefined) headers.set("X-App-Token", LegacyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/autofeeder/${encodeURIComponent(String(args.cat))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };