Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c21d78a

Browse files
authored
Merge pull request haskell-github#424 from TomMD/feature/add-comment-replies-endpoint
Add support for the comment reply endpoint
2 parents 09e1708 + e4ddc1a commit c21d78a

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/GitHub/Data/Comments.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,15 @@ instance ToJSON NewPullComment where
8383
, "path" .= path
8484
, "position" .= pos
8585
]
86+
87+
data PullCommentReply = PullCommentReply
88+
{ pullCommentReplyBody :: Text
89+
}
90+
deriving (Show, Data, Typeable, Eq, Ord, Generic)
91+
92+
instance NFData PullCommentReply where rnf = genericRnf
93+
94+
instance ToJSON PullCommentReply where
95+
toJSON (PullCommentReply b) =
96+
object [ "body" .= b
97+
]

src/GitHub/Endpoints/PullRequests/Comments.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module GitHub.Endpoints.PullRequests.Comments (
99
pullRequestCommentsR,
1010
pullRequestCommentR,
1111
createPullCommentR,
12+
createPullCommentReplyR,
1213
module GitHub.Data,
1314
) where
1415

@@ -36,3 +37,13 @@ createPullCommentR user repo iss commit path position body =
3637
command Post parts (encode $ NewPullComment commit path position body)
3738
where
3839
parts = ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart iss, "comments"]
40+
41+
-- | Create a comment reply.
42+
--
43+
-- See <https://developer.github.com/v3/pulls/comments/#create-a-review-comment-reply>
44+
createPullCommentReplyR :: Name Owner -> Name Repo -> IssueNumber -> Id Comment -> Text -> Request 'RW Comment
45+
createPullCommentReplyR user repo iss cid body =
46+
command Post parts (encode $ PullCommentReply body)
47+
where
48+
parts = ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart iss
49+
, "comments", toPathPart cid, "replies"]

0 commit comments

Comments
 (0)