mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Add sorting capability to Organization.get_repos() (#1139)
This commit is contained in:
committed by
Wan Liuyang
parent
4349bca136
commit
ef6f009dc3
+10
-1
@@ -760,16 +760,25 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
)
|
||||
return github.Repository.Repository(self._requester, headers, data, completed=True)
|
||||
|
||||
def get_repos(self, type=github.GithubObject.NotSet):
|
||||
def get_repos(self, type=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /orgs/:org/repos <http://developer.github.com/v3/repos>`_
|
||||
:param type: string ('all', 'public', 'private', 'forks', 'sources', 'member')
|
||||
:param sort: string ('created', 'updated', 'pushed', 'full_name')
|
||||
:param direction: string ('asc', desc')
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
|
||||
"""
|
||||
assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type
|
||||
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 type is not github.GithubObject.NotSet:
|
||||
url_parameters["type"] = type
|
||||
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.Repository.Repository,
|
||||
self._requester,
|
||||
|
||||
Reference in New Issue
Block a user