UNPKG

@klevu/core

Version:

Typescript SDK that simplifies development on Klevu backend. Klevu provides advanced AI-powered search and discovery solutions for online retailers.

39 lines (38 loc) 1.37 kB
import { KlevuApiRawResponse } from "../models/KlevuApiRawResponse.js"; import { KlevuFetchFunctionReturnValue } from "../queries/index.js"; import { KlevuFetchOption } from "./klevuFetch.js"; import { KlevuResponseQueryObject } from "./responseQueryObject.js"; /** * This class is used to access the response data from Klevu API * It builds up the state of the result and it can be used to do various things with the data */ export declare class KlevuResponseObject { #private; apiResponse: KlevuApiRawResponse; constructor(response: KlevuApiRawResponse, functions: KlevuFetchFunctionReturnValue[], options?: KlevuFetchOption, checkProcessedFunctions?: string); /** * Get suggestions by id * * @param id * @returns */ suggestionsById(id: string): import("../index.js").KlevuSuggestionResult | undefined; /** * Get query results by id * @param id query id used * @returns */ queriesById(id: string): KlevuResponseQueryObject; /** * Check if query exists. This should be used as queriesById can throw an error * * @param id query id used * @returns */ queryExists(id: string): boolean; /** * * @returns String that can be used to compare if the same functions were used to create this response */ packProcessedFunctionsToString(): string; }