{-# LANGUAGE OverloadedStrings #-}
module GitLab.API.Pipelines where
import Control.Monad.IO.Unlift
import Data.Either
import qualified Data.Text as T
import GitLab.Types
import GitLab.WebRequests.GitLabWebCalls
import Network.HTTP.Types.Status
pipelines ::
(MonadIO m) =>
Project ->
GitLab m [Pipeline]
pipelines p = do
result <- pipelines' (project_id p)
return (fromRight (error "pipelines error") result)
pipelines' ::
(MonadIO m) =>
Int ->
GitLab m (Either Status [Pipeline])
pipelines' projectId =
gitlabWithAttrs
addr
"&sort=desc"
where
addr =
"/projects/"
<> T.pack (show projectId)
<> "/pipelines"