| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c8eaeb2 commit 95d0d74
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,6 +2,9 @@ | |||
| 2 | 2 | Labels | |
| 3 | 3 | ###### | |
| 4 | 4 | ||
| 5 | + Project labels | ||
| 6 | + ============== | ||
| 7 | + | ||
| 5 | 8 | Reference | |
| 6 | 9 | --------- | |
| 7 | 10 | ||
@@ -48,3 +51,39 @@ Manage labels in issues and merge requests:: | |||
| 48 | 51 | 'labels': ['foo']}) | |
| 49 | 52 | issue.labels.append('bar') | |
| 50 | 53 | issue.save() | |
| 54 | + | ||
| 55 | + Label events | ||
| 56 | + ============ | ||
| 57 | + | ||
| 58 | + Resource label events keep track about who, when, and which label was added or | ||
| 59 | + removed to an issuable. | ||
| 60 | + | ||
| 61 | + Group epic label events are only available in the EE edition. | ||
| 62 | + | ||
| 63 | + Reference | ||
| 64 | + --------- | ||
| 65 | + | ||
| 66 | + * v4 API: | ||
| 67 | + | ||
| 68 | + + :class:`gitlab.v4.objects.ProjectIssueResourceLabelEvent` | ||
| 69 | + + :class:`gitlab.v4.objects.ProjectIssueResourceLabelEventManager` | ||
| 70 | + + :attr:`gitlab.v4.objects.ProjectIssue.resourcelabelevents` | ||
| 71 | + + :class:`gitlab.v4.objects.ProjectMergeRequestResourceLabelEvent` | ||
| 72 | + + :class:`gitlab.v4.objects.ProjectMergeRequestResourceLabelEventManager` | ||
| 73 | + + :attr:`gitlab.v4.objects.ProjectMergeRequest.resourcelabelevents` | ||
| 74 | + + :class:`gitlab.v4.objects.GroupEpicResourceLabelEvent` | ||
| 75 | + + :class:`gitlab.v4.objects.GroupEpicResourceLabelEventManager` | ||
| 76 | + + :attr:`gitlab.v4.objects.GroupEpic.resourcelabelevents` | ||
| 77 | + | ||
| 78 | + * GitLab API: https://docs.gitlab.com/ee/api/resource_label_events.html | ||
| 79 | + | ||
| 80 | + Examples | ||
| 81 | + -------- | ||
| 82 | + | ||
| 83 | + Get the events for a resource (issue, merge request or epic):: | ||
| 84 | + | ||
| 85 | + events = resource.resourcelabelevents.list() | ||
| 86 | + | ||
| 87 | + Get a specific event for a resource:: | ||
| 88 | + | ||
| 89 | + event = resource.resourcelabelevents.get(event_id) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -659,7 +659,7 @@ Delete project push rules:: | |||
| 659 | 659 | pr.delete() | |
| 660 | 660 | ||
| 661 | 661 | Project protected tags | |
| 662 | - ================== | ||
| 662 | + ====================== | ||
| 663 | 663 | ||
| 664 | 664 | Reference | |
| 665 | 665 | --------- | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -662,9 +662,22 @@ def create(self, data, **kwargs): | |||
| 662 | 662 | return self._obj_cls(self, server_data) | |
| 663 | 663 | ||
| 664 | 664 | ||
| 665 | + class GroupEpicResourceLabelEvent(RESTObject): | ||
| 666 | + pass | ||
| 667 | + | ||
| 668 | + | ||
| 669 | + class GroupEpicResourceLabelEventManager(RetrieveMixin, RESTManager): | ||
| 670 | + _path = ('/groups/%(group_id)s/epics/%(epic_id)s/resource_label_events') | ||
| 671 | + _obj_cls = GroupEpicResourceLabelEvent | ||
| 672 | + _from_parent_attrs = {'group_id': 'group_id', 'epic_id': 'id'} | ||
| 673 | + | ||
| 674 | + | ||
| 665 | 675 | class GroupEpic(ObjectDeleteMixin, SaveMixin, RESTObject): | |
| 666 | 676 | _id_attr = 'iid' | |
| 667 | - _managers = (('issues', 'GroupEpicIssueManager'),) | ||
| 677 | + _managers = ( | ||
| 678 | + ('issues', 'GroupEpicIssueManager'), | ||
| 679 | + ('resourcelabelevents', 'GroupEpicResourceLabelEventManager'), | ||
| 680 | + ) | ||
| 668 | 681 | ||
| 669 | 682 | ||
| 670 | 683 | class GroupEpicManager(CRUDMixin, RESTManager): | |
@@ -1803,6 +1816,17 @@ def create(self, data, **kwargs): | |||
| 1803 | 1816 | return source_issue, target_issue | |
| 1804 | 1817 | ||
| 1805 | 1818 | ||
| 1819 | + class ProjectIssueResourceLabelEvent(RESTObject): | ||
| 1820 | + pass | ||
| 1821 | + | ||
| 1822 | + | ||
| 1823 | + class ProjectIssueResourceLabelEventManager(RetrieveMixin, RESTManager): | ||
| 1824 | + _path = ('/projects/%(project_id)s/issues/%(issue_iid)s' | ||
| 1825 | + '/resource_label_events') | ||
| 1826 | + _obj_cls = ProjectIssueResourceLabelEvent | ||
| 1827 | + _from_parent_attrs = {'project_id': 'project_id', 'issue_iid': 'iid'} | ||
| 1828 | + | ||
| 1829 | + | ||
| 1806 | 1830 | class ProjectIssue(UserAgentDetailMixin, SubscribableMixin, TodoMixin, | |
| 1807 | 1831 | TimeTrackingMixin, ParticipantsMixin, SaveMixin, | |
| 1808 | 1832 | ObjectDeleteMixin, RESTObject): | |
@@ -1813,6 +1837,7 @@ class ProjectIssue(UserAgentDetailMixin, SubscribableMixin, TodoMixin, | |||
| 1813 | 1837 | ('discussions', 'ProjectIssueDiscussionManager'), | |
| 1814 | 1838 | ('links', 'ProjectIssueLinkManager'), | |
| 1815 | 1839 | ('notes', 'ProjectIssueNoteManager'), | |
| 1840 | + ('resourcelabelevents', 'ProjectIssueResourceLabelEventManager'), | ||
| 1816 | 1841 | ) | |
| 1817 | 1842 | ||
| 1818 | 1843 | @cli.register_custom_action('ProjectIssue', ('to_project_id',)) | |
@@ -2086,6 +2111,17 @@ class ProjectMergeRequestDiscussionManager(RetrieveMixin, CreateMixin, | |||
| 2086 | 2111 | _update_attrs = (('resolved',), tuple()) | |
| 2087 | 2112 | ||
| 2088 | 2113 | ||
| 2114 | + class ProjectMergeRequestResourceLabelEvent(RESTObject): | ||
| 2115 | + pass | ||
| 2116 | + | ||
| 2117 | + | ||
| 2118 | + class ProjectMergeRequestResourceLabelEventManager(RetrieveMixin, RESTManager): | ||
| 2119 | + _path = ('/projects/%(project_id)s/merge_requests/%(mr_iid)s' | ||
| 2120 | + '/resource_label_events') | ||
| 2121 | + _obj_cls = ProjectMergeRequestResourceLabelEvent | ||
| 2122 | + _from_parent_attrs = {'project_id': 'project_id', 'mr_iid': 'iid'} | ||
| 2123 | + | ||
| 2124 | + | ||
| 2089 | 2125 | class ProjectMergeRequest(SubscribableMixin, TodoMixin, TimeTrackingMixin, | |
| 2090 | 2126 | ParticipantsMixin, SaveMixin, ObjectDeleteMixin, | |
| 2091 | 2127 | RESTObject): | |
@@ -2097,6 +2133,8 @@ class ProjectMergeRequest(SubscribableMixin, TodoMixin, TimeTrackingMixin, | |||
| 2097 | 2133 | ('diffs', 'ProjectMergeRequestDiffManager'), | |
| 2098 | 2134 | ('discussions', 'ProjectMergeRequestDiscussionManager'), | |
| 2099 | 2135 | ('notes', 'ProjectMergeRequestNoteManager'), | |
| 2136 | + ('resourcelabelevents', | ||
| 2137 | + 'ProjectMergeRequestResourceLabelEventManager'), | ||
| 2100 | 2138 | ) | |
| 2101 | 2139 | ||
| 2102 | 2140 | @cli.register_custom_action('ProjectMergeRequest') | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -539,6 +539,15 @@ | |||
| 539 | 539 | assert(issue1.user_agent_detail()['user_agent']) | |
| 540 | 540 | assert(issue1.participants()) | |
| 541 | 541 | ||
| 542 | + # issues labels and events | ||
| 543 | + label2 = admin_project.labels.create({'name': 'label2', 'color': '#aabbcc'}) | ||
| 544 | + issue1.labels = ['label2'] | ||
| 545 | + issue1.save() | ||
| 546 | + events = issue1.resourcelabelevents.list() | ||
| 547 | + assert(events) | ||
| 548 | + event = issue1.resourcelabelevents.get(events[0].id) | ||
| 549 | + assert(event) | ||
| 550 | + | ||
| 542 | 551 | discussion = issue1.discussions.create({'body': 'Discussion body'}) | |
| 543 | 552 | assert(len(issue1.discussions.list()) == 1) | |
| 544 | 553 | d_note = discussion.notes.create({'body': 'first note'}) | |
@@ -628,6 +637,14 @@ | |||
| 628 | 637 | discussion = mr.discussions.get(discussion.id) | |
| 629 | 638 | assert(len(discussion.attributes['notes']) == 1) | |
| 630 | 639 | ||
| 640 | + # mr labels and events | ||
| 641 | + mr.labels = ['label2'] | ||
| 642 | + mr.save() | ||
| 643 | + events = mr.resourcelabelevents.list() | ||
| 644 | + assert(events) | ||
| 645 | + event = mr.resourcelabelevents.get(events[0].id) | ||
| 646 | + assert(event) | ||
| 647 | + | ||
| 631 | 648 | # basic testing: only make sure that the methods exist | |
| 632 | 649 | mr.commits() | |
| 633 | 650 | mr.changes() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments