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:
Huan-Cheng Chang
2020-10-26 16:40:46 +11:00
committed by GitHub
parent 3ec145f221
commit f7d203c083
17 changed files with 134 additions and 7 deletions
+17 -1
View File
@@ -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