export type Likes = {created_at: unknown, event_id: string, user_id: string}; export type PatchApiLikesArgs = {created_at?: unknown | undefined, event_id?: string | undefined, user_id?: string | undefined, Prefer?: ('return=representation' | 'return=minimal' | 'return=none') | undefined, body: Likes}; export type PatchApiLikesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * PATCH /likes */ export const patchApiLikes = async (args: PatchApiLikesArgs, options?: PatchApiLikesOptions) => { 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.created_at != null) query.append("created_at", String(args.created_at)) if (args.event_id != null) query.append("event_id", String(args.event_id)) if (args.user_id != null) query.append("user_id", String(args.user_id)) if (args.Prefer != null) headers.set("Prefer", String(args.Prefer)) const url = `${baseUrl.replace(/\/+$/, '')}/likes${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 };