Skip to content

Commit cb5b754

Browse files
committed
Merge remote-tracking branch 'samcday/teams' into team-api
Conflicts: gitlab.py
2 parents 8a22958 + 5388d19 commit cb5b754

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

gitlab.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,20 @@ def User(self, id=None, **kwargs):
385385
"""
386386
return self._getListOrObject(User, id, **kwargs)
387387

388+
def Team(self, id=None, **kwargs):
389+
"""Creates/gets/lists team(s) known by the GitLab server.
390+
391+
If id is None, returns a list of teams.
392+
393+
If id is an integer, returns the matching project (or raise a
394+
GitlabGetError if not found)
395+
396+
If id is a dict, create a new object using attributes provided. The
397+
object is NOT saved on the server. Use the save() method on the object
398+
to write it on the server.
399+
"""
400+
return self._getListOrObject(Team, id, **kwargs)
401+
388402

389403
class GitlabObject(object):
390404
_url = None
@@ -866,7 +880,7 @@ class TeamMember(GitlabObject):
866880

867881
class TeamProject(GitlabObject):
868882
_url = '/user_teams/%(team_id)s/projects'
869-
_constructorTypes = {'owner': 'User'}
883+
_constructorTypes = {'owner': 'User', 'namespace': 'Group'}
870884
canUpdate = False
871885
requiredCreateAttrs = ['team_id', 'project_id', 'greatest_access_level']
872886
requiredDeleteAttrs = ['team_id', 'project_id']
@@ -881,13 +895,12 @@ class Team(GitlabObject):
881895
requiredCreateAttrs = ['name', 'path']
882896
canUpdate = False
883897

884-
def Members(self, id=None, **kwargs):
898+
def Member(self, id=None, **kwargs):
885899
return self._getListOrObject(TeamMember, id,
886900
team_id=self.id,
887901
**kwargs)
888902

889-
def Projects(self, id=None, **kwargs):
903+
def Project(self, id=None, **kwargs):
890904
return self._getListOrObject(TeamProject, id,
891905
team_id=self.id,
892906
**kwargs)
893-

0 commit comments

Comments
 (0)