UNPKG

addsearch-js-client

Version:

AddSearch API JavaScript client

49 lines 1.39 kB
import 'es6-promise/auto'; import { Settings } from './settings'; interface RecommendOptions { type: 'RELATED_ITEMS' | 'FREQUENTLY_BOUGHT_TOGETHER'; itemId?: string; blockId?: string; configurationKey?: string; } export interface SearchResponseDocument { id: string; score: number; url: string; title: string; ts: string; images: { main: string; mainB64: string; capture: string; }; categories: string[]; type: string; custom_fields: Record<string, string>; document_type: string; meta_description: string; highlight: string; } export interface SearchResponse { total_hits: number; hits: SearchResponseDocument[]; facets: any; stats: any; response_time: number; } interface Suggestion { value: string; } export interface SuggestionsResponse { suggestions: Suggestion[]; } export interface ApiFetchCallback<T = any> { (response: T): void; } export type ExecuteApiFetch = (apiHostname: string, sitekey: string, type: string, settings: Settings | null, cb: ApiFetchCallback, fuzzyRetry?: boolean | null, customFilterObject?: any, recommendOptions?: RecommendOptions) => void; /** * Fetch search results of search suggestions from the Addsearch API */ declare const executeApiFetch: ExecuteApiFetch; export default executeApiFetch; //# sourceMappingURL=apifetch.d.ts.map