summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2017-11-11 15:11:12 +0100
committerGauvain Pocentek <gauvain@pocentek.net>2017-11-11 15:11:12 +0100
commit397d67745f573f1d6bcf9399e3ee602640b019c8 (patch)
treeee03fac11372e278229f54b4a5d4669bbd171a36
parentad35482bdeb587ec816cac4f2231b93fcdd0066a (diff)
downloadgitlab-397d67745f573f1d6bcf9399e3ee602640b019c8.tar.gz
Add support for user_agent_detail (issues)
https://docs.gitlab.com/ce/api/issues.html#get-user-agent-details
-rw-r--r--docs/gl_objects/issues.py4
-rw-r--r--docs/gl_objects/issues.rst5
-rw-r--r--gitlab/v4/objects.py15
-rw-r--r--tools/python_test_v4.py1
4 files changed, 25 insertions, 0 deletions
diff --git a/docs/gl_objects/issues.py b/docs/gl_objects/issues.py
index de4a356..2e4645e 100644
--- a/docs/gl_objects/issues.py
+++ b/docs/gl_objects/issues.py
@@ -85,3 +85,7 @@ issue.add_time_spent({'duration': '3h30m'})
# project issue reset time spent
issue.reset_time_spent()
# end project issue reset time spent
+
+# project issue useragent
+detail = issue.user_agent_detail()
+# end project issue useragent
diff --git a/docs/gl_objects/issues.rst b/docs/gl_objects/issues.rst
index b3b1cf1..4384ba9 100644
--- a/docs/gl_objects/issues.rst
+++ b/docs/gl_objects/issues.rst
@@ -176,3 +176,8 @@ Reset spent time for an issue:
:start-after: # project issue reset time spent
:end-before: # end project issue reset time spent
+Get user agent detail for the issue (admin only):
+
+.. literalinclude:: issues.py
+ :start-after: # project issue useragent
+ :end-before: # end project issue useragent
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py
index 18e208b..722f8ab 100644
--- a/gitlab/v4/objects.py
+++ b/gitlab/v4/objects.py
@@ -1128,6 +1128,21 @@ class ProjectIssue(SubscribableMixin, TodoMixin, TimeTrackingMixin, SaveMixin,
_id_attr = 'iid'
_managers = (('notes', 'ProjectIssueNoteManager'), )
+ @cli.register_custom_action('ProjectIssue')
+ @exc.on_http_error(exc.GitlabUpdateError)
+ def user_agent_detail(self, **kwargs):
+ """Get 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 detail could not be retrieved
+ """
+ path = '%s/%s/user_agent_detail' % (self.manager.path, self.get_id())
+ return self.manager.gitlab.http_get(path, **kwargs)
+
@cli.register_custom_action('ProjectIssue', ('to_project_id',))
@exc.on_http_error(exc.GitlabUpdateError)
def move(self, to_project_id, **kwargs):
diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py
index cb199b7..f126719 100644
--- a/tools/python_test_v4.py
+++ b/tools/python_test_v4.py
@@ -435,6 +435,7 @@ note = issue1.notes.create({'body': 'This is an issue note'})
assert(len(issue1.notes.list()) == 1)
note.delete()
assert(len(issue1.notes.list()) == 0)
+assert(isinstance(issue1.user_agent_detail(), dict))
# tags
tag1 = admin_project.tags.create({'tag_name': 'v1.0', 'ref': 'master'})