summaryrefslogtreecommitdiff
path: root/gitlab/mixins.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/mixins.py')
-rw-r--r--gitlab/mixins.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py
index 581e3d5..7119aef 100644
--- a/gitlab/mixins.py
+++ b/gitlab/mixins.py
@@ -114,6 +114,8 @@ class ListMixin(object):
# Duplicate data to avoid messing with what the user sent us
data = kwargs.copy()
+ if self.gitlab.per_page:
+ data.setdefault('per_page', self.gitlab.per_page)
# We get the attributes that need some special transformation
types = getattr(self, '_types', {})
@@ -369,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', ))
@@ -526,3 +545,29 @@ class TimeTrackingMixin(object):
"""
path = '%s/%s/reset_spent_time' % (self.manager.path, self.get_id())
return self.manager.gitlab.http_post(path, **kwargs)
+
+
+class ParticipantsMixin(object):
+ @cli.register_custom_action(('ProjectMergeRequest', 'ProjectIssue'))
+ @exc.on_http_error(exc.GitlabListError)
+ def participants(self, **kwargs):
+ """List the participants.
+
+ Args:
+ all (bool): If True, return all the items, without pagination
+ per_page (int): Number of items to retrieve per request
+ page (int): ID of the page to return (starts with page 1)
+ as_list (bool): If set to False and no pagination option is
+ defined, return a generator instead of a list
+ **kwargs: Extra options to send to the server (e.g. sudo)
+
+ Raises:
+ GitlabAuthenticationError: If authentication is not correct
+ GitlabListError: If the list could not be retrieved
+
+ Returns:
+ RESTObjectList: The list of participants
+ """
+
+ path = '%s/%s/participants' % (self.manager.path, self.get_id())
+ return self.manager.gitlab.http_get(path, **kwargs)