-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(recommend): export method types (#1287)
- Loading branch information
1 parent
2fefd78
commit 95281fe
Showing
13 changed files
with
68 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 5 additions & 10 deletions
15
packages/recommend/src/methods/getFrequentlyBoughtTogether.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...es/recommend/src/types/RecommendClient.ts → ...ecommend/src/types/BaseRecommendClient.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/recommend/src/types/FrequentlyBoughtTogetherQuery.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { RecommendationsQuery } from './RecommendationsQuery'; | ||
|
||
export type FrequentlyBoughtTogetherQuery = Omit< | ||
RecommendationsQuery, | ||
'model' | 'fallbackParameters' | ||
>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { RecommendModel } from './RecommendModel'; | ||
import { RecommendSearchOptions } from './RecommendSearchOptions'; | ||
|
||
export type RecommendationsQuery = { | ||
readonly indexName: string; | ||
readonly model: RecommendModel; | ||
readonly objectID: string; | ||
readonly threshold?: number; | ||
readonly maxRecommendations?: number; | ||
readonly queryParameters?: RecommendSearchOptions; | ||
readonly fallbackParameters?: RecommendSearchOptions; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { RecommendationsQuery } from './RecommendationsQuery'; | ||
|
||
export type RelatedProductsQuery = Omit<RecommendationsQuery, 'model'>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
import { MultipleQueriesResponse, SearchOptions } from '@algolia/client-search'; | ||
import { RequestOptions } from '@algolia/transporter'; | ||
|
||
import { | ||
GetFrequentlyBoughtTogetherQuery, | ||
GetRecommendationsQuery, | ||
GetRelatedProductsQuery, | ||
} from '../methods'; | ||
import { FrequentlyBoughtTogetherQuery } from './FrequentlyBoughtTogetherQuery'; | ||
import { RecommendationsQuery } from './RecommendationsQuery'; | ||
import { RelatedProductsQuery } from './RelatedProductsQuery'; | ||
|
||
export type WithRecommendMethods<TType> = TType & { | ||
/** | ||
* Returns recommendations. | ||
*/ | ||
readonly getRecommendations: <TObject>( | ||
queries: readonly GetRecommendationsQuery[], | ||
queries: readonly RecommendationsQuery[], | ||
requestOptions?: RequestOptions & SearchOptions | ||
) => Readonly<Promise<MultipleQueriesResponse<TObject>>>; | ||
|
||
/** | ||
* Returns [Related Products](https://algolia.com/doc/guides/algolia-ai/recommend/#related-products). | ||
*/ | ||
readonly getRelatedProducts: <TObject>( | ||
queries: readonly GetRelatedProductsQuery[], | ||
queries: readonly RelatedProductsQuery[], | ||
requestOptions?: RequestOptions & SearchOptions | ||
) => Readonly<Promise<MultipleQueriesResponse<TObject>>>; | ||
|
||
/** | ||
* Returns [Frequently Bought Together](https://algolia.com/doc/guides/algolia-ai/recommend/#frequently-bought-together) products. | ||
*/ | ||
readonly getFrequentlyBoughtTogether: <TObject>( | ||
queries: readonly GetFrequentlyBoughtTogetherQuery[], | ||
queries: readonly FrequentlyBoughtTogetherQuery[], | ||
requestOptions?: RequestOptions & SearchOptions | ||
) => Readonly<Promise<MultipleQueriesResponse<TObject>>>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters