diff --git a/app/src/main/java/com/example/nemophila/resources/AccountsRest.java b/app/src/main/java/com/example/nemophila/resources/AccountsRest.java index 776b3ae..1fce59e 100644 --- a/app/src/main/java/com/example/nemophila/resources/AccountsRest.java +++ b/app/src/main/java/com/example/nemophila/resources/AccountsRest.java @@ -1,4 +1,81 @@ package com.example.nemophila.resources; +//import android.accounts.Account; + +import com.example.nemophila.entities.Account; +import com.example.nemophila.entities.Post; + +import java.util.Collection; +import java.util.HashMap; +import java.util.List; + +import retrofit2.Call; +import retrofit2.http.DELETE; +import retrofit2.http.Field; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Path; + public interface AccountsRest { + @GET("accounts") + Call getAccounts(); + + @FormUrlEncoded + @POST("accounts") + Call createAccounts( + @Field("name") String name, + @Field("pw") String pw + ); + + @GET("accounts/{uid}") + Call getAccount( + @Path("uid") String uid + ); + + @DELETE("accounts/{uid}") + Call deleteAccount( + @Path("uid") String uid + ); + + @FormUrlEncoded + @POST("accounts/{uid}/login") + Call getAccounts( + @Path("uid") String uid + ); + + @FormUrlEncoded + @PUT("accounts/{uid}/pw") + Call changePw( + @Path("uid") String uid, + @Field("oldPw") String oldPw + ); + + @FormUrlEncoded + @PUT("accounts/{uid}/name") + Call changeName( + @Path("uid") String uid, + @Field("name") String oldPw, + @Field("token") String token + ); + + @FormUrlEncoded + @POST("accounts/{uid}/posts") + Call postAccountPost( + @Path("uid") String uid, + @Field("token") String token, + @Field("sid") String sid, + @Field("rate") String rate, + @Field("genre") String genre, + @Field("comment")String comment, + @Field("image1") String img1, + @Field("image2") String img2, + @Field("image3") String img3 + ); + + @GET("accounts/{uid}/posts") + Call> getAccountPosts( + @Path("uid") String uid + ); }