Skip to content

Commit 6965cc0

Browse files
authored
[Bitbucket Cloud] Add support for query parameters in pullrequest.comments endpoint (#1101)
* [Bitbucket Cloud] Add support for query parameters in pullrequests/comments endpoint Updated pull_requests.comments to accept a query string, which is passed to params if present and used with _get_paged * [Bitbucket Cloud] Add sorting to comments endpoint Updated to include the sort parameter Reorganized docstring
1 parent 6e7399b commit 6965cc0

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

atlassian/bitbucket/cloud/repositories/pullRequests.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,23 @@ def builds(self):
275275

276276
return
277277

278-
def comments(self):
278+
def comments(self, q=None, sort=None):
279279
"""
280280
Returns generator object of the comments endpoint
281281
282+
:param q: string: Query string to narrow down the response.
283+
:param sort: string: Name of a response property to sort results.
284+
See https://developer.atlassian.com/bitbucket/api/2/reference/meta/filtering
285+
for details on filtering and sorting.
286+
282287
API docs: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pullrequests/%7Bpull_request_id%7D/comments#get
283288
"""
284-
for comment in self._get_paged("comments"):
289+
params = {}
290+
if sort is not None:
291+
params["sort"] = sort
292+
if q is not None:
293+
params["q"] = q
294+
for comment in self._get_paged("comments", params=params):
285295
yield Comment(comment, **self._new_session_args)
286296

287297
def comment(self, raw_message):

0 commit comments

Comments
 (0)