-----------------------------------------------------------------------------
-- |
-- License     :  BSD-3-Clause
-- Maintainer  :  Oleg Grenrus <oleg.grenrus@iki.fi>
--
-- The loving comments people have left on Gists, described on
-- <http://developer.github.com/v3/gists/comments/>.
module GitHub.Endpoints.Gists.Comments (
    commentsOnR,
    gistCommentR,
    module GitHub.Data,
    ) where

import GitHub.Data
import GitHub.Internal.Prelude
import Prelude ()

-- | List comments on a gist.
-- See <https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist>
commentsOnR :: Name Gist -> FetchCount -> Request k (Vector GistComment)
commentsOnR :: Name Gist -> FetchCount -> Request k (Vector GistComment)
commentsOnR Name Gist
gid =
    Paths
-> QueryString -> FetchCount -> Request k (Vector GistComment)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery [Text
"gists", Name Gist -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Gist
gid, Text
"comments"] []

-- | Query a single comment.
-- See <https://developer.github.com/v3/gists/comments/#get-a-single-comment>
gistCommentR :: Id GistComment -> Request k GistComment
gistCommentR :: Id GistComment -> Request k GistComment
gistCommentR Id GistComment
cid =
    Paths -> QueryString -> Request k GistComment
forall (mt :: RW) a. Paths -> QueryString -> Request mt a
query [Text
"gists", Text
"comments", Id GistComment -> Text
forall a. IsPathPart a => a -> Text
toPathPart Id GistComment
cid] []