Skip to content

Add sort and direction for fetching organizations repos #863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 20, 2020
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
1 change: 1 addition & 0 deletions lib/Github/Api/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Notification extends AbstractApi
* @param bool $includingRead
* @param bool $participating
* @param DateTime|null $since
* @param DateTime|null $before
*
* @return array array of notifications
*/
Expand Down
18 changes: 15 additions & 3 deletions lib/Github/Api/Organization.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,27 @@ public function update($organization, array $params)
* @param string $organization the user name
* @param string $type the type of repositories
* @param int $page the page
* @param string $sort sort by
* @param string $direction direction of sort, asc or desc
*
* @return array the repositories
*/
public function repositories($organization, $type = 'all', $page = 1)
public function repositories($organization, $type = 'all', $page = 1, $sort = null, $direction = null)
{
return $this->get('/orgs/'.rawurlencode($organization).'/repos', [
$parameters = [
'type' => $type,
'page' => $page,
]);
];

if ($sort !== null) {
$parameters['sort'] = $sort;
}

if ($direction !== null) {
$parameters['direction'] = $direction;
}

return $this->get('/orgs/'.rawurlencode($organization).'/repos', $parameters);
}

/**
Expand Down