summaryrefslogtreecommitdiff
path: root/gitlab/mixins.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2018-05-27 19:28:31 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2018-05-27 19:28:31 +0200
commit70257438044b793a42adce791037b9b86ae35d9b (patch)
treee38f46effcfe54cb3346b985c1ca41c61b8da103 /gitlab/mixins.py
parent590ea0da7e5617c42e705c62370d6e94ff46ea74 (diff)
downloadgitlab-70257438044b793a42adce791037b9b86ae35d9b.tar.gz
Implement user_agent_detail for snippets
Add a new UserAgentDetail mixin to avoid code duplication.
Diffstat (limited to 'gitlab/mixins.py')
-rw-r--r--gitlab/mixins.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py
index 013f7b7..988042b 100644
--- a/gitlab/mixins.py
+++ b/gitlab/mixins.py
@@ -371,6 +371,23 @@ class ObjectDeleteMixin(object):
self.manager.delete(self.get_id())
+class UserAgentDetailMixin(object):
+ @cli.register_custom_action(('Snippet', 'ProjectSnippet', 'ProjectIssue'))
+ @exc.on_http_error(exc.GitlabGetError)
+ def user_agent_detail(self, **kwargs):
+ """Get the user agent detail.
+
+ Args:
+ **kwargs: Extra options to send to the server (e.g. sudo)
+
+ Raises:
+ GitlabAuthenticationError: If authentication is not correct
+ GitlabGetError: If the server cannot perform the request
+ """
+ path = '%s/%s/user_agent_detail' % (self.manager.path, self.get_id())
+ return self.manager.gitlab.http_get(path, **kwargs)
+
+
class AccessRequestMixin(object):
@cli.register_custom_action(('ProjectAccessRequest', 'GroupAccessRequest'),
tuple(), ('access_level', ))