module GitHub.Endpoints.Organizations.Teams (
teamsOfR,
teamInfoForR,
createTeamForR,
editTeamR,
deleteTeamR,
listTeamMembersR,
listTeamReposR,
addOrUpdateTeamRepoR,
teamMembershipInfoForR,
addTeamMembershipForR,
deleteTeamMembershipForR,
listTeamsCurrentR,
module GitHub.Data,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import Prelude ()
teamsOfR :: Name Organization -> FetchCount -> Request k (Vector SimpleTeam)
teamsOfR org =
pagedQuery ["orgs", toPathPart org, "teams"] []
teamInfoForR :: Id Team -> Request k Team
teamInfoForR tid =
query ["teams", toPathPart tid] []
createTeamForR :: Name Organization -> CreateTeam -> Request 'RW Team
createTeamForR org cteam =
command Post ["orgs", toPathPart org, "teams"] (encode cteam)
editTeamR :: Id Team -> EditTeam -> Request 'RW Team
editTeamR tid eteam =
command Patch ["teams", toPathPart tid] (encode eteam)
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"
listTeamReposR :: Id Team -> FetchCount -> Request k (Vector Repo)
listTeamReposR tid =
pagedQuery ["teams", toPathPart tid, "repos"] []
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)
teamMembershipInfoForR :: Id Team -> Name Owner -> Request k TeamMembership
teamMembershipInfoForR tid user =
query ["teams", toPathPart tid, "memberships", toPathPart user] []
addTeamMembershipForR :: Id Team -> Name Owner -> Role -> Request 'RW TeamMembership
addTeamMembershipForR tid user role =
command Put ["teams", toPathPart tid, "memberships", toPathPart user] (encode $ CreateTeamMembership role)
deleteTeamMembershipForR :: Id Team -> Name Owner -> GenRequest 'MtUnit 'RW ()
deleteTeamMembershipForR tid user =
Command Delete ["teams", toPathPart tid, "memberships", toPathPart user] mempty
listTeamsCurrentR :: FetchCount -> Request 'RA (Vector Team)
listTeamsCurrentR =
pagedQuery ["user", "teams"] []