Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/Github/Api/CurrentUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,19 @@ public function organizations()
/**
* @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, ask or desc

* @return array
*/
public function repositories()
public function repositories($type = 'owner', $sort = 'full_name', $direction = 'asc')
{
return $this->get('user/repos');
return $this->get('user/repos', array(
$type,
$sort,
$direction
));
}

/**
Expand Down
15 changes: 11 additions & 4 deletions lib/Github/Api/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,19 @@ public function subscriptions($username)
* Get the repositories of a user
* @link http://developer.github.com/v3/repos/
*
* @param string $username the username
* @return array list of the 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, ask or desc
* @return array list of the user repositories
*/
public function repositories($username)
public function repositories($username, $type = 'owner', $sort = 'full_name', $direction = 'asc')
{
return $this->get('users/'.rawurlencode($username).'/repos');
return $this->get('users/'.rawurlencode($username).'/repos', array(
$type,
$sort,
$direction
));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/Github/Tests/Api/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function shouldGetUserRepositories()
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('users/l3l0/repos')
->with('users/l3l0/repos', array('owner', 'full_name', 'asc'))
->will($this->returnValue($expectedArray));

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