summaryrefslogtreecommitdiff
path: root/gitlab.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2013-12-26 15:27:53 +0100
committerGauvain Pocentek <gauvain@pocentek.net>2013-12-26 15:27:53 +0100
commitdc2bf5ea5ae827178e1e7a058e39b491ddebc01a (patch)
tree26785c97ac5238ad7c85c97fe9b5baf04b58ef62 /gitlab.py
parent0ee6ca547b08e5d629e0671db87829d857e05544 (diff)
downloadgitlab-dc2bf5ea5ae827178e1e7a058e39b491ddebc01a.tar.gz
support creation of projects for users
Diffstat (limited to 'gitlab.py')
-rw-r--r--gitlab.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/gitlab.py b/gitlab.py
index c78cdb2..370c224 100644
--- a/gitlab.py
+++ b/gitlab.py
@@ -348,6 +348,13 @@ class Gitlab(object):
"""
return self._getListOrObject(Project, id, **kwargs)
+ def UserProject(self, id=None, **kwargs):
+ """Creates a project for a user.
+
+ id must be a dict.
+ """
+ return self._getListOrObject(UserProject, id, **kwargs)
+
def _list_projects(self, url):
r = self.rawGet(url)
if r.status_code != 200:
@@ -892,6 +899,20 @@ class ProjectSnippet(GitlabObject):
**kwargs)
+class UserProject(GitlabObject):
+ _url = '/projects/user/%(user_id)s'
+ _constructorTypes = {'owner': 'User', 'namespace': 'Group'}
+ canUpdate = False
+ canDelete = False
+ canList = False
+ canGet = False
+ requiredCreateAttrs = ['name', 'user_id']
+ optionalCreateAttrs = ['default_branch', 'issues_enabled', 'wall_enabled',
+ 'merge_requests_enabled', 'wiki_enabled',
+ 'snippets_enabled', 'public', 'visibility_level',
+ 'description']
+
+
class Project(GitlabObject):
_url = '/projects'
_constructorTypes = {'owner': 'User', 'namespace': 'Group'}
@@ -900,7 +921,8 @@ class Project(GitlabObject):
requiredCreateAttrs = ['name']
optionalCreateAttrs = ['default_branch', 'issues_enabled', 'wall_enabled',
'merge_requests_enabled', 'wiki_enabled',
- 'namespace_id']
+ 'snippets_enabled', 'public', 'visibility_level',
+ 'namespace_id', 'description']
shortPrintAttr = 'path'
def Branch(self, id=None, **kwargs):