export type GetApiFundableInvestorSearchArgs = {name?: string | undefined, domain?: string | undefined, linkedin?: string | undefined, crunchbase?: string | undefined}; export type GetApiFundableInvestorSearchOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search for an investor id using fuzzy match or other identifiers * * GET /fundable/investor/search */ export const getApiFundableInvestorSearch = async (args: GetApiFundableInvestorSearchArgs, options?: GetApiFundableInvestorSearchOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.name != null) query.append("name", String(args.name)) 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/investor/search${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 };