export type PublicSendEmailDto = {to: string | Array, cc?: Array | undefined, bcc?: Array | undefined, contact_name?: string | undefined, from?: string | undefined, template_id?: string | undefined, template_name?: string | undefined, variables?: {[key: string]: string} | undefined, subject?: string | undefined, html_body?: string | undefined, attachments?: (Array<{filename: string, content: string, type?: string | undefined}>) | undefined}; export type CreateApiApiPublicEmailSendArgs = {'x-api-key': string, body: PublicSendEmailDto}; export type CreateApiApiPublicEmailSendOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send an email * * POST /api/public/email/send */ export const createApiApiPublicEmailSend = async (args: CreateApiApiPublicEmailSendArgs, options?: CreateApiApiPublicEmailSendOptions) => { const {baseUrl = "https://api.vambe.me", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/public/email/send${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };