export type SendInteractiveListMessageRowDto = {id: string, title: string, description?: string | undefined}; export type SendInteractiveListMessageSectionDto = {title?: string | undefined, rows: Array}; export type SendInteractiveListMessageContentDto = {header?: string | undefined, body: string, footer?: string | undefined, button: string, sections: Array}; export type SendWhatsappInteractiveListMessageDto = {from?: unknown | undefined, to: unknown, messageId?: string | undefined, content: SendInteractiveListMessageContentDto}; export type CreateApiWhatsappMessageInteractiveListArgs = {body: SendWhatsappInteractiveListMessageDto}; export type CreateApiWhatsappMessageInteractiveListOptions = {baseUrl?: string | undefined, basic?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send Whatsapp Interactive List Message * * POST /whatsapp/message/interactive-list */ export const createApiWhatsappMessageInteractiveList = async (args: CreateApiWhatsappMessageInteractiveListArgs, options?: CreateApiWhatsappMessageInteractiveListOptions) => { const {baseUrl = "https://public.doubletick.io", fetch: fetchFn = fetch, basic} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (basic !== undefined) headers.set("Authorization", basic) const url = `${baseUrl.replace(/\/+$/, '')}/whatsapp/message/interactive-list${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 };