diff --git a/app/src/main/java/com/example/citrusclient/rest/FavoritesRest.java b/app/src/main/java/com/example/citrusclient/rest/FavoritesRest.java index 8cf4caa..225e35e 100644 --- a/app/src/main/java/com/example/citrusclient/rest/FavoritesRest.java +++ b/app/src/main/java/com/example/citrusclient/rest/FavoritesRest.java @@ -1,4 +1,58 @@ package com.example.citrusclient.rest; +import java.util.HashMap; +import java.util.HashSet; + +import retrofit2.Call; +import retrofit2.http.DELETE; +import retrofit2.http.Field; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.GET; +import retrofit2.http.PUT; +import retrofit2.http.Path; +import retrofit2.http.Query; + public interface FavoritesRest { + //主がいいねした本の一覧 + @FormUrlEncoded + @GET("accounts/{account_id}/favorites") + Call>> getFavoritesBooks( + @Path("account_id") String accountId, + @Query("token") String token + ); + + @FormUrlEncoded + @GET("accounts/{account_id}/favorites/{other_account_id}") + Call> getFavoritesBooksById( + @Path("account_id") String accountId, + @Path("other_account_id") String otherAccountId, + @Query("token") String token + ); + + @FormUrlEncoded + @GET("accounts/{account_id}/books/{book_id}/favorited") + Call> getFavoritedAccount( + @Path("account_id") String accountId, + @Path("book_id") Integer bookId, + @Query("token") String token + ); + + @FormUrlEncoded + @PUT("accounts/{account_id}/books/{book_id}/favorited/{other_account_id}") + Call putFavorite( + @Path("account_id") String accountId, + @Path("book_id") Integer bookId, + @Path("other_account_id") String otherAccountId, + @Field("token") String token + ); + + @FormUrlEncoded + @DELETE("accounts/{account_id}/books/{book_id}/favorited/{other_account_id}") + Call removeFavorite( + @Path("account_id") String accountId, + @Path("book_id") Integer bookId, + @Path("other_account_id") String otherAccountId, + @Query("token") String token + ); + }