{-# LANGUAGE OverloadedStrings #-}
module GitLab.API.Branches where
import Data.Either
import qualified Data.Text as T
import GitLab.Types
import GitLab.WebRequests.GitLabWebCalls
import Network.HTTP.Types.Status
branches :: Project -> GitLab [Branch]
branches project = do
result <- branches' (project_id project)
return (fromRight (error "branches error") result)
branches' :: Int -> GitLab (Either Status [Branch])
branches' projectId =
gitlab addr
where
addr =
"/projects/"
<> T.pack (show projectId)
<> "/repository"
<> "/branches"