export type GetApiPeopledatalabsV5IpEnrichArgs = {ip: string, return_if_unmatched?: boolean | undefined, pretty?: boolean | undefined}; export type GetApiPeopledatalabsV5IpEnrichOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Enrich an IP address with associated company, location, and metadata. * * GET /peopledatalabs/v5/ip/enrich */ export const getApiPeopledatalabsV5IpEnrich = async (args: GetApiPeopledatalabsV5IpEnrichArgs, options?: GetApiPeopledatalabsV5IpEnrichOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.ip != null) query.append("ip", String(args.ip)) if (args.return_if_unmatched != null) query.append("return_if_unmatched", String(args.return_if_unmatched)) if (args.pretty != null) query.append("pretty", String(args.pretty)) const url = `${baseUrl.replace(/\/+$/, '')}/peopledatalabs/v5/ip/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 };