export type CreateApiNynePersonEnrichmentArgs = {body: {email?: string | undefined, phone?: string | undefined, social_media_url?: string | undefined, name?: string | undefined, company?: string | undefined, callback_url?: string | undefined, newsfeed?: Array | undefined, ai_enhanced_search?: boolean | undefined, strict_email_check?: boolean | undefined, lite_enrich?: boolean | undefined, probability_score?: boolean | undefined}}; export type CreateApiNynePersonEnrichmentOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Start async person enrichment. Requires at least one of: email, phone, or social_media_url. * * POST /nyne/person/enrichment */ export const createApiNynePersonEnrichment = async (args: CreateApiNynePersonEnrichmentArgs, options?: CreateApiNynePersonEnrichmentOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/nyne/person/enrichment${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 };