export type GetApiUnsubscribeEmbedsIdShowArgs = {id: string}; export type GetApiUnsubscribeEmbedsIdShowOptions = {baseUrl?: string | undefined, HttpBasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Embed the unsubscribe form * * GET /unsubscribe_embeds/{id}/show */ export const getApiUnsubscribeEmbedsIdShow = async (args: GetApiUnsubscribeEmbedsIdShowArgs, options?: GetApiUnsubscribeEmbedsIdShowOptions) => { 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(/\/+$/, '')}/unsubscribe_embeds/${encodeURIComponent(String(args.id))}/show${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() };