diff --git a/docs/gl_objects/notes.rst b/docs/gl_objects/notes.rst index 053c0a0a2..26d0e5ec1 100644 --- a/docs/gl_objects/notes.rst +++ b/docs/gl_objects/notes.rst @@ -4,7 +4,7 @@ Notes ##### -You can manipulate notes (comments) on project issues, merge requests and +You can manipulate notes (comments) on group epics, project issues, merge requests and snippets. Reference @@ -12,6 +12,12 @@ Reference * v4 API: + Epics: + + * :class:`gitlab.v4.objects.GroupEpicNote` + * :class:`gitlab.v4.objects.GroupEpicNoteManager` + * :attr:`gitlab.v4.objects.GroupEpic.notes` + Issues: + :class:`gitlab.v4.objects.ProjectIssueNote` @@ -37,18 +43,21 @@ Examples List the notes for a resource:: + e_notes = epic.notes.list() i_notes = issue.notes.list() mr_notes = mr.notes.list() s_notes = snippet.notes.list() Get a note for a resource:: + e_note = epic.notes.get(note_id) i_note = issue.notes.get(note_id) mr_note = mr.notes.get(note_id) s_note = snippet.notes.get(note_id) Create a note for a resource:: + e_note = epic.notes.create({'body': 'note content'}) i_note = issue.notes.create({'body': 'note content'}) mr_note = mr.notes.create({'body': 'note content'}) s_note = snippet.notes.create({'body': 'note content'}) diff --git a/gitlab/v4/objects/award_emojis.py b/gitlab/v4/objects/award_emojis.py index e4ad370c6..3f9d77704 100644 --- a/gitlab/v4/objects/award_emojis.py +++ b/gitlab/v4/objects/award_emojis.py @@ -4,6 +4,10 @@ from gitlab.mixins import NoUpdateMixin, ObjectDeleteMixin __all__ = [ + "GroupEpicAwardEmoji", + "GroupEpicAwardEmojiManager", + "GroupEpicNoteAwardEmoji", + "GroupEpicNoteAwardEmojiManager", "ProjectIssueAwardEmoji", "ProjectIssueAwardEmojiManager", "ProjectIssueNoteAwardEmoji", @@ -19,6 +23,42 @@ ] +class GroupEpicAwardEmoji(ObjectDeleteMixin, RESTObject): + pass + + +class GroupEpicAwardEmojiManager(NoUpdateMixin, RESTManager): + _path = "/groups/{group_id}/epics/{epic_iid}/award_emoji" + _obj_cls = GroupEpicAwardEmoji + _from_parent_attrs = {"group_id": "group_id", "epic_iid": "iid"} + _create_attrs = RequiredOptional(required=("name",)) + + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> GroupEpicAwardEmoji: + return cast(GroupEpicAwardEmoji, super().get(id=id, lazy=lazy, **kwargs)) + + +class GroupEpicNoteAwardEmoji(ObjectDeleteMixin, RESTObject): + pass + + +class GroupEpicNoteAwardEmojiManager(NoUpdateMixin, RESTManager): + _path = "/groups/{group_id}/epics/{epic_iid}/notes/{note_id}/award_emoji" + _obj_cls = GroupEpicNoteAwardEmoji + _from_parent_attrs = { + "group_id": "group_id", + "epic_iid": "epic_iid", + "note_id": "id", + } + _create_attrs = RequiredOptional(required=("name",)) + + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> GroupEpicNoteAwardEmoji: + return cast(GroupEpicNoteAwardEmoji, super().get(id=id, lazy=lazy, **kwargs)) + + class ProjectIssueAwardEmoji(ObjectDeleteMixin, RESTObject): pass diff --git a/gitlab/v4/objects/notes.py b/gitlab/v4/objects/notes.py index c4055ad65..833f63226 100644 --- a/gitlab/v4/objects/notes.py +++ b/gitlab/v4/objects/notes.py @@ -13,12 +13,17 @@ ) from .award_emojis import ( # noqa: F401 + GroupEpicNoteAwardEmojiManager, ProjectIssueNoteAwardEmojiManager, ProjectMergeRequestNoteAwardEmojiManager, ProjectSnippetNoteAwardEmojiManager, ) __all__ = [ + "GroupEpicNote", + "GroupEpicNoteManager", + "GroupEpicDiscussionNote", + "GroupEpicDiscussionNoteManager", "ProjectNote", "ProjectNoteManager", "ProjectCommitDiscussionNote", @@ -38,6 +43,46 @@ ] +class GroupEpicNote(SaveMixin, ObjectDeleteMixin, RESTObject): + awardemojis: GroupEpicNoteAwardEmojiManager + + +class GroupEpicNoteManager(CRUDMixin, RESTManager): + _path = "/groups/{group_id}/epics/{epic_iid}/notes" + _obj_cls = GroupEpicNote + _from_parent_attrs = {"group_id": "group_id", "epic_iid": "iid"} + _create_attrs = RequiredOptional(required=("body",), optional=("created_at",)) + _update_attrs = RequiredOptional(required=("body",)) + + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> GroupEpicNote: + return cast(GroupEpicNote, super().get(id=id, lazy=lazy, **kwargs)) + + +class GroupEpicDiscussionNote(SaveMixin, ObjectDeleteMixin, RESTObject): + pass + + +class GroupEpicDiscussionNoteManager( + GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTManager +): + _path = "/groups/{group_id}/epics/{epic_iid}/discussions/{discussion_id}/notes" + _obj_cls = GroupEpicDiscussionNote + _from_parent_attrs = { + "group_id": "group_id", + "epic_iid": "epic_iid", + "discussion_id": "id", + } + _create_attrs = RequiredOptional(required=("body",), optional=("created_at",)) + _update_attrs = RequiredOptional(required=("body",)) + + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> GroupEpicDiscussionNote: + return cast(GroupEpicDiscussionNote, super().get(id=id, lazy=lazy, **kwargs)) + + class ProjectNote(RESTObject): pass @@ -172,7 +217,7 @@ def get( class ProjectSnippetNote(SaveMixin, ObjectDeleteMixin, RESTObject): - awardemojis: ProjectMergeRequestNoteAwardEmojiManager + awardemojis: ProjectSnippetNoteAwardEmojiManager class ProjectSnippetNoteManager(CRUDMixin, RESTManager):
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: