export type Questions = {id: string, created_at: unknown, event_id: string, content?: unknown | undefined, required?: boolean | undefined, type?: ('text' | 'number' | 'link') | undefined}; export type PatchApiQuestionsArgs = {id?: string | undefined, created_at?: unknown | undefined, event_id?: string | undefined, content?: unknown | undefined, required?: unknown | undefined, type?: unknown | undefined, Prefer?: ('return=representation' | 'return=minimal' | 'return=none') | undefined, body: Questions}; export type PatchApiQuestionsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * PATCH /questions */ export const patchApiQuestions = async (args: PatchApiQuestionsArgs, options?: PatchApiQuestionsOptions) => { 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.event_id != null) query.append("event_id", String(args.event_id)) if (args.content != null) query.append("content", String(args.content)) if (args.required != null) query.append("required", String(args.required)) if (args.type != null) query.append("type", String(args.type)) if (args.Prefer != null) headers.set("Prefer", String(args.Prefer)) const url = `${baseUrl.replace(/\/+$/, '')}/questions${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 };