export type GetApiApiPublicTemplatesArgs = {page?: number | undefined, name?: string | undefined, option?: string | undefined, language?: string | undefined, status?: string | undefined, category?: string | undefined, channel_type?: ('whatsapp' | 'playground' | 'instagram' | 'webchat' | 'web-whatsapp' | 'messenger' | 'sms' | 'tiktok' | 'linkedin' | 'telegram' | 'voice' | 'email') | undefined, channel_identifier?: string | undefined, get_all?: string | undefined, whatsapp_flow_id?: string | undefined, exclude_type?: (Array<'VAMBE' | 'WHATSAPP_ABANDONED_CHECKOUT' | 'WEB_WHATSAPP_ABANDONED_CHECKOUT' | 'MEETING_REMINDER' | 'MEETING_CONFIRMATION_MESSAGE' | 'MEETING_REMINDER_IN_PERSON' | 'MEETING_CONFIRMATION_IN_PERSON' | 'APPOINTMENT_CONFIRMATION_MESSAGE' | 'APPOINTMENT_REMINDER' | 'APPOINTMENT_REACTIVATION' | 'FLOW' | 'CAROUSEL' | 'FEEDBACK_CSAT' | 'FEEDBACK_NPS' | 'PROACTIVE_FOLLOWUP'>) | undefined, 'x-api-key': string}; export type GetApiApiPublicTemplatesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get templates * * GET /api/public/templates */ export const getApiApiPublicTemplates = async (args: GetApiApiPublicTemplatesArgs, options?: GetApiApiPublicTemplatesOptions) => { const {baseUrl = "https://api.vambe.me", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.page != null) query.append("page", String(args.page)) if (args.name != null) query.append("name", String(args.name)) if (args.option != null) query.append("option", String(args.option)) if (args.language != null) query.append("language", String(args.language)) if (args.status != null) query.append("status", String(args.status)) if (args.category != null) query.append("category", String(args.category)) if (args.channel_type != null) query.append("channel_type", String(args.channel_type)) if (args.channel_identifier != null) query.append("channel_identifier", String(args.channel_identifier)) if (args.get_all != null) query.append("get_all", String(args.get_all)) if (args.whatsapp_flow_id != null) query.append("whatsapp_flow_id", String(args.whatsapp_flow_id)) for (const item of args.exclude_type ?? []) query.append("exclude_type", String(item)) if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/public/templates${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 };