export type Links = {id: string, created_at: unknown, created_by?: string | undefined, title?: unknown | undefined, url?: unknown | undefined, order?: number | undefined, eventspace_id: string}; export type PatchApiLinksArgs = {id?: string | undefined, created_at?: unknown | undefined, created_by?: string | undefined, title?: unknown | undefined, url?: unknown | undefined, order?: unknown | undefined, eventspace_id?: string | undefined, Prefer?: ('return=representation' | 'return=minimal' | 'return=none') | undefined, body: Links}; export type PatchApiLinksOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * PATCH /links */ export const patchApiLinks = async (args: PatchApiLinksArgs, options?: PatchApiLinksOptions) => { const {baseUrl = "https://vnaabuozknwgxuvnfwjo.supabase.co:443", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.id != null) query.append("id", String(args.id)) if (args.created_at != null) query.append("created_at", String(args.created_at)) if (args.created_by != null) query.append("created_by", String(args.created_by)) if (args.title != null) query.append("title", String(args.title)) if (args.url != null) query.append("url", String(args.url)) if (args.order != null) query.append("order", String(args.order)) if (args.eventspace_id != null) query.append("eventspace_id", String(args.eventspace_id)) if (args.Prefer != null) headers.set("Prefer", String(args.Prefer)) const url = `${baseUrl.replace(/\/+$/, '')}/links${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };