Update to use ResultList
This commit is contained in:
@@ -206,7 +206,7 @@ public class TheMovieDbApi {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public List<MovieBasic> getFavoriteMovies(String sessionId, int accountId) throws MovieDbException {
|
||||
public TmdbResultsList<MovieBasic> getFavoriteMovies(String sessionId, int accountId) throws MovieDbException {
|
||||
return tmdbAccount.getFavoriteMovies(sessionId, accountId);
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ public class TheMovieDbApi {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public List<MovieBasic> getRatedMovies(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
||||
public TmdbResultsList<MovieBasic> getRatedMovies(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
||||
return tmdbAccount.getRatedMovies(sessionId, accountId, page, sortBy, language);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ public class TheMovieDbApi {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public List<TVBasic> getRatedTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
||||
public TmdbResultsList<TVBasic> getRatedTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
||||
return tmdbAccount.getRatedTV(sessionId, accountId, page, sortBy, language);
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ public class TheMovieDbApi {
|
||||
* @return The watchlist of the user
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public List<MovieBasic> getWatchListMovie(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
||||
public TmdbResultsList<MovieBasic> getWatchListMovie(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
||||
return tmdbAccount.getWatchListMovie(sessionId, accountId, page, sortBy, language);
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ public class TheMovieDbApi {
|
||||
* @return The watchlist of the user
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public List<TVBasic> getWatchListTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
||||
public TmdbResultsList<TVBasic> getWatchListTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
||||
return tmdbAccount.getWatchListTV(sessionId, accountId, page, sortBy, language);
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ public class TheMovieDbApi {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public List getFavoriteTv(String sessionId, int accountId) throws MovieDbException {
|
||||
public TmdbResultsList<TVBasic> getFavoriteTv(String sessionId, int accountId) throws MovieDbException {
|
||||
return tmdbAccount.getFavoriteTv(sessionId, accountId);
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ public class TheMovieDbApi {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public List<MovieBasic> getGuestRatedMovies(String guestSessionId, String language, Integer page, SortBy sortBy) throws MovieDbException {
|
||||
public TmdbResultsList<MovieBasic> getGuestRatedMovies(String guestSessionId, String language, Integer page, SortBy sortBy) throws MovieDbException {
|
||||
return tmdbAccount.getGuestRatedMovies(guestSessionId, language, page, sortBy);
|
||||
}
|
||||
//</editor-fold>
|
||||
@@ -449,7 +449,7 @@ public class TheMovieDbApi {
|
||||
* @return List of changed movie
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public List<ChangeListItem> getMovieChangeList(Integer page, String startDate, String endDate) throws MovieDbException {
|
||||
public TmdbResultsList<ChangeListItem> getMovieChangeList(Integer page, String startDate, String endDate) throws MovieDbException {
|
||||
return tmdbChanges.getChangeList(MethodBase.MOVIE, page, startDate, endDate);
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ public class TheMovieDbApi {
|
||||
* @return List of changed movie
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public List<ChangeListItem> getTvChangeList(Integer page, String startDate, String endDate) throws MovieDbException {
|
||||
public TmdbResultsList<ChangeListItem> getTvChangeList(Integer page, String startDate, String endDate) throws MovieDbException {
|
||||
return tmdbChanges.getChangeList(MethodBase.TV, page, startDate, endDate);
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ public class TheMovieDbApi {
|
||||
* @return List of changed movie
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public List<ChangeListItem> getPersonChangeList(Integer page, String startDate, String endDate) throws MovieDbException {
|
||||
public TmdbResultsList<ChangeListItem> getPersonChangeList(Integer page, String startDate, String endDate) throws MovieDbException {
|
||||
return tmdbChanges.getChangeList(MethodBase.PERSON, page, startDate, endDate);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
@@ -21,14 +21,15 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.model.change.ChangeListItem;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
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.wrapper.WrapperGenericList;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Class to hold the Change Methods
|
||||
@@ -50,8 +51,7 @@ public class TmdbChanges extends AbstractMethod {
|
||||
/**
|
||||
* Get a list of Media IDs that have been edited.
|
||||
*
|
||||
* You can then use the movie/TV/person changes API to get the actual data
|
||||
* that has been changed.
|
||||
* You can then use the movie/TV/person changes API to get the actual data that has been changed.
|
||||
*
|
||||
* @param method The method base to get
|
||||
* @param page
|
||||
@@ -60,14 +60,15 @@ public class TmdbChanges extends AbstractMethod {
|
||||
* @return List of changed movie
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public List<ChangeListItem> getChangeList(MethodBase method, Integer page, String startDate, String endDate) throws MovieDbException {
|
||||
public TmdbResultsList<ChangeListItem> getChangeList(MethodBase method, Integer page, String startDate, String endDate) throws MovieDbException {
|
||||
TmdbParameters params = new TmdbParameters();
|
||||
params.add(Param.PAGE, page);
|
||||
params.add(Param.START_DATE, startDate);
|
||||
params.add(Param.END_DATE, endDate);
|
||||
|
||||
URL url = new ApiUrl(apiKey, method).subMethod(MethodSub.CHANGES).buildUrl(params);
|
||||
return processWrapperList(getTypeReference(ChangeListItem.class), url, "changes");
|
||||
WrapperGenericList<ChangeListItem> wrapper = processWrapper(getTypeReference(ChangeListItem.class), url, "changes");
|
||||
return wrapper.getTmdbResultsList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ package com.omertron.themoviedbapi.methods;
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.model.change.ChangeListItem;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||
import java.util.List;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import org.junit.BeforeClass;
|
||||
@@ -59,7 +59,7 @@ public class TmdbChangesTest extends AbstractTests {
|
||||
@Test
|
||||
public void testGetMovieChangesList() throws MovieDbException {
|
||||
LOG.info("getMovieChangesList");
|
||||
List<ChangeListItem> result = instance.getChangeList(MethodBase.MOVIE, null, null, null);
|
||||
TmdbResultsList<ChangeListItem> result = instance.getChangeList(MethodBase.MOVIE, null, null, null);
|
||||
assertFalse("No movie changes.", result.isEmpty());
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class TmdbChangesTest extends AbstractTests {
|
||||
@Ignore("Not ready yet")
|
||||
public void testGetPersonChangesList() throws MovieDbException {
|
||||
LOG.info("getPersonChangesList");
|
||||
List<ChangeListItem> result = instance.getChangeList(MethodBase.PERSON, null, null, null);
|
||||
TmdbResultsList<ChangeListItem> result = instance.getChangeList(MethodBase.PERSON, null, null, null);
|
||||
assertFalse("No Person changes.", result.isEmpty());
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class TmdbChangesTest extends AbstractTests {
|
||||
@Ignore("Not ready yet")
|
||||
public void testGetTVChangesList() throws MovieDbException {
|
||||
LOG.info("getPersonChangesList");
|
||||
List<ChangeListItem> result = instance.getChangeList(MethodBase.PERSON, null, null, null);
|
||||
TmdbResultsList<ChangeListItem> result = instance.getChangeList(MethodBase.PERSON, null, null, null);
|
||||
assertFalse("No TV changes.", result.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,12 +355,12 @@ public class TmdbMoviesTest extends AbstractTests {
|
||||
int maxCheck = 5;
|
||||
|
||||
TmdbChanges chgs = new TmdbChanges(getApiKey(), getHttpTools());
|
||||
List<ChangeListItem> changeList = chgs.getChangeList(MethodBase.MOVIE, null, null, null);
|
||||
LOG.info("Found {} changes to check, will check maximum of {}", changeList.size(), maxCheck);
|
||||
TmdbResultsList<ChangeListItem> changeList = chgs.getChangeList(MethodBase.MOVIE, null, null, null);
|
||||
LOG.info("Found {} changes to check, will check maximum of {}", changeList.getResults().size(), maxCheck);
|
||||
|
||||
int count = 1;
|
||||
WrapperChanges result;
|
||||
for (ChangeListItem item : changeList) {
|
||||
for (ChangeListItem item : changeList.getResults()) {
|
||||
result = instance.getMovieChanges(item.getId(), startDate, endDate);
|
||||
for (ChangeKeyItem ci : result.getChangedItems()) {
|
||||
assertNotNull("Null changes", ci);
|
||||
|
||||
@@ -266,12 +266,12 @@ public class TmdbPeopleTest extends AbstractTests {
|
||||
int maxCheck = 5;
|
||||
|
||||
TmdbChanges chgs = new TmdbChanges(getApiKey(), getHttpTools());
|
||||
List<ChangeListItem> changeList = chgs.getChangeList(MethodBase.PERSON, null, null, null);
|
||||
LOG.info("Found {} person changes to check", changeList.size());
|
||||
TmdbResultsList<ChangeListItem> changeList = chgs.getChangeList(MethodBase.PERSON, null, null, null);
|
||||
LOG.info("Found {} person changes to check", changeList.getResults().size());
|
||||
|
||||
int count = 1;
|
||||
WrapperChanges result;
|
||||
for (ChangeListItem item : changeList) {
|
||||
for (ChangeListItem item : changeList.getResults()) {
|
||||
result = instance.getPersonChanges(item.getId(), startDate, endDate);
|
||||
for (ChangeKeyItem ci : result.getChangedItems()) {
|
||||
assertNotNull("Null changes", ci);
|
||||
|
||||
@@ -146,12 +146,12 @@ public class TmdbTVTest extends AbstractTests {
|
||||
int maxCheck = 5;
|
||||
|
||||
TmdbChanges chgs = new TmdbChanges(getApiKey(), getHttpTools());
|
||||
List<ChangeListItem> changeList = chgs.getChangeList(MethodBase.TV, null, null, null);
|
||||
LOG.info("Found {} changes to check, will check maximum of {}", changeList.size(), maxCheck);
|
||||
TmdbResultsList<ChangeListItem> changeList = chgs.getChangeList(MethodBase.TV, null, null, null);
|
||||
LOG.info("Found {} changes to check, will check maximum of {}", changeList.getResults().size(), maxCheck);
|
||||
|
||||
int count = 1;
|
||||
WrapperChanges result;
|
||||
for (ChangeListItem item : changeList) {
|
||||
for (ChangeListItem item : changeList.getResults()) {
|
||||
result = instance.getTVChanges(item.getId(), startDate, endDate);
|
||||
for (ChangeKeyItem ci : result.getChangedItems()) {
|
||||
assertNotNull("Null changes", ci);
|
||||
|
||||
Reference in New Issue
Block a user