Skip to content

Commit b716e03

Browse files
Adam Campbellacrobat
Adam Campbell
authored andcommitted
Add missing parameters for User/CurrentUser Repositories (#684)
* Add missing parameters for User/CurrentUser Repositories * Make some StyleCI fixes to User and CurrentUser classes * Some unrelated StyleCI fixes... ?
1 parent 556d978 commit b716e03

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

lib/Github/Api/CurrentUser.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,22 @@ public function teams()
111111
/**
112112
* @link http://developer.github.com/v3/repos/#list-your-repositories
113113
*
114-
* @param string $type role in the repository
115-
* @param string $sort sort by
116-
* @param string $direction direction of sort, asc or desc
114+
* @param string $type role in the repository
115+
* @param string $sort sort by
116+
* @param string $direction direction of sort, asc or desc
117+
* @param string $visibility visibility of repository
118+
* @param string $affiliation relationship to repository
117119
*
118120
* @return array
119121
*/
120-
public function repositories($type = 'owner', $sort = 'full_name', $direction = 'asc')
122+
public function repositories($type = 'owner', $sort = 'full_name', $direction = 'asc', $visibility = 'all', $affiliation = 'owner,collaborator,organization_member')
121123
{
122124
return $this->get('/user/repos', [
123125
'type' => $type,
124126
'sort' => $sort,
125127
'direction' => $direction,
128+
'visibility' => $visibility,
129+
'affiliation' => $affiliation,
126130
]);
127131
}
128132

lib/Github/Api/Repository/Collaborators.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ public function remove($username, $repository, $collaborator)
7070

7171
/**
7272
* @link https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level
73+
*
7374
* @param $username
7475
* @param $repository
7576
* @param $collaborator
77+
*
7678
* @return array|string
7779
*/
7880
public function permission($username, $repository, $collaborator)

lib/Github/Api/User.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,19 +173,23 @@ public function subscriptions($username)
173173
*
174174
* @link https://developer.github.com/v3/repos/#list-user-repositories
175175
*
176-
* @param string $username the username
177-
* @param string $type role in the repository
178-
* @param string $sort sort by
179-
* @param string $direction direction of sort, asc or desc
176+
* @param string $username the username
177+
* @param string $type role in the repository
178+
* @param string $sort sort by
179+
* @param string $direction direction of sort, asc or desc
180+
* @param string $visibility visibility of repository
181+
* @param string $affiliation relationship to repository
180182
*
181183
* @return array list of the user repositories
182184
*/
183-
public function repositories($username, $type = 'owner', $sort = 'full_name', $direction = 'asc')
185+
public function repositories($username, $type = 'owner', $sort = 'full_name', $direction = 'asc', $visibility = 'all', $affiliation = 'owner,collaborator,organization_member')
184186
{
185187
return $this->get('/users/'.rawurlencode($username).'/repos', [
186188
'type' => $type,
187189
'sort' => $sort,
188190
'direction' => $direction,
191+
'visibility' => $visibility,
192+
'affiliation' => $affiliation,
189193
]);
190194
}
191195

test/Github/Tests/Api/Repository/CollaboratorsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function shouldRemoveRepositoryCollaborator()
7575
*/
7676
public function shouldGetRepositoryCollaboratorPermission()
7777
{
78-
$expectedValue = array(array('permission' => 'admin', 'user' => 'l3l0'));
78+
$expectedValue = [['permission' => 'admin', 'user' => 'l3l0']];
7979

8080
$api = $this->getApiMock();
8181
$api->expects($this->once())

test/Github/Tests/Api/UserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public function shouldGetUserRepositories()
194194
$api = $this->getApiMock();
195195
$api->expects($this->once())
196196
->method('get')
197-
->with('/users/l3l0/repos', ['type' => 'owner', 'sort' => 'full_name', 'direction' => 'asc'])
197+
->with('/users/l3l0/repos', ['type' => 'owner', 'sort' => 'full_name', 'direction' => 'asc', 'visibility' => 'all', 'affiliation' => 'owner,collaborator,organization_member'])
198198
->will($this->returnValue($expectedArray));
199199

200200
$this->assertEquals($expectedArray, $api->repositories('l3l0'));

0 commit comments

Comments
 (0)