Skip to content

[SD] request_comments start,limit,public,internal #974

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

Merged
merged 1 commit into from
May 15, 2022
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