@@ -68,15 +68,22 @@ class PullRequestServices(client: BitbucketClient) {
68
68
client.postJson(Request (url, classOf [JsObject ]), JsNull )
69
69
}
70
70
71
- def createComment (author : String , repo : String , prId : Int , commitUUID : String , body : String , file : Option [ String ], line : Option [ Int ] ): RequestResponse [PullRequestComment ] = {
71
+ private [ this ] def postNewComment (author : String , repo : String , prId : Int , values : JsObject ): RequestResponse [PullRequestComment ] = {
72
72
val url = s " https://bitbucket.org/api/1.0/repositories/ $author/ $repo/pullrequests/ $prId/comments "
73
+ client.postJson(Request (url, classOf [PullRequestComment ]), values)
74
+ }
75
+
76
+ def createPullRequestComment (author : String , repo : String , prId : Int , content : String ): RequestResponse [PullRequestComment ] = {
77
+ val values = Json .obj(" content" -> JsString (content))
78
+ postNewComment(author, repo, prId, values)
79
+ }
73
80
81
+ def createComment (author : String , repo : String , prId : Int , commitUUID : String , body : String , file : Option [String ], line : Option [Int ]): RequestResponse [PullRequestComment ] = {
74
82
val params = file.map(filename => " filename" -> JsString (filename)) ++
75
83
line.map(lineTo => " line_to" -> JsNumber (lineTo))
76
84
77
85
val values = JsObject (params.toSeq :+ " content" -> JsString (body) :+ " anchor" -> JsString (commitUUID.take(12 )))
78
-
79
- client.postJson(Request (url, classOf [PullRequestComment ]), values)
86
+ postNewComment(author, repo, prId, values = values)
80
87
}
81
88
82
89
def deleteComment (author : String , repo : String , commitUUID : String , pullRequestId : Int , commentId : Long ): Unit = {
0 commit comments