export type GetApiFundableCompanyArgs = {id?: string | undefined, domain?: string | undefined, linkedin?: string | undefined, crunchbase?: string | undefined}; export type GetApiFundableCompanyOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get company by id, includes latest funding round * * GET /fundable/company */ export const getApiFundableCompany = async (args: GetApiFundableCompanyArgs, options?: GetApiFundableCompanyOptions) => { 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)) if (args.domain != null) query.append("domain", String(args.domain)) if (args.linkedin != null) query.append("linkedin", String(args.linkedin)) if (args.crunchbase != null) query.append("crunchbase", String(args.crunchbase)) const url = `${baseUrl.replace(/\/+$/, '')}/fundable/company${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 };