export type GetApiEmbedsIdShowRestArgs = {id: string}; export type GetApiEmbedsIdShowRestOptions = {baseUrl?: string | undefined, HttpBasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Render the user experience of the embed * * GET /embeds/{id}/show/*rest */ export const getApiEmbedsIdShowRest = async (args: GetApiEmbedsIdShowRestArgs, options?: GetApiEmbedsIdShowRestOptions) => { const {baseUrl = "https://api.pocketflows.com", fetch: fetchFn = fetch, HttpBasicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/html") if (HttpBasicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${HttpBasicAuth.username}:${HttpBasicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/embeds/${encodeURIComponent(String(args.id))}/show/*rest${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 res.text() };