Skip to content
Merged
Show file tree
Hide file tree
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
29 changes: 24 additions & 5 deletions atlassian/service_desk.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,37 @@ def create_request_comment(self, issue_id_or_key, body, public=True):

return self.post(path=url, data=data, headers=self.experimental_headers)

def get_request_comments(self, issue_id_or_key):
def get_request_comments(self, issue_id_or_key, start=0, limit=50, public=True, internal=True):
"""
Get all comments in issue

:param issue_id_or_key: str
:param start: OPTIONAL: int
:param limit: OPTIONAL: int
:param public: OPTIONAL: bool
:param internal: OPTIONAL: bool
:return: Issue comments
"""
url = "rest/servicedeskapi/request/{}/comment".format(issue_id_or_key)
params = {}
if start is not None:
params["start"] = int(start)
if limit is not None:
params["limit"] = int(limit)
if public is not None:
params["public"] = bool(public)
if internal is not None:
params["internal"] = bool(internal)

return self.get(
"rest/servicedeskapi/request/{}/comment".format(issue_id_or_key),
headers=self.experimental_headers,
)
response = self.get(url, params=params, headers=self.experimental_headers)
if self.advanced_mode:
return response
return (response or {}).get("values")

# return self.get(
# "rest/servicedeskapi/request/{}/comment".format(issue_id_or_key),
# headers=self.experimental_headers,
# )

def get_request_comment_by_id(self, issue_id_or_key, comment_id):
"""
Expand Down
2 changes: 1 addition & 1 deletion docs/service_desk.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The Request actions
sd.create_request_comment(issue_id_or_key, body, public=True)

# Get request comments
sd.get_request_comments(issue_id_or_key)
sd.get_request_comments(issue_id_or_key, start=0, limit=50, public=True, internal=True)

# Get request comment
sd.get_request_comment_by_id(issue_id_or_key, comment_id)
Expand Down