mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Add support for deleting reactions (#1708)
* Delete comment reactions * Add test case * update ignore-word-list * Delete issue reactions * Delete issue comment reactions * Delete pull request comment reactions * check status
This commit is contained in:
+17
-1
@@ -9,10 +9,11 @@
|
||||
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
||||
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
||||
# Copyright 2017 Nicolas Agustín Torres <nicolastrres@gmail.com> #
|
||||
# Copyright 2017 Nicolas Agustín Torres <nicolastrres@gmail.com> #
|
||||
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
||||
# Copyright 2018 per1234 <accounts@perglass.com> #
|
||||
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
||||
# Copyright 2020 Huan-Cheng Chang <changhc84@gmail.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. #
|
||||
# http://pygithub.readthedocs.io/ #
|
||||
@@ -189,6 +190,21 @@ class CommitComment(github.GithubObject.CompletableGithubObject):
|
||||
)
|
||||
return github.Reaction.Reaction(self._requester, headers, data, completed=True)
|
||||
|
||||
def delete_reaction(self, reaction_id):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/comments/:comment_id/reactions/:reaction_id
|
||||
<https://developer.github.com/v3/reactions/#delete-a-commit-comment-reaction>`_
|
||||
:param reaction_id: integer
|
||||
:rtype: bool
|
||||
"""
|
||||
assert isinstance(reaction_id, int), reaction_id
|
||||
status, _, _ = self._requester.requestJson(
|
||||
"DELETE",
|
||||
self.url + "/reactions/" + str(reaction_id),
|
||||
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
||||
)
|
||||
return status == 204
|
||||
|
||||
def _initAttributes(self):
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._commit_id = github.GithubObject.NotSet
|
||||
|
||||
@@ -18,6 +18,7 @@ class CommitComment(CompletableGithubObject):
|
||||
@property
|
||||
def created_at(self) -> datetime: ...
|
||||
def delete(self) -> None: ...
|
||||
def delete_reaction(self, reaction_id: int) -> bool: ...
|
||||
def edit(self, body: str) -> None: ...
|
||||
def get_reactions(self) -> PaginatedList[Reaction]: ...
|
||||
@property
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
# Copyright 2018 per1234 <accounts@perglass.com> #
|
||||
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
||||
# Copyright 2019 Nick Campbell <nicholas.j.campbell@gmail.com> #
|
||||
# Copyright 2020 Huan-Cheng Chang <changhc84@gmail.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. #
|
||||
# http://pygithub.readthedocs.io/ #
|
||||
@@ -585,6 +586,20 @@ class Issue(github.GithubObject.CompletableGithubObject):
|
||||
)
|
||||
return github.Reaction.Reaction(self._requester, headers, data, completed=True)
|
||||
|
||||
def delete_reaction(self, reaction_id):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/issues/:issue_number/reactions/:reaction_id <https://developer.github.com/v3/reactions/#delete-an-issue-reaction>`_
|
||||
:param reaction_id: integer
|
||||
:rtype: bool
|
||||
"""
|
||||
assert isinstance(reaction_id, int), reaction_id
|
||||
status, _, _ = self._requester.requestJson(
|
||||
"DELETE",
|
||||
self.url + "/reactions/" + str(reaction_id),
|
||||
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
||||
)
|
||||
return status == 204
|
||||
|
||||
def get_timeline(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/issues/:number/timeline <https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue>`_
|
||||
|
||||
@@ -45,6 +45,7 @@ class Issue(CompletableGithubObject):
|
||||
@property
|
||||
def created_at(self) -> datetime: ...
|
||||
def delete_labels(self) -> None: ...
|
||||
def delete_reaction(self, reaction_id: int) -> bool: ...
|
||||
def edit(
|
||||
self,
|
||||
title: Union[str, _NotSetType] = ...,
|
||||
|
||||
+17
-1
@@ -10,10 +10,11 @@
|
||||
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
||||
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
||||
# Copyright 2017 Nicolas Agustín Torres <nicolastrres@gmail.com> #
|
||||
# Copyright 2017 Nicolas Agustín Torres <nicolastrres@gmail.com> #
|
||||
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
||||
# Copyright 2018 per1234 <accounts@perglass.com> #
|
||||
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
||||
# Copyright 2020 Huan-Cheng Chang <changhc84@gmail.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. #
|
||||
# http://pygithub.readthedocs.io/ #
|
||||
@@ -166,6 +167,21 @@ class IssueComment(github.GithubObject.CompletableGithubObject):
|
||||
)
|
||||
return github.Reaction.Reaction(self._requester, headers, data, completed=True)
|
||||
|
||||
def delete_reaction(self, reaction_id):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/issues/comments/:comment_id/reactions/:reaction_id
|
||||
<https://developer.github.com/v3/reactions/#delete-an-issue-comment-reaction>`_
|
||||
:param reaction_id: integer
|
||||
:rtype: bool
|
||||
"""
|
||||
assert isinstance(reaction_id, int), reaction_id
|
||||
status, _, _ = self._requester.requestJson(
|
||||
"DELETE",
|
||||
self.url + "/reactions/" + str(reaction_id),
|
||||
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
||||
)
|
||||
return status == 204
|
||||
|
||||
def _initAttributes(self):
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._created_at = github.GithubObject.NotSet
|
||||
|
||||
@@ -16,6 +16,7 @@ class IssueComment(CompletableGithubObject):
|
||||
@property
|
||||
def created_at(self) -> datetime: ...
|
||||
def delete(self) -> None: ...
|
||||
def delete_reaction(self, reaction_id: int) -> bool: ...
|
||||
def edit(self, body: str) -> None: ...
|
||||
def get_reactions(self) -> PaginatedList[Reaction]: ...
|
||||
@property
|
||||
|
||||
@@ -11,10 +11,11 @@
|
||||
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
||||
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
||||
# Copyright 2017 Nicolas Agustín Torres <nicolastrres@gmail.com> #
|
||||
# Copyright 2017 Nicolas Agustín Torres <nicolastrres@gmail.com> #
|
||||
# Copyright 2018 Jess Morgan <979404+JessMorgan@users.noreply.github.com> #
|
||||
# Copyright 2018 per1234 <accounts@perglass.com> #
|
||||
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
||||
# Copyright 2020 Huan-Cheng Chang <changhc84@gmail.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. #
|
||||
# http://pygithub.readthedocs.io/ #
|
||||
@@ -223,6 +224,21 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject):
|
||||
)
|
||||
return github.Reaction.Reaction(self._requester, headers, data, completed=True)
|
||||
|
||||
def delete_reaction(self, reaction_id):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/pulls/comments/:comment_id/reactions/:reaction_id
|
||||
<https://developer.github.com/v3/reactions/#delete-a-pull-request-comment-reaction>`_
|
||||
:param reaction_id: integer
|
||||
:rtype: bool
|
||||
"""
|
||||
assert isinstance(reaction_id, int), reaction_id
|
||||
status, _, _ = self._requester.requestJson(
|
||||
"DELETE",
|
||||
self.url + "/reactions/" + str(reaction_id),
|
||||
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
||||
)
|
||||
return status == 204
|
||||
|
||||
def _initAttributes(self):
|
||||
self._body = github.GithubObject.NotSet
|
||||
self._commit_id = github.GithubObject.NotSet
|
||||
|
||||
@@ -18,6 +18,7 @@ class PullRequestComment(CompletableGithubObject):
|
||||
@property
|
||||
def created_at(self) -> datetime: ...
|
||||
def delete(self) -> None: ...
|
||||
def delete_reaction(self, reaction_id: int) -> bool: ...
|
||||
@property
|
||||
def diff_hunk(self) -> str: ...
|
||||
def edit(self, body: str) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user