diff --git a/app/src/main/java/com/example/citrusclient/models/Todo.java b/app/src/main/java/com/example/citrusclient/models/Todo.java new file mode 100644 index 0000000..dcb5509 --- /dev/null +++ b/app/src/main/java/com/example/citrusclient/models/Todo.java @@ -0,0 +1,10 @@ +package com.example.citrusclient.models; + +public class Todo { + String title; + boolean check; + int year; + int month; + int day; + Integer todoId; +} diff --git a/app/src/main/java/com/example/citrusclient/rest/TodosRest.java b/app/src/main/java/com/example/citrusclient/rest/TodosRest.java index 5e169ab..42a1eed 100644 --- a/app/src/main/java/com/example/citrusclient/rest/TodosRest.java +++ b/app/src/main/java/com/example/citrusclient/rest/TodosRest.java @@ -1,5 +1,91 @@ package com.example.citrusclient.rest; +import java.util.HashMap; + +import retrofit2.Call; +import retrofit2.Response; +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; +import retrofit2.http.Query; + public interface TodosRest { + @GET + Call getAllTodos( + @Path("account_id") String accountId, + @Path("book_id") String bookId, + @Query("token") String token + ); + + @GET + Call getTodosByMonth( + @Path("account_id") String accountId, + @Path("book_id") String bookId, + @Path("year") Integer year, + @Path("month") Integer month, + @Query("token") String token + ); + + @GET + Call getTodosByDay( + @Path("account_id") String accountId, + @Path("book_id") String bookId, + @Path("year") Integer year, + @Path("month") Integer month, + @Path("day") Integer day, + @Query("token") String token + ); + + @GET + Call getTodoById( + @Path("account_id") String accountId, + @Path("book_id") String bookId, + @Path("year") Integer year, + @Path("month") Integer month, + @Path("day") Integer day, + @Path("todo_id") Integer todoId, + @Query("token") String token + ); + + @FormUrlEncoded + @POST + Call createTodo( + @Path("account_id") String accountId, + @Path("book_id") String bookId, + @Path("year") Integer year, + @Path("month") Integer month, + @Path("day") Integer day, + @Field("title") String title, + @Field("token") String token + ); + @FormUrlEncoded + @PUT + Call setCheck( + @Path("account_id") String accountId, + @Path("book_id") String bookId, + @Path("year") Integer year, + @Path("month") Integer month, + @Path("day") Integer day, + @Path("todo_id") Integer todoId, + @Field("check") boolean check, + @Field("token") String token + ); + + @DELETE + Call deleteTodoById( + @Path("account_id") String accountId, + @Path("book_id") String bookId, + @Path("year") Integer year, + @Path("month") Integer month, + @Path("day") Integer day, + @Path("todo_id") Integer todoId, + @Query("token") String token + ); + + }