From d0b3a0771ccbcf5e4e49e35cae371d7dac5644d2 Mon Sep 17 00:00:00 2001 From: Fabien Bourigault Date: Tue, 25 Jul 2017 13:06:28 +0200 Subject: [PATCH] use issue iid --- UPGRADE.md | 5 +++ lib/Gitlab/Api/Issues.php | 66 +++++++++++++++++++-------------------- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 3ac17720e..9100eaa1e 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -13,6 +13,11 @@ See [documentation](doc/customize.md) to know how to customize the client timeou * The `setHttpClient` method have been removed. Use a `Gitlab\HttpClient\Builder` instead. * The `getHttpClient` method return type is changed to `Http\Client\Common\HttpMethodsClient`. +## `Gitlab\Api\Issues` changes + +* The second argument of `update`, `remove`, `showComments`, `showComment`, `addComment`, `updateComment`, `removeComment`, + `setTimeEstimate`, `resetTimeEstimate`, `addSpentTime` and `resetSpentTime` methods is now a scoped issue id (iid). + ## `Gitlab\Api\Projects` changes * The `keys`, `key`, `addKey`, `removeKey`, `disableKey` and `enableKey` methods have been removed. diff --git a/lib/Gitlab/Api/Issues.php b/lib/Gitlab/Api/Issues.php index 661ea7ac1..db35145fc 100644 --- a/lib/Gitlab/Api/Issues.php +++ b/lib/Gitlab/Api/Issues.php @@ -44,53 +44,53 @@ public function create($project_id, array $params) /** * @param int $project_id - * @param int $issue_id + * @param int $issue_iid * @param array $params * @return mixed */ - public function update($project_id, $issue_id, array $params) + public function update($project_id, $issue_iid, array $params) { - return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)), $params); + return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)), $params); } /** * @param int $project_id - * @param int $issue_id + * @param int $issue_iid * @return mixed */ - public function remove($project_id, $issue_id) + public function remove($project_id, $issue_iid) { - return $this->delete($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id))); + return $this->delete($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid))); } /** * @param int $project_id - * @param int $issue_id + * @param int $issue_iid * @return mixed */ - public function showComments($project_id, $issue_id) + public function showComments($project_id, $issue_iid) { - return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)).'/notes'); + return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)).'/notes'); } /** * @param int $project_id - * @param int $issue_id + * @param int $issue_iid * @param int $note_id * @return mixed */ - public function showComment($project_id, $issue_id, $note_id) + public function showComment($project_id, $issue_iid, $note_id) { - return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)).'/notes/'.$this->encodePath($note_id)); + return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)).'/notes/'.$this->encodePath($note_id)); } /** * @param int $project_id - * @param int $issue_id + * @param int $issue_iid * @param string|array $body * @return mixed */ - public function addComment($project_id, $issue_id, $body) + public function addComment($project_id, $issue_iid, $body) { // backwards compatibility if (is_array($body)) { @@ -99,70 +99,70 @@ public function addComment($project_id, $issue_id, $body) $params = array('body' => $body); } - return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/notes'), $params); + return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/notes'), $params); } /** * @param int $project_id - * @param int $issue_id + * @param int $issue_iid * @param int $note_id * @param string $body * @return mixed */ - public function updateComment($project_id, $issue_id, $note_id, $body) + public function updateComment($project_id, $issue_iid, $note_id, $body) { - return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/notes/'.$this->encodePath($note_id)), array( + return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/notes/'.$this->encodePath($note_id)), array( 'body' => $body )); } /** * @param int $project_id - * @param int $issue_id + * @param int $issue_iid * @param int $note_id * @return mixed */ - public function removeComment($project_id, $issue_id, $note_id) + public function removeComment($project_id, $issue_iid, $note_id) { - return $this->delete($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/notes/'.$this->encodePath($note_id))); + return $this->delete($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/notes/'.$this->encodePath($note_id))); } /** * @param int $project_id - * @param int $issue_id + * @param int $issue_iid * @param string $duration */ - public function setTimeEstimate($project_id, $issue_id, $duration) + public function setTimeEstimate($project_id, $issue_iid, $duration) { - return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/time_estimate'), array('duration' => $duration)); + return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/time_estimate'), array('duration' => $duration)); } /** * @param int $project_id - * @param int $issue_id + * @param int $issue_iid */ - public function resetTimeEstimate($project_id, $issue_id) + public function resetTimeEstimate($project_id, $issue_iid) { - return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/reset_time_estimate')); + return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/reset_time_estimate')); } /** * @param int $project_id - * @param int $issue_id + * @param int $issue_iid * @param string $duration */ - public function addSpentTime($project_id, $issue_id, $duration) + public function addSpentTime($project_id, $issue_iid, $duration) { - return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/add_spent_time'), array('duration' => $duration)); + return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/add_spent_time'), array('duration' => $duration)); } /** * @param int $project_id - * @param int $issue_id + * @param int $issue_iid */ - public function resetSpentTime($project_id, $issue_id) + public function resetSpentTime($project_id, $issue_iid) { - return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/reset_spent_time')); + return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/reset_spent_time')); } /**