diff --git a/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java b/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java index 6fdd74e47..217a0b1dc 100644 --- a/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java +++ b/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java @@ -51,6 +51,7 @@ import com.omertron.themoviedbapi.model.artwork.Artwork; import com.omertron.themoviedbapi.model.artwork.ArtworkMedia; import com.omertron.themoviedbapi.model.authentication.TokenAuthorisation; import com.omertron.themoviedbapi.model.authentication.TokenSession; +import com.omertron.themoviedbapi.model.change.ChangeKeyItem; import com.omertron.themoviedbapi.model.change.ChangeListItem; import com.omertron.themoviedbapi.model.collection.Collection; import com.omertron.themoviedbapi.model.collection.CollectionInfo; @@ -84,10 +85,8 @@ import com.omertron.themoviedbapi.results.ResultList; import com.omertron.themoviedbapi.results.ResultsMap; import com.omertron.themoviedbapi.tools.HttpTools; import com.omertron.themoviedbapi.tools.MethodBase; -import com.omertron.themoviedbapi.wrapper.WrapperChanges; import java.net.URL; import java.util.List; -import java.util.Map; import org.apache.http.client.HttpClient; import org.yamj.api.common.http.SimpleHttpClientBuilder; @@ -585,7 +584,7 @@ public class TheMovieDbApi { * * @return @throws MovieDbException */ - public Map> getTimezones() throws MovieDbException { + public ResultsMap> getTimezones() throws MovieDbException { return tmdbConfiguration.getTimezones(); } // @@ -624,7 +623,7 @@ public class TheMovieDbApi { * @return * @throws MovieDbException */ - public List getDiscoverMovies(Discover discover) throws MovieDbException { + public ResultList getDiscoverMovies(Discover discover) throws MovieDbException { return tmdbDiscover.getDiscoverMovies(discover); } @@ -636,7 +635,7 @@ public class TheMovieDbApi { * @return * @throws MovieDbException */ - public List getDiscoverTV(Discover discover) throws MovieDbException { + public ResultList getDiscoverTV(Discover discover) throws MovieDbException { return tmdbDiscover.getDiscoverTV(discover); } // @@ -710,7 +709,7 @@ public class TheMovieDbApi { * @return * @throws MovieDbException */ - public List getGenreMovies(int genreId, String language, Integer page, Boolean includeAllMovies, Boolean includeAdult) throws MovieDbException { + public ResultList getGenreMovies(int genreId, String language, Integer page, Boolean includeAllMovies, Boolean includeAdult) throws MovieDbException { return tmdbGenre.getGenreMovies(genreId, language, page, includeAllMovies, includeAdult); } // @@ -1038,7 +1037,7 @@ public class TheMovieDbApi { * @return * @throws MovieDbException */ - public WrapperChanges getMovieChanges(int movieId, String startDate, String endDate) throws MovieDbException { + public ResultList getMovieChanges(int movieId, String startDate, String endDate) throws MovieDbException { return tmdbMovies.getMovieChanges(movieId, startDate, endDate); } @@ -1264,7 +1263,7 @@ public class TheMovieDbApi { * @return * @throws com.omertron.themoviedbapi.MovieDbException */ - public WrapperChanges getPersonChanges(int personId, String startDate, String endDate) throws MovieDbException { + public ResultList getPersonChanges(int personId, String startDate, String endDate) throws MovieDbException { return tmdbPeople.getPersonChanges(personId, startDate, endDate); } @@ -1487,7 +1486,7 @@ public class TheMovieDbApi { * @return * @throws com.omertron.themoviedbapi.MovieDbException */ - public WrapperChanges getTVChanges(int tvID, String startDate, String endDate) throws MovieDbException { + public ResultList getTVChanges(int tvID, String startDate, String endDate) throws MovieDbException { return tmdbTv.getTVChanges(tvID, startDate, endDate); } @@ -1675,10 +1674,11 @@ public class TheMovieDbApi { public ResultList getTVPopular(Integer page, String language) throws MovieDbException { return tmdbTv.getTVPopular(page, language); } - // + // // + // // } diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbConfiguration.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbConfiguration.java index 2cd64a1bf..e5ae1a807 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbConfiguration.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbConfiguration.java @@ -25,6 +25,7 @@ import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER; import com.omertron.themoviedbapi.model.config.Configuration; import com.omertron.themoviedbapi.model.config.JobDepartment; import com.omertron.themoviedbapi.results.ResultList; +import com.omertron.themoviedbapi.results.ResultsMap; import com.omertron.themoviedbapi.tools.ApiUrl; import com.omertron.themoviedbapi.tools.HttpTools; import com.omertron.themoviedbapi.tools.MethodBase; @@ -33,7 +34,6 @@ import com.omertron.themoviedbapi.wrapper.WrapperConfig; import com.omertron.themoviedbapi.wrapper.WrapperJobList; import java.io.IOException; import java.net.URL; -import java.util.HashMap; import java.util.List; import java.util.Map; import org.yamj.api.common.exception.ApiExceptionType; @@ -109,7 +109,7 @@ public class TmdbConfiguration extends AbstractMethod { * @return * @throws MovieDbException */ - public Map> getTimezones() throws MovieDbException { + public ResultsMap> getTimezones() throws MovieDbException { URL url = new ApiUrl(apiKey, MethodBase.TIMEZONES).subMethod(MethodSub.LIST).buildUrl(); String webpage = httpTools.getRequest(url); @@ -121,7 +121,7 @@ public class TmdbConfiguration extends AbstractMethod { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get timezone list", url, ex); } - Map> timezones = new HashMap>(); + ResultsMap> timezones = new ResultsMap>(); for (Map> tzMap : tzList) { for (Map.Entry> x : tzMap.entrySet()) { diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbDiscover.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbDiscover.java index 625f5db07..208393d08 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbDiscover.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbDiscover.java @@ -23,12 +23,13 @@ import com.omertron.themoviedbapi.MovieDbException; import com.omertron.themoviedbapi.model.discover.Discover; import com.omertron.themoviedbapi.model.movie.MovieBasic; import com.omertron.themoviedbapi.model.tv.TVBasic; +import com.omertron.themoviedbapi.results.ResultList; 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.wrapper.WrapperGenericList; import java.net.URL; -import java.util.List; /** * Class to hold the Discover Methods @@ -54,10 +55,11 @@ public class TmdbDiscover extends AbstractMethod { * @return * @throws MovieDbException */ - public List getDiscoverMovies(Discover discover) throws MovieDbException { + public ResultList getDiscoverMovies(Discover discover) throws MovieDbException { URL url = new ApiUrl(apiKey, MethodBase.DISCOVER).subMethod(MethodSub.MOVIE).buildUrl(discover.getParams()); String webpage = httpTools.getRequest(url); - return processWrapperList(getTypeReference(MovieBasic.class), url, webpage); + WrapperGenericList wrapper = processWrapper(getTypeReference(MovieBasic.class), url, webpage); + return wrapper.getResultsList(); } /** @@ -67,9 +69,10 @@ public class TmdbDiscover extends AbstractMethod { * @return * @throws MovieDbException */ - public List getDiscoverTV(Discover discover) throws MovieDbException { + public ResultList getDiscoverTV(Discover discover) throws MovieDbException { URL url = new ApiUrl(apiKey, MethodBase.DISCOVER).subMethod(MethodSub.TV).buildUrl(discover.getParams()); String webpage = httpTools.getRequest(url); - return processWrapperList(getTypeReference(TVBasic.class), url, webpage); + WrapperGenericList wrapper = processWrapper(getTypeReference(TVBasic.class), url, webpage); + return wrapper.getResultsList(); } } diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbGenres.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbGenres.java index 0e0695454..7b38be0a0 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbGenres.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbGenres.java @@ -29,10 +29,10 @@ 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.wrapper.WrapperGenericList; import com.omertron.themoviedbapi.wrapper.WrapperGenres; import java.io.IOException; import java.net.URL; -import java.util.List; import org.yamj.api.common.exception.ApiExceptionType; /** @@ -112,7 +112,7 @@ public class TmdbGenres extends AbstractMethod { * @return * @throws MovieDbException */ - public List getGenreMovies(int genreId, String language, Integer page, Boolean includeAllMovies, Boolean includeAdult) throws MovieDbException { + public ResultList getGenreMovies(int genreId, String language, Integer page, Boolean includeAllMovies, Boolean includeAdult) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, genreId); parameters.add(Param.LANGUAGE, language); @@ -123,6 +123,7 @@ public class TmdbGenres extends AbstractMethod { URL url = new ApiUrl(apiKey, MethodBase.GENRE).subMethod(MethodSub.MOVIES).buildUrl(parameters); String webpage = httpTools.getRequest(url); - return processWrapperList(getTypeReference(MovieBasic.class), url, webpage); + WrapperGenericList wrapper = processWrapper(getTypeReference(MovieBasic.class), url, webpage); + return wrapper.getResultsList(); } } diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java index aba7b7aac..693ac5653 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java @@ -23,6 +23,7 @@ import com.omertron.themoviedbapi.MovieDbException; import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER; 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.list.UserList; import com.omertron.themoviedbapi.model.media.MediaCreditList; @@ -78,8 +79,7 @@ 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 @@ -111,8 +111,7 @@ 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 @@ -141,8 +140,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. * @@ -167,8 +166,7 @@ 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 @@ -217,8 +215,7 @@ public class TmdbMovies extends AbstractMethod { } /** - * This method should be used when you’re wanting to retrieve all of the - * images for a particular movie. + * This method should be used when you’re wanting to retrieve all of the images for a particular movie. * * @param movieId * @param language @@ -246,8 +243,7 @@ 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. * @@ -275,8 +271,7 @@ 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 @@ -304,8 +299,7 @@ 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. * @@ -335,8 +329,7 @@ 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 @@ -362,11 +355,9 @@ 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 * @@ -440,8 +431,7 @@ 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. * @@ -451,7 +441,7 @@ public class TmdbMovies extends AbstractMethod { * @return * @throws MovieDbException */ - public WrapperChanges getMovieChanges(int movieId, String startDate, String endDate) throws MovieDbException { + public ResultList getMovieChanges(int movieId, String startDate, String endDate) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); parameters.add(Param.START_DATE, startDate); @@ -461,7 +451,10 @@ public class TmdbMovies extends AbstractMethod { String webpage = httpTools.getRequest(url); try { - return MAPPER.readValue(webpage, WrapperChanges.class); + WrapperChanges wrapper = MAPPER.readValue(webpage, WrapperChanges.class); + ResultList results = new ResultList(wrapper.getChangedItems()); + wrapper.setResultProperties(results); + return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get changes", url, ex); } @@ -545,8 +538,7 @@ 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 @@ -584,8 +576,7 @@ 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. * diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java index 4ce73a23a..2393e9b3d 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java @@ -23,8 +23,10 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.omertron.themoviedbapi.MovieDbException; import com.omertron.themoviedbapi.enumeration.ArtworkType; +import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER; import com.omertron.themoviedbapi.model.artwork.Artwork; import com.omertron.themoviedbapi.model.artwork.ArtworkMedia; +import com.omertron.themoviedbapi.model.change.ChangeKeyItem; import com.omertron.themoviedbapi.model.person.CreditBasic; import com.omertron.themoviedbapi.model.person.CreditMovieBasic; import com.omertron.themoviedbapi.model.person.CreditTVBasic; @@ -268,7 +270,7 @@ public class TmdbPeople extends AbstractMethod { * @return * @throws com.omertron.themoviedbapi.MovieDbException */ - public WrapperChanges getPersonChanges(int personId, String startDate, String endDate) throws MovieDbException { + public ResultList getPersonChanges(int personId, String startDate, String endDate) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, personId); parameters.add(Param.START_DATE, startDate); @@ -278,7 +280,10 @@ public class TmdbPeople extends AbstractMethod { String webpage = httpTools.getRequest(url); try { - return MAPPER.readValue(webpage, WrapperChanges.class); + WrapperChanges wrapper = MAPPER.readValue(webpage, WrapperChanges.class); + ResultList results = new ResultList(wrapper.getChangedItems()); + wrapper.setResultProperties(results); + return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person changes", url, ex); } diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java index b2583a4e0..2dd35bd71 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java @@ -23,6 +23,7 @@ import com.omertron.themoviedbapi.MovieDbException; import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER; 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.MediaCreditList; import com.omertron.themoviedbapi.model.media.MediaState; @@ -146,7 +147,7 @@ public class TmdbTV extends AbstractMethod { * @return * @throws com.omertron.themoviedbapi.MovieDbException */ - public WrapperChanges getTVChanges(int tvID, String startDate, String endDate) throws MovieDbException { + public ResultList getTVChanges(int tvID, String startDate, String endDate) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, tvID); parameters.add(Param.START_DATE, startDate); @@ -156,7 +157,10 @@ public class TmdbTV extends AbstractMethod { String webpage = httpTools.getRequest(url); try { - return MAPPER.readValue(webpage, WrapperChanges.class); + WrapperChanges wrapper = MAPPER.readValue(webpage, WrapperChanges.class); + ResultList results = new ResultList(wrapper.getChangedItems()); + wrapper.setResultProperties(results); + return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get changes", url, ex); } diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbTVEpisodes.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbTVEpisodes.java index 2241c87ea..ba1baabb6 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbTVEpisodes.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbTVEpisodes.java @@ -23,6 +23,7 @@ import com.omertron.themoviedbapi.MovieDbException; import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER; 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.media.MediaCreditList; import com.omertron.themoviedbapi.model.media.MediaState; import com.omertron.themoviedbapi.model.media.Video; @@ -104,7 +105,7 @@ public class TmdbTVEpisodes extends AbstractMethod { * @return * @throws MovieDbException */ - public WrapperChanges getEpisodeChanges(int episodeID, String startDate, String endDate) throws MovieDbException { + public ResultList getEpisodeChanges(int episodeID, String startDate, String endDate) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, episodeID); parameters.add(Param.START_DATE, startDate); @@ -114,7 +115,10 @@ public class TmdbTVEpisodes extends AbstractMethod { String webpage = httpTools.getRequest(url); try { - return MAPPER.readValue(webpage, WrapperChanges.class); + WrapperChanges wrapper = MAPPER.readValue(webpage, WrapperChanges.class); + ResultList results = new ResultList(wrapper.getChangedItems()); + wrapper.setResultProperties(results); + return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get changes", url, ex); } diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbTVSeasons.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbTVSeasons.java index df3d0e52e..1bfb251dc 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbTVSeasons.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbTVSeasons.java @@ -22,6 +22,7 @@ package com.omertron.themoviedbapi.methods; import com.omertron.themoviedbapi.MovieDbException; import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER; import com.omertron.themoviedbapi.model.artwork.Artwork; +import com.omertron.themoviedbapi.model.change.ChangeKeyItem; import com.omertron.themoviedbapi.model.media.MediaCreditList; import com.omertron.themoviedbapi.model.media.MediaState; import com.omertron.themoviedbapi.model.media.Video; @@ -94,7 +95,7 @@ public class TmdbTVSeasons extends AbstractMethod { * @return * @throws MovieDbException */ - public WrapperChanges getSeasonChanges(int tvID, String startDate, String endDate) throws MovieDbException { + public ResultList getSeasonChanges(int tvID, String startDate, String endDate) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, tvID); parameters.add(Param.START_DATE, startDate); @@ -104,7 +105,10 @@ public class TmdbTVSeasons extends AbstractMethod { String webpage = httpTools.getRequest(url); try { - return MAPPER.readValue(webpage, WrapperChanges.class); + WrapperChanges wrapper = MAPPER.readValue(webpage, WrapperChanges.class); + ResultList results = new ResultList(wrapper.getChangedItems()); + wrapper.setResultProperties(results); + return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get changes", url, ex); } diff --git a/src/main/java/com/omertron/themoviedbapi/methods/_Method_List.txt b/src/main/java/com/omertron/themoviedbapi/methods/_Method_List.txt deleted file mode 100644 index 33b025846..000000000 --- a/src/main/java/com/omertron/themoviedbapi/methods/_Method_List.txt +++ /dev/null @@ -1,157 +0,0 @@ -Account (Done) -/account Get the basic information for an account. You will need to have a valid session id. -/account/{id}/lists Get the lists that you have created and marked as a favorite. -/account/{id}/favorite/movies Get the list of favorite movies for an account. -/account/{id}/favorite/tv Get the list of favorite TV series for an account -/account/{id}/favorite Add or remove a movie to an accounts favorite list -/account/{id}/rated/movies Get the list of rated movies (and associated rating) for an account -/account/{id}/rated/tv Get the list of rated TV shows (and associated rating) for an account. -/account/{id}/watchlist/movies Get the list of movies on an accounts watchlist -/account/{id}/watchlist/tv Get the list of TV series on an accounts watchlist -/account/{id}/watchlist Add or remove a movie to an accounts watch list - -Authentication (Done) -/authentication/token/new This method is used to generate a valid request token for user based authentication -/authentication/token/validate_with_login Once you have a valid request token you can use this method to authenticate a user with a TMDb username and password. -/authentication/session/new 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. -/authentication/guest_session/new 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. - -Certifications (Done) -/certification/movie/list Get the list of supported certifications for movies. -/certification/tv/list Get the list of supported certifications for tv shows - -Changes (Done) -/movie/changes Get a list of movie ids that have been edited. -/person/changes Get a list of people ids that have been edited. -/tv/changes Get a list of TV show ids that have been edited - -Collections (Done) -/collection/{id} Get the basic collection information for a specific collection id. -/collection/{id}/images Get all of the images for a particular collection by collection id. - -Companies (Done) -/company/{id} This method is used to retrieve all of the basic information about a company -/company/{id}/movies Get the list of movies associated with a particular company. - -Credits (Done) -/credit/{credit_id} Get the detailed information about a particular credit record. - -Discover (Done) -/discover/movie Discover movies by different types of data like average rating, number of votes, genres and certifications. -/discover/tv Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates. - -Find (Done) -/find/{id} The find method makes it easy to search for objects in our database by an external id. - -Genres (Done) -/genre/movie/list Get the list of movie genres. -/genre/tv/list Get the list of TV genres. -/genre/{id}/movies Get the list of movies for a particular genre by id. - -Guest Sessions (Partial - in Account) -/guest_session/{guest_session_id}/rated_movies Get a list of rated movies for a specific guest session id. - -Jobs (Done - part of configuration) -/job/list Get a list of valid jobs. - -Keyword (Done) -/keyword/{id} Get the basic information for a specific keyword id -/keyword/{id}/movies Get the list of movies for a particular keyword by id - -Lists (Done) -/list/{id} Get a list by id. -/list/{id}/item_status Check to see if a movie ID is already added to a list. -/list This method lets users create a new list. A valid session id is required. -/list/{id}/add_item This method lets users add new movies to a list that they created. A valid session id is required. -/list/{id}/remove_item This method lets users delete movies from a list that they created. A valid session id is required. -/list/{id}/clear Clear all of the items within a list. This is a irreversible action and should be treated with caution. A valid session id is required. - -Movies (Done) -/movie/{id} Get the basic movie information for a specific movie id. -/movie/{id}/account_states This method lets a TMDb user account get the status of whether or not the movie has been rated or added to their favourite or movie watch list -/movie/{id}/alternative_titles Get the alternative titles for a specific movie id. -/movie/{id}/credits Get the cast and crew information for a specific movie id. -/movie/{id}/images Get the images (posters and backdrops) for a specific movie id. -/movie/{id}/keywords Get the plot keywords for a specific movie id. -/movie/{id}/releases Get the release date and certification information by country for a specific movie id. -/movie/{id}/videos Get the videos (trailers, teasers, clips, etc...) for a specific movie id. -/movie/{id}/translations Get the translations for a specific movie id. -/movie/{id}/similar Get the similar movies for a specific movie id. -/movie/{id}/reviews Get the reviews for a particular movie id. -/movie/{id}/lists Get the lists that the movie belongs to. -/movie/{id}/changes Get the changes for a specific movie id. -/movie/{id}/rating This method lets users rate a movie. A valid session id or guest session id is required. -/movie/latest Get the latest movie id. -/movie/upcoming Get the list of upcoming movies by release date. This list refreshes every day. -/movie/now_playing Get the list of movies playing that have been, or are being released this week. This list refreshes every day. -/movie/popular Get the list of popular movies on The Movie Database. This list refreshes every day. -/movie/top_rated Get the list of top rated movies. By default, this list will only include movies that have 10 or more votes. This list refreshes every day. - -Networks (Done) -/network/{id} This method is used to retrieve the basic information about a TV network. - -People (Done) -/person/{id} Get the general person information for a specific id -/person/{id}/movie_credits Get the movie credits for a specific person id. -/person/{id}/tv_credits Get the TV credits for a specific person id. -/person/{id}/combined_credits Get the combined (movie and TV) credits for a specific person id. -/person/{id}/external_ids Get the external ids for a specific person id. -/person/{id}/images Get the images for a specific person id. -/person/{id}/tagged_images Get the images that have been tagged with a specific person id -/person/{id}/changes Get the changes for a specific person id. -/person/popular Get the list of popular people on The Movie Database. This list refreshes every day. -/person/latest Get the latest person id. - -Reviews (Done) -/review/{id} Get the full details of a review by ID. - -Search (Done) -/search/company Search for companies by name. -/search/collection Search for collections by name. -/search/keyword Search for keywords by name. -/search/list Search for lists by name and description. -/search/movie Search for movies by title. -/search/multi Search the movie, tv show and person collections with a single query. -/search/person Search for people by name. -/search/tv Search for TV shows by title. - -Timezones (Done - part of configuration) -/timezones/list Get the list of supported timezones for the API methods that support them. - -TV (Done) -/tv/{id} Get the primary information about a TV series by id. -/tv/{id}/account_states 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. -/tv/{id}/alternative_titles Get the alternative titles for a specific show ID. -/tv/{id}/changes Get the changes for a specific TV show id. -/tv/{id}/content_ratings Get the content ratings for a specific TV show id. -/tv/{id}/credits Get the cast & crew information about a TV series. -/tv/{id}/external_ids Get the external ids that we have stored for a TV series. -/tv/{id}/images Get the images (posters and backdrops) for a TV series. -/tv/{id}/keywords Get the plot keywords for a specific TV show id. -/tv/{id}/rating This method lets users rate a TV show. A valid session id or guest session id is required. -/tv/{id}/similar Get the similar TV shows for a specific tv id. -/tv/{id}/translations Get the list of translations that exist for a TV series. These translations cascade down to the episode level. -/tv/{id}/videos Get the videos that have been added to a TV series (trailers, opening credits, etc...) -/tv/latest Get the latest TV show id. -/tv/on_the_air 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. -/tv/airing_today Get the list of TV shows that air today. Without a specified timezone, this query defaults to EST -/tv/top_rated Get the list of top rated TV shows. By default, this list will only include TV shows that have 2 or more votes. This list refreshes every day. -/tv/popular Get the list of popular TV shows. This list refreshes every day. - -TV Seasons -/tv/{id}/season/{season_number} Get the primary information about a TV season by its season number. -/tv/season/{id}/changes Look up a TV season's changes by season ID. -/tv/{id}/season/{season_number}/credits Get the cast & crew credits for a TV season by season number. -/tv/{id}/season/{season_number}/external_ids Get the external ids that we have stored for a TV season by season number. -/tv/{id}/season/{season_number}/images Get the images (posters) that we have stored for a TV season by season number. -/tv/{id}/season/{season_number}/videos Get the videos that have been added to a TV season (trailers, teasers, etc...) - -TV Episodes -/tv/{id}/season/{season_number}/episode/{episode_number} Get the primary information about a TV episode by combination of a season and episode number. -/tv/episode/{id}/changes Look up a TV episode's changes by episode ID -/tv/{id}/season/{season_number}/episode/{episode_number}/account_states This method lets users get the status of whether or not the TV episode has been rated. A valid session id is required. -/tv/{id}/season/{season_number}/episode/{episode_number}/credits Get the TV episode credits by combination of season and episode number. -/tv/{id}/season/{season_number}/episode/{episode_number}/external_ids Get the external ids for a TV episode by comabination of a season and episode number. -/tv/{id}/season/{season_number}/episode/{episode_number}/images Get the images (episode stills) for a TV episode by combination of a season and episode number. -/tv/{id}/season/{season_number}/episode/{episode_number}/rating This method lets users rate a TV episode. A valid session id or guest session id is required. -/tv/{id}/season/{season_number}/episode/{episode_number}/videos Get the videos that have been added to a TV episode (teasers, clips, etc...) diff --git a/src/main/java/com/omertron/themoviedbapi/results/ResultsMap.java b/src/main/java/com/omertron/themoviedbapi/results/ResultsMap.java index 189f84eb7..ebc73b632 100644 --- a/src/main/java/com/omertron/themoviedbapi/results/ResultsMap.java +++ b/src/main/java/com/omertron/themoviedbapi/results/ResultsMap.java @@ -48,10 +48,26 @@ public final class ResultsMap extends AbstractResults { } } + public boolean isEmpty() { + return results.isEmpty(); + } + public Map getResults() { return results; } + public boolean containsKey(K key) { + return results.containsKey(key); + } + + public V get(K key) { + return results.get(key); + } + + public void put(K key, V value) { + this.results.put(key, value); + } + public void setResults(Map results) { this.results = results; } diff --git a/src/test/java/com/omertron/themoviedbapi/methods/TmdbConfigurationTest.java b/src/test/java/com/omertron/themoviedbapi/methods/TmdbConfigurationTest.java index 4569c8d8d..d523f10ab 100644 --- a/src/test/java/com/omertron/themoviedbapi/methods/TmdbConfigurationTest.java +++ b/src/test/java/com/omertron/themoviedbapi/methods/TmdbConfigurationTest.java @@ -24,8 +24,8 @@ import com.omertron.themoviedbapi.MovieDbException; import com.omertron.themoviedbapi.model.config.Configuration; import com.omertron.themoviedbapi.model.config.JobDepartment; import com.omertron.themoviedbapi.results.ResultList; +import com.omertron.themoviedbapi.results.ResultsMap; import java.util.List; -import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.junit.After; import org.junit.AfterClass; @@ -119,7 +119,7 @@ public class TmdbConfigurationTest extends AbstractTests { @Test public void testGetTimezones() throws MovieDbException { LOG.info("getTimezones"); - Map> result = instance.getTimezones(); + ResultsMap> result = instance.getTimezones(); assertNotNull("Null results", result); assertFalse("Empty results", result.isEmpty()); assertTrue("No US TZ",result.containsKey("US")); diff --git a/src/test/java/com/omertron/themoviedbapi/methods/TmdbDiscoverTest.java b/src/test/java/com/omertron/themoviedbapi/methods/TmdbDiscoverTest.java index 422d28dae..9f99c0149 100644 --- a/src/test/java/com/omertron/themoviedbapi/methods/TmdbDiscoverTest.java +++ b/src/test/java/com/omertron/themoviedbapi/methods/TmdbDiscoverTest.java @@ -24,7 +24,7 @@ import com.omertron.themoviedbapi.MovieDbException; import com.omertron.themoviedbapi.model.discover.Discover; import com.omertron.themoviedbapi.model.movie.MovieBasic; import com.omertron.themoviedbapi.model.tv.TVBasic; -import java.util.List; +import com.omertron.themoviedbapi.results.ResultList; import org.junit.After; import org.junit.AfterClass; import static org.junit.Assert.assertFalse; @@ -72,7 +72,7 @@ public class TmdbDiscoverTest extends AbstractTests { Discover discover = new Discover(); discover.year(2013).language(LANGUAGE_ENGLISH); - List result = instance.getDiscoverMovies(discover); + ResultList result = instance.getDiscoverMovies(discover); assertFalse("No movies discovered", result.isEmpty()); } @@ -87,7 +87,7 @@ public class TmdbDiscoverTest extends AbstractTests { Discover discover = new Discover(); discover.year(2013).language(LANGUAGE_ENGLISH); - List result = instance.getDiscoverTV(discover); + ResultList result = instance.getDiscoverTV(discover); assertFalse("No TV shows discovered", result.isEmpty()); } diff --git a/src/test/java/com/omertron/themoviedbapi/methods/TmdbGenresTest.java b/src/test/java/com/omertron/themoviedbapi/methods/TmdbGenresTest.java index 1619e79ca..a1b5df61c 100644 --- a/src/test/java/com/omertron/themoviedbapi/methods/TmdbGenresTest.java +++ b/src/test/java/com/omertron/themoviedbapi/methods/TmdbGenresTest.java @@ -24,7 +24,6 @@ import com.omertron.themoviedbapi.MovieDbException; import com.omertron.themoviedbapi.model.Genre; import com.omertron.themoviedbapi.model.movie.MovieBasic; import com.omertron.themoviedbapi.results.ResultList; -import java.util.List; import org.junit.After; import org.junit.AfterClass; import static org.junit.Assert.assertFalse; @@ -100,7 +99,7 @@ public class TmdbGenresTest extends AbstractTests { Integer page = null; Boolean includeAllMovies = null; Boolean includeAdult = null; - List result = instance.getGenreMovies(ID_GENRE_ACTION, LANGUAGE_DEFAULT, page, includeAllMovies, includeAdult); + ResultList result = instance.getGenreMovies(ID_GENRE_ACTION, LANGUAGE_DEFAULT, page, includeAllMovies, includeAdult); assertNotNull("List is null", result); assertFalse("List is empty", result.isEmpty()); } diff --git a/src/test/java/com/omertron/themoviedbapi/methods/TmdbMoviesTest.java b/src/test/java/com/omertron/themoviedbapi/methods/TmdbMoviesTest.java index 592c3bd67..78dd46bba 100644 --- a/src/test/java/com/omertron/themoviedbapi/methods/TmdbMoviesTest.java +++ b/src/test/java/com/omertron/themoviedbapi/methods/TmdbMoviesTest.java @@ -41,7 +41,6 @@ import com.omertron.themoviedbapi.model.media.Video; import com.omertron.themoviedbapi.model.review.Review; import com.omertron.themoviedbapi.results.ResultList; import com.omertron.themoviedbapi.tools.MethodBase; -import com.omertron.themoviedbapi.wrapper.WrapperChanges; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -359,10 +358,10 @@ public class TmdbMoviesTest extends AbstractTests { LOG.info("Found {} changes to check, will check maximum of {}", changeList.getResults().size(), maxCheck); int count = 1; - WrapperChanges result; + ResultList result; for (ChangeListItem item : changeList.getResults()) { result = instance.getMovieChanges(item.getId(), startDate, endDate); - for (ChangeKeyItem ci : result.getChangedItems()) { + for (ChangeKeyItem ci : result.getResults()) { assertNotNull("Null changes", ci); } diff --git a/src/test/java/com/omertron/themoviedbapi/methods/TmdbPeopleTest.java b/src/test/java/com/omertron/themoviedbapi/methods/TmdbPeopleTest.java index afa47b47b..34840283b 100644 --- a/src/test/java/com/omertron/themoviedbapi/methods/TmdbPeopleTest.java +++ b/src/test/java/com/omertron/themoviedbapi/methods/TmdbPeopleTest.java @@ -37,7 +37,6 @@ import com.omertron.themoviedbapi.model.person.PersonCredits; import com.omertron.themoviedbapi.model.person.PersonFind; import com.omertron.themoviedbapi.results.ResultList; import com.omertron.themoviedbapi.tools.MethodBase; -import com.omertron.themoviedbapi.wrapper.WrapperChanges; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -270,10 +269,10 @@ public class TmdbPeopleTest extends AbstractTests { LOG.info("Found {} person changes to check", changeList.getResults().size()); int count = 1; - WrapperChanges result; + ResultList result; for (ChangeListItem item : changeList.getResults()) { result = instance.getPersonChanges(item.getId(), startDate, endDate); - for (ChangeKeyItem ci : result.getChangedItems()) { + for (ChangeKeyItem ci : result.getResults()) { assertNotNull("Null changes", ci); } diff --git a/src/test/java/com/omertron/themoviedbapi/methods/TmdbTVTest.java b/src/test/java/com/omertron/themoviedbapi/methods/TmdbTVTest.java index d65d8da0f..4469fb0d5 100644 --- a/src/test/java/com/omertron/themoviedbapi/methods/TmdbTVTest.java +++ b/src/test/java/com/omertron/themoviedbapi/methods/TmdbTVTest.java @@ -41,7 +41,6 @@ import com.omertron.themoviedbapi.model.tv.TVBasic; import com.omertron.themoviedbapi.model.tv.TVInfo; import com.omertron.themoviedbapi.results.ResultList; import com.omertron.themoviedbapi.tools.MethodBase; -import com.omertron.themoviedbapi.wrapper.WrapperChanges; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -150,10 +149,10 @@ public class TmdbTVTest extends AbstractTests { LOG.info("Found {} changes to check, will check maximum of {}", changeList.getResults().size(), maxCheck); int count = 1; - WrapperChanges result; + ResultList result; for (ChangeListItem item : changeList.getResults()) { result = instance.getTVChanges(item.getId(), startDate, endDate); - for (ChangeKeyItem ci : result.getChangedItems()) { + for (ChangeKeyItem ci : result.getResults()) { assertNotNull("Null changes", ci); }