Corrected AppendToResponse methods

master
Stuart Boston 11 years ago
parent c94688b0e1
commit 84243703e3

@ -32,6 +32,7 @@ import com.omertron.themoviedbapi.methods.TmdbCompanies;
import com.omertron.themoviedbapi.methods.TmdbConfiguration;
import com.omertron.themoviedbapi.methods.TmdbCredits;
import com.omertron.themoviedbapi.methods.TmdbDiscover;
import com.omertron.themoviedbapi.methods.TmdbEpisodes;
import com.omertron.themoviedbapi.methods.TmdbFind;
import com.omertron.themoviedbapi.methods.TmdbGenres;
import com.omertron.themoviedbapi.methods.TmdbKeywords;
@ -41,9 +42,8 @@ import com.omertron.themoviedbapi.methods.TmdbNetworks;
import com.omertron.themoviedbapi.methods.TmdbPeople;
import com.omertron.themoviedbapi.methods.TmdbReviews;
import com.omertron.themoviedbapi.methods.TmdbSearch;
import com.omertron.themoviedbapi.methods.TmdbTV;
import com.omertron.themoviedbapi.methods.TmdbEpisodes;
import com.omertron.themoviedbapi.methods.TmdbSeasons;
import com.omertron.themoviedbapi.methods.TmdbTV;
import com.omertron.themoviedbapi.model.Certification;
import com.omertron.themoviedbapi.model.FindResults;
import com.omertron.themoviedbapi.model.Genre;
@ -64,22 +64,22 @@ import com.omertron.themoviedbapi.model.discover.Discover;
import com.omertron.themoviedbapi.model.keyword.Keyword;
import com.omertron.themoviedbapi.model.list.ListItem;
import com.omertron.themoviedbapi.model.list.UserList;
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
import com.omertron.themoviedbapi.model.media.MediaBasic;
import com.omertron.themoviedbapi.model.media.MediaCreditList;
import com.omertron.themoviedbapi.model.media.MediaState;
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
import com.omertron.themoviedbapi.model.media.Translation;
import com.omertron.themoviedbapi.model.media.Video;
import com.omertron.themoviedbapi.model.movie.MovieBasic;
import com.omertron.themoviedbapi.model.movie.MovieInfo;
import com.omertron.themoviedbapi.model.movie.ReleaseInfo;
import com.omertron.themoviedbapi.model.media.Translation;
import com.omertron.themoviedbapi.model.media.Video;
import com.omertron.themoviedbapi.model.network.Network;
import com.omertron.themoviedbapi.model.person.ContentRating;
import com.omertron.themoviedbapi.model.person.CreditInfo;
import com.omertron.themoviedbapi.model.person.ExternalID;
import com.omertron.themoviedbapi.model.person.PersonInfo;
import com.omertron.themoviedbapi.model.person.PersonCreditList;
import com.omertron.themoviedbapi.model.person.PersonFind;
import com.omertron.themoviedbapi.model.person.PersonInfo;
import com.omertron.themoviedbapi.model.review.Review;
import com.omertron.themoviedbapi.model.tv.TVBasic;
import com.omertron.themoviedbapi.model.tv.TVEpisodeInfo;
@ -97,7 +97,8 @@ import org.yamj.api.common.http.SimpleHttpClientBuilder;
/**
* The MovieInfo 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
*/
@ -181,7 +182,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
@ -347,13 +349,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
@ -363,7 +368,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.
*
@ -376,7 +382,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.
*
@ -393,14 +400,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
@ -436,7 +447,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
@ -451,7 +463,8 @@ public class TheMovieDbApi {
/**
* 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
@ -466,7 +479,8 @@ public class TheMovieDbApi {
/**
* Get a list of PersonInfo 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
@ -481,9 +495,11 @@ public class TheMovieDbApi {
//<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
@ -509,7 +525,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
@ -522,7 +539,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.
*
* @param companyId
* @param language
@ -569,7 +587,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
*/
@ -584,11 +603,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
@ -602,7 +624,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
@ -613,7 +636,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
@ -626,16 +650,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
@ -677,9 +703,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
@ -746,7 +774,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
@ -806,7 +835,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
@ -823,7 +853,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
@ -836,8 +867,8 @@ public class TheMovieDbApi {
}
/**
* 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.
* 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.
*
@ -851,113 +882,113 @@ 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
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<AlternativeTitle> getMovieAlternativeTitles(int movieId, String country, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieAlternativeTitles(movieId, country, appendToResponse);
public ResultList<AlternativeTitle> getMovieAlternativeTitles(int movieId, String country) throws MovieDbException {
return tmdbMovies.getMovieAlternativeTitles(movieId, country);
}
/**
* Get the cast and crew information for a specific movie id.
*
* @param movieId
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public MediaCreditList getMovieCredits(int movieId, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieCredits(movieId, appendToResponse);
public MediaCreditList getMovieCredits(int movieId) throws MovieDbException {
return tmdbMovies.getMovieCredits(movieId);
}
/**
* 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
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<Artwork> getMovieImages(int movieId, String language, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieImages(movieId, language, appendToResponse);
public ResultList<Artwork> getMovieImages(int movieId, String language) throws MovieDbException {
return tmdbMovies.getMovieImages(movieId, language);
}
/**
* 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.
*
* @param movieId
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<Keyword> getMovieKeywords(int movieId, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieKeywords(movieId, appendToResponse);
public ResultList<Keyword> getMovieKeywords(int movieId) throws MovieDbException {
return tmdbMovies.getMovieKeywords(movieId);
}
/**
* 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
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<ReleaseInfo> getMovieReleaseInfo(int movieId, String language, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieReleaseInfo(movieId, language, appendToResponse);
public ResultList<ReleaseInfo> getMovieReleaseInfo(int movieId, String language) throws MovieDbException {
return tmdbMovies.getMovieReleaseInfo(movieId, language);
}
/**
* 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.
*
* @param movieId
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<Video> getMovieVideos(int movieId, String language, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieVideos(movieId, language, appendToResponse);
public ResultList<Video> getMovieVideos(int movieId, String language) throws MovieDbException {
return tmdbMovies.getMovieVideos(movieId, language);
}
/**
* 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
* @return
* @throws MovieDbException
*/
public ResultList<Translation> getMovieTranslations(int movieId, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieTranslations(movieId, appendToResponse);
public ResultList<Translation> getMovieTranslations(int movieId) throws MovieDbException {
return tmdbMovies.getMovieTranslations(movieId);
}
/**
* 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
*
* @param movieId
* @param language
* @param page
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<MovieInfo> getSimilarMovies(int movieId, Integer page, String language, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getSimilarMovies(movieId, page, language, appendToResponse);
public ResultList<MovieInfo> getSimilarMovies(int movieId, Integer page, String language) throws MovieDbException {
return tmdbMovies.getSimilarMovies(movieId, page, language);
}
/**
@ -966,12 +997,11 @@ public class TheMovieDbApi {
* @param movieId
* @param page
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<Review> getMovieReviews(int movieId, Integer page, String language, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieReviews(movieId, page, language, appendToResponse);
public ResultList<Review> getMovieReviews(int movieId, Integer page, String language) throws MovieDbException {
return tmdbMovies.getMovieReviews(movieId, page, language);
}
/**
@ -980,12 +1010,11 @@ public class TheMovieDbApi {
* @param movieId
* @param language
* @param page
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<UserList> getMovieLists(int movieId, Integer page, String language, String... appendToResponse) throws MovieDbException {
return tmdbMovies.getMovieLists(movieId, page, language, appendToResponse);
public ResultList<UserList> getMovieLists(int movieId, Integer page, String language) throws MovieDbException {
return tmdbMovies.getMovieLists(movieId, page, language);
}
/**
@ -995,7 +1024,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.
*
@ -1054,7 +1084,8 @@ public class TheMovieDbApi {
/**
* 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.
*
* @param language
* @param page
@ -1080,7 +1111,8 @@ public class TheMovieDbApi {
}
/**
* 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.
*
@ -1127,46 +1159,47 @@ public class TheMovieDbApi {
*
* @param personId
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public PersonCreditList getPersonMovieCredits(int personId, String language, String... appendToResponse) throws MovieDbException {
return tmdbPeople.getPersonMovieCredits(personId, language, appendToResponse);
public PersonCreditList getPersonMovieCredits(int personId, String language) throws MovieDbException {
return tmdbPeople.getPersonMovieCredits(personId, language);
}
/**
* 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
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public PersonCreditList getPersonTVCredits(int personId, String language, String... appendToResponse) throws MovieDbException {
return tmdbPeople.getPersonTVCredits(personId, language, appendToResponse);
public PersonCreditList getPersonTVCredits(int personId, String language) throws MovieDbException {
return tmdbPeople.getPersonTVCredits(personId, language);
}
/**
* 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
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public PersonCreditList getPersonCombinedCredits(int personId, String language, String... appendToResponse) throws MovieDbException {
return tmdbPeople.getPersonCombinedCredits(personId, language, appendToResponse);
public PersonCreditList getPersonCombinedCredits(int personId, String language) throws MovieDbException {
return tmdbPeople.getPersonCombinedCredits(personId, language);
}
/**
@ -1194,7 +1227,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
@ -1213,7 +1247,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.
*
@ -1266,8 +1301,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
*
@ -1319,13 +1354,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
@ -1344,9 +1382,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
@ -1362,7 +1402,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
@ -1406,8 +1447,8 @@ public class TheMovieDbApi {
}
/**
* This method lets users get the status of whether or not the TV show has been rated or added to their favourite or watch
* lists.
* This method lets users get the status of whether or not the TV show has
* been rated or added to their favourite or watch lists.
*
* A valid session id is required.
*
@ -1460,12 +1501,11 @@ public class TheMovieDbApi {
*
* @param tvID
* @param language
* @param appendToResponse
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public MediaCreditList getTVCredits(int tvID, String language, String... appendToResponse) throws MovieDbException {
return tmdbTv.getTVCredits(tvID, language, appendToResponse);
public MediaCreditList getTVCredits(int tvID, String language) throws MovieDbException {
return tmdbTv.getTVCredits(tvID, language);
}
/**
@ -1497,12 +1537,11 @@ public class TheMovieDbApi {
* Get the plot keywords for a specific TV show id.
*
* @param tvID
* @param appendToResponse
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public ResultList<Keyword> getTVKeywords(int tvID, String... appendToResponse) throws MovieDbException {
return tmdbTv.getTVKeywords(tvID, appendToResponse);
public ResultList<Keyword> getTVKeywords(int tvID) throws MovieDbException {
return tmdbTv.getTVKeywords(tvID);
}
/**
@ -1527,16 +1566,16 @@ public class TheMovieDbApi {
* @param tvID
* @param page
* @param language
* @param appendToResponse
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public ResultList<TVInfo> getTVSimilar(int tvID, Integer page, String language, String... appendToResponse) throws MovieDbException {
return tmdbTv.getTVSimilar(tvID, page, language, appendToResponse);
public ResultList<TVInfo> getTVSimilar(int tvID, Integer page, String language) throws MovieDbException {
return tmdbTv.getTVSimilar(tvID, page, language);
}
/**
* Get the list of translations that exist for a TV series. These translations cascade down to the episode level.
* Get the list of translations that exist for a TV series. These
* translations cascade down to the episode level.
*
* @param tvID
* @return
@ -1547,7 +1586,8 @@ public class TheMovieDbApi {
}
/**
* Get the videos that have been added to a TV series (trailers, opening credits, etc...)
* Get the videos that have been added to a TV series (trailers, opening
* credits, etc...)
*
* @param tvID
* @param language
@ -1571,7 +1611,8 @@ public class TheMovieDbApi {
/**
* Get the list of TV shows that are currently on the air.
*
* This query looks for any TV show that has an episode with an air date in the next 7 days.
* This query looks for any TV show that has an episode with an air date in
* the next 7 days.
*
* @param page
* @param language
@ -1600,7 +1641,8 @@ public class TheMovieDbApi {
/**
* Get the list of top rated TV shows.
*
* By default, this list will only include TV shows that have 2 or more votes.
* By default, this list will only include TV shows that have 2 or more
* votes.
*
* This list refreshes every day.
*
@ -1655,7 +1697,8 @@ public class TheMovieDbApi {
}
/**
* This method lets users get the status of whether or not the TV episodes of a season have been rated.
* This method lets users get the status of whether or not the TV episodes
* of a season have been rated.
*
* A valid session id is required.
*
@ -1681,7 +1724,8 @@ public class TheMovieDbApi {
}
/**
* Get the external ids that we have stored for a TV season by season number.
* Get the external ids that we have stored for a TV season by season
* number.
*
* @param tvID
* @param seasonNumber
@ -1708,7 +1752,8 @@ public class TheMovieDbApi {
}
/**
* Get the videos that have been added to a TV season (trailers, teasers, etc...)
* Get the videos that have been added to a TV season (trailers, teasers,
* etc...)
*
* @param tvID
* @param seasonNumber
@ -1723,7 +1768,8 @@ public class TheMovieDbApi {
//<editor-fold defaultstate="collapsed" desc="TV Episodes">
/**
* Get the primary information about a TV episode by combination of a season and episode number.
* Get the primary information about a TV episode by combination of a season
* and episode number.
*
* @param tvID
* @param seasonNumber
@ -1751,7 +1797,8 @@ public class TheMovieDbApi {
}
/**
* This method lets users get the status of whether or not the TV episode has been rated.
* This method lets users get the status of whether or not the TV episode
* has been rated.
*
* A valid session id is required.
*
@ -1780,7 +1827,8 @@ public class TheMovieDbApi {
}
/**
* Get the external ids for a TV episode by comabination of a season and episode number.
* Get the external ids for a TV episode by comabination of a season and
* episode number.
*
* @param tvID
* @param seasonNumber
@ -1794,7 +1842,8 @@ public class TheMovieDbApi {
}
/**
* Get the images (episode stills) for a TV episode by combination of a season and episode number.
* Get the images (episode stills) for a TV episode by combination of a
* season and episode number.
*
* @param tvID
* @param seasonNumber
@ -1807,7 +1856,8 @@ public class TheMovieDbApi {
}
/**
* This method lets users rate a TV episode. A valid session id or guest session id is required.
* This method lets users rate a TV episode. A valid session id or guest
* session id is required.
*
* @param tvID
* @param seasonNumber
@ -1823,7 +1873,8 @@ public class TheMovieDbApi {
}
/**
* Get the videos that have been added to a TV episode (teasers, clips, etc...)
* Get the videos that have been added to a TV episode (teasers, clips,
* etc...)
*
* @param tvID
* @param seasonNumber

@ -23,10 +23,10 @@ package com.omertron.themoviedbapi.interfaces;
* Interface to indicate that the object has append to response methods
*
* @author Stuart
* @param <AppendToResponseMethod> Method for Append To Response
* @param <T> Method for Append To Response
*/
public interface AppendToResponse<AppendToResponseMethod> {
public interface AppendToResponse<T extends AppendToResponseMethod> {
boolean hasMethod(AppendToResponseMethod method);
boolean hasMethod(T method);
}

@ -26,15 +26,22 @@ import com.omertron.themoviedbapi.model.artwork.Artwork;
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
import com.omertron.themoviedbapi.model.keyword.Keyword;
import com.omertron.themoviedbapi.model.list.UserList;
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
import com.omertron.themoviedbapi.model.media.MediaCreditList;
import com.omertron.themoviedbapi.model.media.MediaState;
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
import com.omertron.themoviedbapi.model.movie.MovieInfo;
import com.omertron.themoviedbapi.model.movie.ReleaseInfo;
import com.omertron.themoviedbapi.model.media.Translation;
import com.omertron.themoviedbapi.model.media.Video;
import com.omertron.themoviedbapi.model.movie.MovieInfo;
import com.omertron.themoviedbapi.model.movie.ReleaseInfo;
import com.omertron.themoviedbapi.model.review.Review;
import com.omertron.themoviedbapi.results.ResultList;
import com.omertron.themoviedbapi.results.WrapperAlternativeTitles;
import com.omertron.themoviedbapi.results.WrapperGenericList;
import com.omertron.themoviedbapi.results.WrapperImages;
import com.omertron.themoviedbapi.results.WrapperMovieKeywords;
import com.omertron.themoviedbapi.results.WrapperReleaseInfo;
import com.omertron.themoviedbapi.results.WrapperTranslations;
import com.omertron.themoviedbapi.results.WrapperVideos;
import com.omertron.themoviedbapi.tools.ApiUrl;
import com.omertron.themoviedbapi.tools.HttpTools;
import com.omertron.themoviedbapi.tools.MethodBase;
@ -43,13 +50,6 @@ import com.omertron.themoviedbapi.tools.Param;
import com.omertron.themoviedbapi.tools.PostBody;
import com.omertron.themoviedbapi.tools.PostTools;
import com.omertron.themoviedbapi.tools.TmdbParameters;
import com.omertron.themoviedbapi.results.WrapperAlternativeTitles;
import com.omertron.themoviedbapi.results.WrapperGenericList;
import com.omertron.themoviedbapi.results.WrapperImages;
import com.omertron.themoviedbapi.results.WrapperMovieKeywords;
import com.omertron.themoviedbapi.results.WrapperReleaseInfo;
import com.omertron.themoviedbapi.results.WrapperTranslations;
import com.omertron.themoviedbapi.results.WrapperVideos;
import java.io.IOException;
import java.net.URL;
import org.yamj.api.common.exception.ApiExceptionType;
@ -78,7 +78,8 @@ public class TmdbMovies extends AbstractMethod {
*
* 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
@ -110,7 +111,8 @@ public class TmdbMovies extends AbstractMethod {
*
* 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
@ -139,8 +141,8 @@ 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.
* 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.
*
@ -165,19 +167,18 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* 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
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<AlternativeTitle> getMovieAlternativeTitles(int movieId, String country, String... appendToResponse) throws MovieDbException {
public ResultList<AlternativeTitle> getMovieAlternativeTitles(int movieId, String country) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.COUNTRY, country);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.ALT_TITLES).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
@ -195,14 +196,12 @@ public class TmdbMovies extends AbstractMethod {
* Get the cast and crew information for a specific movie id.
*
* @param movieId
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public MediaCreditList getMovieCredits(int movieId, String... appendToResponse) throws MovieDbException {
public MediaCreditList getMovieCredits(int movieId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.CREDITS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
@ -214,19 +213,18 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* 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
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<Artwork> getMovieImages(int movieId, String language, String... appendToResponse) throws MovieDbException {
public ResultList<Artwork> getMovieImages(int movieId, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.IMAGES).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
@ -242,19 +240,18 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* 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.
*
* @param movieId
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<Keyword> getMovieKeywords(int movieId, String... appendToResponse) throws MovieDbException {
public ResultList<Keyword> getMovieKeywords(int movieId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.KEYWORDS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
@ -270,19 +267,18 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* 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
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<ReleaseInfo> getMovieReleaseInfo(int movieId, String language, String... appendToResponse) throws MovieDbException {
public ResultList<ReleaseInfo> getMovieReleaseInfo(int movieId, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RELEASES).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
@ -298,21 +294,20 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* 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.
*
* @param movieId
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<Video> getMovieVideos(int movieId, String language, String... appendToResponse) throws MovieDbException {
public ResultList<Video> getMovieVideos(int movieId, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.VIDEOS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
@ -328,17 +323,16 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* 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
* @return
* @throws MovieDbException
*/
public ResultList<Translation> getMovieTranslations(int movieId, String... appendToResponse) throws MovieDbException {
public ResultList<Translation> getMovieTranslations(int movieId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.TRANSLATIONS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
@ -354,25 +348,25 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* 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
*
* @param movieId
* @param language
* @param page
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<MovieInfo> getSimilarMovies(int movieId, Integer page, String language, String... appendToResponse) throws MovieDbException {
public ResultList<MovieInfo> getSimilarMovies(int movieId, Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.PAGE, page);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.SIMILAR).buildUrl(parameters);
WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "similar movies");
@ -385,16 +379,14 @@ public class TmdbMovies extends AbstractMethod {
* @param movieId
* @param page
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<Review> getMovieReviews(int movieId, Integer page, String language, String... appendToResponse) throws MovieDbException {
public ResultList<Review> getMovieReviews(int movieId, Integer page, String language) 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).subMethod(MethodSub.REVIEWS).buildUrl(parameters);
WrapperGenericList<Review> wrapper = processWrapper(getTypeReference(Review.class), url, "review");
@ -407,16 +399,14 @@ public class TmdbMovies extends AbstractMethod {
* @param movieId
* @param language
* @param page
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public ResultList<UserList> getMovieLists(int movieId, Integer page, String language, String... appendToResponse) throws MovieDbException {
public ResultList<UserList> getMovieLists(int movieId, Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.PAGE, page);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.LISTS).buildUrl(parameters);
WrapperGenericList<UserList> wrapper = processWrapper(getTypeReference(UserList.class), url, "movie lists");
@ -430,7 +420,8 @@ public class TmdbMovies extends AbstractMethod {
*
* 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.
*
@ -522,7 +513,8 @@ public class TmdbMovies extends AbstractMethod {
/**
* 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.
*
* @param language
* @param page
@ -560,7 +552,8 @@ public class TmdbMovies extends AbstractMethod {
}
/**
* 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.
*

@ -31,19 +31,19 @@ import com.omertron.themoviedbapi.model.credits.CreditBasic;
import com.omertron.themoviedbapi.model.credits.CreditMovieBasic;
import com.omertron.themoviedbapi.model.credits.CreditTVBasic;
import com.omertron.themoviedbapi.model.person.ExternalID;
import com.omertron.themoviedbapi.model.person.PersonInfo;
import com.omertron.themoviedbapi.model.person.PersonCreditList;
import com.omertron.themoviedbapi.model.person.PersonCreditsMixIn;
import com.omertron.themoviedbapi.model.person.PersonFind;
import com.omertron.themoviedbapi.model.person.PersonInfo;
import com.omertron.themoviedbapi.results.ResultList;
import com.omertron.themoviedbapi.results.WrapperGenericList;
import com.omertron.themoviedbapi.results.WrapperImages;
import com.omertron.themoviedbapi.tools.ApiUrl;
import com.omertron.themoviedbapi.tools.HttpTools;
import com.omertron.themoviedbapi.tools.MethodBase;
import com.omertron.themoviedbapi.tools.MethodSub;
import com.omertron.themoviedbapi.tools.Param;
import com.omertron.themoviedbapi.tools.TmdbParameters;
import com.omertron.themoviedbapi.results.WrapperGenericList;
import com.omertron.themoviedbapi.results.WrapperImages;
import java.io.IOException;
import java.net.URL;
import org.slf4j.LoggerFactory;
@ -85,7 +85,7 @@ public class TmdbPeople extends AbstractMethod {
try {
return MAPPER.readValue(webpage, PersonInfo.class);
} catch (IOException ex) {
LoggerFactory.getLogger("test").info("{}",ex);
LoggerFactory.getLogger("test").info("{}", ex);
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person info", url, ex);
}
}
@ -95,15 +95,13 @@ public class TmdbPeople extends AbstractMethod {
*
* @param personId
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public PersonCreditList<CreditMovieBasic> getPersonMovieCredits(int personId, String language, String... appendToResponse) throws MovieDbException {
public PersonCreditList<CreditMovieBasic> getPersonMovieCredits(int personId, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, personId);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.MOVIE_CREDITS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
@ -128,15 +126,13 @@ public class TmdbPeople extends AbstractMethod {
*
* @param personId
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public PersonCreditList<CreditTVBasic> getPersonTVCredits(int personId, String language, String... appendToResponse) throws MovieDbException {
public PersonCreditList<CreditTVBasic> getPersonTVCredits(int personId, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, personId);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.TV_CREDITS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
@ -161,15 +157,13 @@ public class TmdbPeople extends AbstractMethod {
*
* @param personId
* @param language
* @param appendToResponse
* @return
* @throws MovieDbException
*/
public PersonCreditList<CreditBasic> getPersonCombinedCredits(int personId, String language, String... appendToResponse) throws MovieDbException {
public PersonCreditList<CreditBasic> getPersonCombinedCredits(int personId, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, personId);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.COMBINED_CREDITS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);

@ -25,9 +25,9 @@ import com.omertron.themoviedbapi.model.StatusCode;
import com.omertron.themoviedbapi.model.artwork.Artwork;
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
import com.omertron.themoviedbapi.model.keyword.Keyword;
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
import com.omertron.themoviedbapi.model.media.MediaCreditList;
import com.omertron.themoviedbapi.model.media.MediaState;
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
import com.omertron.themoviedbapi.model.media.Translation;
import com.omertron.themoviedbapi.model.media.Video;
import com.omertron.themoviedbapi.model.person.ContentRating;
@ -35,6 +35,10 @@ import com.omertron.themoviedbapi.model.person.ExternalID;
import com.omertron.themoviedbapi.model.tv.TVBasic;
import com.omertron.themoviedbapi.model.tv.TVInfo;
import com.omertron.themoviedbapi.results.ResultList;
import com.omertron.themoviedbapi.results.WrapperGenericList;
import com.omertron.themoviedbapi.results.WrapperImages;
import com.omertron.themoviedbapi.results.WrapperTranslations;
import com.omertron.themoviedbapi.results.WrapperVideos;
import com.omertron.themoviedbapi.tools.ApiUrl;
import com.omertron.themoviedbapi.tools.HttpTools;
import com.omertron.themoviedbapi.tools.MethodBase;
@ -43,10 +47,6 @@ import com.omertron.themoviedbapi.tools.Param;
import com.omertron.themoviedbapi.tools.PostBody;
import com.omertron.themoviedbapi.tools.PostTools;
import com.omertron.themoviedbapi.tools.TmdbParameters;
import com.omertron.themoviedbapi.results.WrapperGenericList;
import com.omertron.themoviedbapi.results.WrapperImages;
import com.omertron.themoviedbapi.results.WrapperTranslations;
import com.omertron.themoviedbapi.results.WrapperVideos;
import java.io.IOException;
import java.net.URL;
import org.yamj.api.common.exception.ApiExceptionType;
@ -96,8 +96,8 @@ public class TmdbTV extends AbstractMethod {
}
/**
* This method lets users get the status of whether or not the TV show has been rated or added to their favourite or watch
* lists.
* This method lets users get the status of whether or not the TV show has
* been rated or added to their favourite or watch lists.
*
* A valid session id is required.
*
@ -171,15 +171,13 @@ public class TmdbTV extends AbstractMethod {
*
* @param tvID
* @param language
* @param appendToResponse
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public MediaCreditList getTVCredits(int tvID, String language, String... appendToResponse) throws MovieDbException {
public MediaCreditList getTVCredits(int tvID, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.CREDITS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
@ -245,14 +243,12 @@ public class TmdbTV extends AbstractMethod {
* Get the plot keywords for a specific TV show id.
*
* @param tvID
* @param appendToResponse
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public ResultList<Keyword> getTVKeywords(int tvID, String... appendToResponse) throws MovieDbException {
public ResultList<Keyword> getTVKeywords(int tvID) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.KEYWORDS).buildUrl(parameters);
WrapperGenericList<Keyword> wrapper = processWrapper(getTypeReference(Keyword.class), url, "keywords");
@ -300,16 +296,14 @@ public class TmdbTV extends AbstractMethod {
* @param tvID
* @param page
* @param language
* @param appendToResponse
* @return
* @throws com.omertron.themoviedbapi.MovieDbException
*/
public ResultList<TVInfo> getTVSimilar(int tvID, Integer page, String language, String... appendToResponse) throws MovieDbException {
public ResultList<TVInfo> getTVSimilar(int tvID, Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.SIMILAR).buildUrl(parameters);
WrapperGenericList<TVInfo> wrapper = processWrapper(getTypeReference(TVInfo.class), url, "similar TV shows");
@ -317,7 +311,8 @@ public class TmdbTV extends AbstractMethod {
}
/**
* Get the list of translations that exist for a TV series. These translations cascade down to the episode level.
* Get the list of translations that exist for a TV series. These
* translations cascade down to the episode level.
*
* @param tvID
* @return
@ -341,7 +336,8 @@ public class TmdbTV extends AbstractMethod {
}
/**
* Get the videos that have been added to a TV series (trailers, opening credits, etc...)
* Get the videos that have been added to a TV series (trailers, opening
* credits, etc...)
*
* @param tvID
* @param language
@ -386,7 +382,8 @@ public class TmdbTV extends AbstractMethod {
/**
* Get the list of TV shows that are currently on the air.
*
* This query looks for any TV show that has an episode with an air date in the next 7 days.
* This query looks for any TV show that has an episode with an air date in
* the next 7 days.
*
* @param page
* @param language
@ -428,7 +425,8 @@ public class TmdbTV extends AbstractMethod {
/**
* Get the list of top rated TV shows.
*
* By default, this list will only include TV shows that have 2 or more votes.
* By default, this list will only include TV shows that have 2 or more
* votes.
*
* This list refreshes every day.
*

@ -19,6 +19,8 @@
*/
package com.omertron.themoviedbapi;
import com.omertron.themoviedbapi.enumeration.MovieMethod;
import com.omertron.themoviedbapi.interfaces.AppendToResponseMethod;
import com.omertron.themoviedbapi.methods.TmdbAccount;
import com.omertron.themoviedbapi.methods.TmdbAuthentication;
import com.omertron.themoviedbapi.model.account.Account;
@ -260,6 +262,29 @@ public class AbstractTests {
* @return
*/
protected static String getProperty(String property) {
appendToResponseBuilder(MovieMethod.class);
return props.getProperty(property);
}
/**
* Build up a full list of the AppendToResponse methods into a string for
* use in the URL
*
* @param <T>
* @param methodClass
* @return
*/
protected static <T extends AppendToResponseMethod> String appendToResponseBuilder(Class<T> methodClass) {
boolean first = true;
StringBuilder atr = new StringBuilder();
for (AppendToResponseMethod method : methodClass.getEnumConstants()) {
if (first) {
first = false;
} else {
atr.append(",");
}
atr.append(method.getPropertyString());
}
return atr.toString();
}
}

@ -30,16 +30,16 @@ import com.omertron.themoviedbapi.model.StatusCode;
import com.omertron.themoviedbapi.model.artwork.Artwork;
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
import com.omertron.themoviedbapi.model.change.ChangeListItem;
import com.omertron.themoviedbapi.model.credits.MediaCreditCast;
import com.omertron.themoviedbapi.model.keyword.Keyword;
import com.omertron.themoviedbapi.model.list.UserList;
import com.omertron.themoviedbapi.model.credits.MediaCreditCast;
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
import com.omertron.themoviedbapi.model.media.MediaCreditList;
import com.omertron.themoviedbapi.model.media.MediaState;
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
import com.omertron.themoviedbapi.model.movie.MovieInfo;
import com.omertron.themoviedbapi.model.movie.ReleaseInfo;
import com.omertron.themoviedbapi.model.media.Translation;
import com.omertron.themoviedbapi.model.media.Video;
import com.omertron.themoviedbapi.model.movie.MovieInfo;
import com.omertron.themoviedbapi.model.movie.ReleaseInfo;
import com.omertron.themoviedbapi.model.review.Review;
import com.omertron.themoviedbapi.results.ResultList;
import com.omertron.themoviedbapi.tools.MethodBase;
@ -89,17 +89,7 @@ public class TmdbMoviesTest extends AbstractTests {
LOG.info("appendToResponse");
String language = LANGUAGE_DEFAULT;
boolean first = true;
StringBuilder appendToResponse = new StringBuilder();
for (MovieMethod method : MovieMethod.values()) {
if (first) {
first = false;
} else {
appendToResponse.append(",");
}
appendToResponse.append(method.getPropertyString());
}
String appendToResponse = appendToResponseBuilder(MovieMethod.class);
for (TestID test : FILM_IDS) {
// Just test Blade Runner
@ -107,10 +97,13 @@ public class TmdbMoviesTest extends AbstractTests {
continue;
}
MovieInfo result = instance.getMovieInfo(test.getTmdb(), language, appendToResponse.toString());
MovieInfo result = instance.getMovieInfo(test.getTmdb(), language, appendToResponse);
assertEquals("Wrong IMDB ID", test.getImdb(), result.getImdbID());
assertEquals("Wrong title", test.getName(), result.getTitle());
TestSuite.test(result);
for (MovieMethod method : MovieMethod.values()) {
assertTrue("Does not have " + method.getPropertyString(), result.hasMethod(method));
}
TestSuite.test(result.getAlternativeTitles(), "Alt titles");
TestSuite.test(result.getCast(), "Cast");
TestSuite.test(result.getCrew(), "Crew");
@ -191,10 +184,9 @@ public class TmdbMoviesTest extends AbstractTests {
LOG.info("getMovieAlternativeTitles");
String country = "";
String[] appendToResponse = null;
for (TestID test : FILM_IDS) {
ResultList<AlternativeTitle> result = instance.getMovieAlternativeTitles(test.getTmdb(), country, appendToResponse);
ResultList<AlternativeTitle> result = instance.getMovieAlternativeTitles(test.getTmdb(), country);
TestSuite.test(result, "Alt Titles");
}
}
@ -208,10 +200,8 @@ public class TmdbMoviesTest extends AbstractTests {
public void testGetMovieCredits() throws MovieDbException {
LOG.info("getMovieCredits");
String[] appendToResponse = null;
for (TestID test : FILM_IDS) {
MediaCreditList result = instance.getMovieCredits(test.getTmdb(), appendToResponse);
MediaCreditList result = instance.getMovieCredits(test.getTmdb());
assertNotNull(result);
assertFalse(result.getCast().isEmpty());
TestSuite.test(result.getCast(), "Cast");
@ -240,12 +230,11 @@ public class TmdbMoviesTest extends AbstractTests {
LOG.info("getMovieImages");
String language = LANGUAGE_DEFAULT;
String[] appendToResponse = null;
ArtworkResults results = new ArtworkResults();
for (TestID test : FILM_IDS) {
ResultList<Artwork> result = instance.getMovieImages(test.getTmdb(), language, appendToResponse);
ResultList<Artwork> result = instance.getMovieImages(test.getTmdb(), language);
assertFalse("No artwork", result.isEmpty());
for (Artwork artwork : result.getResults()) {
results.found(artwork.getArtworkType());
@ -265,10 +254,8 @@ public class TmdbMoviesTest extends AbstractTests {
public void testGetMovieKeywords() throws MovieDbException {
LOG.info("getMovieKeywords");
String[] appendToResponse = null;
for (TestID test : FILM_IDS) {
ResultList<Keyword> result = instance.getMovieKeywords(test.getTmdb(), appendToResponse);
ResultList<Keyword> result = instance.getMovieKeywords(test.getTmdb());
TestSuite.test(result, "Keywords");
}
}
@ -283,10 +270,9 @@ public class TmdbMoviesTest extends AbstractTests {
LOG.info("getMovieReleaseInfo");
String language = LANGUAGE_DEFAULT;
String[] appendToResponse = null;
for (TestID test : FILM_IDS) {
ResultList<ReleaseInfo> result = instance.getMovieReleaseInfo(test.getTmdb(), language, appendToResponse);
ResultList<ReleaseInfo> result = instance.getMovieReleaseInfo(test.getTmdb(), language);
TestSuite.test(result, "Rel Info");
}
}
@ -301,11 +287,10 @@ public class TmdbMoviesTest extends AbstractTests {
LOG.info("getMovieVideos");
String language = LANGUAGE_DEFAULT;
String[] appendToResponse = null;
boolean found = false;
for (TestID test : FILM_IDS) {
ResultList<Video> result = instance.getMovieVideos(test.getTmdb(), language, appendToResponse);
ResultList<Video> result = instance.getMovieVideos(test.getTmdb(), language);
found = found || !result.isEmpty();
}
assertTrue("No videos", found);
@ -320,10 +305,8 @@ public class TmdbMoviesTest extends AbstractTests {
public void testGetMovieTranslations() throws MovieDbException {
LOG.info("getMovieTranslations");
String[] appendToResponse = null;
for (TestID test : FILM_IDS) {
ResultList<Translation> result = instance.getMovieTranslations(test.getTmdb(), appendToResponse);
ResultList<Translation> result = instance.getMovieTranslations(test.getTmdb());
TestSuite.test(result, "Translations");
}
}
@ -339,10 +322,9 @@ public class TmdbMoviesTest extends AbstractTests {
Integer page = null;
String language = LANGUAGE_DEFAULT;
String[] appendToResponse = null;
for (TestID test : FILM_IDS) {
ResultList<MovieInfo> result = instance.getSimilarMovies(test.getTmdb(), page, language, appendToResponse);
ResultList<MovieInfo> result = instance.getSimilarMovies(test.getTmdb(), page, language);
TestSuite.test(result, "Similar");
}
}
@ -358,14 +340,13 @@ public class TmdbMoviesTest extends AbstractTests {
Integer page = null;
String language = LANGUAGE_DEFAULT;
String[] appendToResponse = null;
for (TestID test : FILM_IDS) {
if (test.getTmdb() == 76757) {
// Has no reviews
continue;
}
ResultList<Review> result = instance.getMovieReviews(test.getTmdb(), page, language, appendToResponse);
ResultList<Review> result = instance.getMovieReviews(test.getTmdb(), page, language);
TestSuite.test(result, "Reviews");
}
}
@ -381,10 +362,9 @@ public class TmdbMoviesTest extends AbstractTests {
Integer page = null;
String language = LANGUAGE_DEFAULT;
String[] appendToResponse = null;
for (TestID test : FILM_IDS) {
ResultList<UserList> result = instance.getMovieLists(test.getTmdb(), page, language, appendToResponse);
ResultList<UserList> result = instance.getMovieLists(test.getTmdb(), page, language);
TestSuite.test(result, "Lists");
}
}

@ -34,9 +34,9 @@ import com.omertron.themoviedbapi.model.credits.CreditBasic;
import com.omertron.themoviedbapi.model.credits.CreditMovieBasic;
import com.omertron.themoviedbapi.model.credits.CreditTVBasic;
import com.omertron.themoviedbapi.model.person.ExternalID;
import com.omertron.themoviedbapi.model.person.PersonInfo;
import com.omertron.themoviedbapi.model.person.PersonCreditList;
import com.omertron.themoviedbapi.model.person.PersonFind;
import com.omertron.themoviedbapi.model.person.PersonInfo;
import com.omertron.themoviedbapi.results.ResultList;
import com.omertron.themoviedbapi.tools.MethodBase;
import java.text.SimpleDateFormat;
@ -96,20 +96,14 @@ public class TmdbPeopleTest extends AbstractTests {
public void testAppendToResponse() throws MovieDbException {
LOG.info("appendToResponse");
boolean first = true;
StringBuilder appendToResponse = new StringBuilder();
for (PeopleMethod method : PeopleMethod.values()) {
if (first) {
first = false;
} else {
appendToResponse.append(",");
}
appendToResponse.append(method.getPropertyString());
}
String appendToResponse = appendToResponseBuilder(PeopleMethod.class);
for (TestID test : TEST_IDS) {
PersonInfo result = instance.getPersonInfo(test.getTmdb(), appendToResponse.toString());
PersonInfo result = instance.getPersonInfo(test.getTmdb(), appendToResponse);
TestSuite.test(result);
for (PeopleMethod method : PeopleMethod.values()) {
assertTrue("Does not have " + method.getPropertyString(), result.hasMethod(method));
}
TestSuite.test(result.getExternalIDs());
TestSuite.test(result.getImages(), "Images");
TestSuite.test(result.getMovieCredits(), "Movie Credits");
@ -146,10 +140,9 @@ public class TmdbPeopleTest extends AbstractTests {
public void testGetPersonMovieCredits() throws MovieDbException {
LOG.info("getPersonMovieCredits");
String language = LANGUAGE_DEFAULT;
String[] appendToResponse = null;
for (TestID test : TEST_IDS) {
PersonCreditList<CreditMovieBasic> result = instance.getPersonMovieCredits(test.getTmdb(), language, appendToResponse);
PersonCreditList<CreditMovieBasic> result = instance.getPersonMovieCredits(test.getTmdb(), language);
LOG.info("ID: {}, # Cast: {}, # Crew: {}", result.getId(), result.getCast().size(), result.getCrew().size());
assertEquals("Incorrect ID", test.getTmdb(), result.getId());
TestSuite.test(result.getCast(), "Cast");
@ -170,10 +163,9 @@ public class TmdbPeopleTest extends AbstractTests {
public void testGetPersonTVCredits() throws MovieDbException {
LOG.info("getPersonTVCredits");
String language = LANGUAGE_DEFAULT;
String[] appendToResponse = null;
for (TestID test : TEST_IDS) {
PersonCreditList<CreditTVBasic> result = instance.getPersonTVCredits(test.getTmdb(), language, appendToResponse);
PersonCreditList<CreditTVBasic> result = instance.getPersonTVCredits(test.getTmdb(), language);
LOG.info("ID: {}, # Cast: {}, # Crew: {}", result.getId(), result.getCast().size(), result.getCrew().size());
assertEquals("Incorrect ID", test.getTmdb(), result.getId());
TestSuite.test(result.getCast(), "Cast");
@ -194,10 +186,9 @@ public class TmdbPeopleTest extends AbstractTests {
public void testGetPersonCombinedCredits() throws MovieDbException {
LOG.info("getPersonCombinedCredits");
String language = LANGUAGE_DEFAULT;
String[] appendToResponse = null;
for (TestID test : TEST_IDS) {
PersonCreditList<CreditBasic> result = instance.getPersonCombinedCredits(test.getTmdb(), language, appendToResponse);
PersonCreditList<CreditBasic> result = instance.getPersonCombinedCredits(test.getTmdb(), language);
LOG.info("ID: {}, # Cast: {}, # Crew: {}", result.getId(), result.getCast().size(), result.getCrew().size());
assertEquals("Incorrect ID", test.getTmdb(), result.getId());
TestSuite.test(result.getCast(), "Cast");

@ -30,11 +30,11 @@ import com.omertron.themoviedbapi.model.StatusCode;
import com.omertron.themoviedbapi.model.artwork.Artwork;
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
import com.omertron.themoviedbapi.model.change.ChangeListItem;
import com.omertron.themoviedbapi.model.keyword.Keyword;
import com.omertron.themoviedbapi.model.credits.MediaCreditCast;
import com.omertron.themoviedbapi.model.keyword.Keyword;
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
import com.omertron.themoviedbapi.model.media.MediaCreditList;
import com.omertron.themoviedbapi.model.media.MediaState;
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
import com.omertron.themoviedbapi.model.media.Translation;
import com.omertron.themoviedbapi.model.media.Video;
import com.omertron.themoviedbapi.model.person.ContentRating;
@ -89,17 +89,7 @@ public class TmdbTVTest extends AbstractTests {
LOG.info("appendToResponse");
String language = LANGUAGE_DEFAULT;
boolean first = true;
StringBuilder appendToResponse = new StringBuilder();
for (TVMethod method : TVMethod.values()) {
if (first) {
first = false;
} else {
appendToResponse.append(",");
}
appendToResponse.append(method.getPropertyString());
}
String appendToResponse = appendToResponseBuilder(TVMethod.class);
for (TestID test : TV_IDS) {
// Just test Waling Dead
@ -107,8 +97,11 @@ public class TmdbTVTest extends AbstractTests {
continue;
}
TVInfo result = instance.getTVInfo(test.getTmdb(), language, appendToResponse.toString());
TVInfo result = instance.getTVInfo(test.getTmdb(), language, appendToResponse);
TestSuite.test(result);
for (TVMethod method : TVMethod.values()) {
assertTrue("Does not have " + method.getPropertyString(), result.hasMethod(method));
}
TestSuite.test(result.getAlternativeTitles(), "Alt titles");
TestSuite.test(result.getContentRatings(), "Content Ratings");
TestSuite.test(result.getCredits());
@ -300,10 +293,8 @@ public class TmdbTVTest extends AbstractTests {
public void testGetTVKeywords() throws MovieDbException {
LOG.info("getTVKeywords");
String[] appendToResponse = null;
for (TestID test : TV_IDS) {
ResultList<Keyword> result = instance.getTVKeywords(test.getTmdb(), appendToResponse);
ResultList<Keyword> result = instance.getTVKeywords(test.getTmdb());
TestSuite.test(result, "TV Keyword");
}
}
@ -335,10 +326,9 @@ public class TmdbTVTest extends AbstractTests {
Integer page = null;
String language = LANGUAGE_DEFAULT;
String[] appendToResponse = null;
for (TestID test : TV_IDS) {
ResultList<TVInfo> result = instance.getTVSimilar(test.getTmdb(), page, language, appendToResponse);
ResultList<TVInfo> result = instance.getTVSimilar(test.getTmdb(), page, language);
TestSuite.test(result, "TV Similar");
}
}

Loading…
Cancel
Save