module GitHub.Endpoints.Issues.Comments (
commentR,
commentsR,
createCommentR,
deleteCommentR,
editCommentR,
module GitHub.Data,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import Prelude ()
commentR :: Name Owner -> Name Repo -> Id Comment -> Request k IssueComment
Name Owner
user Name Repo
repo Id Comment
cid =
Paths -> QueryString -> Request k IssueComment
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
"issues", Text
"comments", Id Comment -> Text
forall a. IsPathPart a => a -> Text
toPathPart Id Comment
cid] []
commentsR :: Name Owner -> Name Repo -> IssueNumber -> FetchCount -> Request k (Vector IssueComment)
Name Owner
user Name Repo
repo IssueNumber
iid =
Paths
-> QueryString -> FetchCount -> Request k (Vector IssueComment)
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
"issues", IssueNumber -> Text
forall a. IsPathPart a => a -> Text
toPathPart IssueNumber
iid, Text
"comments"] []
createCommentR :: Name Owner -> Name Repo -> IssueNumber -> Text -> Request 'RW Comment
Name Owner
user Name Repo
repo IssueNumber
iss Text
body =
CommandMethod -> Paths -> ByteString -> Request 'RW Comment
forall a. CommandMethod -> Paths -> ByteString -> Request 'RW a
command CommandMethod
Post Paths
parts (NewComment -> ByteString
forall a. ToJSON a => a -> ByteString
encode (NewComment -> ByteString) -> NewComment -> ByteString
forall a b. (a -> b) -> a -> b
$ Text -> NewComment
NewComment 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
"issues", IssueNumber -> Text
forall a. IsPathPart a => a -> Text
toPathPart IssueNumber
iss, Text
"comments"]
editCommentR :: Name Owner -> Name Repo -> Id Comment -> Text -> Request 'RW Comment
Name Owner
user Name Repo
repo Id Comment
commid Text
body =
CommandMethod -> Paths -> ByteString -> Request 'RW Comment
forall a. CommandMethod -> Paths -> ByteString -> Request 'RW a
command CommandMethod
Patch Paths
parts (EditComment -> ByteString
forall a. ToJSON a => a -> ByteString
encode (EditComment -> ByteString) -> EditComment -> ByteString
forall a b. (a -> b) -> a -> b
$ Text -> EditComment
EditComment 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
"issues", Text
"comments", Id Comment -> Text
forall a. IsPathPart a => a -> Text
toPathPart Id Comment
commid]
deleteCommentR :: Name Owner -> Name Repo -> Id Comment -> GenRequest 'MtUnit 'RW ()
Name Owner
user Name Repo
repo Id Comment
commid =
CommandMethod -> Paths -> ByteString -> GenRequest 'MtUnit 'RW ()
forall (mt :: MediaType (*)) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command CommandMethod
Delete Paths
parts ByteString
forall a. Monoid a => a
mempty
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
"issues", Text
"comments", Id Comment -> Text
forall a. IsPathPart a => a -> Text
toPathPart Id Comment
commid]