add support for the direction parameter in Repository.get_pulls

This commit is contained in:
Kevin Lewandowski
2015-11-16 23:08:31 -08:00
parent f37d1febe1
commit 70bcb6d0c1
+6 -1
View File
@@ -1664,19 +1664,24 @@ class Repository(github.GithubObject.CompletableGithubObject):
)
return github.PullRequest.PullRequest(self._requester, headers, data, completed=True)
def get_pulls(self, state=github.GithubObject.NotSet, sort=github.GithubObject.NotSet):
def get_pulls(self, state=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet):
"""
:calls: `GET /repos/:owner/:repo/pulls <http://developer.github.com/v3/pulls>`_
:param state: string
:param sort: string
:param direction: string
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.PullRequest.PullRequest`
"""
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
url_parameters = dict()
if state is not github.GithubObject.NotSet:
url_parameters["state"] = state
if sort is not github.GithubObject.NotSet:
url_parameters["sort"] = sort
if direction is not github.GithubObject.NotSet:
url_parameters["direction"] = direction
return github.PaginatedList.PaginatedList(
github.PullRequest.PullRequest,
self._requester,