Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(api): add support for epic notes#1712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nejch merged 1 commit intopython-gitlab:mainfromStingRayZA:Epicnotes
Nov 27, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletiondocs/gl_objects/notes.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,14 +4,20 @@
Notes
#####

You can manipulate notes (comments) on project issues, merge requests and
You can manipulate notes (comments) ongroup epics,project issues, merge requests and
snippets.

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`
Expand All@@ -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'})
Expand Down
40 changes: 40 additions & 0 deletionsgitlab/v4/objects/award_emojis.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,10 @@
fromgitlab.mixinsimportNoUpdateMixin,ObjectDeleteMixin

__all__= [
"GroupEpicAwardEmoji",
"GroupEpicAwardEmojiManager",
"GroupEpicNoteAwardEmoji",
"GroupEpicNoteAwardEmojiManager",
"ProjectIssueAwardEmoji",
"ProjectIssueAwardEmojiManager",
"ProjectIssueNoteAwardEmoji",
Expand All@@ -19,6 +23,42 @@
]


classGroupEpicAwardEmoji(ObjectDeleteMixin,RESTObject):
pass


classGroupEpicAwardEmojiManager(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",))

defget(
self,id:Union[str,int],lazy:bool=False,**kwargs:Any
)->GroupEpicAwardEmoji:
returncast(GroupEpicAwardEmoji,super().get(id=id,lazy=lazy,**kwargs))


classGroupEpicNoteAwardEmoji(ObjectDeleteMixin,RESTObject):
pass


classGroupEpicNoteAwardEmojiManager(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",))

defget(
self,id:Union[str,int],lazy:bool=False,**kwargs:Any
)->GroupEpicNoteAwardEmoji:
returncast(GroupEpicNoteAwardEmoji,super().get(id=id,lazy=lazy,**kwargs))


classProjectIssueAwardEmoji(ObjectDeleteMixin,RESTObject):
pass

Expand Down
47 changes: 46 additions & 1 deletiongitlab/v4/objects/notes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,12 +13,17 @@
)

from .award_emojis import ( # noqa: F401
GroupEpicNoteAwardEmojiManager,
ProjectIssueNoteAwardEmojiManager,
ProjectMergeRequestNoteAwardEmojiManager,
ProjectSnippetNoteAwardEmojiManager,
)

__all__ = [
"GroupEpicNote",
"GroupEpicNoteManager",
"GroupEpicDiscussionNote",
"GroupEpicDiscussionNoteManager",
"ProjectNote",
"ProjectNoteManager",
"ProjectCommitDiscussionNote",
Expand All@@ -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

Expand DownExpand Up@@ -172,7 +217,7 @@ def get(


class ProjectSnippetNote(SaveMixin, ObjectDeleteMixin, RESTObject):
awardemojis:ProjectMergeRequestNoteAwardEmojiManager
awardemojis:ProjectSnippetNoteAwardEmojiManager


class ProjectSnippetNoteManager(CRUDMixin, RESTManager):
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp