export type GetApiApiPublicContactWhatsappChannelIdentifierInfoArgs = {'x-api-key': string, channelIdentifier: string, 'phone-number-channel': string, channel: 'whatsapp' | 'web-whatsapp'}; export type GetApiApiPublicContactWhatsappChannelIdentifierInfoOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve info by channel identifier * * GET /api/public/contact/whatsapp/{channelIdentifier}/info */ export const getApiApiPublicContactWhatsappChannelIdentifierInfo = async (args: GetApiApiPublicContactWhatsappChannelIdentifierInfoArgs, options?: GetApiApiPublicContactWhatsappChannelIdentifierInfoOptions) => { const {baseUrl = "https://api.vambe.me", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) if (args['phone-number-channel'] != null) query.append("phone-number-channel", String(args['phone-number-channel'])) if (args.channel != null) query.append("channel", String(args.channel)) const url = `${baseUrl.replace(/\/+$/, '')}/api/public/contact/whatsapp/${encodeURIComponent(String(args.channelIdentifier))}/info${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 };