Skip to content

Commit 1803e3d

Browse files
H9lDJbyZhobbeat
authored andcommitted
[SD] request_comments start,limit,public,internal (#974)
Co-authored-by: hobbeat <demivan@gmail.com>
1 parent 9dcd84a commit 1803e3d

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

atlassian/service_desk.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,18 +242,37 @@ def create_request_comment(self, issue_id_or_key, body, public=True):
242242

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

245-
def get_request_comments(self, issue_id_or_key):
245+
def get_request_comments(self, issue_id_or_key, start=0, limit=50, public=True, internal=True):
246246
"""
247247
Get all comments in issue
248248
249249
:param issue_id_or_key: str
250+
:param start: OPTIONAL: int
251+
:param limit: OPTIONAL: int
252+
:param public: OPTIONAL: bool
253+
:param internal: OPTIONAL: bool
250254
:return: Issue comments
251255
"""
256+
url = "rest/servicedeskapi/request/{}/comment".format(issue_id_or_key)
257+
params = {}
258+
if start is not None:
259+
params["start"] = int(start)
260+
if limit is not None:
261+
params["limit"] = int(limit)
262+
if public is not None:
263+
params["public"] = bool(public)
264+
if internal is not None:
265+
params["internal"] = bool(internal)
252266

253-
return self.get(
254-
"rest/servicedeskapi/request/{}/comment".format(issue_id_or_key),
255-
headers=self.experimental_headers,
256-
)
267+
response = self.get(url, params=params, headers=self.experimental_headers)
268+
if self.advanced_mode:
269+
return response
270+
return (response or {}).get("values")
271+
272+
# return self.get(
273+
# "rest/servicedeskapi/request/{}/comment".format(issue_id_or_key),
274+
# headers=self.experimental_headers,
275+
# )
257276

258277
def get_request_comment_by_id(self, issue_id_or_key, comment_id):
259278
"""

docs/service_desk.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ The Request actions
4545
sd.create_request_comment(issue_id_or_key, body, public=True)
4646
4747
# Get request comments
48-
sd.get_request_comments(issue_id_or_key)
48+
sd.get_request_comments(issue_id_or_key, start=0, limit=50, public=True, internal=True)
4949
5050
# Get request comment
5151
sd.get_request_comment_by_id(issue_id_or_key, comment_id)

0 commit comments

Comments
 (0)