Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bitbucket Cloud] Add support for query parameters in pullrequest.comments endpoint #1101

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions atlassian/bitbucket/cloud/repositories/pullRequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,23 @@ def builds(self):

return

def comments(self):
def comments(self, q=None, sort=None):
"""
Returns generator object of the comments endpoint

:param q: string: Query string to narrow down the response.
:param sort: string: Name of a response property to sort results.
See https://developer.atlassian.com/bitbucket/api/2/reference/meta/filtering
for details on filtering and sorting.

API docs: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pullrequests/%7Bpull_request_id%7D/comments#get
"""
for comment in self._get_paged("comments"):
params = {}
if sort is not None:
params["sort"] = sort
if q is not None:
params["q"] = q
for comment in self._get_paged("comments", params=params):
yield Comment(comment, **self._new_session_args)

def comment(self, raw_message):
Expand Down