Add ChecklistService #14
@ -0,0 +1,56 @@
|
||||
package wekan.wrapper.api;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.*;
|
||||
import wekan.wrapper.entity.Checklist;
|
||||
import wekan.wrapper.entity.ChecklistPrototype;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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<List<Checklist>> getChecklists(
|
||||
@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<Checklist> 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<Checklist> postChecklist(
|
||||
@Path("boardId") String boardId,
|
||||
@Path("cardId") String cardId,
|
||||
@Body ChecklistPrototype checklistPrototype
|
||||
);
|
||||
}
|
57
wrapper/src/main/java/wekan/wrapper/entity/Checklist.java
Normal file
57
wrapper/src/main/java/wekan/wrapper/entity/Checklist.java
Normal file
@ -0,0 +1,57 @@
|
||||
package wekan.wrapper.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Checklist {
|
||||
@SerializedName("_id")
|
||||
private String id;
|
||||
private String cardId;
|
||||
private String title;
|
||||
private Date finishedAt;
|
||||
private Date createdAt;
|
||||
private Date modifiedAt;
|
||||
private int sort;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getCardId() {
|
||||
return cardId;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public Date getFinishedAt() {
|
||||
return finishedAt;
|
||||
}
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public Date getModifiedAt() {
|
||||
return modifiedAt;
|
||||
}
|
||||
|
||||
public int getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Checklist{" +
|
||||
"id='" + id + '\'' +
|
||||
", cardId='" + cardId + '\'' +
|
||||
", title='" + title + '\'' +
|
||||
", finishedAt=" + finishedAt +
|
||||
", createdAt=" + createdAt +
|
||||
", modifiedAt=" + modifiedAt +
|
||||
", sort=" + sort +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package wekan.wrapper.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ChecklistPrototype {
|
||||
private String title;
|
||||
private List<String> items;
|
||||
|
||||
private ChecklistPrototype(String title, List<String> items) {
|
||||
this.title = title;
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String title;
|
||||
private List<String> items;
|
||||
|
||||
public Builder() {
|
||||
items = new ArrayList<>();
|
||||
}
|
||||
|
||||
public ChecklistPrototype build() {
|
||||
return new ChecklistPrototype(
|
||||
title,
|
||||
items
|
||||
);
|
||||
}
|
||||
|
||||
public Builder setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addItems(String item) {
|
||||
items.add(item);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user