diff --git a/CHANGELOG.md b/CHANGELOG.md index 87625280..850f47c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ Change Log ## Next version _in development -* Deprecated TV rage ID, it appears to be no longer used. +* Deprecated TV rage ID, it appears to be no longer used. +* Add variants of the comments methods that accept a `Cache-Control` header. + This can be used to skip the local cache and get the latest comments from the server. * Update retrofit [2.9.0 -> 2.11.0]. * Update okhttp [4.10.0 -> 4.12.0]. * Update gson [2.9.1 -> 2.11.0]. diff --git a/src/main/java/com/uwetrottmann/trakt5/services/Episodes.java b/src/main/java/com/uwetrottmann/trakt5/services/Episodes.java index 0ca16555..7d19f008 100644 --- a/src/main/java/com/uwetrottmann/trakt5/services/Episodes.java +++ b/src/main/java/com/uwetrottmann/trakt5/services/Episodes.java @@ -23,6 +23,7 @@ import com.uwetrottmann.trakt5.enums.Extended; import retrofit2.Call; import retrofit2.http.GET; +import retrofit2.http.Header; import retrofit2.http.Path; import retrofit2.http.Query; @@ -62,6 +63,20 @@ Call> comments( @Query(value = "extended", encoded = true) Extended extended ); + /** + * Variant that allows changing the Cache-Control header. + */ + @GET("shows/{id}/seasons/{season}/episodes/{episode}/comments") + Call> comments( + @Path("id") String showId, + @Path("season") int season, + @Path("episode") int episode, + @Query("page") Integer page, + @Query("limit") Integer limit, + @Query(value = "extended", encoded = true) Extended extended, + @Header("Cache-Control") String cacheControl + ); + /** * Returns rating (between 0 and 10) and distribution for an episode. * diff --git a/src/main/java/com/uwetrottmann/trakt5/services/Movies.java b/src/main/java/com/uwetrottmann/trakt5/services/Movies.java index b8e2b3c2..fb06cabe 100644 --- a/src/main/java/com/uwetrottmann/trakt5/services/Movies.java +++ b/src/main/java/com/uwetrottmann/trakt5/services/Movies.java @@ -26,6 +26,7 @@ import com.uwetrottmann.trakt5.enums.Extended; import retrofit2.Call; import retrofit2.http.GET; +import retrofit2.http.Header; import retrofit2.http.Path; import retrofit2.http.Query; @@ -107,6 +108,18 @@ Call> comments( @Query(value = "extended", encoded = true) Extended extended ); + /** + * Variant that allows changing the Cache-Control header. + */ + @GET("movies/{id}/comments") + Call> comments( + @Path("id") String movieId, + @Query("page") Integer page, + @Query("limit") Integer limit, + @Query(value = "extended", encoded = true) Extended extended, + @Header("Cache-Control") String cacheControl + ); + /** * Returns all actors, directors, writers, and producers for a movie. * diff --git a/src/main/java/com/uwetrottmann/trakt5/services/Seasons.java b/src/main/java/com/uwetrottmann/trakt5/services/Seasons.java index 82898ac0..5dac8277 100644 --- a/src/main/java/com/uwetrottmann/trakt5/services/Seasons.java +++ b/src/main/java/com/uwetrottmann/trakt5/services/Seasons.java @@ -24,6 +24,7 @@ import com.uwetrottmann.trakt5.enums.Extended; import retrofit2.Call; import retrofit2.http.GET; +import retrofit2.http.Header; import retrofit2.http.Path; import retrofit2.http.Query; @@ -67,6 +68,16 @@ Call> comments( @Path("season") int season ); + /** + * Variant that allows changing the Cache-Control header. + */ + @GET("shows/{id}/seasons/{season}/comments") + Call> comments( + @Path("id") String showId, + @Path("season") int season, + @Header("Cache-Control") String cacheControl + ); + /** * Returns rating (between 0 and 10) and distribution for a season. * diff --git a/src/main/java/com/uwetrottmann/trakt5/services/Shows.java b/src/main/java/com/uwetrottmann/trakt5/services/Shows.java index 1cfb35b4..d4d8f307 100755 --- a/src/main/java/com/uwetrottmann/trakt5/services/Shows.java +++ b/src/main/java/com/uwetrottmann/trakt5/services/Shows.java @@ -28,6 +28,7 @@ import com.uwetrottmann.trakt5.enums.ProgressLastActivity; import retrofit2.Call; import retrofit2.http.GET; +import retrofit2.http.Header; import retrofit2.http.Path; import retrofit2.http.Query; @@ -109,6 +110,18 @@ Call> comments( @Query(value = "extended", encoded = true) Extended extended ); + /** + * Variant that allows changing the Cache-Control header. + */ + @GET("shows/{id}/comments") + Call> comments( + @Path("id") String showId, + @Query("page") Integer page, + @Query("limit") Integer limit, + @Query(value = "extended", encoded = true) Extended extended, + @Header("Cache-Control") String cacheControl + ); + /** * OAuth Required *