export type CreateApiLeadsforgeEnrichmentEmailArgs = {body: {firstName?: string | undefined, lastName?: string | undefined, company?: string | undefined, companyDomain?: string | undefined, linkedinURL?: string | undefined, personID?: string | undefined, externalID?: string | undefined}}; export type CreateApiLeadsforgeEnrichmentEmailOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Find email address for a person synchronously. Provide name + company or LinkedIn URL. * * POST /leadsforge/enrichment/email */ export const createApiLeadsforgeEnrichmentEmail = async (args: CreateApiLeadsforgeEnrichmentEmailArgs, options?: CreateApiLeadsforgeEnrichmentEmailOptions) => { 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(/\/+$/, '')}/leadsforge/enrichment/email${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 };