export type CreateApiWhatsappCallCreateArgs = {body: {from: string, to: string, sdp: string, sdpType: string, deviceId?: string | undefined}}; export type CreateApiWhatsappCallCreateOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create outgoing call * * POST /whatsapp/call/create */ export const createApiWhatsappCallCreate = async (args: CreateApiWhatsappCallCreateArgs, options?: CreateApiWhatsappCallCreateOptions) => { const {baseUrl = "https://public.doubletick.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/whatsapp/call/create${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 };