export type GetApiCompanyEnrichCompaniesArgs = {id: string, expand?: Array | undefined}; export type GetApiCompanyEnrichCompaniesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get a company's full profile by its CompanyEnrich ID. Returns name, domain, industry, employee count, revenue, location, funding, social links, and more. * * GET /company-enrich/companies */ export const getApiCompanyEnrichCompanies = async (args: GetApiCompanyEnrichCompaniesArgs, options?: GetApiCompanyEnrichCompaniesOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.id != null) query.append("id", String(args.id)) for (const item of args.expand ?? []) query.append("expand", String(item)) const url = `${baseUrl.replace(/\/+$/, '')}/company-enrich/companies${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 };