-
-
Notifications
You must be signed in to change notification settings - Fork 769
feat(search): add filters for search results #2725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
3b16a3a
dab0b48
95bf1d6
c2fd9e4
c41b9eb
8d745ce
eb1c451
2f80789
398e03f
e4f7f7e
0540f81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,8 +18,10 @@ import type { | |
| TmdbPersonDetails, | ||
| TmdbProductionCompany, | ||
| TmdbRegion, | ||
| TmdbSearchCollectionResponse, | ||
| TmdbSearchMovieResponse, | ||
| TmdbSearchMultiResponse, | ||
| TmdbSearchPersonResponse, | ||
| TmdbSearchTvResponse, | ||
| TmdbSeasonWithEpisodes, | ||
| TmdbTvDetails, | ||
|
|
@@ -230,6 +232,63 @@ class TheMovieDb extends ExternalAPI implements TvShowProvider { | |
| } | ||
| }; | ||
|
|
||
| public searchPerson = async ({ | ||
| query, | ||
| page = 1, | ||
| includeAdult = false, | ||
| language = this.locale, | ||
| }: SearchOptions): Promise<TmdbSearchPersonResponse> => { | ||
| try { | ||
| const data = await this.get<TmdbSearchPersonResponse>('/search/person', { | ||
| params: { | ||
| query, | ||
| page, | ||
| include_adult: includeAdult, | ||
| language, | ||
| }, | ||
| }); | ||
|
|
||
| return data; | ||
| } catch { | ||
| return { | ||
| page: 1, | ||
| results: [], | ||
| total_pages: 1, | ||
| total_results: 0, | ||
| }; | ||
|
Comment on lines
+235
to
+258
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don’t mask TMDB failures as an empty first page. Both new search paths return Also applies to: 262-288 🤖 Prompt for AI Agents |
||
| } | ||
| }; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| public searchCollections = async ({ | ||
| query, | ||
| page = 1, | ||
| includeAdult = false, | ||
| language = this.locale, | ||
| }: SearchOptions): Promise<TmdbSearchCollectionResponse> => { | ||
| try { | ||
| const data = await this.get<TmdbSearchCollectionResponse>( | ||
| '/search/collection', | ||
| { | ||
| params: { | ||
| query, | ||
| page, | ||
| include_adult: includeAdult, | ||
| language, | ||
| }, | ||
| } | ||
| ); | ||
|
|
||
| return data; | ||
| } catch { | ||
| return { | ||
| page: 1, | ||
| results: [], | ||
| total_pages: 1, | ||
| total_results: 0, | ||
| }; | ||
| } | ||
| }; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| public getPerson = async ({ | ||
| personId, | ||
| language = this.locale, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenAPI spec adds CollectionResult to the /search response, but there is no corresponding
components/schemas/CollectionResultdefined in this file. This makes the spec invalid for generators/validators. Add aCollectionResultschema (matching the API response fields) or reference an existing schema name if one already exists.