Skip to content

Commit 1406c44

Browse files
committed
Allow to provide parameters for PullRequests list
According to the [API documentation](https://developer.github.com/v3/pulls/#list-pull-requests) of the v3 API a sort can be added and some other parameters not yet supported by this library. I have changed the "all" function to allow parameters to be given.
1 parent bdb8637 commit 1406c44

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

lib/Github/Api/PullRequest.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,13 @@ class PullRequest extends AbstractApi
1919
*
2020
* @param string $username the username
2121
* @param string $repository the repository
22-
* @param string $state the state of the fetched pull requests.
23-
* The API seems to automatically default to 'open'
24-
* @param integer $page the page
25-
* @param integer $perPage the per page
22+
* @param array $params a list of extra parameters.
2623
*
2724
* @return array array of pull requests for the project
2825
*/
29-
public function all($username, $repository, $state = null, $page = 1, $perPage = 30)
26+
public function all($username, $repository, array $params = array())
3027
{
31-
$parameters = array(
32-
'page' => $page,
33-
'per_page' => $perPage,
34-
'state' => $state,
35-
);
36-
37-
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $parameters);
28+
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $params );
3829
}
3930

4031
/**

0 commit comments

Comments
 (0)