export type CreateApiExtructAiV1CompaniesSearchArgs = {body: {q: string, filters?: Record | undefined, pagination?: Record | undefined}}; export type CreateApiExtructAiV1CompaniesSearchOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search for companies using natural language queries with Extruct AI. POST variant accepts filters as a JSON object. Use when exclude.domains list is too large for a GET URL. * * POST /extruct-ai/v1/companies/search */ export const createApiExtructAiV1CompaniesSearch = async (args: CreateApiExtructAiV1CompaniesSearchArgs, options?: CreateApiExtructAiV1CompaniesSearchOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/extruct-ai/v1/companies/search${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };