FavoritesRestの作成
1 parent 4846d7d commit f8712d80fce23a800d6934308b3526577ec2d619
Kazuki Shiomura authored on 26 Sep
Showing 1 changed file
View
54
app/src/main/java/com/example/citrusclient/rest/FavoritesRest.java
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<HashMap<String, HashSet<Integer>>> getFavoritesBooks(
@Path("account_id") String accountId,
@Query("token") String token
);
 
@FormUrlEncoded
@GET("accounts/{account_id}/favorites/{other_account_id}")
Call<HashSet<Integer>> 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<HashSet<String>> 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<Void> 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<Void> removeFavorite(
@Path("account_id") String accountId,
@Path("book_id") Integer bookId,
@Path("other_account_id") String otherAccountId,
@Query("token") String token
);
 
}