module GitHub.Endpoints.Repos.Deployments
( deploymentsWithOptionsForR
, createDeploymentR
, deploymentStatusesForR
, createDeploymentStatusR
, module GitHub.Data
) where
import Control.Arrow (second)
import GitHub.Data
import GitHub.Internal.Prelude
deploymentsWithOptionsForR
:: FromJSON a
=> Name Owner
-> Name Repo
-> FetchCount
-> [DeploymentQueryOption]
-> Request 'RA (Vector (Deployment a))
deploymentsWithOptionsForR :: Name Owner
-> Name Repo
-> FetchCount
-> [DeploymentQueryOption]
-> Request 'RA (Vector (Deployment a))
deploymentsWithOptionsForR Name Owner
owner Name Repo
repo FetchCount
limit [DeploymentQueryOption]
opts =
Paths
-> QueryString -> FetchCount -> Request 'RA (Vector (Deployment a))
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery (Name Owner -> Name Repo -> Paths
deployPaths Name Owner
owner Name Repo
repo)
((DeploymentQueryOption -> (ByteString, Maybe ByteString))
-> [DeploymentQueryOption] -> QueryString
forall a b. (a -> b) -> [a] -> [b]
map ((ByteString -> Maybe ByteString)
-> (ByteString, ByteString) -> (ByteString, Maybe ByteString)
forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (d, b) (d, c)
second ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just ((ByteString, ByteString) -> (ByteString, Maybe ByteString))
-> (DeploymentQueryOption -> (ByteString, ByteString))
-> DeploymentQueryOption
-> (ByteString, Maybe ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DeploymentQueryOption -> (ByteString, ByteString)
renderDeploymentQueryOption) [DeploymentQueryOption]
opts)
FetchCount
limit
createDeploymentR
:: ( ToJSON a
, FromJSON a
)
=> Name Owner
-> Name Repo
-> CreateDeployment a
-> Request 'RW (Deployment a)
createDeploymentR :: Name Owner
-> Name Repo -> CreateDeployment a -> Request 'RW (Deployment a)
createDeploymentR Name Owner
owner Name Repo
repo =
CommandMethod -> Paths -> ByteString -> Request 'RW (Deployment a)
forall a. CommandMethod -> Paths -> ByteString -> Request 'RW a
command CommandMethod
Post (Name Owner -> Name Repo -> Paths
deployPaths Name Owner
owner Name Repo
repo) (ByteString -> Request 'RW (Deployment a))
-> (CreateDeployment a -> ByteString)
-> CreateDeployment a
-> Request 'RW (Deployment a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CreateDeployment a -> ByteString
forall a. ToJSON a => a -> ByteString
encode
deploymentStatusesForR
:: Name Owner
-> Name Repo
-> Id (Deployment a)
-> FetchCount
-> Request 'RA (Vector DeploymentStatus)
deploymentStatusesForR :: Name Owner
-> Name Repo
-> Id (Deployment a)
-> FetchCount
-> Request 'RA (Vector DeploymentStatus)
deploymentStatusesForR Name Owner
owner Name Repo
repo Id (Deployment a)
deploy =
Paths
-> QueryString
-> FetchCount
-> Request 'RA (Vector DeploymentStatus)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery (Name Owner -> Name Repo -> Id (Deployment a) -> Paths
forall a. Name Owner -> Name Repo -> Id (Deployment a) -> Paths
statusesPaths Name Owner
owner Name Repo
repo Id (Deployment a)
deploy) []
createDeploymentStatusR
:: Name Owner
-> Name Repo
-> Id (Deployment a)
-> CreateDeploymentStatus
-> Request 'RW DeploymentStatus
createDeploymentStatusR :: Name Owner
-> Name Repo
-> Id (Deployment a)
-> CreateDeploymentStatus
-> Request 'RW DeploymentStatus
createDeploymentStatusR Name Owner
owner Name Repo
repo Id (Deployment a)
deploy =
CommandMethod
-> Paths -> ByteString -> Request 'RW DeploymentStatus
forall a. CommandMethod -> Paths -> ByteString -> Request 'RW a
command CommandMethod
Post (Name Owner -> Name Repo -> Id (Deployment a) -> Paths
forall a. Name Owner -> Name Repo -> Id (Deployment a) -> Paths
statusesPaths Name Owner
owner Name Repo
repo Id (Deployment a)
deploy) (ByteString -> Request 'RW DeploymentStatus)
-> (CreateDeploymentStatus -> ByteString)
-> CreateDeploymentStatus
-> Request 'RW DeploymentStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CreateDeploymentStatus -> ByteString
forall a. ToJSON a => a -> ByteString
encode
statusesPaths :: Name Owner -> Name Repo -> Id (Deployment a) -> Paths
statusesPaths :: Name Owner -> Name Repo -> Id (Deployment a) -> Paths
statusesPaths Name Owner
owner Name Repo
repo Id (Deployment a)
deploy =
Name Owner -> Name Repo -> Paths
deployPaths Name Owner
owner Name Repo
repo Paths -> Paths -> Paths
forall a. [a] -> [a] -> [a]
++ [Id (Deployment a) -> Text
forall a. IsPathPart a => a -> Text
toPathPart Id (Deployment a)
deploy, Text
"statuses"]
deployPaths :: Name Owner -> Name Repo -> Paths
deployPaths :: Name Owner -> Name Repo -> Paths
deployPaths Name Owner
owner Name Repo
repo =
[Text
"repos", Name Owner -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Owner
owner, Name Repo -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, Text
"deployments"]