Skip to content

Commit 8a22958

Browse files
committed
Addded API for team access.
1 parent 05ab473 commit 8a22958

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

gitlab.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,3 +852,42 @@ def Tag(self, id=None, **kwargs):
852852
return self._getListOrObject(ProjectTag, id,
853853
project_id=self.id,
854854
**kwargs)
855+
856+
857+
class TeamMember(GitlabObject):
858+
_url = '/user_teams/%(team_id)s/members'
859+
canUpdate = False
860+
requiredCreateAttrs = ['team_id', 'user_id', 'access_level']
861+
requiredDeleteAttrs = ['team_id']
862+
requiredGetAttrs = ['team_id']
863+
requiredListAttrs = ['team_id']
864+
shortPrintAttr = 'username'
865+
866+
867+
class TeamProject(GitlabObject):
868+
_url = '/user_teams/%(team_id)s/projects'
869+
_constructorTypes = {'owner': 'User'}
870+
canUpdate = False
871+
requiredCreateAttrs = ['team_id', 'project_id', 'greatest_access_level']
872+
requiredDeleteAttrs = ['team_id', 'project_id']
873+
requiredGetAttrs = ['team_id']
874+
requiredListAttrs = ['team_id']
875+
shortPrintAttr = 'name'
876+
877+
878+
class Team(GitlabObject):
879+
_url = '/user_teams'
880+
shortPrintAttr = 'name'
881+
requiredCreateAttrs = ['name', 'path']
882+
canUpdate = False
883+
884+
def Members(self, id=None, **kwargs):
885+
return self._getListOrObject(TeamMember, id,
886+
team_id=self.id,
887+
**kwargs)
888+
889+
def Projects(self, id=None, **kwargs):
890+
return self._getListOrObject(TeamProject, id,
891+
team_id=self.id,
892+
**kwargs)
893+

0 commit comments

Comments
 (0)