module GitHub.Endpoints.GitData.References (
referenceR,
referencesR,
createReferenceR,
deleteReferenceR,
namespacedReferencesR,
module GitHub.Data,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import Prelude ()
referenceR :: Name Owner -> Name Repo -> Name GitReference -> Request k GitReference
referenceR :: Name Owner
-> Name Repo -> Name GitReference -> Request k GitReference
referenceR Name Owner
user Name Repo
repo Name GitReference
ref =
Paths -> QueryString -> Request k GitReference
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
"git", Text
"refs", Name GitReference -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name GitReference
ref] []
referencesR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector GitReference)
referencesR :: Name Owner
-> Name Repo -> FetchCount -> Request k (Vector GitReference)
referencesR Name Owner
user Name Repo
repo =
Paths
-> QueryString -> FetchCount -> Request k (Vector GitReference)
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
"git", Text
"refs"] []
createReferenceR :: Name Owner -> Name Repo -> NewGitReference -> Request 'RW GitReference
createReferenceR :: Name Owner
-> Name Repo -> NewGitReference -> Request 'RW GitReference
createReferenceR Name Owner
user Name Repo
repo NewGitReference
newRef =
CommandMethod -> Paths -> ByteString -> Request 'RW GitReference
forall a. CommandMethod -> Paths -> ByteString -> Request 'RW a
command CommandMethod
Post [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
"git", Text
"refs"] (NewGitReference -> ByteString
forall a. ToJSON a => a -> ByteString
encode NewGitReference
newRef)
deleteReferenceR :: Name Owner -> Name Repo -> Name GitReference -> GenRequest 'MtUnit 'RW ()
deleteReferenceR :: Name Owner
-> Name Repo -> Name GitReference -> GenRequest 'MtUnit 'RW ()
deleteReferenceR Name Owner
user Name Repo
repo Name GitReference
ref =
CommandMethod -> Paths -> ByteString -> GenRequest 'MtUnit 'RW ()
forall (mt :: MediaType *) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command CommandMethod
Delete [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
"git", Text
"refs", Name GitReference -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name GitReference
ref] ByteString
forall a. Monoid a => a
mempty
namespacedReferencesR :: Name Owner -> Name Repo -> Text -> Request k [GitReference]
namespacedReferencesR :: Name Owner -> Name Repo -> Text -> Request k [GitReference]
namespacedReferencesR Name Owner
user Name Repo
repo Text
namespace =
Paths -> QueryString -> Request k [GitReference]
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
"git", Text
"refs", Text
namespace] []