export type GetApiRpcGenerateTokenArgs = {length: number}; export type GetApiRpcGenerateTokenOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /rpc/generate_token */ export const getApiRpcGenerateToken = async (args: GetApiRpcGenerateTokenArgs, options?: GetApiRpcGenerateTokenOptions) => { const {baseUrl = "https://vnaabuozknwgxuvnfwjo.supabase.co:443", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.length != null) query.append("length", String(args.length)) const url = `${baseUrl.replace(/\/+$/, '')}/rpc/generate_token${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };