wedroid/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardCommentService.java

75 lines
2.2 KiB
Java

package it.unisannio.ding.ids.wedroid.wrapper.api;
import it.unisannio.ding.ids.wedroid.wrapper.entity.Comment;
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.Path;
public interface CardCommentService {
/**
* Get all comments attached to a card.
*
* @param boardId The ID of the board
* @param cardId The ID of the card
* @return The list of the comments
*/
@GET("/api/boards/{boardId}/cards/{cardId}/comments")
Call<List<Comment>> getAllComments(
@Path("boardId") String boardId,
@Path("cardId") String cardId
);
/**
* Post new comment attached on the give card.
*
* @param boardId The ID of the board
* @param cardId The ID of the card
* @param authorId The ID of the author
* @param comment The comment
* @return The id of the new comment
*/
@FormUrlEncoded
@POST("/api/boards/{boardId}/cards/{cardId}/comments")
Call<Comment> postNewComment(
@Path("boardId") String boardId,
@Path("cardId") String cardId,
@Field("authorId") String authorId,
@Field("comment") String comment
);
/**
* Get a comment attached to a card.
*
* @param boardId The ID of the board
* @param cardId The ID of the card
* @param commentId The ID of the comment
* @return The comment
*/
@GET("/api/boards/{boardId}/cards/{cardId}/comments/{commentId}")
Call<Comment> getComment(
@Path("boardId") String boardId,
@Path("cardId") String cardId,
@Path("commentId") String commentId
);
/**
* Delete a comment attached to a card.
*
* @param boardId The ID of the board
* @param cardId The ID of the card
* @param commentId The ID of the comment
*/
@DELETE("/api/boards/{boardId}/cards/{cardId}/comments/{commentId}")
Call<Void> deleteComment(
@Path("boardId") String boardId,
@Path("cardId") String cardId,
@Path("commentId") String commentId
);
}