module GitHub.Endpoints.PullRequests.Comments (
pullRequestCommentsR,
pullRequestCommentR,
createPullCommentR,
createPullCommentReplyR,
module GitHub.Data,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import Prelude ()
pullRequestCommentsR :: Name Owner -> Name Repo -> IssueNumber -> FetchCount -> Request k (Vector Comment)
Name Owner
user Name Repo
repo IssueNumber
prid =
Paths -> QueryString -> FetchCount -> Request k (Vector Comment)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery [Text
"repos", Name Owner -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, Name Repo -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, Text
"pulls", IssueNumber -> Text
forall a. IsPathPart a => a -> Text
toPathPart IssueNumber
prid, Text
"comments"] []
pullRequestCommentR :: Name Owner -> Name Repo -> Id Comment -> Request k Comment
Name Owner
user Name Repo
repo Id Comment
cid =
Paths -> QueryString -> Request k Comment
forall (mt :: RW) a. Paths -> QueryString -> Request mt a
query [Text
"repos", Name Owner -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, Name Repo -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, Text
"pulls", Text
"comments", Id Comment -> Text
forall a. IsPathPart a => a -> Text
toPathPart Id Comment
cid] []
createPullCommentR :: Name Owner -> Name Repo -> IssueNumber -> Text -> Text -> Int -> Text -> Request 'RW Comment
Name Owner
user Name Repo
repo IssueNumber
iss Text
commit Text
path Int
position Text
body =
CommandMethod -> Paths -> ByteString -> Request 'RW Comment
forall a. CommandMethod -> Paths -> ByteString -> Request 'RW a
command CommandMethod
Post Paths
parts (NewPullComment -> ByteString
forall a. ToJSON a => a -> ByteString
encode (NewPullComment -> ByteString) -> NewPullComment -> ByteString
forall a b. (a -> b) -> a -> b
$ Text -> Text -> Int -> Text -> NewPullComment
NewPullComment Text
commit Text
path Int
position Text
body)
where
parts :: Paths
parts = [Text
"repos", Name Owner -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, Name Repo -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, Text
"pulls", IssueNumber -> Text
forall a. IsPathPart a => a -> Text
toPathPart IssueNumber
iss, Text
"comments"]
createPullCommentReplyR :: Name Owner -> Name Repo -> IssueNumber -> Id Comment -> Text -> Request 'RW Comment
Name Owner
user Name Repo
repo IssueNumber
iss Id Comment
cid Text
body =
CommandMethod -> Paths -> ByteString -> Request 'RW Comment
forall a. CommandMethod -> Paths -> ByteString -> Request 'RW a
command CommandMethod
Post Paths
parts (PullCommentReply -> ByteString
forall a. ToJSON a => a -> ByteString
encode (PullCommentReply -> ByteString) -> PullCommentReply -> ByteString
forall a b. (a -> b) -> a -> b
$ Text -> PullCommentReply
PullCommentReply Text
body)
where
parts :: Paths
parts = [Text
"repos", Name Owner -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, Name Repo -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, Text
"pulls", IssueNumber -> Text
forall a. IsPathPart a => a -> Text
toPathPart IssueNumber
iss
, Text
"comments", Id Comment -> Text
forall a. IsPathPart a => a -> Text
toPathPart Id Comment
cid, Text
"replies"]