diff --git a/CHANGELOG.md b/CHANGELOG.md index 8adc9033..1b98a835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ Change Log ========== + +## Next version +_in development + +* 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. ## 6.12.0 _2024-01-25_ diff --git a/src/main/java/com/uwetrottmann/trakt5/services/Episodes.java b/src/main/java/com/uwetrottmann/trakt5/services/Episodes.java index a99b8414..52a65e41 100644 --- a/src/main/java/com/uwetrottmann/trakt5/services/Episodes.java +++ b/src/main/java/com/uwetrottmann/trakt5/services/Episodes.java @@ -7,6 +7,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; @@ -46,6 +47,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 d32d4dcd..51765fff 100644 --- a/src/main/java/com/uwetrottmann/trakt5/services/Movies.java +++ b/src/main/java/com/uwetrottmann/trakt5/services/Movies.java @@ -10,6 +10,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; @@ -91,6 +92,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 c0a0ea4f..30260f06 100644 --- a/src/main/java/com/uwetrottmann/trakt5/services/Seasons.java +++ b/src/main/java/com/uwetrottmann/trakt5/services/Seasons.java @@ -8,6 +8,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; @@ -51,6 +52,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 57eff47e..a9bcb904 100755 --- a/src/main/java/com/uwetrottmann/trakt5/services/Shows.java +++ b/src/main/java/com/uwetrottmann/trakt5/services/Shows.java @@ -12,6 +12,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; @@ -93,6 +94,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 *