mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Add list projects support, update tests (#1431)
This commit is contained in:
@@ -49,6 +49,8 @@ import github.Permissions
|
||||
import github.Plan
|
||||
import github.Repository
|
||||
|
||||
from . import Consts
|
||||
|
||||
|
||||
class NamedUser(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
@@ -481,6 +483,22 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
|
||||
github.Organization.Organization, self._requester, self.url + "/orgs", None
|
||||
)
|
||||
|
||||
def get_projects(self, state="open"):
|
||||
"""
|
||||
:calls: `GET /users/:user/projects <https://developer.github.com/v3/projects/#list-user-projects>`_
|
||||
:param state: string
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Project.Project`
|
||||
"""
|
||||
assert isinstance(state, str), state
|
||||
url_parameters = {"state": state}
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Project.Project,
|
||||
self._requester,
|
||||
self.url + "/projects",
|
||||
url_parameters,
|
||||
headers={"Accept": Consts.mediaTypeProjectsPreview},
|
||||
)
|
||||
|
||||
def get_public_events(self):
|
||||
"""
|
||||
:calls: `GET /users/:user/events/public <http://developer.github.com/v3/activity/events>`_
|
||||
|
||||
Reference in New Issue
Block a user