summaryrefslogtreecommitdiff
path: root/gitlab
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2017-12-16 07:30:47 +0100
committerGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2017-12-16 07:30:50 +0100
commitb33265c7c235b4365c1a7b2b03ac519ba9e26fa4 (patch)
treeb8b40089fa8191f3d258d9157070cfdc0baaca3b /gitlab
parent2167409fd6388be6758ae71762af88a466ec648d (diff)
downloadgitlab-b33265c7c235b4365c1a7b2b03ac519ba9e26fa4.tar.gz
Add support for award emojis
Fixes #361
Diffstat (limited to 'gitlab')
-rw-r--r--gitlab/v4/objects.py94
1 files changed, 88 insertions, 6 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py
index 85aba12..0f947b4 100644
--- a/gitlab/v4/objects.py
+++ b/gitlab/v4/objects.py
@@ -1091,10 +1091,35 @@ class ProjectHookManager(CRUDMixin, RESTManager):
)
-class ProjectIssueNote(SaveMixin, ObjectDeleteMixin, RESTObject):
+class ProjectIssueAwardEmoji(ObjectDeleteMixin, RESTObject):
pass
+class ProjectIssueAwardEmojiManager(NoUpdateMixin, RESTManager):
+ _path = '/projects/%(project_id)s/issues/%(issue_iid)s/award_emoji'
+ _obj_cls = ProjectIssueAwardEmoji
+ _from_parent_attrs = {'project_id': 'project_id', 'issue_iid': 'iid'}
+ _create_attrs = (('name', ), tuple())
+
+
+class ProjectIssueNoteAwardEmoji(ObjectDeleteMixin, RESTObject):
+ pass
+
+
+class ProjectIssueNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
+ _path = ('/projects/%(project_id)s/issues/%(issue_iid)s'
+ '/notes/%(note_id)s/award_emoji')
+ _obj_cls = ProjectIssueNoteAwardEmoji
+ _from_parent_attrs = {'project_id': 'project_id',
+ 'issue_iid': 'issue_iid',
+ 'note_id': 'id'}
+ _create_attrs = (('name', ), tuple())
+
+
+class ProjectIssueNote(SaveMixin, ObjectDeleteMixin, RESTObject):
+ _managers = (('awardemojis', 'ProjectIssueNoteAwardEmojiManager'),)
+
+
class ProjectIssueNoteManager(CRUDMixin, RESTManager):
_path = '/projects/%(project_id)s/issues/%(issue_iid)s/notes'
_obj_cls = ProjectIssueNote
@@ -1107,7 +1132,10 @@ class ProjectIssue(SubscribableMixin, TodoMixin, TimeTrackingMixin, SaveMixin,
ObjectDeleteMixin, RESTObject):
_short_print_attr = 'title'
_id_attr = 'iid'
- _managers = (('notes', 'ProjectIssueNoteManager'), )
+ _managers = (
+ ('notes', 'ProjectIssueNoteManager'),
+ ('awardemojis', 'ProjectIssueAwardEmojiManager'),
+ )
@cli.register_custom_action('ProjectIssue')
@exc.on_http_error(exc.GitlabUpdateError)
@@ -1243,6 +1271,17 @@ class ProjectTagManager(NoUpdateMixin, RESTManager):
_create_attrs = (('tag_name', 'ref'), ('message',))
+class ProjectMergeRequestAwardEmoji(ObjectDeleteMixin, RESTObject):
+ pass
+
+
+class ProjectMergeRequestAwardEmojiManager(NoUpdateMixin, RESTManager):
+ _path = '/projects/%(project_id)s/merge_requests/%(mr_iid)s/award_emoji'
+ _obj_cls = ProjectMergeRequestAwardEmoji
+ _from_parent_attrs = {'project_id': 'project_id', 'mr_iid': 'iid'}
+ _create_attrs = (('name', ), tuple())
+
+
class ProjectMergeRequestDiff(RESTObject):
pass
@@ -1253,10 +1292,24 @@ class ProjectMergeRequestDiffManager(RetrieveMixin, RESTManager):
_from_parent_attrs = {'project_id': 'project_id', 'mr_iid': 'iid'}
-class ProjectMergeRequestNote(SaveMixin, ObjectDeleteMixin, RESTObject):
+class ProjectMergeRequestNoteAwardEmoji(ObjectDeleteMixin, RESTObject):
pass
+class ProjectMergeRequestNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
+ _path = ('/projects/%(project_id)s/merge_requests/%(mr_iid)s'
+ '/notes/%(note_id)s/award_emoji')
+ _obj_cls = ProjectMergeRequestNoteAwardEmoji
+ _from_parent_attrs = {'project_id': 'project_id',
+ 'mr_iid': 'issue_iid',
+ 'note_id': 'id'}
+ _create_attrs = (('name', ), tuple())
+
+
+class ProjectMergeRequestNote(SaveMixin, ObjectDeleteMixin, RESTObject):
+ _managers = (('awardemojis', 'ProjectMergeRequestNoteAwardEmojiManager'),)
+
+
class ProjectMergeRequestNoteManager(CRUDMixin, RESTManager):
_path = '/projects/%(project_id)s/merge_requests/%(mr_iid)s/notes'
_obj_cls = ProjectMergeRequestNote
@@ -1270,8 +1323,9 @@ class ProjectMergeRequest(SubscribableMixin, TodoMixin, TimeTrackingMixin,
_id_attr = 'iid'
_managers = (
+ ('awardemojis', 'ProjectMergeRequestAwardEmojiManager'),
+ ('diffs', 'ProjectMergeRequestDiffManager'),
('notes', 'ProjectMergeRequestNoteManager'),
- ('diffs', 'ProjectMergeRequestDiffManager')
)
@cli.register_custom_action('ProjectMergeRequest')
@@ -1764,10 +1818,24 @@ class ProjectPipelineManager(RetrieveMixin, CreateMixin, RESTManager):
return CreateMixin.create(self, data, path=path, **kwargs)
-class ProjectSnippetNote(SaveMixin, ObjectDeleteMixin, RESTObject):
+class ProjectSnippetNoteAwardEmoji(ObjectDeleteMixin, RESTObject):
pass
+class ProjectSnippetNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
+ _path = ('/projects/%(project_id)s/snippets/%(snippet_id)s'
+ '/notes/%(note_id)s/award_emoji')
+ _obj_cls = ProjectSnippetNoteAwardEmoji
+ _from_parent_attrs = {'project_id': 'project_id',
+ 'snippet_id': 'snippet_id',
+ 'note_id': 'id'}
+ _create_attrs = (('name', ), tuple())
+
+
+class ProjectSnippetNote(SaveMixin, ObjectDeleteMixin, RESTObject):
+ _managers = (('awardemojis', 'ProjectSnippetNoteAwardEmojiManager'),)
+
+
class ProjectSnippetNoteManager(CRUDMixin, RESTManager):
_path = '/projects/%(project_id)s/snippets/%(snippet_id)s/notes'
_obj_cls = ProjectSnippetNote
@@ -1777,10 +1845,24 @@ class ProjectSnippetNoteManager(CRUDMixin, RESTManager):
_update_attrs = (('body', ), tuple())
+class ProjectSnippetAwardEmoji(ObjectDeleteMixin, RESTObject):
+ pass
+
+
+class ProjectSnippetAwardEmojiManager(NoUpdateMixin, RESTManager):
+ _path = '/projects/%(project_id)s/snippets/%(snippet_id)s/award_emoji'
+ _obj_cls = ProjectSnippetAwardEmoji
+ _from_parent_attrs = {'project_id': 'project_id', 'snippet_id': 'id'}
+ _create_attrs = (('name', ), tuple())
+
+
class ProjectSnippet(SaveMixin, ObjectDeleteMixin, RESTObject):
_url = '/projects/%(project_id)s/snippets'
_short_print_attr = 'title'
- _managers = (('notes', 'ProjectSnippetNoteManager'), )
+ _managers = (
+ ('awardemojis', 'ProjectSnippetAwardEmojiManager'),
+ ('notes', 'ProjectSnippetNoteManager'),
+ )
@cli.register_custom_action('ProjectSnippet')
@exc.on_http_error(exc.GitlabGetError)