diff --git a/lib/Github/Api/CurrentUser.php b/lib/Github/Api/CurrentUser.php index 8718673746c..1ed98a65eae 100644 --- a/lib/Github/Api/CurrentUser.php +++ b/lib/Github/Api/CurrentUser.php @@ -111,18 +111,22 @@ public function teams() /** * @link http://developer.github.com/v3/repos/#list-your-repositories * - * @param string $type role in the repository - * @param string $sort sort by - * @param string $direction direction of sort, asc or desc + * @param string $type role in the repository + * @param string $sort sort by + * @param string $direction direction of sort, asc or desc + * @param string $visibility visibility of repository + * @param string $affiliation relationship to repository * * @return array */ - public function repositories($type = 'owner', $sort = 'full_name', $direction = 'asc') + public function repositories($type = 'owner', $sort = 'full_name', $direction = 'asc', $visibility = 'all', $affiliation = 'owner,collaborator,organization_member') { return $this->get('/user/repos', [ 'type' => $type, 'sort' => $sort, 'direction' => $direction, + 'visibility' => $visibility, + 'affiliation' => $affiliation, ]); } diff --git a/lib/Github/Api/Repository/Collaborators.php b/lib/Github/Api/Repository/Collaborators.php index b15109dd4f5..34411884624 100644 --- a/lib/Github/Api/Repository/Collaborators.php +++ b/lib/Github/Api/Repository/Collaborators.php @@ -70,9 +70,11 @@ public function remove($username, $repository, $collaborator) /** * @link https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level + * * @param $username * @param $repository * @param $collaborator + * * @return array|string */ public function permission($username, $repository, $collaborator) diff --git a/lib/Github/Api/User.php b/lib/Github/Api/User.php index 2c3b807b9bf..c4414c56c75 100644 --- a/lib/Github/Api/User.php +++ b/lib/Github/Api/User.php @@ -173,19 +173,23 @@ public function subscriptions($username) * * @link https://developer.github.com/v3/repos/#list-user-repositories * - * @param string $username the username - * @param string $type role in the repository - * @param string $sort sort by - * @param string $direction direction of sort, asc or desc + * @param string $username the username + * @param string $type role in the repository + * @param string $sort sort by + * @param string $direction direction of sort, asc or desc + * @param string $visibility visibility of repository + * @param string $affiliation relationship to repository * * @return array list of the user repositories */ - public function repositories($username, $type = 'owner', $sort = 'full_name', $direction = 'asc') + public function repositories($username, $type = 'owner', $sort = 'full_name', $direction = 'asc', $visibility = 'all', $affiliation = 'owner,collaborator,organization_member') { return $this->get('/users/'.rawurlencode($username).'/repos', [ 'type' => $type, 'sort' => $sort, 'direction' => $direction, + 'visibility' => $visibility, + 'affiliation' => $affiliation, ]); } diff --git a/test/Github/Tests/Api/Repository/CollaboratorsTest.php b/test/Github/Tests/Api/Repository/CollaboratorsTest.php index 03b8c11d22a..8bf57d96791 100644 --- a/test/Github/Tests/Api/Repository/CollaboratorsTest.php +++ b/test/Github/Tests/Api/Repository/CollaboratorsTest.php @@ -75,7 +75,7 @@ public function shouldRemoveRepositoryCollaborator() */ public function shouldGetRepositoryCollaboratorPermission() { - $expectedValue = array(array('permission' => 'admin', 'user' => 'l3l0')); + $expectedValue = [['permission' => 'admin', 'user' => 'l3l0']]; $api = $this->getApiMock(); $api->expects($this->once()) diff --git a/test/Github/Tests/Api/UserTest.php b/test/Github/Tests/Api/UserTest.php index fa56225fd1f..0c9eea62b9d 100644 --- a/test/Github/Tests/Api/UserTest.php +++ b/test/Github/Tests/Api/UserTest.php @@ -194,7 +194,7 @@ public function shouldGetUserRepositories() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('/users/l3l0/repos', ['type' => 'owner', 'sort' => 'full_name', 'direction' => 'asc']) + ->with('/users/l3l0/repos', ['type' => 'owner', 'sort' => 'full_name', 'direction' => 'asc', 'visibility' => 'all', 'affiliation' => 'owner,collaborator,organization_member']) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->repositories('l3l0'));