From 2084d65781f9882652a1744f8279fa6aa0bb9214 Mon Sep 17 00:00:00 2001 From: Luke Rodgers Date: Thu, 10 Aug 2017 16:09:58 +0100 Subject: [PATCH 1/2] Add params to collaborators api calls https://developer.github.com/v3/repos/collaborators/#list-collaborators `GET /repos/:owner/:repo/collaborators` Params = `affiliation` https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator `PUT /repos/:owner/:repo/collaborators/:username` Params = `permission` --- lib/Github/Api/Repository/Collaborators.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Github/Api/Repository/Collaborators.php b/lib/Github/Api/Repository/Collaborators.php index 116d8cc5a38..876b969b95f 100644 --- a/lib/Github/Api/Repository/Collaborators.php +++ b/lib/Github/Api/Repository/Collaborators.php @@ -10,9 +10,9 @@ */ class Collaborators extends AbstractApi { - public function all($username, $repository) + public function all($username, $repository, array $params = []) { - return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators'); + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators', $params); } public function check($username, $repository, $collaborator) @@ -20,9 +20,9 @@ public function check($username, $repository, $collaborator) return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator)); } - public function add($username, $repository, $collaborator) + public function add($username, $repository, $collaborator, array $params = []) { - return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator)); + return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator), $params); } public function remove($username, $repository, $collaborator) From e45fba2a98b43b116966d66a65f1fcb7d7b10786 Mon Sep 17 00:00:00 2001 From: Luke Rodgers Date: Thu, 10 Aug 2017 21:08:02 +0100 Subject: [PATCH 2/2] Add phpdoc to Collaborators api --- lib/Github/Api/Repository/Collaborators.php | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/Github/Api/Repository/Collaborators.php b/lib/Github/Api/Repository/Collaborators.php index 876b969b95f..86812be9538 100644 --- a/lib/Github/Api/Repository/Collaborators.php +++ b/lib/Github/Api/Repository/Collaborators.php @@ -10,21 +10,54 @@ */ class Collaborators extends AbstractApi { + /** + * @link https://developer.github.com/v3/repos/collaborators/#list-collaborators + * + * @param $username + * @param $repository + * @param array $params + * @return array|string + */ public function all($username, $repository, array $params = []) { return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators', $params); } + /** + * @link https://developer.github.com/v3/repos/collaborators/#check-if-a-user-is-a-collaborator + * + * @param $username + * @param $repository + * @param $collaborator + * @return array|string + */ public function check($username, $repository, $collaborator) { return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator)); } + /** + * @link https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator + * + * @param $username + * @param $repository + * @param $collaborator + * @param array $params + * @return array|string + */ public function add($username, $repository, $collaborator, array $params = []) { return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator), $params); } + /** + * @link https://developer.github.com/v3/repos/collaborators/#remove-user-as-a-collaborator + * + * @param $username + * @param $repository + * @param $collaborator + * @return array|string + */ public function remove($username, $repository, $collaborator) { return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator));