|
1 | 1 | import { MethodEnum } from '@algolia/requester-common';
|
2 | 2 |
|
3 |
| -import { |
4 |
| - RecommendClient, |
5 |
| - RecommendModel, |
6 |
| - RecommendSearchOptions, |
7 |
| - WithRecommendMethods, |
8 |
| -} from '../types'; |
9 |
| - |
10 |
| -export type GetRecommendationsQuery = { |
11 |
| - readonly indexName: string; |
12 |
| - readonly model: RecommendModel; |
13 |
| - readonly objectID: string; |
14 |
| - readonly threshold?: number; |
15 |
| - readonly maxRecommendations?: number; |
16 |
| - readonly queryParameters?: RecommendSearchOptions; |
17 |
| - readonly fallbackParameters?: RecommendSearchOptions; |
18 |
| -}; |
| 3 | +import { BaseRecommendClient, RecommendationsQuery, WithRecommendMethods } from '../types'; |
19 | 4 |
|
20 | 5 | type GetRecommendations = (
|
21 |
| - base: RecommendClient |
22 |
| -) => WithRecommendMethods<RecommendClient>['getRecommendations']; |
| 6 | + base: BaseRecommendClient |
| 7 | +) => WithRecommendMethods<BaseRecommendClient>['getRecommendations']; |
23 | 8 |
|
24 | 9 | export const getRecommendations: GetRecommendations = base => {
|
25 |
| - return (queries, requestOptions) => { |
26 |
| - const requests: readonly GetRecommendationsQuery[] = queries.map(query => ({ |
| 10 | + return (queries: readonly RecommendationsQuery[], requestOptions) => { |
| 11 | + const requests: readonly RecommendationsQuery[] = queries.map(query => ({ |
27 | 12 | // The `threshold` param is required by the endpoint to make it easier
|
28 | 13 | // to provide a default value later, so we default it in the client
|
29 | 14 | // so that users don't have to provide a value.
|
|
0 commit comments