diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java index 2b968aa24..b0ca3158a 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java @@ -22,6 +22,7 @@ package com.omertron.themoviedbapi.methods; import com.omertron.themoviedbapi.MovieDbException; import com.omertron.themoviedbapi.model.Artwork; import com.omertron.themoviedbapi.enumeration.ArtworkType; +import static com.omertron.themoviedbapi.methods.AbstractMethod.getTypeReference; import com.omertron.themoviedbapi.model.person.Person; import com.omertron.themoviedbapi.model.person.PersonCredit; import com.omertron.themoviedbapi.results.TmdbResultsList; @@ -31,8 +32,8 @@ 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.WrapperImages; -import com.omertron.themoviedbapi.wrapper.WrapperPersonCredits; import com.omertron.themoviedbapi.wrapper.WrapperPersonList; import java.io.IOException; import java.net.URL; @@ -56,9 +57,7 @@ public class TmdbPeople extends AbstractMethod { } /** - * This method is used to retrieve all of the basic person information. - * - * It will return the single highest rated profile image. + * Get the general person information for a specific id. * * @param personId * @param appendToResponse @@ -81,35 +80,74 @@ public class TmdbPeople extends AbstractMethod { } /** - * This method is used to retrieve all of the cast & crew information for the person. - * - * It will return the single highest rated poster for each movie record. + * Get the movie credits for a specific person id. * * @param personId + * @param language * @param appendToResponse * @return * @throws MovieDbException */ - public TmdbResultsList getPersonCredits(int personId, String... appendToResponse) throws MovieDbException { + public TmdbResultsList getPersonMovieCredits(int personId, String language, String... appendToResponse) 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).setSubMethod(MethodSub.MOVIE_CREDITS).buildUrl(parameters); - URL url = new ApiUrl(apiKey, MethodBase.PERSON).setSubMethod(MethodSub.CREDITS).buildUrl(parameters); - String webpage = httpTools.getRequest(url); + WrapperGenericList wrapper = processWrapper(getTypeReference(PersonCredit.class), url, "person movie credits"); + TmdbResultsList results = new TmdbResultsList(wrapper.getResults()); + results.copyWrapper(wrapper); + return results; + } - try { - WrapperPersonCredits wrapper = MAPPER.readValue(webpage, WrapperPersonCredits.class); - TmdbResultsList results = new TmdbResultsList(wrapper.getAll()); - results.copyWrapper(wrapper); - return results; - } catch (IOException ex) { - throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person credits", url, ex); - } + /** + * 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. + * + * This will provide details about which episode and/or season the credit is for. + * + * @param personId + * @param language + * @param appendToResponse + * @return + * @throws MovieDbException + */ + public TmdbResultsList getPersonTVCredits(int personId, String language, String... appendToResponse) throws MovieDbException { + return null; + } + + /** + * 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. + * + * This will provide details about which episode and/or season the credit is for. + * + * @param personId + * @param language + * @param appendToResponse + * @return + * @throws MovieDbException + */ + public TmdbResultsList getPersonCombinedCredits(int personId, String language, String... appendToResponse) throws MovieDbException { + return null; } /** - * This method is used to retrieve all of the profile images for a person. + * Get the external ids for a specific person id. + * + * @param personId + * @return + * @throws MovieDbException + */ + public TmdbResultsList getPersonExternalIds(int personId) throws MovieDbException { + return null; + } + + /** + * Get the images for a specific person id. * * @param personId * @return @@ -132,6 +170,40 @@ public class TmdbPeople extends AbstractMethod { } } + /** + * 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. + * + * @param personId + * @param page + * @param language + * @return + */ + public TmdbResultsList getPersonTaggedImages(int personId, Integer page, String language) { + return null; + } + + /** + * Get the changes for a specific person id. + * + * Changes are grouped by key, and ordered by date in descending order. + * + * By default, only the last 24 hours of changes are returned. + * + * The maximum number of days that can be returned in a single request is 14. + * + * The language is present on fields that are translatable. + * + * @param persondId + * @param startDate + * @param endDate + * @return + */ + public TmdbResultsList getPersonChanges(int persondId, String startDate, String endDate) { + return null; + } + /** * Get the list of popular people on The Movie Database. * @@ -141,7 +213,7 @@ public class TmdbPeople extends AbstractMethod { * @return * @throws MovieDbException */ - public TmdbResultsList getPersonPopular(int page) throws MovieDbException { + public TmdbResultsList getPersonPopular(Integer page) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.PAGE, page); @@ -175,8 +247,4 @@ public class TmdbPeople extends AbstractMethod { } } - int getPersonMovieCredits(int ID_BRUCE_WILLIS, String LANGUAGE_DEFAULT) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - } diff --git a/src/main/java/com/omertron/themoviedbapi/tools/MethodSub.java b/src/main/java/com/omertron/themoviedbapi/tools/MethodSub.java index d8b73dfda..96615675a 100644 --- a/src/main/java/com/omertron/themoviedbapi/tools/MethodSub.java +++ b/src/main/java/com/omertron/themoviedbapi/tools/MethodSub.java @@ -30,6 +30,7 @@ public enum MethodSub { CHANGES("changes"), CLEAR("clear"), COLLECTION("collection"), + COMBINED_CREDITS("combined_credits"), COMPANY("company"), CREDITS("credits"), FAVORITE("favorite"), @@ -45,6 +46,7 @@ public enum MethodSub { LISTS("lists"), MOVIE("movie"), MOVIES("movies"), + MOVIE_CREDITS("movie_credits"), MOVIE_LIST("movie/list"), MULTI("multi"), NOW_PLAYING("now-playing"), @@ -64,6 +66,7 @@ public enum MethodSub { TOP_RATED("top-rated"), TRANSLATIONS("translations"), TV("tv"), + TV_CREDITS("tv_credits"), TV_LIST("tv/list"), UPCOMING("upcoming"), VIDEOS("videos"),