export type GetApiSmsTemplateEmbedsIdShowArgs = {id: string, hide_top_bar?: boolean | undefined, hide_buttons?: boolean | undefined, hide_save_button?: boolean | undefined}; export type GetApiSmsTemplateEmbedsIdShowOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Embed the SMS template editor * * GET /sms_template_embeds/{id}/show */ export const getApiSmsTemplateEmbedsIdShow = async (args: GetApiSmsTemplateEmbedsIdShowArgs, options?: GetApiSmsTemplateEmbedsIdShowOptions) => { const {baseUrl = "https://api.pocketflows.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/html") if (args.hide_top_bar != null) query.append("hide_top_bar", String(args.hide_top_bar)) if (args.hide_buttons != null) query.append("hide_buttons", String(args.hide_buttons)) if (args.hide_save_button != null) query.append("hide_save_button", String(args.hide_save_button)) const url = `${baseUrl.replace(/\/+$/, '')}/sms_template_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() };