@@ -345,6 +345,20 @@ def User(self, id=None, **kwargs):
345
345
"""
346
346
return self ._getListOrObject (User , id , ** kwargs )
347
347
348
+ def Team (self , id = None , ** kwargs ):
349
+ """Creates/gets/lists team(s) known by the GitLab server.
350
+
351
+ If id is None, returns a list of teams.
352
+
353
+ If id is an integer, returns the matching project (or raise a
354
+ GitlabGetError if not found)
355
+
356
+ If id is a dict, create a new object using attributes provided. The
357
+ object is NOT saved on the server. Use the save() method on the object
358
+ to write it on the server.
359
+ """
360
+ return self ._getListOrObject (Team , id , ** kwargs )
361
+
348
362
349
363
class GitlabObject (object ):
350
364
_url = None
@@ -705,3 +719,31 @@ def Tag(self, id=None, **kwargs):
705
719
return self ._getListOrObject (ProjectTag , id ,
706
720
project_id = self .id ,
707
721
** kwargs )
722
+
723
+
724
+ class TeamMember (GitlabObject ):
725
+ _url = '/user_teams/%(team_id)d/members'
726
+ requiredCreateAttrs = ['user_id' , 'access_level' ]
727
+ canUpdate = False
728
+
729
+
730
+ class TeamProject (GitlabObject ):
731
+ _url = '/user_teams/%(team_id)d/projects'
732
+ _constructorTypes = {'owner' : 'User' , 'namespace' : 'Group' }
733
+ requiredCreateAttrs = ['project_id' , 'greatest_access_level' ]
734
+ canUpdate = False
735
+
736
+
737
+ class Team (GitlabObject ):
738
+ _url = '/user_teams'
739
+ requiredCreateAttrs = ['name' , 'path' ]
740
+
741
+ def Member (self , id = None , ** kwargs ):
742
+ return self ._getListOrObject (TeamMember , id ,
743
+ team_id = self .id ,
744
+ ** kwargs )
745
+
746
+ def Project (self , id = None , ** kwargs ):
747
+ return self ._getListOrObject (TeamProject , id ,
748
+ team_id = self .id ,
749
+ ** kwargs )
0 commit comments