package it.unisannio.ding.ids.wedroid.wrapper.api; import it.unisannio.ding.ids.wedroid.wrapper.entity.Checklist; import it.unisannio.ding.ids.wedroid.wrapper.entity.ChecklistItem; import it.unisannio.ding.ids.wedroid.wrapper.entity.ChecklistItemStatus; import it.unisannio.ding.ids.wedroid.wrapper.entity.ChecklistPrototype; import java.util.List; import retrofit2.Call; import retrofit2.http.Body; 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 ChecklistService { /** * Get all checklists attached on a card. * * @param boardId The ID of the board * @param cardId The ID of the card * @return The list with the checklists */ @GET("/api/boards/{boardId}/cards/{cardId}/checklists") Call> getAllChecklists( @Path("boardId") String boardId, @Path("cardId") String cardId ); /** * Attach new empty checklist to a card. * * @param boardId The ID of the board * @param cardId The ID of the card * @param title The title of the new checklist * @return The new checklist */ @FormUrlEncoded @POST("/api/boards/{boardId}/cards/{cardId}/checklists") Call postChecklist( @Path("boardId") String boardId, @Path("cardId") String cardId, @Field("title") String title ); /** * Attach new checklist to a card. * * @param boardId The ID of the board * @param cardId The ID of the card * @param checklistPrototype The prototype of the checklist * @return The new checklist * @see ChecklistPrototype */ @POST("/api/boards/{boardId}/cards/{cardId}/checklists") Call postChecklist( @Path("boardId") String boardId, @Path("cardId") String cardId, @Body ChecklistPrototype checklistPrototype ); /** * Get the checklist attached on a card. * * @param boardId The ID of the board * @param cardId The ID of the card * @param checklistId The ID of the checklist * @return The checklist */ @GET("/api/boards/{boardId}/cards/{cardId}/checklists/{checklistId}") Call getChecklist( @Path("boardId") String boardId, @Path("cardId") String cardId, @Path("checklistId") String checklistId ); /** * Delete the checklist attached on a card. * * @param boardId The ID of the board * @param cardId The ID of the card * @param checklistId The ID of the checklist * @return The id of the checklist */ @DELETE("/api/boards/{boardId}/cards/{cardId}/checklists/{checklistId}") Call deleteChecklist( @Path("boardId") String boardId, @Path("cardId") String cardId, @Path("checklistId") String checklistId ); /** * Get the checklist item attached on a checklist. * * @param boardId The ID of the board * @param cardId The ID of the card * @param checklistId The ID of the checklist * @param itemId The ID of the item * @return The checklist item */ @GET("/api/boards/{boardId}/cards/{cardId}/checklists/{checklistId}/items/{itemId}") Call getChecklistItem( @Path("boardId") String boardId, @Path("cardId") String cardId, @Path("checklistId") String checklistId, @Path("itemId") String itemId ); /** * Change the title of the checklist item. * * @param boardId The ID of the board * @param cardId The ID of the card * @param checklistId The ID of the checklist * @param itemId The ID of the item * @param title The new title * @return The ID of the checklist item */ @FormUrlEncoded @PUT("/api/boards/{boardId}/cards/{cardId}/checklists/{checklistId}/items/{itemId}") Call editChecklistItem( @Path("boardId") String boardId, @Path("cardId") String cardId, @Path("checklistId") String checklistId, @Path("itemId") String itemId, @Field("title") String title ); /** * Change the state of the checklist item. * * @param boardId The ID of the board * @param cardId The ID of the card * @param checklistId The ID of the checklist * @param itemId The ID of the item * @param itemStatus The status of the item * @return The ID of the checklist item * @see ChecklistItemStatus */ @PUT("/api/boards/{boardId}/cards/{cardId}/checklists/{checklistId}/items/{itemId}") Call editChecklistItem( @Path("boardId") String boardId, @Path("cardId") String cardId, @Path("checklistId") String checklistId, @Path("itemId") String itemId, @Body ChecklistItemStatus itemStatus ); /** * Delete a checklist item from the checklist. * * @param boardId The ID of the board * @param cardId The ID of the card * @param checklistId The ID of the checklist * @param itemId The ID of the item * @return The ID of the checklist item */ @DELETE("/api/boards/{boardId}/cards/{cardId}/checklists/{checklistId}/items/{itemId}") Call deleteChecklistItem( @Path("boardId") String boardId, @Path("cardId") String cardId, @Path("checklistId") String checklistId, @Path("itemId") String itemId ); }