From aeeb57c331b4f52acb4b7092ad4e7bc693a3bb3c Mon Sep 17 00:00:00 2001 From: Alexander Ray Date: Wed, 13 Apr 2016 13:56:53 -0700 Subject: [PATCH] Added getComments method to src/Jira/Api.php under addComment --- src/Jira/Api.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Jira/Api.php b/src/Jira/Api.php index 5741d96..640551e 100644 --- a/src/Jira/Api.php +++ b/src/Jira/Api.php @@ -281,6 +281,27 @@ public function addComment($issueKey, $params) return $this->api(self::REQUEST_POST, sprintf('/rest/api/2/issue/%s/comment', $issueKey), $params); } + /** + * get comments from a ticket + * + * issue key should be YOURPROJ-221 + * + * @param $issueKey + * @param $params + * @return mixed + */ + + public function getComments($issueKey, $params) + { + if (is_string($params)) { + // if $params is scalar string value -> wrapping it properly + $params = array( + 'body' => $params + ); + } + return $this->api(self::REQUEST_GET, sprintf("/rest/api/2/issue/%s/comment", $issueKey), $params); + } + /** * Get all worklogs for an issue *