-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Tmdb.Movies.search/2 for Tmdb.Search to match TMDb API (#3)
* Search endpoint added * delete search module from various resources * a
- Loading branch information
1 parent
a9482f4
commit f60ca5c
Showing
7 changed files
with
40 additions
and
30 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
defmodule Tmdb.Search do | ||
use Tmdb.Base | ||
|
||
def companies(query, params \\ %{}) do | ||
search_api("company", query, params) | ||
end | ||
|
||
def collections(query, params \\ %{}) do | ||
search_api("collection", query, params) | ||
end | ||
|
||
def keywords(query, params \\ %{}) do | ||
search_api("keyword", query, params) | ||
end | ||
|
||
def lists(query, params \\ %{}) do | ||
search_api("list", query, params) | ||
end | ||
|
||
def movies(query, params \\ %{}) do | ||
search_api("movie", query, params) | ||
end | ||
|
||
def multi(query, params \\ %{}) do | ||
search_api("multi", query, params) | ||
end | ||
|
||
def persons(query, params \\ %{}) do | ||
search_api("person", query, params) | ||
end | ||
|
||
def tv(query, params \\ %{}) do | ||
search_api("tv", query, params) | ||
end | ||
|
||
defp search_api(endpoint, query, params \\ %{}) do | ||
params = Map.merge(params, %{"query" => query}) | ||
get!("search/#{endpoint}?#{URI.encode_query(params)}").body | ||
end | ||
end |