module GitHub.Endpoints.Gists (
gistsR,
gistR,
createGistR,
starGistR,
unstarGistR,
deleteGistR,
module GitHub.Data,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import Prelude ()
gistsR :: Name Owner -> FetchCount -> Request k (Vector Gist)
gistsR :: Name Owner -> FetchCount -> Request k (Vector Gist)
gistsR Name Owner
user = Paths -> QueryString -> FetchCount -> Request k (Vector Gist)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery [Text
"users", Name Owner -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, Text
"gists"] []
gistR :: Name Gist -> Request k Gist
gistR :: Name Gist -> Request k Gist
gistR Name Gist
gid =
Paths -> QueryString -> Request k Gist
forall (mt :: RW) a. Paths -> QueryString -> Request mt a
query [Text
"gists", Name Gist -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Gist
gid] []
createGistR :: NewGist -> Request 'RW Gist
createGistR :: NewGist -> Request 'RW Gist
createGistR NewGist
ngist = CommandMethod -> Paths -> ByteString -> Request 'RW Gist
forall a. CommandMethod -> Paths -> ByteString -> Request 'RW a
command CommandMethod
Post [Text
"gists"] (NewGist -> ByteString
forall a. ToJSON a => a -> ByteString
encode NewGist
ngist)
starGistR :: Name Gist -> GenRequest 'MtUnit 'RW ()
starGistR :: Name Gist -> GenRequest 'MtUnit 'RW ()
starGistR Name Gist
gid = CommandMethod -> Paths -> ByteString -> GenRequest 'MtUnit 'RW ()
forall (mt :: MediaType *) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command CommandMethod
Put [Text
"gists", Name Gist -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Gist
gid, Text
"star"] ByteString
forall a. Monoid a => a
mempty
unstarGistR :: Name Gist -> GenRequest 'MtUnit 'RW ()
unstarGistR :: Name Gist -> GenRequest 'MtUnit 'RW ()
unstarGistR Name Gist
gid = CommandMethod -> Paths -> ByteString -> GenRequest 'MtUnit 'RW ()
forall (mt :: MediaType *) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command CommandMethod
Delete [Text
"gists", Name Gist -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Gist
gid, Text
"star"] ByteString
forall a. Monoid a => a
mempty
deleteGistR :: Name Gist -> GenRequest 'MtUnit 'RW ()
deleteGistR :: Name Gist -> GenRequest 'MtUnit 'RW ()
deleteGistR Name Gist
gid = CommandMethod -> Paths -> ByteString -> GenRequest 'MtUnit 'RW ()
forall (mt :: MediaType *) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command CommandMethod
Delete [Text
"gists", Name Gist -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Gist
gid] ByteString
forall a. Monoid a => a
mempty