import { AuthModeType } from '@algolia/client-common'; import { ClientTransporterOptions } from '@algolia/client-common'; import { Destroyable } from '@algolia/requester-common'; import { RecommendSearchOptions as RecommendSearchOptions_2 } from '@algolia/recommend'; import { RequestOptions } from '@algolia/transporter'; import { SearchOptions } from '@algolia/client-search'; import { SearchResponse } from '@algolia/client-search'; import { Transporter } from '@algolia/transporter'; export declare type BaseRecommendClient = { /** * The application id. */ readonly appId: string; /** * The underlying transporter. */ readonly transporter: Transporter; /** * Mutates the transporter, adding the given user agent. */ readonly addAlgoliaAgent: (segment: string, version?: string) => void; /** * Clears both requests and responses caches. */ readonly clearCache: () => Readonly>; }; export declare type FrequentlyBoughtTogetherQuery = Omit; declare type GetFrequentlyBoughtTogether = (base: BaseRecommendClient) => WithRecommendMethods['getFrequentlyBoughtTogether']; export declare const getFrequentlyBoughtTogether: GetFrequentlyBoughtTogether; declare type GetLookingSimilar = (base: BaseRecommendClient) => WithRecommendMethods['getLookingSimilar']; export declare const getLookingSimilar: GetLookingSimilar; declare type GetRecommendations = (base: BaseRecommendClient) => WithRecommendMethods['getRecommendations']; export declare const getRecommendations: GetRecommendations; declare type GetRecommendedForYou = (base: BaseRecommendClient) => WithRecommendMethods['getRecommendedForYou']; export declare const getRecommendedForYou: GetRecommendedForYou; declare type GetRelatedProducts = (base: BaseRecommendClient) => WithRecommendMethods['getRelatedProducts']; export declare const getRelatedProducts: GetRelatedProducts; declare type GetTrendingFacets = (base: BaseRecommendClient) => WithRecommendMethods['getTrendingFacets']; export declare const getTrendingFacets: GetTrendingFacets; declare type GetTrendingItems = (base: BaseRecommendClient) => WithRecommendMethods['getTrendingItems']; export declare const getTrendingItems: GetTrendingItems; export declare type LookingSimilarQuery = Omit; declare function recommend(appId: string, apiKey: string, options?: RecommendOptions): RecommendClient; declare namespace recommend { var version: string; } export default recommend; export declare type RecommendationsQuery = { /** * The name of the target index. */ readonly indexName: string; /** * The name of the Recommendation model to use. */ readonly model: 'related-products' | 'bought-together' | 'looking-similar'; /** * The `objectID` of the item to get recommendations for. */ readonly objectID: string; /** * Threshold for the recommendations confidence score (between 0 and 100). Only recommendations with a greater score are returned. */ readonly threshold?: number; /** * How many recommendations to retrieve. */ readonly maxRecommendations?: number; /** * List of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) to send. */ readonly queryParameters?: RecommendSearchOptions; /** * List of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) to send. * * Additional filters to use as fallback when there aren’t enough recommendations. */ readonly fallbackParameters?: RecommendSearchOptions; }; export declare type RecommendClient = WithRecommendMethods & Destroyable; export declare type RecommendClientOptions = { /** * The application id. */ readonly appId: string; /** * The api key. */ readonly apiKey: string; /** * The auth mode type. In browser environments credentials may * be passed within the headers. */ readonly authMode?: AuthModeType; }; /** * The parameters used for `getRecommendedForYou` method. */ export declare type RecommendedForYouParams = Omit; export declare type RecommendedForYouQuery = Omit & { readonly model: 'recommended-for-you'; /** * List of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) to send. */ readonly queryParameters: Omit & { /** * A user identifier. * Format: alpha numeric string [a-zA-Z0-9_-] * Length: between 1 and 64 characters. */ readonly userToken: string; }; }; export declare type RecommendModel = 'related-products' | 'bought-together' | 'looking-similar' | 'recommended-for-you' | TrendingModel; export declare type RecommendOptions = Partial; export declare type RecommendQueriesResponse = { /** * The list of results. */ readonly results: ReadonlyArray>; }; export declare type RecommendSearchOptions = Omit; export declare type RecommendTrendingFacetsQueriesResponse = { /** * The list of results. */ readonly results: readonly TrendingFacetsResponse[]; }; export declare type RelatedProductsQuery = Omit; export declare type TrendingFacetHit = { readonly _score: number; readonly facetName: string; readonly facetValue: string; }; export declare type TrendingFacetsQuery = { /** * The name of the target index. */ readonly indexName: string; /** * Threshold for the recommendations confidence score (between 0 and 100). Only recommendations with a greater score are returned. */ readonly threshold?: number; /** * How many recommendations to retrieve. */ readonly maxRecommendations?: number; /** * The facet attribute to get recommendations for. */ readonly facetName: string; }; export declare type TrendingFacetsResponse = Omit & { readonly hits: readonly TrendingFacetHit[]; }; export declare type TrendingItemsQuery = { /** * The name of the target index. */ readonly indexName: string; /** * Threshold for the recommendations confidence score (between 0 and 100). Only recommendations with a greater score are returned. */ readonly threshold?: number; /** * How many recommendations to retrieve. */ readonly maxRecommendations?: number; /** * List of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) to send. */ readonly queryParameters?: RecommendSearchOptions_2; /** * List of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) to send. * * Additional filters to use as fallback when there aren’t enough recommendations. */ readonly fallbackParameters?: RecommendSearchOptions_2; /** * The facet attribute to get recommendations for. */ readonly facetName?: string; /** * The value of the target facet. */ readonly facetValue?: string; }; export declare type TrendingModel = 'trending-items' | 'trending-facets'; export declare type TrendingQuery = (TrendingItemsQuery & { readonly model: TrendingModel; }) | (TrendingFacetsQuery & { readonly model: TrendingModel; }); export declare type WithRecommendMethods = TType & { /** * Returns recommendations. */ readonly getRecommendations: (queries: ReadonlyArray, requestOptions?: RequestOptions & SearchOptions) => Readonly>>; /** * Returns [Related Products](https://algolia.com/doc/guides/algolia-ai/recommend/#related-products). */ readonly getRelatedProducts: (queries: readonly RelatedProductsQuery[], requestOptions?: RequestOptions & SearchOptions) => Readonly>>; /** * Returns [Frequently Bought Together](https://algolia.com/doc/guides/algolia-ai/recommend/#frequently-bought-together) products. */ readonly getFrequentlyBoughtTogether: (queries: readonly FrequentlyBoughtTogetherQuery[], requestOptions?: RequestOptions & SearchOptions) => Readonly>>; /** * Returns trending items */ readonly getTrendingItems: (queries: readonly TrendingItemsQuery[], requestOptions?: RequestOptions & SearchOptions) => Readonly>>; /** * Returns trending items per facet */ readonly getTrendingFacets: (queries: readonly TrendingFacetsQuery[], requestOptions?: RequestOptions & SearchOptions) => Readonly>; /** * Returns Looking Similar */ readonly getLookingSimilar: (queries: readonly LookingSimilarQuery[], requestOptions?: RequestOptions & SearchOptions) => Readonly>>; /** * Returns Recommended for you */ readonly getRecommendedForYou: (queries: readonly RecommendedForYouParams[], requestOptions?: RequestOptions & SearchOptions) => Readonly>>; }; export { }