Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ Now you got two options:
<tr><td>DELETE /1/cards/[card_id]/members/[idMember] </td><td>TODO</td></tr>
<tr><td>DELETE /1/cards/[card_id]/membersVoted/[idMember] </td><td>TODO</td></tr>

<tr><th colspan="2">Comments</th></tr>
<tr><td>POST /1/cards/[card_id]/actions/comments </td><td>IMPLEMENTED</td></tr>

<tr><th colspan="2">Checklists</th></tr>
<tr><td>GET /1/checklists/[checklist_id] </td><td>IMPLEMENTED</td></tr>
<tr><td>GET /1/checklists/[checklist_id]/[field] </td><td>TODO</td></tr>
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/org/trello4j/CommentService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.trello4j;

import org.trello4j.model.Comment;

/**
* The Interface CardService.
*
* @author
*/
public interface CommentService {

/**
* Add a new {@link org.trello4j.model.Comment} with the optional keyValue pairs.
* @param cardId Id of the {@link org.trello4j.model.Card}
* the comment should be added to.
* @param text body of the new comment.
*/
Comment createComment(String cardId, String text);
}
2 changes: 1 addition & 1 deletion src/main/java/org/trello4j/Trello.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
public interface Trello extends OrganizationService, NotificationService,
BoardService, CardService, ActionService, ListService, MemberService,
ChecklistService, TokenService, WebhookService {
ChecklistService, TokenService, WebhookService, CommentService {

/**
* Gets the type.
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/org/trello4j/TrelloImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,19 @@ public Card createCard(String idList, String name, Map<String, String> keyValueM
}, doPost(url, keyValueMap));
}

@Override
public Comment createComment(String cardId, String text) {
final String url = TrelloURL
.create(apiKey, TrelloURL.COMMENT_POST_URL, cardId)
.token(token)
.build();
Map<String, String> keyValueMap = new HashMap<String, String>();
keyValueMap.put("text", text);

return trelloObjFactory.createObject(new TypeToken<Comment>() {
}, doPost(url, keyValueMap));
}

/*
* (non-Javadoc)
*
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/trello4j/TrelloURL.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class TrelloURL {
public static final String CARD_LIST_URL = "https://api.trello.com/1/cards/{0}/list";
public static final String CARD_MEMBERS_URL = "https://api.trello.com/1/cards/{0}/members";
public static final String CARD_POST_URL = "https://api.trello.com/1/cards";
public static final String COMMENT_POST_URL = "https://api.trello.com/1/cards/{0}/actions/comments";
public static final String LIST_ACTIONS_URL = "https://api.trello.com/1/lists/{0}/action";
public static final String LIST_BOARD_URL = "https://api.trello.com/1/lists/{0}/board";
public static final String LIST_CARDS_URL = "https://api.trello.com/1/lists/{0}/cards";
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/trello4j/model/Comment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.trello4j.model;

public class Comment extends TrelloObject {

private String text;

public String getText() {
return text;
}

public void setText(String text) {
this.text = text;
}
}