module GitHub.Endpoints.Organizations.Teams (
teamsOf,
teamsOf',
teamsOfR,
teamInfoFor,
teamInfoFor',
teamInfoForR,
createTeamFor',
createTeamForR,
editTeam',
editTeamR,
deleteTeam',
deleteTeamR,
listTeamMembersR,
listTeamRepos,
listTeamRepos',
listTeamReposR,
addOrUpdateTeamRepo',
addOrUpdateTeamRepoR,
teamMembershipInfoFor,
teamMembershipInfoFor',
teamMembershipInfoForR,
addTeamMembershipFor',
addTeamMembershipForR,
deleteTeamMembershipFor',
deleteTeamMembershipForR,
listTeamsCurrent',
listTeamsCurrentR,
module GitHub.Data,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import GitHub.Request
import Prelude ()
teamsOf' :: Maybe Auth -> Name Organization -> IO (Either Error (Vector SimpleTeam))
teamsOf' auth org =
executeRequestMaybe auth $ teamsOfR org FetchAll
teamsOf :: Name Organization -> IO (Either Error (Vector SimpleTeam))
teamsOf = teamsOf' Nothing
teamsOfR :: Name Organization -> FetchCount -> Request k (Vector SimpleTeam)
teamsOfR org =
pagedQuery ["orgs", toPathPart org, "teams"] []
teamInfoFor' :: Maybe Auth -> 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 -> Request k Team
teamInfoForR tid =
query ["teams", toPathPart tid] []
createTeamFor' :: Auth
-> Name Organization
-> CreateTeam
-> IO (Either Error Team)
createTeamFor' auth org cteam =
executeRequest auth $ createTeamForR org cteam
createTeamForR :: Name Organization -> CreateTeam -> Request 'RW Team
createTeamForR org cteam =
command Post ["orgs", toPathPart org, "teams"] (encode cteam)
editTeam' :: Auth
-> Id Team
-> EditTeam
-> IO (Either Error Team)
editTeam' auth tid eteam =
executeRequest auth $ editTeamR tid eteam
editTeamR :: Id Team -> EditTeam -> Request 'RW Team
editTeamR tid eteam =
command Patch ["teams", toPathPart tid] (encode eteam)
deleteTeam' :: Auth -> Id Team -> IO (Either Error ())
deleteTeam' auth tid =
executeRequest auth $ deleteTeamR tid
deleteTeamR :: Id Team -> GenRequest 'MtUnit 'RW ()
deleteTeamR tid =
Command Delete ["teams", toPathPart tid] mempty
listTeamMembersR :: Id Team -> TeamMemberRole -> FetchCount -> Request 'RA (Vector SimpleUser)
listTeamMembersR tid r =
pagedQuery ["teams", toPathPart tid, "members"] [("role", Just r')]
where
r' = case r of
TeamMemberRoleAll -> "all"
TeamMemberRoleMaintainer -> "maintainer"
TeamMemberRoleMember -> "member"
listTeamRepos' :: Maybe Auth -> Id Team -> IO (Either Error (Vector Repo))
listTeamRepos' auth tid = executeRequestMaybe auth $ listTeamReposR tid FetchAll
listTeamReposR :: Id Team -> FetchCount -> Request k (Vector Repo)
listTeamReposR tid =
pagedQuery ["teams", toPathPart tid, "repos"] []
listTeamRepos :: Id Team -> IO (Either Error (Vector Repo))
listTeamRepos = listTeamRepos' Nothing
addOrUpdateTeamRepo' :: Auth -> Id Team -> Name Organization -> Name Repo -> Permission -> IO (Either Error ())
addOrUpdateTeamRepo' auth tid org repo permission =
executeRequest auth $ addOrUpdateTeamRepoR tid org repo permission
addOrUpdateTeamRepoR :: Id Team -> Name Organization -> Name Repo -> Permission -> GenRequest 'MtUnit 'RW ()
addOrUpdateTeamRepoR tid org repo permission =
Command Put ["teams", toPathPart tid, "repos", toPathPart org, toPathPart repo] (encode $ AddTeamRepoPermission permission)
teamMembershipInfoFor' :: Maybe Auth -> Id Team -> Name Owner -> IO (Either Error TeamMembership)
teamMembershipInfoFor' auth tid user =
executeRequestMaybe auth $ teamMembershipInfoForR tid user
teamMembershipInfoForR :: Id Team -> Name Owner -> Request k TeamMembership
teamMembershipInfoForR tid user =
query ["teams", toPathPart tid, "memberships", toPathPart user] []
teamMembershipInfoFor :: Id Team -> Name Owner -> IO (Either Error TeamMembership)
teamMembershipInfoFor = teamMembershipInfoFor' Nothing
addTeamMembershipFor' :: Auth -> Id Team -> Name Owner -> Role -> IO (Either Error TeamMembership)
addTeamMembershipFor' auth tid user role =
executeRequest auth $ addTeamMembershipForR tid user role
addTeamMembershipForR :: Id Team -> Name Owner -> Role -> Request 'RW TeamMembership
addTeamMembershipForR tid user role =
command Put ["teams", toPathPart tid, "memberships", toPathPart user] (encode $ CreateTeamMembership role)
deleteTeamMembershipFor' :: Auth -> Id Team -> Name Owner -> IO (Either Error ())
deleteTeamMembershipFor' auth tid user =
executeRequest auth $ deleteTeamMembershipForR tid user
deleteTeamMembershipForR :: Id Team -> Name Owner -> GenRequest 'MtUnit 'RW ()
deleteTeamMembershipForR tid user =
Command Delete ["teams", toPathPart tid, "memberships", toPathPart user] mempty
listTeamsCurrent' :: Auth -> IO (Either Error (Vector Team))
listTeamsCurrent' auth = executeRequest auth $ listTeamsCurrentR FetchAll
listTeamsCurrentR :: FetchCount -> Request 'RA (Vector Team)
listTeamsCurrentR =
pagedQuery ["user", "teams"] []