Skip to content

Commit

Permalink
Add variants of comments that accept Cache-Control header
Browse files Browse the repository at this point in the history
  • Loading branch information
UweTrottmann committed May 24, 2024
1 parent c47f3ae commit e372b6f
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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_
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/uwetrottmann/trakt5/services/Episodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -46,6 +47,20 @@ Call<List<Comment>> 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<List<Comment>> 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.
*
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/uwetrottmann/trakt5/services/Movies.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -91,6 +92,18 @@ Call<List<Comment>> comments(
@Query(value = "extended", encoded = true) Extended extended
);

/**
* Variant that allows changing the Cache-Control header.
*/
@GET("movies/{id}/comments")
Call<List<Comment>> 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.
*
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/uwetrottmann/trakt5/services/Seasons.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -51,6 +52,16 @@ Call<List<Comment>> comments(
@Path("season") int season
);

/**
* Variant that allows changing the Cache-Control header.
*/
@GET("shows/{id}/seasons/{season}/comments")
Call<List<Comment>> 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.
*
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/uwetrottmann/trakt5/services/Shows.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -93,6 +94,18 @@ Call<List<Comment>> comments(
@Query(value = "extended", encoded = true) Extended extended
);

/**
* Variant that allows changing the Cache-Control header.
*/
@GET("shows/{id}/comments")
Call<List<Comment>> 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
);

/**
* <b>OAuth Required</b>
*
Expand Down

0 comments on commit e372b6f

Please sign in to comment.