91 lines
2.6 KiB
Java
91 lines
2.6 KiB
Java
package it.unisannio.ding.ids.wedroid.wrapper.api;
|
|
|
|
import it.unisannio.ding.ids.wedroid.wrapper.entity.Board;
|
|
import it.unisannio.ding.ids.wedroid.wrapper.entity.BoardPrototype;
|
|
import it.unisannio.ding.ids.wedroid.wrapper.entity.LabelPrototype;
|
|
import it.unisannio.ding.ids.wedroid.wrapper.entity.MemberPermission;
|
|
import java.util.List;
|
|
import retrofit2.Call;
|
|
import retrofit2.http.Body;
|
|
import retrofit2.http.DELETE;
|
|
import retrofit2.http.GET;
|
|
import retrofit2.http.POST;
|
|
import retrofit2.http.PUT;
|
|
import retrofit2.http.Path;
|
|
|
|
public interface BoardService {
|
|
|
|
/**
|
|
* Get all public boards.
|
|
*
|
|
* @return the list with all public boards
|
|
*/
|
|
@GET("api/boards")
|
|
Call<List<Board>> getPublicBoards();
|
|
|
|
/**
|
|
* Create a board.
|
|
*
|
|
* @param boardPrototype the prototype of the new board
|
|
* @return the new board
|
|
* @see BoardPrototype
|
|
*/
|
|
@POST("api/boards")
|
|
Call<Board> newBoard(@Body BoardPrototype boardPrototype);
|
|
|
|
/**
|
|
* Get the board with that particular ID.
|
|
*
|
|
* @param boardId The ID of the board
|
|
* @return The board with the matching ID
|
|
*/
|
|
@GET("api/boards/{boardId}")
|
|
Call<Board> getBoard(@Path("boardId") String boardId);
|
|
|
|
/**
|
|
* Delete the board with that particular ID
|
|
*
|
|
* @param boardId The ID of the board
|
|
*/
|
|
@DELETE("api/boards/{boardId}")
|
|
Call<Void> deleteBoard(@Path("boardId") String boardId);
|
|
|
|
/**
|
|
* Add a label to a board.
|
|
*
|
|
* @param boardId The ID of the board
|
|
* @param labelPrototype The prototype of new label
|
|
* @return The ID of new label
|
|
* @see LabelPrototype
|
|
*/
|
|
@PUT("/api/boards/{boardId}/labels")
|
|
Call<String> addLabel(
|
|
@Path("boardId") String boardId,
|
|
@Body LabelPrototype labelPrototype
|
|
);
|
|
|
|
/**
|
|
* Change the permission of a member of a board.
|
|
*
|
|
* @param boardId The ID of the board
|
|
* @param memberId The ID of the member
|
|
* @param memberPermission The new role of the member
|
|
* @see MemberPermission
|
|
*/
|
|
@POST("/api/boards/{boardId}/members/{memberId}")
|
|
Call<Void> setMemberPermission(
|
|
@Path("boardId") String boardId,
|
|
@Path("memberId") String memberId,
|
|
@Body MemberPermission memberPermission
|
|
);
|
|
|
|
/**
|
|
* Get all boards attached to a user.
|
|
*
|
|
* @param userId The ID of the user
|
|
* @return The list with all user's boards
|
|
*/
|
|
@GET("api/users/{userId}/boards")
|
|
Call<List<Board>> getBoardsFromUser(@Path("userId") String userId);
|
|
}
|