Skip to content

Commit 5eb55ce

Browse files
author
Pierre Grimaud
authored
feature #863 Add sort and direction for fetching organizations repos (pgrimaud)
This PR was squashed before being merged into the 2.13.x-dev branch. Discussion ---------- Hi, It's possible to sort repositories of organizations here : https://developer.github.com/v3/repos/#list-organization-repositories. I added `$sort` and `$direction` parameters after actual parameters to avoid BC. Associated tests are updated too. Commits ------- 5c3aee1 Add sort and direction for fetching organizations repos 6aa74fb Fix styleci 041af92 Set new parameters as null instead of default values 304bd19 Fix styleci
1 parent 1cb5115 commit 5eb55ce

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

lib/Github/Api/Notification.php

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Notification extends AbstractApi
2323
* @param bool $includingRead
2424
* @param bool $participating
2525
* @param DateTime|null $since
26+
* @param DateTime|null $before
2627
*
2728
* @return array array of notifications
2829
*/

lib/Github/Api/Organization.php

+15-3
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,27 @@ public function update($organization, array $params)
5353
* @param string $organization the user name
5454
* @param string $type the type of repositories
5555
* @param int $page the page
56+
* @param string $sort sort by
57+
* @param string $direction direction of sort, asc or desc
5658
*
5759
* @return array the repositories
5860
*/
59-
public function repositories($organization, $type = 'all', $page = 1)
61+
public function repositories($organization, $type = 'all', $page = 1, $sort = null, $direction = null)
6062
{
61-
return $this->get('/orgs/'.rawurlencode($organization).'/repos', [
63+
$parameters = [
6264
'type' => $type,
6365
'page' => $page,
64-
]);
66+
];
67+
68+
if ($sort !== null) {
69+
$parameters['sort'] = $sort;
70+
}
71+
72+
if ($direction !== null) {
73+
$parameters['direction'] = $direction;
74+
}
75+
76+
return $this->get('/orgs/'.rawurlencode($organization).'/repos', $parameters);
6577
}
6678

6779
/**

0 commit comments

Comments
 (0)