export type GetApiAviatoPersonEmailArgs = {type?: string | undefined, id?: string | undefined, linkedinID?: string | undefined, linkedinEntityId?: string | undefined, linkedinURL?: string | undefined, email?: string | undefined}; export type GetApiAviatoPersonEmailOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get a person's email addresses. * * GET /aviato/person/email */ export const getApiAviatoPersonEmail = async (args: GetApiAviatoPersonEmailArgs, options?: GetApiAviatoPersonEmailOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.type != null) query.append("type", String(args.type)) if (args.id != null) query.append("id", String(args.id)) if (args.linkedinID != null) query.append("linkedinID", String(args.linkedinID)) if (args.linkedinEntityId != null) query.append("linkedinEntityId", String(args.linkedinEntityId)) if (args.linkedinURL != null) query.append("linkedinURL", String(args.linkedinURL)) if (args.email != null) query.append("email", String(args.email)) const url = `${baseUrl.replace(/\/+$/, '')}/aviato/person/email${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 };