Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 1 addition & 3 deletions src/GitHub.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,10 @@ module GitHub (
-- ** Comments
-- | See <https://developer.github.com/v3/issues/comments/>
--
-- Missing endpoints:
--
-- * Delete comment
commentR,
commentsR,
createCommentR,
deleteCommentR,
editCommentR,

-- ** Events
Expand Down
18 changes: 18 additions & 0 deletions src/GitHub/Endpoints/Issues/Comments.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module GitHub.Endpoints.Issues.Comments (
comments',
createComment,
createCommentR,
deleteComment,
deleteCommentR,
editComment,
editCommentR,
module GitHub.Data,
Expand Down Expand Up @@ -88,3 +90,19 @@ editCommentR user repo commid body =
command Patch parts (encode $ EditComment body)
where
parts = ["repos", toPathPart user, toPathPart repo, "issues", "comments", toPathPart commid]

-- | Delete a comment.
--
-- > deleteComment (User (user, password)) user repo commentid
deleteComment :: Auth -> Name Owner -> Name Repo -> Id Comment
-> IO (Either Error ())
deleteComment auth user repo commid =
executeRequest auth $ deleteCommentR user repo commid

-- | Delete a comment.
-- See <https://developer.github.com/v3/issues/comments/#delete-a-comment>
deleteCommentR :: Name Owner -> Name Repo -> Id Comment -> Request 'RW ()
deleteCommentR user repo commid =
command Delete parts mempty
where
parts = ["repos", toPathPart user, toPathPart repo, "issues", "comments", toPathPart commid]