stub methods

This commit is contained in:
Stuart Boston
2015-03-03 13:19:33 +00:00
parent 5dd6ed7d60
commit 306f6f3cc2
3 changed files with 370 additions and 225 deletions
@@ -95,7 +95,8 @@ import org.yamj.api.common.http.SimpleHttpClientBuilder;
/**
* The MovieDb API
* <p>
* This is for version 3 of the API as specified here: http://help.themoviedb.org/kb/api/about-3
* This is for version 3 of the API as specified here:
* http://help.themoviedb.org/kb/api/about-3
*
* @author stuart.boston
*/
@@ -193,7 +194,8 @@ public class TheMovieDbApi {
* @param moviedb The moviedb object to compare too
* @param title The title of the movie to compare
* @param year The year of the movie to compare
* @param maxDistance The Levenshtein Distance between the two titles. 0 = exact match
* @param maxDistance The Levenshtein Distance between the two titles. 0 =
* exact match
* @param caseSensitive true if the comparison is to be case sensitive
* @return True if there is a match, False otherwise.
*/
@@ -274,7 +276,8 @@ public class TheMovieDbApi {
//<editor-fold defaultstate="collapsed" desc="Account">
/**
* Get the basic information for an account. You will need to have a valid session id.
* Get the basic information for an account. You will need to have a valid
* session id.
*
* @param sessionId
* @return
@@ -440,13 +443,16 @@ public class TheMovieDbApi {
//<editor-fold defaultstate="collapsed" desc="Authentication">
/**
* This method is used to generate a valid request token for user based authentication.
* This method is used to generate a valid request token for user based
* authentication.
*
* A request token is required in order to request a session id.
*
* You can generate any number of request tokens but they will expire after 60 minutes.
* You can generate any number of request tokens but they will expire after
* 60 minutes.
*
* As soon as a valid session id has been created the token will be destroyed.
* As soon as a valid session id has been created the token will be
* destroyed.
*
* @return
* @throws MovieDbException
@@ -456,7 +462,8 @@ public class TheMovieDbApi {
}
/**
* This method is used to generate a session id for user based authentication.
* This method is used to generate a session id for user based
* authentication.
*
* A session id is required in order to use any of the write methods.
*
@@ -469,7 +476,8 @@ public class TheMovieDbApi {
}
/**
* This method is used to generate a session id for user based authentication. User must provide their username and password
* This method is used to generate a session id for user based
* authentication. User must provide their username and password
*
* A session id is required in order to use any of the write methods.
*
@@ -486,14 +494,18 @@ public class TheMovieDbApi {
/**
* This method is used to generate a guest session id.
*
* A guest session can be used to rate movies without having a registered TMDb user account.
* A guest session can be used to rate movies without having a registered
* TMDb user account.
*
* You should only generate a single guest session per user (or device) as you will be able to attach the ratings to a TMDb user
* account in the future.
* You should only generate a single guest session per user (or device) as
* you will be able to attach the ratings to a TMDb user account in the
* future.
*
* There are also IP limits in place so you should always make sure it's the end user doing the guest session actions.
* There are also IP limits in place so you should always make sure it's the
* end user doing the guest session actions.
*
* If a guest session is not used for the first time within 24 hours, it will be automatically discarded.
* If a guest session is not used for the first time within 24 hours, it
* will be automatically discarded.
*
* @return
* @throws MovieDbException
@@ -529,7 +541,8 @@ public class TheMovieDbApi {
/**
* Get a list of Movie IDs that have been edited.
*
* You can then use the movie changes API to get the actual data that has been changed.
* You can then use the movie changes API to get the actual data that has
* been changed.
*
* @param page
* @param startDate the start date of the changes, optional
@@ -537,14 +550,15 @@ public class TheMovieDbApi {
* @return List of changed movie
* @throws MovieDbException
*/
public List<ChangeListItem> getMovieChangeList(int page, String startDate, String endDate) throws MovieDbException {
public List<ChangeListItem> getMovieChangeList(Integer page, String startDate, String endDate) throws MovieDbException {
return tmdbChanges.getChangeList(MethodBase.MOVIE, page, startDate, endDate);
}
/**
* Get a list of TV IDs that have been edited.
*
* You can then use the TV changes API to get the actual data that has been changed.
* You can then use the TV changes API to get the actual data that has been
* changed.
*
* @param page
* @param startDate the start date of the changes, optional
@@ -552,14 +566,15 @@ public class TheMovieDbApi {
* @return List of changed movie
* @throws MovieDbException
*/
public List<ChangeListItem> getTvChangeList(int page, String startDate, String endDate) throws MovieDbException {
public List<ChangeListItem> getTvChangeList(Integer page, String startDate, String endDate) throws MovieDbException {
return tmdbChanges.getChangeList(MethodBase.TV, page, startDate, endDate);
}
/**
* Get a list of Person IDs that have been edited.
*
* You can then use the person changes API to get the actual data that has been changed.
* You can then use the person changes API to get the actual data that has
* been changed.
*
* @param page
* @param startDate the start date of the changes, optional
@@ -567,16 +582,18 @@ public class TheMovieDbApi {
* @return List of changed movie
* @throws MovieDbException
*/
public List<ChangeListItem> getPersonChangeList(int page, String startDate, String endDate) throws MovieDbException {
public List<ChangeListItem> getPersonChangeList(Integer page, String startDate, String endDate) throws MovieDbException {
return tmdbChanges.getChangeList(MethodBase.PERSON, page, startDate, endDate);
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Collections">
/**
* This method is used to retrieve all of the basic information about a movie collection.
* This method is used to retrieve all of the basic information about a
* movie collection.
*
* You can get the ID needed for this method by making a getMovieInfo request for the belongs_to_collection.
* You can get the ID needed for this method by making a getMovieInfo
* request for the belongs_to_collection.
*
* @param collectionId
* @param language
@@ -602,7 +619,8 @@ public class TheMovieDbApi {
//<editor-fold defaultstate="collapsed" desc="Companies">
/**
* This method is used to retrieve the basic information about a production company on TMDb.
* This method is used to retrieve the basic information about a production
* company on TMDb.
*
* @param companyId
* @return
@@ -615,7 +633,8 @@ public class TheMovieDbApi {
/**
* This method is used to retrieve the movies associated with a company.
*
* These movies are returned in order of most recently released to oldest. The default response will return 20 movies per page.
* These movies are returned in order of most recently released to oldest.
* The default response will return 20 movies per page.
*
* TODO: Implement more than 20 movies
*
@@ -625,7 +644,7 @@ public class TheMovieDbApi {
* @return
* @throws MovieDbException
*/
public List<MovieBasic> getCompanyMovies(int companyId, String language, int page) throws MovieDbException {
public List<MovieBasic> getCompanyMovies(int companyId, String language, Integer page) throws MovieDbException {
return tmdbCompany.getCompanyMovies(companyId, language, page);
}
//</editor-fold>
@@ -664,7 +683,8 @@ public class TheMovieDbApi {
}
/**
* Get the list of supported timezones for the API methods that support them.
* Get the list of supported timezones for the API methods that support
* them.
*
* @return @throws MovieDbException
*/
@@ -679,11 +699,14 @@ public class TheMovieDbApi {
* <p>
* This is currently only supported with the new credit model found in TV.
* <br/>
* These IDs can be found from any TV credit response as well as the TV_credits and combined_credits methods for people. <br/>
* The episodes object returns a list of episodes and are generally going to be guest stars. <br/>
* These IDs can be found from any TV credit response as well as the
* TV_credits and combined_credits methods for people. <br/>
* The episodes object returns a list of episodes and are generally going to
* be guest stars. <br/>
* The season array will return a list of season numbers. <br/>
* Season credits are credits that were marked with the "add to every season" option in the editing interface and are assumed to
* be "season regulars".
* Season credits are credits that were marked with the "add to every
* season" option in the editing interface and are assumed to be "season
* regulars".
*
* @param creditId
* @param language
@@ -697,7 +720,8 @@ public class TheMovieDbApi {
//<editor-fold defaultstate="collapsed" desc="Discover">
/**
* Discover movies by different types of data like average rating, number of votes, genres and certifications.
* Discover movies by different types of data like average rating, number of
* votes, genres and certifications.
*
* @param discover A discover object containing the search criteria required
* @return
@@ -708,7 +732,8 @@ public class TheMovieDbApi {
}
/**
* Discover movies by different types of data like average rating, number of votes, genres and certifications.
* Discover movies by different types of data like average rating, number of
* votes, genres and certifications.
*
* @param discover A discover object containing the search criteria required
* @return
@@ -721,16 +746,18 @@ public class TheMovieDbApi {
//<editor-fold defaultstate="collapsed" desc="Find">
/**
* You con use this method to find movies, tv series or persons using external ids.
* You con use this method to find movies, tv series or persons using
* external ids.
*
* Supported query ids are
* <ul>
* <li>Movies: imdb_id</li>
* <li>People: imdb_id, freebase_mid, freebase_id, tvrage_id</li>
* <li>TV Series: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_id</li>
* <li>TV Series: imdb_id, freebase_mid, freebase_id, tvdb_id,
* tvrage_id</li>
* <li>TV Seasons: freebase_mid, freebase_id, tvdb_id, tvrage_id</li>
* <li>TV Episodes: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_idimdb_id, freebase_mid, freebase_id, tvrage_id,
* tvdb_id.
* <li>TV Episodes: imdb_id, freebase_mid, freebase_id, tvdb_id,
* tvrage_idimdb_id, freebase_mid, freebase_id, tvrage_id, tvdb_id.
* </ul>
*
* For details see http://docs.themoviedb.apiary.io/#find
@@ -772,9 +799,11 @@ public class TheMovieDbApi {
/**
* Get a list of movies per genre.
*
* It is important to understand that only movies with more than 10 votes get listed.
* It is important to understand that only movies with more than 10 votes
* get listed.
*
* This prevents movies from 1 10/10 rating from being listed first and for the first 5 pages.
* This prevents movies from 1 10/10 rating from being listed first and for
* the first 5 pages.
*
* @param genreId
* @param language
@@ -810,7 +839,7 @@ public class TheMovieDbApi {
* @return List of movies with the keyword
* @throws MovieDbException
*/
public TmdbResultsList<KeywordMovie> getKeywordMovies(String keywordId, String language, int page) throws MovieDbException {
public TmdbResultsList<KeywordMovie> getKeywordMovies(String keywordId, String language, Integer page) throws MovieDbException {
return tmdbKeywords.getKeywordMovies(keywordId, language, page);
}
//</editor-fold>
@@ -841,7 +870,8 @@ public class TheMovieDbApi {
}
/**
* This method lets users delete a list that they created. A valid session id is required.
* This method lets users delete a list that they created. A valid session
* id is required.
*
* @param sessionId
* @param listId
@@ -901,7 +931,8 @@ public class TheMovieDbApi {
*
* It will return the single highest rated poster and backdrop.
*
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies found.
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies
* found.
*
* @param movieId
* @param language
@@ -918,7 +949,8 @@ public class TheMovieDbApi {
*
* It will return the single highest rated poster and backdrop.
*
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies found.
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies
* found.
*
* @param imdbId
* @param language
@@ -931,7 +963,8 @@ public class TheMovieDbApi {
}
/**
* This method is used to retrieve all of the alternative titles we have for a particular movie.
* This method is used to retrieve all of the alternative titles we have for
* a particular movie.
*
* @param movieId
* @param country
@@ -958,7 +991,8 @@ public class TheMovieDbApi {
}
/**
* This method should be used when youre wanting to retrieve all of the images for a particular movie.
* This method should be used when youre wanting to retrieve all of the
* images for a particular movie.
*
* @param movieId
* @param language
@@ -971,7 +1005,8 @@ public class TheMovieDbApi {
}
/**
* This method is used to retrieve all of the keywords that have been added to a particular movie.
* This method is used to retrieve all of the keywords that have been added
* to a particular movie.
*
* Currently, only English keywords exist.
*
@@ -985,7 +1020,8 @@ public class TheMovieDbApi {
}
/**
* This method is used to retrieve all of the release and certification data we have for a specific movie.
* This method is used to retrieve all of the release and certification data
* we have for a specific movie.
*
* @param movieId
* @param language
@@ -998,7 +1034,8 @@ public class TheMovieDbApi {
}
/**
* This method is used to retrieve all of the trailers for a particular movie.
* This method is used to retrieve all of the trailers for a particular
* movie.
*
* Supported sites are YouTube and QuickTime.
*
@@ -1009,11 +1046,12 @@ public class TheMovieDbApi {
* @throws MovieDbException
*/
public TmdbResultsList<Video> getMovieTrailers(int movieId, String language, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieTrailers(movieId, language, appendToResponse);
return tmdbMovies.getMovieVideos(movieId, language, appendToResponse);
}
/**
* This method is used to retrieve a list of the available translations for a specific movie.
* This method is used to retrieve a list of the available translations for
* a specific movie.
*
* @param movieId
* @param appendToResponse
@@ -1025,9 +1063,11 @@ public class TheMovieDbApi {
}
/**
* The similar movies method will let you retrieve the similar movies for a particular movie.
* The similar movies method will let you retrieve the similar movies for a
* particular movie.
*
* This data is created dynamically but with the help of users votes on TMDb.
* This data is created dynamically but with the help of users votes on
* TMDb.
*
* The data is much better with movies that have more keywords
*
@@ -1038,8 +1078,8 @@ public class TheMovieDbApi {
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getSimilarMovies(int movieId, String language, int page, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getSimilarMovies(movieId, language, page, appendToResponse);
public TmdbResultsList<MovieDb> getSimilarMovies(int movieId, String language, Integer page, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getSimilarMovies(movieId, page, language, appendToResponse);
}
/**
@@ -1052,8 +1092,8 @@ public class TheMovieDbApi {
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieList> getMovieLists(int movieId, String language, int page, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieLists(movieId, language, page, appendToResponse);
public TmdbResultsList<MovieList> getMovieLists(int movieId, String language, Integer page, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieLists(movieId, page, language, appendToResponse);
}
/**
@@ -1078,14 +1118,15 @@ public class TheMovieDbApi {
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getUpcoming(String language, int page) throws MovieDbException {
return tmdbMovies.getUpcoming(language, page);
public TmdbResultsList<MovieDb> getUpcoming(String language, Integer page) throws MovieDbException {
return tmdbMovies.getUpcoming(page, language);
}
/**
* This method is used to retrieve the movies currently in theatres.
*
* This is a curated list that will normally contain 100 movies. The default response will return 20 movies.
* This is a curated list that will normally contain 100 movies. The default
* response will return 20 movies.
*
* TODO: Implement more than 20 movies
*
@@ -1094,8 +1135,8 @@ public class TheMovieDbApi {
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getNowPlayingMovies(String language, int page) throws MovieDbException {
return tmdbMovies.getNowPlayingMovies(language, page);
public TmdbResultsList<MovieDb> getNowPlayingMovies(String language, Integer page) throws MovieDbException {
return tmdbMovies.getNowPlayingMovies(page, language);
}
/**
@@ -1110,12 +1151,13 @@ public class TheMovieDbApi {
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getPopularMovieList(String language, int page) throws MovieDbException {
return tmdbMovies.getPopularMovieList(language, page);
public TmdbResultsList<MovieDb> getPopularMovieList(String language, Integer page) throws MovieDbException {
return tmdbMovies.getPopularMovieList(page, language);
}
/**
* This method is used to retrieve the top rated movies that have over 10 votes on TMDb.
* This method is used to retrieve the top rated movies that have over 10
* votes on TMDb.
*
* The default response will return 20 movies.
*
@@ -1126,8 +1168,8 @@ public class TheMovieDbApi {
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getTopRatedMovies(String language, int page) throws MovieDbException {
return tmdbMovies.getTopRatedMovies(language, page);
public TmdbResultsList<MovieDb> getTopRatedMovies(String language, Integer page) throws MovieDbException {
return tmdbMovies.getTopRatedMovies(page, language);
}
/**
@@ -1190,9 +1232,11 @@ public class TheMovieDbApi {
/**
* Get the TV credits for a specific person id.
*
* To get the expanded details for each record, call the /credit method with the provided credit_id.
* To get the expanded details for each record, call the /credit method with
* the provided credit_id.
*
* This will provide details about which episode and/or season the credit is for.
* This will provide details about which episode and/or season the credit is
* for.
*
* @param personId
* @param language
@@ -1207,9 +1251,11 @@ public class TheMovieDbApi {
/**
* Get the combined (movie and TV) credits for a specific person id.
*
* To get the expanded details for each TV record, call the /credit method with the provided credit_id.
* To get the expanded details for each TV record, call the /credit method
* with the provided credit_id.
*
* This will provide details about which episode and/or season the credit is for.
* This will provide details about which episode and/or season the credit is
* for.
*
* @param personId
* @param language
@@ -1246,7 +1292,8 @@ public class TheMovieDbApi {
/**
* Get the images that have been tagged with a specific person id.
*
* We return all of the image results with a media object mapped for each image.
* We return all of the image results with a media object mapped for each
* image.
*
* @param personId
* @param page
@@ -1265,7 +1312,8 @@ public class TheMovieDbApi {
*
* By default, only the last 24 hours of changes are returned.
*
* The maximum number of days that can be returned in a single request is 14.
* The maximum number of days that can be returned in a single request is
* 14.
*
* The language is present on fields that are translatable.
*
@@ -1318,8 +1366,8 @@ public class TheMovieDbApi {
/**
* Search Companies.
*
* You can use this method to search for production companies that are part of TMDb. The company IDs will map to those returned
* on movie calls.
* You can use this method to search for production companies that are part
* of TMDb. The company IDs will map to those returned on movie calls.
*
* http://help.themoviedb.org/kb/api/search-companies
*
@@ -1371,13 +1419,16 @@ public class TheMovieDbApi {
}
/**
* Search Movies This is a good starting point to start finding movies on TMDb.
* Search Movies This is a good starting point to start finding movies on
* TMDb.
*
* @param query
* @param searchYear Limit the search to the provided year. Zero (0) will get all years
* @param searchYear Limit the search to the provided year. Zero (0) will
* get all years
* @param language The language to include. Can be blank/null.
* @param includeAdult true or false to include adult titles in the search
* @param page The page of results to return. 0 to get the default (first page)
* @param page The page of results to return. 0 to get the default (first
* page)
* @param primaryReleaseYear
* @param searchType
* @return
@@ -1396,9 +1447,11 @@ public class TheMovieDbApi {
/**
* Search the movie, tv show and person collections with a single query.
*
* Each item returned in the result array has a media_type field that maps to either movie, tv or person.
* Each item returned in the result array has a media_type field that maps
* to either movie, tv or person.
*
* Each mapped result is the same response you would get from each independent search
* Each mapped result is the same response you would get from each
* independent search
*
* @param query
* @param page
@@ -1414,7 +1467,8 @@ public class TheMovieDbApi {
/**
* This is a good starting point to start finding people on TMDb.
*
* The idea is to be a quick and light method so you can iterate through people quickly.
* The idea is to be a quick and light method so you can iterate through
* people quickly.
*
* @param query
* @param includeAdult
@@ -21,15 +21,15 @@ package com.omertron.themoviedbapi.methods;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.model.AlternativeTitle;
import com.omertron.themoviedbapi.model2.artwork.Artwork;
import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model.MovieList;
import com.omertron.themoviedbapi.model.ReleaseInfo;
import com.omertron.themoviedbapi.model2.StatusCode;
import com.omertron.themoviedbapi.model.Translation;
import com.omertron.themoviedbapi.model.Video;
import com.omertron.themoviedbapi.model2.keyword.Keyword;
import com.omertron.themoviedbapi.model.person.Person;
import com.omertron.themoviedbapi.model2.StatusCode;
import com.omertron.themoviedbapi.model2.artwork.Artwork;
import com.omertron.themoviedbapi.model2.keyword.Keyword;
import com.omertron.themoviedbapi.results.TmdbResultsList;
import com.omertron.themoviedbapi.tools.ApiUrl;
import com.omertron.themoviedbapi.tools.HttpTools;
@@ -139,6 +139,27 @@ public class TmdbMovies extends AbstractMethod {
}
}
/**
* This method lets a user get the status of whether or not the movie has
* been rated or added to their favourite or movie watch list.
*
* A valid session id is required.
*
* @param movieId
* @param sessionId
* @return
* @throws MovieDbException
*/
public String getMovieAccountState(int movieId, String sessionId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.SESSION, sessionId);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
return null;
}
/**
* This method is used to retrieve all of the alternative titles we have for
* a particular movie.
@@ -167,6 +188,24 @@ public class TmdbMovies extends AbstractMethod {
}
}
/**
* Get the cast and crew information for a specific movie id.
*
* @param movieId
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public String getMovieCredits(int movieId, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
return null;
}
/**
* Get the cast information for a specific movie id.
*
@@ -294,7 +333,7 @@ public class TmdbMovies extends AbstractMethod {
* @return
* @throws MovieDbException
*/
public TmdbResultsList<Video> getMovieTrailers(int movieId, String language, String... appendToResponse) throws MovieDbException {
public TmdbResultsList<Video> getMovieVideos(int movieId, String language, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.LANGUAGE, language);
@@ -356,7 +395,7 @@ public class TmdbMovies extends AbstractMethod {
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getSimilarMovies(int movieId, String language, int page, String... appendToResponse) throws MovieDbException {
public TmdbResultsList<MovieDb> getSimilarMovies(int movieId, Integer page, String language, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.LANGUAGE, language);
@@ -376,6 +415,28 @@ public class TmdbMovies extends AbstractMethod {
}
}
/**
* Get the reviews for a particular movie id.
*
* @param movieId
* @param page
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public String getMovieReviews(int movieId, Integer page, String language, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
return null;
}
/**
* Get the lists that the movie belongs to
*
@@ -386,7 +447,7 @@ public class TmdbMovies extends AbstractMethod {
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieList> getMovieLists(int movieId, String language, int page, String... appendToResponse) throws MovieDbException {
public TmdbResultsList<MovieList> getMovieLists(int movieId, Integer page, String language, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.LANGUAGE, language);
@@ -407,143 +468,32 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* This method is used to retrieve the newest movie that was added to TMDb.
* Get the changes for a specific movie ID.
*
* Changes are grouped by key, and ordered by date in descending order.
*
* By default, only the last 24 hours of changes are returned.
*
* The maximum number of days that can be returned in a single request is
* 14.
*
* The language is present on fields that are translatable.
*
* @param movieId
* @param startDate
* @param endDate
* @return
* @throws MovieDbException
*/
public MovieDb getLatestMovie() throws MovieDbException {
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).setSubMethod(MethodSub.LATEST).buildUrl();
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, MovieDb.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get latest movie", url, ex);
}
}
/**
* Get the list of upcoming movies.
*
* This list refreshes every day.
*
* The maximum number of items this list will include is 100.
*
* @param language
* @param page
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getUpcoming(String language, int page) throws MovieDbException {
public String getMovieChanges(int movieId, String startDate, String endDate) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.PAGE, page);
parameters.add(Param.ID, movieId);
parameters.add(Param.START_DATE, startDate);
parameters.add(Param.END_DATE, endDate);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).setSubMethod(MethodSub.UPCOMING).buildUrl(parameters);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
WrapperMovie wrapper = MAPPER.readValue(webpage, WrapperMovie.class);
TmdbResultsList<MovieDb> results = new TmdbResultsList<MovieDb>(wrapper.getMovies());
results.copyWrapper(wrapper);
return results;
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get upcoming movies", url, ex);
}
}
/**
* This method is used to retrieve the movies currently in theatres.
*
* This is a curated list that will normally contain 100 movies. The default
* response will return 20 movies.
*
* TODO: Implement more than 20 movies
*
* @param language
* @param page
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getNowPlayingMovies(String language, int page) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.PAGE, page);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).setSubMethod(MethodSub.NOW_PLAYING).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
WrapperMovie wrapper = MAPPER.readValue(webpage, WrapperMovie.class);
TmdbResultsList<MovieDb> results = new TmdbResultsList<MovieDb>(wrapper.getMovies());
results.copyWrapper(wrapper);
return results;
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get now playing movies", url, ex);
}
}
/**
* This method is used to retrieve the daily movie popularity list.
*
* This list is updated daily. The default response will return 20 movies.
*
* TODO: Implement more than 20 movies
*
* @param language
* @param page
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getPopularMovieList(String language, int page) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.PAGE, page);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).setSubMethod(MethodSub.POPULAR).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
WrapperMovie wrapper = MAPPER.readValue(webpage, WrapperMovie.class);
TmdbResultsList<MovieDb> results = new TmdbResultsList<MovieDb>(wrapper.getMovies());
results.copyWrapper(wrapper);
return results;
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get popular movie list", url, ex);
}
}
/**
* This method is used to retrieve the top rated movies that have over 10
* votes on TMDb.
*
* The default response will return 20 movies.
*
* TODO: Implement more than 20 movies
*
* @param language
* @param page
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getTopRatedMovies(String language, int page) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.PAGE, page);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).setSubMethod(MethodSub.TOP_RATED).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
WrapperMovie wrapper = MAPPER.readValue(webpage, WrapperMovie.class);
TmdbResultsList<MovieDb> results = new TmdbResultsList<MovieDb>(wrapper.getMovies());
results.copyWrapper(wrapper);
return results;
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get top rated movies", url, ex);
}
return null;
}
/**
@@ -583,4 +533,144 @@ public class TmdbMovies extends AbstractMethod {
}
}
/**
* This method is used to retrieve the newest movie that was added to TMDb.
*
* @return
* @throws MovieDbException
*/
public MovieDb getLatestMovie() throws MovieDbException {
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).setSubMethod(MethodSub.LATEST).buildUrl();
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, MovieDb.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get latest movie", url, ex);
}
}
/**
* Get the list of upcoming movies.
*
* This list refreshes every day.
*
* The maximum number of items this list will include is 100.
*
* @param language
* @param page
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getUpcoming(Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.PAGE, page);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).setSubMethod(MethodSub.UPCOMING).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
WrapperMovie wrapper = MAPPER.readValue(webpage, WrapperMovie.class);
TmdbResultsList<MovieDb> results = new TmdbResultsList<MovieDb>(wrapper.getMovies());
results.copyWrapper(wrapper);
return results;
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get upcoming movies", url, ex);
}
}
/**
* This method is used to retrieve the movies currently in theatres.
*
* This is a curated list that will normally contain 100 movies. The default
* response will return 20 movies.
*
* TODO: Implement more than 20 movies
*
* @param language
* @param page
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getNowPlayingMovies(Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.PAGE, page);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).setSubMethod(MethodSub.NOW_PLAYING).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
WrapperMovie wrapper = MAPPER.readValue(webpage, WrapperMovie.class);
TmdbResultsList<MovieDb> results = new TmdbResultsList<MovieDb>(wrapper.getMovies());
results.copyWrapper(wrapper);
return results;
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get now playing movies", url, ex);
}
}
/**
* This method is used to retrieve the daily movie popularity list.
*
* This list is updated daily. The default response will return 20 movies.
*
* TODO: Implement more than 20 movies
*
* @param language
* @param page
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getPopularMovieList(Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.PAGE, page);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).setSubMethod(MethodSub.POPULAR).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
WrapperMovie wrapper = MAPPER.readValue(webpage, WrapperMovie.class);
TmdbResultsList<MovieDb> results = new TmdbResultsList<MovieDb>(wrapper.getMovies());
results.copyWrapper(wrapper);
return results;
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get popular movie list", url, ex);
}
}
/**
* This method is used to retrieve the top rated movies that have over 10
* votes on TMDb.
*
* The default response will return 20 movies.
*
* TODO: Implement more than 20 movies
*
* @param language
* @param page
* @return
* @throws MovieDbException
*/
public TmdbResultsList<MovieDb> getTopRatedMovies(Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.PAGE, page);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).setSubMethod(MethodSub.TOP_RATED).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
WrapperMovie wrapper = MAPPER.readValue(webpage, WrapperMovie.class);
TmdbResultsList<MovieDb> results = new TmdbResultsList<MovieDb>(wrapper.getMovies());
results.copyWrapper(wrapper);
return results;
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get top rated movies", url, ex);
}
}
}
@@ -22,13 +22,13 @@ package com.omertron.themoviedbapi.methods;
import com.omertron.themoviedbapi.AbstractTests;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.model.AlternativeTitle;
import com.omertron.themoviedbapi.model2.artwork.Artwork;
import com.omertron.themoviedbapi.model2.keyword.Keyword;
import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model.MovieList;
import com.omertron.themoviedbapi.model.ReleaseInfo;
import com.omertron.themoviedbapi.model.Translation;
import com.omertron.themoviedbapi.model.Video;
import com.omertron.themoviedbapi.model2.artwork.Artwork;
import com.omertron.themoviedbapi.model2.keyword.Keyword;
import com.omertron.themoviedbapi.model2.movie.MovieBasic;
import com.omertron.themoviedbapi.results.TmdbResultsList;
import java.util.List;
@@ -179,14 +179,14 @@ public class TmdbMoviesTest extends AbstractTests {
}
/**
* Test of getMovieTrailers method, of class TheMovieDbApi.
* Test of getMovieVideos method, of class TheMovieDbApi.
*
* @throws MovieDbException
*/
@Test
public void testGetMovieTrailers() throws MovieDbException {
LOG.info("getMovieTrailers");
TmdbResultsList<Video> result = instance.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, "");
TmdbResultsList<Video> result = instance.getMovieVideos(ID_MOVIE_BLADE_RUNNER, "");
assertFalse("Movie trailers missing", result.getResults().isEmpty());
}
@@ -210,7 +210,7 @@ public class TmdbMoviesTest extends AbstractTests {
@Test
public void testGetSimilarMovies() throws MovieDbException {
LOG.info("getSimilarMovies");
TmdbResultsList<MovieDb> result = instance.getSimilarMovies(ID_MOVIE_BLADE_RUNNER, LANGUAGE_DEFAULT, 0);
TmdbResultsList<MovieDb> result = instance.getSimilarMovies(ID_MOVIE_BLADE_RUNNER, 0, LANGUAGE_DEFAULT);
assertTrue("No similar movies found", !result.getResults().isEmpty());
}
@@ -222,7 +222,7 @@ public class TmdbMoviesTest extends AbstractTests {
@Test
public void testGetMovieLists() throws MovieDbException {
LOG.info("getMovieLists");
TmdbResultsList<MovieList> result = instance.getMovieLists(ID_MOVIE_BLADE_RUNNER, LANGUAGE_ENGLISH, 0);
TmdbResultsList<MovieList> result = instance.getMovieLists(ID_MOVIE_BLADE_RUNNER, 0, LANGUAGE_ENGLISH);
assertNotNull("No results found", result);
assertTrue("No results found", result.getResults().size() > 0);
}
@@ -248,7 +248,7 @@ public class TmdbMoviesTest extends AbstractTests {
@Test
public void testGetUpcoming() throws MovieDbException {
LOG.info("getUpcoming");
TmdbResultsList<MovieDb> result = instance.getUpcoming(LANGUAGE_DEFAULT, 0);
TmdbResultsList<MovieDb> result = instance.getUpcoming(0, LANGUAGE_DEFAULT);
assertTrue("No upcoming movies found", !result.getResults().isEmpty());
}
@@ -260,7 +260,7 @@ public class TmdbMoviesTest extends AbstractTests {
@Test
public void testGetNowPlayingMovies() throws MovieDbException {
LOG.info("getNowPlayingMovies");
TmdbResultsList<MovieDb> result = instance.getNowPlayingMovies(LANGUAGE_DEFAULT, 0);
TmdbResultsList<MovieDb> result = instance.getNowPlayingMovies(0, LANGUAGE_DEFAULT);
assertTrue("No now playing movies found", !result.getResults().isEmpty());
}
@@ -272,7 +272,7 @@ public class TmdbMoviesTest extends AbstractTests {
@Test
public void testGetPopularMovieList() throws MovieDbException {
LOG.info("getPopularMovieList");
TmdbResultsList<MovieDb> result = instance.getPopularMovieList(LANGUAGE_DEFAULT, 0);
TmdbResultsList<MovieDb> result = instance.getPopularMovieList(0, LANGUAGE_DEFAULT);
assertTrue("No popular movies found", !result.getResults().isEmpty());
}
@@ -284,14 +284,15 @@ public class TmdbMoviesTest extends AbstractTests {
@Test
public void testGetTopRatedMovies() throws MovieDbException {
LOG.info("getTopRatedMovies");
TmdbResultsList<MovieDb> result = instance.getTopRatedMovies(LANGUAGE_DEFAULT, 0);
TmdbResultsList<MovieDb> result = instance.getTopRatedMovies(0, LANGUAGE_DEFAULT);
assertTrue("No top rated movies found", !result.getResults().isEmpty());
}
/**
* Test of postMovieRating method, of class TheMovieDbApi.
*
* TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication /**
* TODO: Cannot be tested without a HTTP authorisation:
* http://help.themoviedb.org/kb/api/user-authentication /**
*
* @throws MovieDbException
*/