module Github.Organizations.Teams (
teamsOf,
teamsOf',
teamsOfR,
teamInfoFor,
teamInfoFor',
teamInfoForR,
createTeamFor',
createTeamForR,
editTeam',
editTeamR,
deleteTeam',
deleteTeamR,
teamMembershipInfoFor,
teamMembershipInfoFor',
teamMembershipInfoForR,
addTeamMembershipFor',
addTeamMembershipForR,
deleteTeamMembershipFor',
deleteTeamMembershipForR,
listTeamsCurrent',
listTeamsCurrentR,
module Github.Data,
) where
import Data.Aeson.Compat (encode)
import Data.Vector (Vector)
import Github.Auth
import Github.Data
import Github.Request
teamsOf' :: Maybe GithubAuth -> Name Organization -> IO (Either Error (Vector SimpleTeam))
teamsOf' auth org =
executeRequestMaybe auth $ teamsOfR org Nothing
teamsOf :: Name Organization -> IO (Either Error (Vector SimpleTeam))
teamsOf = teamsOf' Nothing
teamsOfR :: Name Organization -> Maybe Count -> GithubRequest k (Vector SimpleTeam)
teamsOfR org = GithubPagedGet ["orgs", toPathPart org, "teams"] []
teamInfoFor' :: Maybe GithubAuth -> Id Team -> IO (Either Error Team)
teamInfoFor' auth tid =
executeRequestMaybe auth $ teamInfoForR tid
teamInfoFor :: Id Team -> IO (Either Error Team)
teamInfoFor = teamInfoFor' Nothing
teamInfoForR :: Id Team -> GithubRequest k Team
teamInfoForR tid =
GithubGet ["teams", toPathPart tid] []
createTeamFor' :: GithubAuth
-> Name Organization
-> CreateTeam
-> IO (Either Error Team)
createTeamFor' auth org cteam =
executeRequest auth $ createTeamForR org cteam
createTeamForR :: Name Organization -> CreateTeam -> GithubRequest 'True Team
createTeamForR org cteam =
GithubPost Post ["orgs", toPathPart org, "teams"] (encode cteam)
editTeam' :: GithubAuth
-> Id Team
-> EditTeam
-> IO (Either Error Team)
editTeam' auth tid eteam =
executeRequest auth $ editTeamR tid eteam
editTeamR :: Id Team -> EditTeam -> GithubRequest 'True Team
editTeamR tid eteam =
GithubPost Patch ["teams", toPathPart tid] (encode eteam)
deleteTeam' :: GithubAuth -> Id Team -> IO (Either Error ())
deleteTeam' auth tid =
executeRequest auth $ deleteTeamR tid
deleteTeamR :: Id Team -> GithubRequest 'True ()
deleteTeamR tid =
GithubDelete ["teams", toPathPart tid]
teamMembershipInfoFor' :: Maybe GithubAuth -> Id Team -> Name GithubOwner -> IO (Either Error TeamMembership)
teamMembershipInfoFor' auth tid user =
executeRequestMaybe auth $ teamMembershipInfoForR tid user
teamMembershipInfoForR :: Id Team -> Name GithubOwner -> GithubRequest k TeamMembership
teamMembershipInfoForR tid user =
GithubGet ["teams", toPathPart tid, "memberships", toPathPart user] []
teamMembershipInfoFor :: Id Team -> Name GithubOwner -> IO (Either Error TeamMembership)
teamMembershipInfoFor = teamMembershipInfoFor' Nothing
addTeamMembershipFor' :: GithubAuth -> Id Team -> Name GithubOwner -> Role-> IO (Either Error TeamMembership)
addTeamMembershipFor' auth tid user role =
executeRequest auth $ addTeamMembershipForR tid user role
addTeamMembershipForR :: Id Team -> Name GithubOwner -> Role -> GithubRequest 'True TeamMembership
addTeamMembershipForR tid user role =
GithubPost Put ["teams", toPathPart tid, "memberships", toPathPart user] (encode $ CreateTeamMembership role)
deleteTeamMembershipFor' :: GithubAuth -> Id Team -> Name GithubOwner -> IO (Either Error ())
deleteTeamMembershipFor' auth tid user =
executeRequest auth $ deleteTeamMembershipForR tid user
deleteTeamMembershipForR :: Id Team -> Name GithubOwner -> GithubRequest 'True ()
deleteTeamMembershipForR tid user =
GithubDelete ["teams", toPathPart tid, "memberships", toPathPart user]
listTeamsCurrent' :: GithubAuth -> IO (Either Error (Vector Team))
listTeamsCurrent' auth = executeRequest auth $ listTeamsCurrentR Nothing
listTeamsCurrentR :: Maybe Count -> GithubRequest 'True (Vector Team)
listTeamsCurrentR = GithubPagedGet ["user", "teams"] []