@@ -707,20 +707,24 @@ def check_inbox_pull_requests(self, start=0, limit=None, role=None):
707707 url = 'rest/api/1.0/inbox/pull-requests'
708708 return self .get (url , params = params )
709709
710- def add_pull_request_comment (self , project , repository , pull_request_id , text ):
710+ def add_pull_request_comment (self , project , repository , pull_request_id , text , parent_id = None ):
711711 """
712712 Add comment into pull request
713713 :param project:
714714 :param repository:
715715 :param pull_request_id: the ID of the pull request within the repository
716716 :param text comment text
717+ :param parent_id parent comment id
718+
717719 :return:
718720 """
719721 url = 'rest/api/1.0/projects/{project}/repos/{repository}/pull-requests/{pullRequestId}/comments' .format (
720722 project = project ,
721723 repository = repository ,
722724 pullRequestId = pull_request_id )
723725 body = {'text' : text }
726+ if parent_id :
727+ body ['parent' ] = {'id' : parent_id }
724728 return self .post (url , data = body )
725729
726730 def get_pull_request_comment (self , project , repository , pull_request_id , comment_id ):
@@ -742,6 +746,24 @@ def get_pull_request_comment(self, project, repository, pull_request_id, comment
742746 comment_id = comment_id )
743747 return self .get (url )
744748
749+ def update_pull_request_comment (self , project , repository , pull_request_id , comment_id , comment , comment_version ):
750+ """
751+ Update the text of a comment.
752+ Only the user who created a comment may update it.
753+
754+ Note: the supplied supplied JSON object must contain a version
755+ that must match the server's version of the comment
756+ or the update will fail.
757+ """
758+ url = "/rest/api/1.0/projects/{project}/repos/{repository}/pull-requests/{pull_request_id}/comments/{comment_id}" .format (
759+ project = project , repository = repository , pull_request_id = pull_request_id , comment_id = comment_id
760+ )
761+ payload = {
762+ "version" : comment_version ,
763+ "text" : comment
764+ }
765+ return self .put (url , data = payload )
766+
745767 def get_pullrequest (self , project , repository , pull_request_id ):
746768 """
747769 Retrieve a pull request.
@@ -760,8 +782,8 @@ def get_pullrequest(self, project, repository, pull_request_id):
760782
761783 def change_reviewed_status (self , project_key , repository_slug , pull_request_id , status , user_slug ):
762784 """
763- Change the current user's status for a pull request.
764- Implicitly adds the user as a participant if they are not already.
785+ Change the current user's status for a pull request.
786+ Implicitly adds the user as a participant if they are not already.
765787 If the current user is the author, this method will fail.
766788 :param project_key:
767789 :param repository_slug:
0 commit comments