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 1
1
import { MethodEnum } from '@algolia/requester-common' ;
2
2
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' ;
11
5
12
6
type GetRecommendations = (
13
7
base : BaseRecommendClient
14
8
) => WithRecommendMethods < BaseRecommendClient > [ 'getRecommendations' ] ;
15
9
16
- type TrendingQuery =
17
- | ( TrendingItemsQuery & { readonly model : TrendingModel } )
18
- | ( TrendingFacetsQuery & { readonly model : TrendingModel } ) ;
19
-
20
10
export const getRecommendations : GetRecommendations = base => {
21
11
return ( queries : ReadonlyArray < RecommendationsQuery | TrendingQuery > , requestOptions ) => {
22
12
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';
6
6
import { RelatedProductsQuery } from './RelatedProductsQuery' ;
7
7
import { TrendingFacetsQuery } from './TrendingFacetsQuery' ;
8
8
import { TrendingItemsQuery } from './TrendingItemsQuery' ;
9
+ import { TrendingQuery } from './TrendingQuery' ;
9
10
10
11
export type WithRecommendMethods < TType > = TType & {
11
12
/**
12
13
* Returns recommendations.
13
14
*/
14
15
readonly getRecommendations : < TObject > (
15
- queries : readonly RecommendationsQuery [ ] ,
16
+ queries : ReadonlyArray < RecommendationsQuery | TrendingQuery > ,
16
17
requestOptions ?: RequestOptions & SearchOptions
17
18
) => Readonly < Promise < MultipleQueriesResponse < TObject > > > ;
18
19
Original file line number Diff line number Diff line change @@ -12,4 +12,5 @@ export * from './RecommendationsQuery';
12
12
export * from './RelatedProductsQuery' ;
13
13
export * from './TrendingFacetsQuery' ;
14
14
export * from './TrendingItemsQuery' ;
15
+ export * from './TrendingQuery' ;
15
16
export * from './WithRecommendMethods' ;
You can’t perform that action at this time.
0 commit comments