Skip to content

Commit

Permalink
fix(recommend): create RecommendSearchOptions type
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Jun 22, 2021
1 parent f39102d commit 911c7db
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
12 changes: 8 additions & 4 deletions packages/recommend/src/methods/getRecommendations.ts
@@ -1,16 +1,20 @@
import { SearchOptions } from '@algolia/client-search';
import { MethodEnum } from '@algolia/requester-common';

import { RecommendClient, RecommendModel, WithRecommendMethods } from '../types';
import {
RecommendClient,
RecommendModel,
RecommendSearchOptions,
WithRecommendMethods,
} from '../types';

export type GetRecommendationsOptions = {
readonly indexName: string;
readonly model: RecommendModel;
readonly objectID: string;
readonly threshold?: number;
readonly maxRecommendations?: number;
readonly queryParameters?: SearchOptions;
readonly fallbackParameters?: Pick<SearchOptions, 'facetFilters'>;
readonly queryParameters?: RecommendSearchOptions;
readonly fallbackParameters?: RecommendSearchOptions;
};

type GetRecommendations = (
Expand Down
6 changes: 6 additions & 0 deletions packages/recommend/src/types/RecommendSearchOptions.ts
@@ -0,0 +1,6 @@
import { SearchOptions } from '@algolia/client-search';

export type RecommendSearchOptions = Omit<
SearchOptions,
'page' | 'hitsPerPage' | 'offset' | 'length'
>;
3 changes: 2 additions & 1 deletion packages/recommend/src/types/index.ts
Expand Up @@ -4,6 +4,7 @@

export * from './RecommendClient';
export * from './RecommendClientOptions';
export * from './RecommendOptions';
export * from './RecommendModel';
export * from './RecommendOptions';
export * from './RecommendSearchOptions';
export * from './WithRecommendMethods';

0 comments on commit 911c7db

Please sign in to comment.