summaryrefslogtreecommitdiff
path: root/gitlab.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2013-12-26 13:21:12 +0100
committerGauvain Pocentek <gauvain@pocentek.net>2013-12-26 13:21:39 +0100
commit1969abb3bbb61c4cbb8499496be9f48bd74cf558 (patch)
tree9cce34ff1c23a8ae9618af4af6f9151fcd488405 /gitlab.py
parente31bb9ea26a5ab3299464f37e0931bfee8b7cb62 (diff)
downloadgitlab-1969abb3bbb61c4cbb8499496be9f48bd74cf558.tar.gz
add a Key() method for User objects
Diffstat (limited to 'gitlab.py')
-rw-r--r--gitlab.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/gitlab.py b/gitlab.py
index 368e909..1bd6aff 100644
--- a/gitlab.py
+++ b/gitlab.py
@@ -541,14 +541,6 @@ class GitlabObject(object):
return json.dumps(self.__dict__, cls=jsonEncoder)
-class User(GitlabObject):
- _url = '/users'
- shortPrintAttr = 'username'
- requiredCreateAttrs = ['email', 'password', 'username', 'name']
- optionalCreateAttrs = ['skype', 'linkedin', 'twitter', 'projects_limit',
- 'extern_uid', 'provider', 'bio']
-
-
class UserKey(GitlabObject):
_url = '/users/%(user_id)s/keys'
canGet = False
@@ -558,6 +550,19 @@ class UserKey(GitlabObject):
requiredCreateAttrs = ['user_id', 'title', 'key']
+class User(GitlabObject):
+ _url = '/users'
+ shortPrintAttr = 'username'
+ requiredCreateAttrs = ['email', 'password', 'username', 'name']
+ optionalCreateAttrs = ['skype', 'linkedin', 'twitter', 'projects_limit',
+ 'extern_uid', 'provider', 'bio']
+
+ def Key(self, id=None, **kwargs):
+ return self._getListOrObject(UserKey, id,
+ user_id=self.id,
+ **kwargs)
+
+
class CurrentUserKey(GitlabObject):
_url = '/user/keys'
canUpdate = False