export type Views = {id: string, created_at: unknown, order?: number | undefined, title?: unknown | undefined, type?: ('board' | 'calendar' | 'list' | 'table' | 'dashboard') | undefined, table_id?: string | undefined, required?: boolean | undefined, group_by_property_id?: string | undefined}; export type PatchApiViewsArgs = {id?: string | undefined, created_at?: unknown | undefined, order?: unknown | undefined, title?: unknown | undefined, type?: unknown | undefined, table_id?: string | undefined, required?: unknown | undefined, group_by_property_id?: string | undefined, Prefer?: ('return=representation' | 'return=minimal' | 'return=none') | undefined, body: Views}; export type PatchApiViewsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * PATCH /views */ export const patchApiViews = async (args: PatchApiViewsArgs, options?: PatchApiViewsOptions) => { 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.order != null) query.append("order", String(args.order)) if (args.title != null) query.append("title", String(args.title)) if (args.type != null) query.append("type", String(args.type)) if (args.table_id != null) query.append("table_id", String(args.table_id)) if (args.required != null) query.append("required", String(args.required)) if (args.group_by_property_id != null) query.append("group_by_property_id", String(args.group_by_property_id)) if (args.Prefer != null) headers.set("Prefer", String(args.Prefer)) const url = `${baseUrl.replace(/\/+$/, '')}/views${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 };