1
1
package com .aaroncoplan .todoist ;
2
2
3
- import com .aaroncoplan .todoist .helpers .CommentRequest ;
4
- import com .aaroncoplan .todoist .helpers .LabelRequest ;
5
- import com .aaroncoplan .todoist .helpers .ProjectRequest ;
6
- import com .aaroncoplan .todoist .helpers .TaskRequest ;
7
- import com .aaroncoplan .todoist .model .Comment ;
8
- import com .aaroncoplan .todoist .model .Label ;
9
- import com .aaroncoplan .todoist .model .Project ;
10
- import com .aaroncoplan .todoist .model .Task ;
3
+ import com .aaroncoplan .todoist .helpers .*;
4
+ import com .aaroncoplan .todoist .model .*;
11
5
import com .mashape .unirest .http .HttpResponse ;
12
6
import com .mashape .unirest .http .Unirest ;
13
7
@@ -315,11 +309,11 @@ public List<Comment> getAllCommentsForTask(long id) {
315
309
}
316
310
}
317
311
318
- private Comment createNewComment (Long taskId , Long projectId , String content ) {
312
+ private Comment createNewComment (Long taskId , Long projectId , String content , AttachmentRequest attachmentRequest ) {
319
313
try {
320
314
HttpResponse <String > response = Unirest .post (URL_BASE + "/comments" )
321
315
.header ("Content-Type" , "application/json" )
322
- .body (JsonAdapters .writeCommentRequest (new CommentRequest (taskId , projectId , content , null )))
316
+ .body (JsonAdapters .writeCommentRequest (new CommentRequest (taskId , projectId , content , attachmentRequest )))
323
317
.asString ();
324
318
if (response .getStatus () != HTTP_OK ) {
325
319
throw new Exception ("HTTP STATUS " + response .getStatus ());
@@ -332,10 +326,18 @@ private Comment createNewComment(Long taskId, Long projectId, String content) {
332
326
}
333
327
334
328
public Comment createNewCommentForTask (long id , String content ) {
335
- return createNewComment (id , null , content );
329
+ return createNewComment (id , null , content , null );
330
+ }
331
+
332
+ public Comment createNewCommentForTask (long id , String content , AttachmentRequest attachmentRequest ) {
333
+ return createNewComment (id , null , content , attachmentRequest );
336
334
}
337
335
338
336
public Comment createNewCommentForProject (long id , String content ) {
339
- return createNewComment (null , id , content );
337
+ return createNewComment (null , id , content , null );
338
+ }
339
+
340
+ public Comment createNewCommentForProject (long id , String content , AttachmentRequest attachmentRequest ) {
341
+ return createNewComment (null , id , content , attachmentRequest );
340
342
}
341
343
}
0 commit comments