File tree Expand file tree Collapse file tree 4 files changed +12
-13
lines changed Expand file tree Collapse file tree 4 files changed +12
-13
lines changed Original file line number Diff line number Diff line change 11import { MethodEnum } from '@algolia/requester-common' ;
22
3- import {
4- BaseRecommendClient ,
5- RecommendationsQuery ,
6- TrendingFacetsQuery ,
7- TrendingItemsQuery ,
8- TrendingModel ,
9- WithRecommendMethods ,
10- } from '../types' ;
3+ import { BaseRecommendClient , RecommendationsQuery , WithRecommendMethods } from '../types' ;
4+ import { TrendingQuery } from '../types/TrendingQuery' ;
115
126type GetRecommendations = (
137 base : BaseRecommendClient
148) => WithRecommendMethods < BaseRecommendClient > [ 'getRecommendations' ] ;
159
16- type TrendingQuery =
17- | ( TrendingItemsQuery & { readonly model : TrendingModel } )
18- | ( TrendingFacetsQuery & { readonly model : TrendingModel } ) ;
19-
2010export const getRecommendations : GetRecommendations = base => {
2111 return ( queries : ReadonlyArray < RecommendationsQuery | TrendingQuery > , requestOptions ) => {
2212 const requests : ReadonlyArray < RecommendationsQuery | TrendingQuery > = queries . map ( query => ( {
Original file line number Diff line number Diff line change 1+ import { TrendingFacetsQuery } from '../types/TrendingFacetsQuery' ;
2+ import { TrendingItemsQuery } from '../types/TrendingItemsQuery' ;
3+ import { TrendingModel } from './RecommendModel' ;
4+
5+ export type TrendingQuery =
6+ | ( TrendingItemsQuery & { readonly model : TrendingModel } )
7+ | ( TrendingFacetsQuery & { readonly model : TrendingModel } ) ;
Original file line number Diff line number Diff line change @@ -6,13 +6,14 @@ import { RecommendationsQuery } from './RecommendationsQuery';
66import { RelatedProductsQuery } from './RelatedProductsQuery' ;
77import { TrendingFacetsQuery } from './TrendingFacetsQuery' ;
88import { TrendingItemsQuery } from './TrendingItemsQuery' ;
9+ import { TrendingQuery } from './TrendingQuery' ;
910
1011export type WithRecommendMethods < TType > = TType & {
1112 /**
1213 * Returns recommendations.
1314 */
1415 readonly getRecommendations : < TObject > (
15- queries : readonly RecommendationsQuery [ ] ,
16+ queries : ReadonlyArray < RecommendationsQuery | TrendingQuery > ,
1617 requestOptions ?: RequestOptions & SearchOptions
1718 ) => Readonly < Promise < MultipleQueriesResponse < TObject > > > ;
1819
Original file line number Diff line number Diff line change @@ -12,4 +12,5 @@ export * from './RecommendationsQuery';
1212export * from './RelatedProductsQuery' ;
1313export * from './TrendingFacetsQuery' ;
1414export * from './TrendingItemsQuery' ;
15+ export * from './TrendingQuery' ;
1516export * from './WithRecommendMethods' ;
You can’t perform that action at this time.
0 commit comments