From ee0c6e12f2db1c350e712afea722f925c8faab5e Mon Sep 17 00:00:00 2001 From: Stuart Boston Date: Thu, 5 Mar 2015 09:53:13 +0000 Subject: [PATCH] Added methods to main API, fixed missing parameter --- .../omertron/themoviedbapi/TheMovieDbApi.java | 245 +++++++++++++++++- .../themoviedbapi/methods/TmdbTV.java | 1 + .../omertron/themoviedbapi/tools/Param.java | 1 + 3 files changed, 246 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java b/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java index 12bfc21f1..8a6959014 100644 --- a/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java +++ b/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java @@ -71,6 +71,7 @@ import com.omertron.themoviedbapi.model.movie.ReleaseInfo; import com.omertron.themoviedbapi.model.movie.Translation; import com.omertron.themoviedbapi.model.movie.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.Person; @@ -78,6 +79,7 @@ import com.omertron.themoviedbapi.model.person.PersonCredits; import com.omertron.themoviedbapi.model.person.PersonFind; import com.omertron.themoviedbapi.model.review.Review; import com.omertron.themoviedbapi.model.tv.TVBasic; +import com.omertron.themoviedbapi.model.tv.TVInfo; import com.omertron.themoviedbapi.results.TmdbResultsList; import com.omertron.themoviedbapi.results.TmdbResultsMap; import com.omertron.themoviedbapi.tools.HttpTools; @@ -1436,6 +1438,247 @@ public class TheMovieDbApi { } // - // + // + /** + * Get the primary information about a TV series by id. + * + * @param tvID + * @param language + * @param appendToResponse + * @return + * @throws com.omertron.themoviedbapi.MovieDbException + */ + public TVInfo getTVInfo(int tvID, String language, String... appendToResponse) throws MovieDbException { + return tmdbTv.getTVInfo(tvID, language, appendToResponse); + } + + /** + * 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. + * + * @param tvID + * @param sessionID + * @return + * @throws com.omertron.themoviedbapi.MovieDbException + */ + public MediaState getTVAccountState(int tvID, String sessionID) throws MovieDbException { + return tmdbTv.getTVAccountState(tvID, sessionID); + } + + /** + * Get the alternative titles for a specific show ID. + * + * @param tvID + * @return + * @throws com.omertron.themoviedbapi.MovieDbException + */ + public TmdbResultsList getTVAlternativeTitles(int tvID) throws MovieDbException { + return tmdbTv.getTVAlternativeTitles(tvID); + } + + /** + * Get the changes for a specific TV show id. + * + * @param tvID + * @param startDate + * @param endDate + * @return + * @throws com.omertron.themoviedbapi.MovieDbException + */ + public WrapperChanges getTVChanges(int tvID, String startDate, String endDate) throws MovieDbException { + return tmdbTv.getTVChanges(tvID, startDate, endDate); + } + + /** + * Get the content ratings for a specific TV show id. + * + * @param tvID + * @return + * @throws com.omertron.themoviedbapi.MovieDbException + */ + public TmdbResultsList getTVContentRatings(int tvID) throws MovieDbException { + return tmdbTv.getTVContentRatings(tvID); + } + + /** + * Get the cast & crew information about a TV series. + * + * @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); + } + + /** + * Get the external ids that we have stored for a TV series. + * + * @param tvID + * @param language + * @return + * @throws com.omertron.themoviedbapi.MovieDbException + */ + public ExternalID getTVExternalIDs(int tvID, String language) throws MovieDbException { + return tmdbTv.getTVExternalIDs(tvID, language); + } + + /** + * Get the images (posters and backdrops) for a TV series. + * + * @param tvID + * @param language + * @param includeImageLanguage + * @return + * @throws com.omertron.themoviedbapi.MovieDbException + */ + public TmdbResultsList getTVImages(int tvID, String language, String... includeImageLanguage) throws MovieDbException { + return tmdbTv.getTVImages(tvID, language, includeImageLanguage); + } + + /** + * Get the plot keywords for a specific TV show id. + * + * @param tvID + * @param appendToResponse + * @return + * @throws com.omertron.themoviedbapi.MovieDbException + */ + public TmdbResultsList getTVKeywords(int tvID, String... appendToResponse) throws MovieDbException { + return tmdbTv.getTVKeywords(tvID, appendToResponse); + } + + /** + * This method lets users rate a TV show. + * + * A valid session id or guest session id is required. + * + * @param tvID + * @param rating + * @param sessionID + * @param guestSessionID + * @return + * @throws com.omertron.themoviedbapi.MovieDbException + */ + public StatusCode postTVRating(int tvID, int rating, String sessionID, String guestSessionID) throws MovieDbException { + return tmdbTv.postTVRating(tvID, rating, sessionID, guestSessionID); + } + + /** + * Get the similar TV shows for a specific tv id. + * + * @param tvID + * @param page + * @param language + * @param appendToResponse + * @return + * @throws com.omertron.themoviedbapi.MovieDbException + */ + public TmdbResultsList getTVSimilar(int tvID, Integer page, String language, String... appendToResponse) throws MovieDbException { + return tmdbTv.getTVSimilar(tvID, page, language, appendToResponse); + } + + /** + * Get the list of translations that exist for a TV series. These + * translations cascade down to the episode level. + * + * @param tvID + * @return + * @throws com.omertron.themoviedbapi.MovieDbException + */ + public TmdbResultsList getTVTranslations(int tvID) throws MovieDbException { + return tmdbTv.getTVTranslations(tvID); + } + + /** + * Get the videos that have been added to a TV series (trailers, opening + * credits, etc...) + * + * @param tvID + * @param language + * @return + * @throws com.omertron.themoviedbapi.MovieDbException + */ + public TmdbResultsList + // + // + // // } diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java index 68a03c426..8e815764d 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java @@ -246,6 +246,7 @@ public class TmdbTV extends AbstractMethod { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, tvID); parameters.add(Param.LANGUAGE, language); + parameters.add(Param.INCLUDE_IMAGE_LANGUAGE, includeImageLanguage); URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.IMAGES).buildUrl(parameters); String webpage = httpTools.getRequest(url); diff --git a/src/main/java/com/omertron/themoviedbapi/tools/Param.java b/src/main/java/com/omertron/themoviedbapi/tools/Param.java index 925891410..c8f306d61 100644 --- a/src/main/java/com/omertron/themoviedbapi/tools/Param.java +++ b/src/main/java/com/omertron/themoviedbapi/tools/Param.java @@ -41,6 +41,7 @@ public enum Param { ID("id="), INCLUDE_ALL_MOVIES("include_all_movies="), INCLUDE_ADULT("include_adult="), + INCLUDE_IMAGE_LANGUAGE("include_image_language="), LANGUAGE("language="), MOVIE_ID("movie_id="), MOVIE_WATCHLIST("movie_watchlist="),