Skip to content

Commit 579c0c9

Browse files
committed
Merge pull request taskadapter#13 from benemon/checklists-and-checkitems
CheckList and CheckItem creation API calls - take 2
2 parents d108ae8 + c8e95d8 commit 579c0c9

4 files changed

Lines changed: 30 additions & 14 deletions

File tree

src/main/java/com/julienvey/trello/Trello.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
package com.julienvey.trello;
22

3-
import java.util.List;
3+
import com.julienvey.trello.domain.*;
44

5-
import com.julienvey.trello.domain.Action;
6-
import com.julienvey.trello.domain.Argument;
7-
import com.julienvey.trello.domain.Attachment;
8-
import com.julienvey.trello.domain.Board;
9-
import com.julienvey.trello.domain.Card;
10-
import com.julienvey.trello.domain.CardWithActions;
11-
import com.julienvey.trello.domain.CheckList;
12-
import com.julienvey.trello.domain.Entity;
13-
import com.julienvey.trello.domain.Member;
14-
import com.julienvey.trello.domain.MyPrefs;
15-
import com.julienvey.trello.domain.Organization;
16-
import com.julienvey.trello.domain.TList;
5+
import java.util.List;
176

187
public interface Trello {
198

@@ -83,6 +72,10 @@ List<CardWithActions> getBoardMemberActivity(String boardId, String memberId,
8372

8473
CheckList getCheckList(String checkListId, Argument... args);
8574

75+
CheckList createCheckList(String cardId, CheckList checkList);
76+
77+
void createCheckItem(String checkListId, CheckItem checkItem);
78+
8679
/////////////////
8780

8881
Card createCard(String listId, Card card);

src/main/java/com/julienvey/trello/domain/Board.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
44

5-
import java.util.*;
5+
import java.util.ArrayList;
6+
import java.util.Date;
7+
import java.util.List;
8+
import java.util.Map;
69

710
@JsonIgnoreProperties(ignoreUnknown = true)
811
public class Board extends TrelloEntity {

src/main/java/com/julienvey/trello/impl/TrelloImpl.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,22 @@ public CheckList getCheckList(String checkListId, Argument... args) {
270270
return checkList;
271271
}
272272

273+
@Override
274+
public CheckList createCheckList(String cardId, CheckList checkList)
275+
{
276+
checkList.setIdCard(cardId);
277+
CheckList createdCheckList = postForObject(createUrl(CREATE_CHECKLIST).asString(), checkList, CheckList.class);
278+
createdCheckList.setInternalTrello(this);
279+
return createdCheckList;
280+
}
281+
282+
@Override
283+
public void createCheckItem(String checkListId, CheckItem checkItem)
284+
{
285+
postForLocation(createUrl(ADD_CHECKITEMS_TO_CHECKLIST).asString(), checkItem, checkListId);
286+
}
287+
288+
273289
/* Others */
274290

275291
@Override

src/main/java/com/julienvey/trello/impl/TrelloUrl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,17 @@ public class TrelloUrl {
3737
public static final String GET_LIST = "/lists/{listId}?";
3838

3939
public static final String GET_CHECK_LIST = "/checklists/{checkListId}?";
40+
public static final String CREATE_CHECKLIST = "/checklists?";
41+
public static final String ADD_CHECKITEMS_TO_CHECKLIST = "/checklists/{checkListId}/checkitems?";
4042

4143
public static final String CREATE_CARD = "/cards?pos=top&";
4244
public static final String GET_MEMBER = "/members/{username}?";
4345
public static final String ADD_LABEL_TO_CARD = "/cards/{cardId}/labels?";
4446

4547
public static final String UPDATE_CARD = "/cards/{cardId}?";
4648

49+
50+
4751
private String baseUrl;
4852
private Argument[] args = {};
4953

0 commit comments

Comments
 (0)