release 0.1 #30
@ -10,31 +10,77 @@ import wekan.wrapper.entity.BoardPrototype;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface BoardService {
|
public interface BoardService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all public boards.
|
||||||
|
*
|
||||||
|
* @return the list with all public boards
|
||||||
|
*/
|
||||||
@GET("api/boards")
|
@GET("api/boards")
|
||||||
Call<List<Board>> getPublicBoards();
|
Call<List<Board>> getPublicBoards();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a board.
|
||||||
|
*
|
||||||
|
* @param boardPrototype the prototype of the new board
|
||||||
|
* @return the new board
|
||||||
|
* @see BoardPrototype
|
||||||
|
*/
|
||||||
@POST("api/boards")
|
@POST("api/boards")
|
||||||
Call<Board> newBoard(@Body BoardPrototype boardPrototype);
|
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}")
|
@GET("api/boards/{boardId}")
|
||||||
Call<Board> getBoard(@Path("boardId") String 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}")
|
@DELETE("api/boards/{boardId}")
|
||||||
Call<Void> deleteBoard(@Path("boardId") String 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")
|
@PUT("/api/boards/{boardId}/labels")
|
||||||
Call<String> addLabel(
|
Call<String> addLabel(
|
||||||
@Path("boardId") String board,
|
@Path("boardId") String boardId,
|
||||||
@Body LabelPrototype labelPrototype
|
@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}")
|
@POST("/api/boards/{boardId}/members/{memberId}")
|
||||||
Call<Void> setMemberPermission(
|
Call<Void> setMemberPermission(
|
||||||
@Path("boardId") String board,
|
@Path("boardId") String boardId,
|
||||||
@Path("memberId") String member,
|
@Path("memberId") String memberId,
|
||||||
@Body MemberPermission memberPermission
|
@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")
|
@GET("api/users/{userId}/boards")
|
||||||
Call<List<Board>> getBoardsFromUser(@Path("userId") String userId);
|
Call<List<Board>> getBoardsFromUser(@Path("userId") String userId);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ public class Board {
|
|||||||
private int starts;
|
private int starts;
|
||||||
private List<Label> labels;
|
private List<Label> labels;
|
||||||
private List<Member> members;
|
private List<Member> members;
|
||||||
private Permission permission;
|
private BoardPermission permission;
|
||||||
@SerializedName("color")
|
@SerializedName("color")
|
||||||
private BoardBackgroundColor backgroundColor;
|
private BoardBackgroundColor backgroundColor;
|
||||||
private String description;
|
private String description;
|
||||||
@ -68,7 +68,7 @@ public class Board {
|
|||||||
return members;
|
return members;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Permission getPermission() {
|
public BoardPermission getPermission() {
|
||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package wekan.wrapper.entity;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
public enum Permission {
|
public enum BoardPermission {
|
||||||
@SerializedName("public")
|
@SerializedName("public")
|
||||||
PUBLIC,
|
PUBLIC,
|
||||||
@SerializedName("private")
|
@SerializedName("private")
|
@ -2,6 +2,9 @@ package wekan.wrapper.entity;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the properties of the new board
|
||||||
|
*/
|
||||||
public class BoardPrototype {
|
public class BoardPrototype {
|
||||||
private String title;
|
private String title;
|
||||||
private String owner;
|
private String owner;
|
||||||
@ -9,7 +12,7 @@ public class BoardPrototype {
|
|||||||
private boolean isActive;
|
private boolean isActive;
|
||||||
private boolean isNoComments;
|
private boolean isNoComments;
|
||||||
private boolean isCommentOnly;
|
private boolean isCommentOnly;
|
||||||
private Permission permission;
|
private BoardPermission permission;
|
||||||
@SerializedName("color")
|
@SerializedName("color")
|
||||||
private BoardBackgroundColor backgroundColor;
|
private BoardBackgroundColor backgroundColor;
|
||||||
|
|
||||||
@ -20,7 +23,7 @@ public class BoardPrototype {
|
|||||||
boolean isActive,
|
boolean isActive,
|
||||||
boolean isNoComments,
|
boolean isNoComments,
|
||||||
boolean isCommentOnly,
|
boolean isCommentOnly,
|
||||||
Permission permission,
|
BoardPermission permission,
|
||||||
BoardBackgroundColor backgroundColor
|
BoardBackgroundColor backgroundColor
|
||||||
) {
|
) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
@ -36,64 +39,90 @@ public class BoardPrototype {
|
|||||||
public static class Builder {
|
public static class Builder {
|
||||||
private String title;
|
private String title;
|
||||||
private String owner;
|
private String owner;
|
||||||
private boolean isAdmin = true;
|
|
||||||
private boolean isActive = true;
|
private boolean isActive = true;
|
||||||
private boolean isNoComments = false;
|
private MemberPermission memberPermission = MemberPermission.ADMIN;
|
||||||
private boolean isCommentOnly = false;
|
private BoardPermission boardPermission = BoardPermission.PRIVATE;
|
||||||
private Permission permission = Permission.PRIVATE;
|
|
||||||
private BoardBackgroundColor backgroundColor = BoardBackgroundColor.BELIZE;
|
private BoardBackgroundColor backgroundColor = BoardBackgroundColor.BELIZE;
|
||||||
|
|
||||||
public Builder() {
|
public Builder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new BoardPrototype
|
||||||
|
*
|
||||||
|
* @return The board prototype
|
||||||
|
*/
|
||||||
public BoardPrototype build() {
|
public BoardPrototype build() {
|
||||||
return new BoardPrototype(
|
return new BoardPrototype(
|
||||||
title,
|
title,
|
||||||
owner,
|
owner,
|
||||||
isAdmin,
|
memberPermission.isAdmin(),
|
||||||
isActive,
|
isActive,
|
||||||
isNoComments,
|
memberPermission.isNoComments(),
|
||||||
isCommentOnly,
|
memberPermission.isCommentOnly(),
|
||||||
permission,
|
boardPermission,
|
||||||
backgroundColor
|
backgroundColor
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the title of the new board.
|
||||||
|
*
|
||||||
|
* @param title The title of the new board
|
||||||
|
*/
|
||||||
public Builder setTitle(String title) {
|
public Builder setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the owner of the new board.
|
||||||
|
*
|
||||||
|
* @param owner The owner of the new board
|
||||||
|
*/
|
||||||
public Builder setOwner(String owner) {
|
public Builder setOwner(String owner) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setAdmin(boolean admin) {
|
/**
|
||||||
isAdmin = admin;
|
* Set the owner like an active member of the new board.
|
||||||
return this;
|
*
|
||||||
}
|
* @param active True by default
|
||||||
|
*/
|
||||||
public Builder setActive(boolean active) {
|
public Builder setActive(boolean active) {
|
||||||
isActive = active;
|
isActive = active;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setNoComments(boolean noComments) {
|
/**
|
||||||
isNoComments = noComments;
|
* Set the permission of the owner on the new board.
|
||||||
|
*
|
||||||
|
* @param memberPermission ADMIN by default
|
||||||
|
* @see MemberPermission
|
||||||
|
*/
|
||||||
|
public Builder setMemberPermission(MemberPermission memberPermission) {
|
||||||
|
this.memberPermission = memberPermission;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setCommentOnly(boolean commentOnly) {
|
/**
|
||||||
isCommentOnly = commentOnly;
|
* Set the visibility of the new board.
|
||||||
return this;
|
*
|
||||||
}
|
* @param boardPermission PRIVATE by default
|
||||||
|
* @see BoardPermission
|
||||||
public Builder setPermission(Permission permission) {
|
*/
|
||||||
this.permission = permission;
|
public Builder setBoardPermission(BoardPermission boardPermission) {
|
||||||
|
this.boardPermission = boardPermission;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the background color of the new board.
|
||||||
|
*
|
||||||
|
* @param backgroundColor BELIZE by default
|
||||||
|
* @see BoardBackgroundColor
|
||||||
|
*/
|
||||||
public Builder setBackgroundColor(BoardBackgroundColor backgroundColor) {
|
public Builder setBackgroundColor(BoardBackgroundColor backgroundColor) {
|
||||||
this.backgroundColor = backgroundColor;
|
this.backgroundColor = backgroundColor;
|
||||||
return this;
|
return this;
|
||||||
|
@ -14,6 +14,18 @@ public class Label {
|
|||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LabelColor getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Label{" +
|
return "Label{" +
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
package wekan.wrapper.entity;
|
package wekan.wrapper.entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the properties of the new label.
|
||||||
|
*/
|
||||||
public class LabelPrototype {
|
public class LabelPrototype {
|
||||||
private Label label;
|
private Label label;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name The name of the new label
|
||||||
|
* @param color The color of the new label
|
||||||
|
*/
|
||||||
public LabelPrototype(String name, LabelColor color) {
|
public LabelPrototype(String name, LabelColor color) {
|
||||||
label = new Label(null, name, color);
|
label = new Label(null, name, color);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,26 @@ public class Member {
|
|||||||
this.isCommentOnly = isCommentOnly;
|
this.isCommentOnly = isCommentOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAdmin() {
|
||||||
|
return isAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNoComments() {
|
||||||
|
return isNoComments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCommentOnly() {
|
||||||
|
return isCommentOnly;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Member{" +
|
return "Member{" +
|
||||||
|
@ -1,21 +1,36 @@
|
|||||||
package wekan.wrapper.entity;
|
package wekan.wrapper.entity;
|
||||||
|
|
||||||
public class MemberPermission {
|
public class MemberPermission {
|
||||||
|
/**
|
||||||
|
* The user is an admin of the board
|
||||||
|
*/
|
||||||
public final static MemberPermission ADMIN = new MemberPermission(
|
public final static MemberPermission ADMIN = new MemberPermission(
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The use is an normal member of the board
|
||||||
|
*/
|
||||||
public final static MemberPermission NORMAL = new MemberPermission(
|
public final static MemberPermission NORMAL = new MemberPermission(
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user isn't allowed to make comments on the board
|
||||||
|
*/
|
||||||
public final static MemberPermission NO_COMMENTS = new MemberPermission(
|
public final static MemberPermission NO_COMMENTS = new MemberPermission(
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user is only allowed to make comments on the board
|
||||||
|
*/
|
||||||
public final static MemberPermission COMMENT_ONLY = new MemberPermission(
|
public final static MemberPermission COMMENT_ONLY = new MemberPermission(
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
@ -31,4 +46,16 @@ public class MemberPermission {
|
|||||||
this.isNoComments = isNoComments;
|
this.isNoComments = isNoComments;
|
||||||
this.isCommentOnly = isCommentOnly;
|
this.isCommentOnly = isCommentOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAdmin() {
|
||||||
|
return isAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNoComments() {
|
||||||
|
return isNoComments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCommentOnly() {
|
||||||
|
return isCommentOnly;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ public class BoardServiceTest {
|
|||||||
assertEquals("my-title-1", board.getSlug());
|
assertEquals("my-title-1", board.getSlug());
|
||||||
assertFalse(board.isArchived());
|
assertFalse(board.isArchived());
|
||||||
assertEquals(0, board.getStarts());
|
assertEquals(0, board.getStarts());
|
||||||
assertEquals(Permission.PRIVATE, board.getPermission());
|
assertEquals(BoardPermission.PRIVATE, board.getPermission());
|
||||||
assertEquals(BoardBackgroundColor.CORTEZA, board.getBackgroundColor());
|
assertEquals(BoardBackgroundColor.CORTEZA, board.getBackgroundColor());
|
||||||
assertTrue(board.isAllowsSubtasks());
|
assertTrue(board.isAllowsSubtasks());
|
||||||
assertEquals(PresentParentTask.NO_PARENT, board.getPresentParentTask());
|
assertEquals(PresentParentTask.NO_PARENT, board.getPresentParentTask());
|
||||||
|
Loading…
Reference in New Issue
Block a user