UNPKG

@sajari/sdk-react

Version:
61 lines (60 loc) 1.8 kB
import { AggregateResponse, RequestError, Result } from "@sajari/sdk-js"; export declare type ResponseMap = Map<string, number | AggregateResponse | Result[]>; export declare class Response { private error; private queryValues?; private response?; private values?; /** * Constructs a Response object. * @param error * @param queryValues * @param response * @param values */ constructor(error: RequestError | null, queryValues?: Map<string, string>, response?: ResponseMap, values?: Map<string, string>); /** * Is this response empty? */ isEmpty(): boolean; /** * Is this response an error? */ isError(): boolean; /** * The error associated with this response. */ getError(): RequestError | null; /** * Return the query values used in the search which created this response. */ getQueryValues(): Map<string, string> | undefined; /** * Returns the response, which includes results and aggregates etc. */ getResponse(): ResponseMap | undefined; /** * Return the pipeline values returned by the search. */ getValues(): Map<string, string> | undefined; /** * Return results from the response. */ getResults(): Result[] | undefined; /** * Return the total number of results. */ getTotalResults(): number | undefined; /** * Return time from the response. */ getTime(): number | undefined; /** * Return the aggregates in the response. */ getAggregates(): AggregateResponse | undefined; /** * Return the aggregateFilters in the response. */ getAggregateFilters(): AggregateResponse | undefined; }