diff --git a/packages/recommend/src/types/TrendingFacetHit.ts b/packages/recommend/src/types/TrendingFacetHit.ts new file mode 100644 index 000000000..5b152f032 --- /dev/null +++ b/packages/recommend/src/types/TrendingFacetHit.ts @@ -0,0 +1,5 @@ +export type TrendingFacetHit = { + readonly _score: number; + readonly facetName: string; + readonly facetValue: TObject; +}; diff --git a/packages/recommend/src/types/TrendingFacetsResponse.ts b/packages/recommend/src/types/TrendingFacetsResponse.ts new file mode 100644 index 000000000..db074bd4a --- /dev/null +++ b/packages/recommend/src/types/TrendingFacetsResponse.ts @@ -0,0 +1,7 @@ +import { SearchResponse } from '@algolia/client-search'; + +import { TrendingFacetHit } from './TrendingFacetHit'; + +export type TrendingFacetsResponse = Omit, 'hits'> & { + readonly hits: ReadonlyArray>; +}; diff --git a/packages/recommend/src/types/WithRecommendMethods.ts b/packages/recommend/src/types/WithRecommendMethods.ts index d0e226e8d..d51be5bf2 100644 --- a/packages/recommend/src/types/WithRecommendMethods.ts +++ b/packages/recommend/src/types/WithRecommendMethods.ts @@ -7,9 +7,17 @@ import { LookingSimilarQuery } from './LookingSimilarQuery'; import { RecommendationsQuery } from './RecommendationsQuery'; import { RelatedProductsQuery } from './RelatedProductsQuery'; import { TrendingFacetsQuery } from './TrendingFacetsQuery'; +import { TrendingFacetsResponse } from './TrendingFacetsResponse'; import { TrendingItemsQuery } from './TrendingItemsQuery'; import { TrendingQuery } from './TrendingQuery'; +export type RecommendTrendingFacetsQueriesResponse = { + /** + * The list of results. + */ + readonly results: ReadonlyArray>; +}; + export type RecommendQueriesResponse = { /** * The list of results. @@ -56,7 +64,7 @@ export type WithRecommendMethods = TType & { readonly getTrendingFacets: ( queries: readonly TrendingFacetsQuery[], requestOptions?: RequestOptions & SearchOptions - ) => Readonly>>; + ) => Readonly>>; /** * Returns Looking Similar diff --git a/packages/recommend/src/types/index.ts b/packages/recommend/src/types/index.ts index 767b31335..843fb144a 100644 --- a/packages/recommend/src/types/index.ts +++ b/packages/recommend/src/types/index.ts @@ -16,3 +16,5 @@ export * from './TrendingQuery'; export * from './WithRecommendMethods'; export * from './LookingSimilarQuery'; export * from './RecommendedForYouQuery'; +export * from './TrendingFacetHit'; +export * from './TrendingFacetsResponse';