mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 11:21:16 +00:00
Added nested teams and parent (#1348)
* Added nested teams and parent - Added github.Team.Team.get_teams() to get nested teams. - Added github.Team.Team.parent which points to the parent team. Fixes #1337
This commit is contained in:
committed by
Steve Kowalik
parent
16e5f9891f
commit
eacabb2fb9
@@ -155,6 +155,14 @@ class Team(github.GithubObject.CompletableGithubObject):
|
||||
self._completeIfNotSet(self._privacy)
|
||||
return self._privacy.value
|
||||
|
||||
@property
|
||||
def parent(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
self._completeIfNotSet(self._parent)
|
||||
return self._parent.value
|
||||
|
||||
def add_to_members(self, member):
|
||||
"""
|
||||
This API call is deprecated. Use `add_membership` instead.
|
||||
@@ -263,6 +271,18 @@ class Team(github.GithubObject.CompletableGithubObject):
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def get_teams(self):
|
||||
"""
|
||||
:calls: `GET /teams/:id/teams <https://developer.github.com/v3/teams/#list-child-teams>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Team.Team`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Team.Team,
|
||||
self._requester,
|
||||
self.url + '/teams',
|
||||
None,
|
||||
)
|
||||
|
||||
def get_discussions(self):
|
||||
"""
|
||||
:calls: `GET /teams/:id/discussions <https://developer.github.com/v3/teams/discussions/#list-discussions>`_
|
||||
@@ -393,6 +413,7 @@ class Team(github.GithubObject.CompletableGithubObject):
|
||||
self._url = github.GithubObject.NotSet
|
||||
self._organization = github.GithubObject.NotSet
|
||||
self._privacy = github.GithubObject.NotSet
|
||||
self._parent = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "id" in attributes: # pragma no branch
|
||||
@@ -423,3 +444,7 @@ class Team(github.GithubObject.CompletableGithubObject):
|
||||
)
|
||||
if "privacy" in attributes: # pragma no branch
|
||||
self._privacy = self._makeStringAttribute(attributes["privacy"])
|
||||
if "parent" in attributes: # pragma no branch
|
||||
self._parent = self._makeClassAttribute(
|
||||
github.Team.Team, attributes["parent"]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user