Repository: python-gitlab/python-gitlab

Issue:
API resource_label_events
## Description of the problem, including code/CLI snippet

Hello, what is the forecast to implement the new api - https://docs.gitlab.com/ce/api/resource_label_events.html

## Expected Behavior


## Actual Behavior


## Specifications

  - python-gitlab version: stable
  - API version you are using (v3/v4): v4
  - Gitlab server version (or gitlab.com):



Discussion:
Thanks for your feature request.

There is not really a forecast for new features. It's implemented, when someone comes around to it. If you want to speed up the process, we would be happy to review your merge request, implementing the feature.

Resolving patch:
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py
--- a/gitlab/v4/objects.py
+++ b/gitlab/v4/objects.py
@@ -662,9 +662,22 @@ def create(self, data, **kwargs):
         return self._obj_cls(self, server_data)
 
 
+class GroupEpicResourceLabelEvent(RESTObject):
+    pass
+
+
+class GroupEpicResourceLabelEventManager(RetrieveMixin, RESTManager):
+    _path = ('/groups/%(group_id)s/epics/%(epic_id)s/resource_label_events')
+    _obj_cls = GroupEpicResourceLabelEvent
+    _from_parent_attrs = {'group_id': 'group_id', 'epic_id': 'id'}
+
+
 class GroupEpic(ObjectDeleteMixin, SaveMixin, RESTObject):
     _id_attr = 'iid'
-    _managers = (('issues', 'GroupEpicIssueManager'),)
+    _managers = (
+        ('issues', 'GroupEpicIssueManager'),
+        ('resourcelabelevents', 'GroupEpicResourceLabelEventManager'),
+    )
 
 
 class GroupEpicManager(CRUDMixin, RESTManager):
@@ -1803,6 +1816,17 @@ def create(self, data, **kwargs):
         return source_issue, target_issue
 
 
+class ProjectIssueResourceLabelEvent(RESTObject):
+    pass
+
+
+class ProjectIssueResourceLabelEventManager(RetrieveMixin, RESTManager):
+    _path = ('/projects/%(project_id)s/issues/%(issue_iid)s'
+             '/resource_label_events')
+    _obj_cls = ProjectIssueResourceLabelEvent
+    _from_parent_attrs = {'project_id': 'project_id', 'issue_iid': 'iid'}
+
+
 class ProjectIssue(UserAgentDetailMixin, SubscribableMixin, TodoMixin,
                    TimeTrackingMixin, ParticipantsMixin, SaveMixin,
                    ObjectDeleteMixin, RESTObject):
@@ -1813,6 +1837,7 @@ class ProjectIssue(UserAgentDetailMixin, SubscribableMixin, TodoMixin,
         ('discussions', 'ProjectIssueDiscussionManager'),
         ('links', 'ProjectIssueLinkManager'),
         ('notes', 'ProjectIssueNoteManager'),
+        ('resourcelabelevents', 'ProjectIssueResourceLabelEventManager'),
     )
 
     @cli.register_custom_action('ProjectIssue', ('to_project_id',))
@@ -2086,6 +2111,17 @@ class ProjectMergeRequestDiscussionManager(RetrieveMixin, CreateMixin,
     _update_attrs = (('resolved',), tuple())
 
 
+class ProjectMergeRequestResourceLabelEvent(RESTObject):
+    pass
+
+
+class ProjectMergeRequestResourceLabelEventManager(RetrieveMixin, RESTManager):
+    _path = ('/projects/%(project_id)s/merge_requests/%(mr_iid)s'
+             '/resource_label_events')
+    _obj_cls = ProjectMergeRequestResourceLabelEvent
+    _from_parent_attrs = {'project_id': 'project_id', 'mr_iid': 'iid'}
+
+
 class ProjectMergeRequest(SubscribableMixin, TodoMixin, TimeTrackingMixin,
                           ParticipantsMixin, SaveMixin, ObjectDeleteMixin,
                           RESTObject):
@@ -2097,6 +2133,8 @@ class ProjectMergeRequest(SubscribableMixin, TodoMixin, TimeTrackingMixin,
         ('diffs', 'ProjectMergeRequestDiffManager'),
         ('discussions', 'ProjectMergeRequestDiscussionManager'),
         ('notes', 'ProjectMergeRequestNoteManager'),
+        ('resourcelabelevents',
+         'ProjectMergeRequestResourceLabelEventManager'),
     )
 
     @cli.register_custom_action('ProjectMergeRequest')


Test patch:
diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py
--- a/tools/python_test_v4.py
+++ b/tools/python_test_v4.py
@@ -539,6 +539,15 @@
 assert(issue1.user_agent_detail()['user_agent'])
 assert(issue1.participants())
 
+# issues labels and events
+label2 = admin_project.labels.create({'name': 'label2', 'color': '#aabbcc'})
+issue1.labels = ['label2']
+issue1.save()
+events = issue1.resourcelabelevents.list()
+assert(events)
+event = issue1.resourcelabelevents.get(events[0].id)
+assert(event)
+
 discussion = issue1.discussions.create({'body': 'Discussion body'})
 assert(len(issue1.discussions.list()) == 1)
 d_note = discussion.notes.create({'body': 'first note'})
@@ -628,6 +637,14 @@
 discussion = mr.discussions.get(discussion.id)
 assert(len(discussion.attributes['notes']) == 1)
 
+# mr labels and events
+mr.labels = ['label2']
+mr.save()
+events = mr.resourcelabelevents.list()
+assert(events)
+event = mr.resourcelabelevents.get(events[0].id)
+assert(event)
+
 # basic testing: only make sure that the methods exist
 mr.commits()
 mr.changes()