Skip to content

Commit 397d677

Browse files
author
Gauvain Pocentek
committed
1 parent ad35482 commit 397d677

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

docs/gl_objects/issues.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,7 @@
8585
# project issue reset time spent
8686
issue.reset_time_spent()
8787
# end project issue reset time spent
88+
89+
# project issue useragent
90+
detail = issue.user_agent_detail()
91+
# end project issue useragent

docs/gl_objects/issues.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,8 @@ Reset spent time for an issue:
176176
:start-after: # project issue reset time spent
177177
:end-before: # end project issue reset time spent
178178

179+
Get user agent detail for the issue (admin only):
180+
181+
.. literalinclude:: issues.py
182+
:start-after: # project issue useragent
183+
:end-before: # end project issue useragent

gitlab/v4/objects.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,21 @@ class ProjectIssue(SubscribableMixin, TodoMixin, TimeTrackingMixin, SaveMixin,
11281128
_id_attr = 'iid'
11291129
_managers = (('notes', 'ProjectIssueNoteManager'), )
11301130

1131+
@cli.register_custom_action('ProjectIssue')
1132+
@exc.on_http_error(exc.GitlabUpdateError)
1133+
def user_agent_detail(self, **kwargs):
1134+
"""Get user agent detail.
1135+
1136+
Args:
1137+
**kwargs: Extra options to send to the server (e.g. sudo)
1138+
1139+
Raises:
1140+
GitlabAuthenticationError: If authentication is not correct
1141+
GitlabGetError: If the detail could not be retrieved
1142+
"""
1143+
path = '%s/%s/user_agent_detail' % (self.manager.path, self.get_id())
1144+
return self.manager.gitlab.http_get(path, **kwargs)
1145+
11311146
@cli.register_custom_action('ProjectIssue', ('to_project_id',))
11321147
@exc.on_http_error(exc.GitlabUpdateError)
11331148
def move(self, to_project_id, **kwargs):

tools/python_test_v4.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@
435435
assert(len(issue1.notes.list()) == 1)
436436
note.delete()
437437
assert(len(issue1.notes.list()) == 0)
438+
assert(isinstance(issue1.user_agent_detail(), dict))
438439

439440
# tags
440441
tag1 = admin_project.tags.create({'tag_name': 'v1.0', 'ref': 'master'})

0 commit comments

Comments
 (0)