Skip to content

Commit 22319ee

Browse files
convenientNyholm
authored andcommitted
Add params to collaborators api calls (#623)
* 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` * Add phpdoc to Collaborators api
1 parent a7e86f3 commit 22319ee

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

lib/Github/Api/Repository/Collaborators.php

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,54 @@
1010
*/
1111
class Collaborators extends AbstractApi
1212
{
13-
public function all($username, $repository)
13+
/**
14+
* @link https://developer.github.com/v3/repos/collaborators/#list-collaborators
15+
*
16+
* @param $username
17+
* @param $repository
18+
* @param array $params
19+
* @return array|string
20+
*/
21+
public function all($username, $repository, array $params = [])
1422
{
15-
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators');
23+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators', $params);
1624
}
1725

26+
/**
27+
* @link https://developer.github.com/v3/repos/collaborators/#check-if-a-user-is-a-collaborator
28+
*
29+
* @param $username
30+
* @param $repository
31+
* @param $collaborator
32+
* @return array|string
33+
*/
1834
public function check($username, $repository, $collaborator)
1935
{
2036
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator));
2137
}
2238

23-
public function add($username, $repository, $collaborator)
39+
/**
40+
* @link https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator
41+
*
42+
* @param $username
43+
* @param $repository
44+
* @param $collaborator
45+
* @param array $params
46+
* @return array|string
47+
*/
48+
public function add($username, $repository, $collaborator, array $params = [])
2449
{
25-
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator));
50+
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator), $params);
2651
}
2752

53+
/**
54+
* @link https://developer.github.com/v3/repos/collaborators/#remove-user-as-a-collaborator
55+
*
56+
* @param $username
57+
* @param $repository
58+
* @param $collaborator
59+
* @return array|string
60+
*/
2861
public function remove($username, $repository, $collaborator)
2962
{
3063
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator));

0 commit comments

Comments
 (0)