Changes & Certification

master
Stuart Boston 11 years ago
parent 77f1cf18e7
commit 77b6ae5f60

@ -503,73 +503,6 @@ public class TheMovieDbApi {
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Changes">
/**
* Get the changes for a specific movie 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.
*
* TODO: DOES NOT WORK AT THE MOMENT. This is due to the "value" item changing type in the ChangeItem
*
* @param id
* @param startDate the start date of the changes, optional
* @param endDate the end date of the changes, optional
* @return
* @throws MovieDbException
*/
public TmdbResultsList getMovieChanges(int id, String startDate, String endDate) throws MovieDbException {
return tmdbChanges.getMovieChanges(id, startDate, endDate);
}
/**
* Get the changes for a specific TV 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.
*
* TODO: DOES NOT WORK AT THE MOMENT. This is due to the "value" item changing type in the ChangeItem
*
* @param id
* @param startDate the start date of the changes, optional
* @param endDate the end date of the changes, optional
* @return
* @throws MovieDbException
*/
public TmdbResultsList getTVChanges(int id, String startDate, String endDate) throws MovieDbException {
return tmdbChanges.getMovieChanges(id, startDate, endDate);
}
/**
* 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 id
* @param startDate
* @param endDate
* @return
* @throws MovieDbException
*/
public TmdbResultsList getPersonChanges(int id, String startDate, String endDate) throws MovieDbException {
return tmdbChanges.getPersonChanges(id, startDate, endDate);
}
/**
* Get a list of Movie IDs that have been edited.
*

@ -53,8 +53,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
@ -63,7 +62,7 @@ public class TmdbChanges extends AbstractMethod {
* @return List of changed movie
* @throws MovieDbException
*/
public TmdbResultsList<ChangedMedia> getChangeList(MethodBase method, int page, String startDate, String endDate) throws MovieDbException {
public TmdbResultsList<ChangedMedia> 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);
@ -83,45 +82,4 @@ public class TmdbChanges extends AbstractMethod {
}
}
/**
* Get the changes for a specific movie id.
*
* @param id
* @param startDate the start date of the changes, optional
* @param endDate the end date of the changes, optional
* @return
* @throws MovieDbException
*/
public TmdbResultsList getMovieChanges(int id, String startDate, String endDate) throws MovieDbException {
LOG.trace("Movie Changes: id: {}, start: {}, end: {}", id, startDate, endDate);
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Not implemented yet");
}
/**
* Get the changes for a specific TV Show
*
* @param id
* @param startDate
* @param endDate
* @return
* @throws MovieDbException
*/
public TmdbResultsList getTvChanges(int id, String startDate, String endDate) throws MovieDbException {
LOG.trace("TV Changes: id: {}, start: {}, end: {}", id, startDate, endDate);
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Not implemented yet");
}
/**
* Get the changes for a specific person id.
*
* @param id
* @param startDate
* @param endDate
* @return
* @throws MovieDbException
*/
public TmdbResultsList getPersonChanges(int id, String startDate, String endDate) throws MovieDbException {
LOG.trace("Person Changes: id: {}, start: {}, end: {}", id, startDate, endDate);
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Not implemented yet", "");
}
}

@ -1,4 +1,4 @@
Account (done)
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.
@ -10,17 +10,17 @@ Account (done)
/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 (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
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
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

@ -25,6 +25,7 @@ import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.model.Certification;
import com.omertron.themoviedbapi.results.TmdbResultsMap;
import java.util.List;
import java.util.Map;
import org.junit.AfterClass;
import static org.junit.Assert.assertFalse;
import org.junit.BeforeClass;
@ -62,6 +63,10 @@ public class TmdbCertificationsTest extends AbstractTests {
LOG.info("getMovieCertifications");
TmdbResultsMap<String, List<Certification>> result = instance.getMoviesCertification();
assertFalse("No movie certifications.", result.getResults().isEmpty());
for (Map.Entry<String, List<Certification>> entry : result.getResults().entrySet()) {
LOG.info("{} = {} entries", entry.getKey(), entry.getValue().size());
assertFalse("No entries for " + entry.getKey(), entry.getValue().isEmpty());
}
}
/**
@ -74,5 +79,9 @@ public class TmdbCertificationsTest extends AbstractTests {
LOG.info("getTvCertifications");
TmdbResultsMap<String, List<Certification>> result = instance.getTvCertification();
assertFalse("No tv certifications.", result.getResults().isEmpty());
for (Map.Entry<String, List<Certification>> entry : result.getResults().entrySet()) {
LOG.info("{} = {} entries", entry.getKey(), entry.getValue().size());
assertFalse("No entries for " + entry.getKey(), entry.getValue().isEmpty());
}
}
}

@ -26,7 +26,6 @@ import com.omertron.themoviedbapi.results.TmdbResultsList;
import com.omertron.themoviedbapi.tools.MethodBase;
import org.junit.AfterClass;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
@ -61,11 +60,7 @@ public class TmdbChangesTest extends AbstractTests {
@Test
public void testGetMovieChangesList() throws MovieDbException {
LOG.info("getMovieChangesList");
int page = 0;
String startDate = "";
String endDate = "";
TmdbResultsList<ChangedMedia> result = instance.getChangeList(MethodBase.MOVIE, page, startDate, endDate);
TmdbResultsList<ChangedMedia> result = instance.getChangeList(MethodBase.MOVIE, null, null, null);
assertFalse("No movie changes.", result.getResults().isEmpty());
}
@ -77,12 +72,8 @@ public class TmdbChangesTest extends AbstractTests {
@Ignore("Not ready yet")
public void testGetPersonChangesList() throws MovieDbException {
LOG.info("getPersonChangesList");
int page = 0;
String startDate = "";
String endDate = "";
TmdbResultsList<ChangedMedia> result = instance.getChangeList(MethodBase.PERSON, page, startDate, endDate);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
TmdbResultsList<ChangedMedia> result = instance.getChangeList(MethodBase.PERSON, null, null, null);
assertFalse("No Person changes.", result.getResults().isEmpty());
}
/**
@ -93,11 +84,7 @@ public class TmdbChangesTest extends AbstractTests {
@Ignore("Not ready yet")
public void testGetTVChangesList() throws MovieDbException {
LOG.info("getPersonChangesList");
int page = 0;
String startDate = "";
String endDate = "";
TmdbResultsList<ChangedMedia> result = instance.getChangeList(MethodBase.PERSON, page, startDate, endDate);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
TmdbResultsList<ChangedMedia> result = instance.getChangeList(MethodBase.PERSON, null, null, null);
assertFalse("No TV changes.", result.getResults().isEmpty());
}
}

Loading…
Cancel
Save