Add list projects support, update tests (#1431)

This commit is contained in:
Anuj Bansal
2020-03-11 12:40:25 +11:00
committed by GitHub
parent b1c35499f4
commit e44d11d565
4 changed files with 76 additions and 0 deletions
+18
View File
@@ -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>`_