-- | <https://developer.github.com/v3/git/refs/#delete-a-reference>
module GitHub.Endpoints.GitData.References.Delete
    ( deleteReference
    , deleteReferenceR
    )
where

import Prelude

import GitHub.Data
import GitHub.Request

deleteReference
    :: Auth
    -> Name Owner
    -> Name Repo
    -> Name GitReference
    -> IO (Either Error ())
deleteReference :: Auth
-> Name Owner
-> Name Repo
-> Name GitReference
-> IO (Either Error ())
deleteReference auth :: Auth
auth user :: Name Owner
user repo :: Name Repo
repo ref :: Name GitReference
ref =
    Auth -> GenRequest 'MtUnit 'RW () -> IO (Either Error ())
forall am (mt :: MediaType *) a (rw :: RW).
(AuthMethod am, ParseResponse mt a) =>
am -> GenRequest mt rw a -> IO (Either Error a)
executeRequest Auth
auth (GenRequest 'MtUnit 'RW () -> IO (Either Error ()))
-> GenRequest 'MtUnit 'RW () -> IO (Either Error ())
forall a b. (a -> b) -> a -> b
$ Name Owner
-> Name Repo -> Name GitReference -> GenRequest 'MtUnit 'RW ()
deleteReferenceR Name Owner
user Name Repo
repo Name GitReference
ref

deleteReferenceR
    :: Name Owner
    -> Name Repo
    -> Name GitReference
    -> GenRequest 'MtUnit 'RW ()
deleteReferenceR :: Name Owner
-> Name Repo -> Name GitReference -> GenRequest 'MtUnit 'RW ()
deleteReferenceR user :: Name Owner
user repo :: Name Repo
repo ref :: Name GitReference
ref = CommandMethod -> Paths -> ByteString -> GenRequest 'MtUnit 'RW ()
forall (mt :: MediaType *) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command CommandMethod
Delete Paths
path ByteString
forall a. Monoid a => a
mempty
  where
    path :: Paths
path =
        [ "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
        , "git"
        , "refs"
        , Name GitReference -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name GitReference
ref
        ]