export type GetApiContactoutV1EmailEnrichArgs = {email: string, include?: string | undefined}; export type GetApiContactoutV1EmailEnrichOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get profile details from an email address. * * GET /contactout/v1/email/enrich */ export const getApiContactoutV1EmailEnrich = async (args: GetApiContactoutV1EmailEnrichArgs, options?: GetApiContactoutV1EmailEnrichOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.email != null) query.append("email", String(args.email)) if (args.include != null) query.append("include", String(args.include)) const url = `${baseUrl.replace(/\/+$/, '')}/contactout/v1/email/enrich${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 };