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