summaryrefslogtreecommitdiff
path: root/gitlab.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab.py')
-rw-r--r--gitlab.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/gitlab.py b/gitlab.py
index ac86bef..e3af9fc 100644
--- a/gitlab.py
+++ b/gitlab.py
@@ -545,6 +545,15 @@ class GitlabObject(object):
return json.dumps(self.__dict__, cls=jsonEncoder)
+class UserKey(GitlabObject):
+ _url = '/users/%(user_id)s/keys'
+ canGet = False
+ canList = False
+ canUpdate = False
+ canDelete = False
+ requiredCreateAttrs = ['user_id', 'title', 'key']
+
+
class User(GitlabObject):
_url = '/users'
shortPrintAttr = 'username'
@@ -552,6 +561,11 @@ class User(GitlabObject):
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'