@@ -1906,6 +1906,20 @@ def get_pull_requests_participants(
1906
1906
params ["limit" ] = limit
1907
1907
return self ._get_paged (url , params )
1908
1908
1909
+ def assign_pull_request_participant_role (self , project_key : str , repository_slug : str , pull_request_id : int , role : str , user : str ) -> dict :
1910
+ """
1911
+ Assign a role to a user for a pull request
1912
+ :param project_key: The project key
1913
+ :param repository_slug: The repository key
1914
+ :param pull_request_id: The pull request id
1915
+ :param role: The role to assign, currently it only accepts REVIEWER
1916
+ :param user: The user to assign the role to
1917
+ :return:
1918
+ """
1919
+ url = self ._url_pull_request_participants (project_key , repository_slug , pull_request_id )
1920
+ data = {"role" : role , "user" : {"name" : user }}
1921
+ return self .post (url , data = data )
1922
+
1909
1923
def get_dashboard_pull_requests (
1910
1924
self ,
1911
1925
start = 0 ,
@@ -2104,6 +2118,35 @@ def delete_pull_request_comment(
2104
2118
data = {"version" : comment_version }
2105
2119
return self .delete (url , params = data )
2106
2120
2121
+ def _url_pull_request_blocker_comments (self , project_key , repository_slug , pull_request_id ) -> str :
2122
+ url = "{}/blocker-comments" .format (self ._url_pull_request (project_key , repository_slug , pull_request_id ))
2123
+ return url
2124
+
2125
+ def add_pull_request_blocker_comment (self , project_key : str , repository_slug : str , pull_request_id : int , text : dict , severity : str ) -> dict :
2126
+ """
2127
+ Add a comment to a pull request that blocks the merge
2128
+ :param project_key: The project key
2129
+ :param repository_slug: The repository key
2130
+ :param pull_request_id: The pull request id
2131
+ :param text: The text of the comment
2132
+ :param severity: The severity of the comment
2133
+ :return:
2134
+ """
2135
+ url = self ._url_pull_request_blocker_comments (project_key , repository_slug , pull_request_id )
2136
+ data = {"text" : text , "severity" : severity }
2137
+ return self .post (url , data = data )
2138
+
2139
+ def search_pull_request_blocker_comment (self , project_key : str , repository_slug : str , pull_request_id : int ) -> dict :
2140
+ """
2141
+ Get all comments that block the merge of a pull request
2142
+ :param project_key: The project key
2143
+ :param repository_slug: The repository key
2144
+ :param pull_request_id: The pull request id
2145
+ :return:
2146
+ """
2147
+ url = self ._url_pull_request_blocker_comments (project_key , repository_slug , pull_request_id )
2148
+ return self .get (url )
2149
+
2107
2150
def decline_pull_request (self , project_key , repository_slug , pr_id , pr_version ):
2108
2151
"""
2109
2152
Decline a pull request.
0 commit comments