export type FilterAffiliationItem = {operator: 'EQ' | 'IS_NOT_EMPTY' | 'CONTAINS' | 'KEYWORDS_SEARCH' | 'CONTAINS_NAME' | 'CONTAINS_SENIORITY' | 'CONTAINS_POSITION' | 'RANGE' | 'UNIVERSAL_RANGE' | 'LOCATION' | 'EMAIL_STATUS' | 'INCLUDE' | 'NEQ' | 'NOT_CONTAINS' | 'NOT_CONTAINS_NAME' | 'NOT_LOCATION' | 'NOT_CONTAINS_SENIORITY' | 'NOT_CONTAINS_POSITION' | 'NOT_KEYWORDS_SEARCH' | 'EXCLUDE', value: Array}; export type SearchInsightFilterItem = {property: 'contact.name' | 'contact.updatedAt' | 'contact.linkedinUrl' | 'contact.location' | 'contact.countryCode' | 'company.name' | 'company.domain' | 'company.updatedAt' | 'company.position' | 'company.seniority' | 'company.industry' | 'company.size' | 'company.location' | 'company.countryCode' | 'company.keywords' | 'keywords', included: FilterAffiliationItem, excluded?: FilterAffiliationItem | undefined, checkboxes: Array}; export type SearchInsightsDto = {filters?: Array | undefined}; export type GetApiApiV1InsightsSearchFastSearchSearchArgs = {search: string, body: SearchInsightsDto}; export type GetApiApiV1InsightsSearchFastSearchSearchOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Fast search through insight contacts and companies * * GET /api/v1/insights/search/fast-search/{search} */ export const getApiApiV1InsightsSearchFastSearchSearch = async (args: GetApiApiV1InsightsSearchFastSearchSearchArgs, options?: GetApiApiV1InsightsSearchFastSearchSearchOptions) => { const {baseUrl = "https://api.getprospect.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("apiKey", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/insights/search/fast-search/${encodeURIComponent(String(args.search))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", 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 };