module GitHub.Endpoints.Organizations.Members (
membersOf,
membersOf',
membersOfR,
membersOfWithR,
isMemberOf,
isMemberOf',
isMemberOfR,
orgInvitationsR,
module GitHub.Data,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import GitHub.Request
import Prelude ()
membersOf' :: Maybe Auth -> Name Organization -> IO (Either Error (Vector SimpleUser))
membersOf' auth org =
executeRequestMaybe auth $ membersOfR org FetchAll
membersOf :: Name Organization -> IO (Either Error (Vector SimpleUser))
membersOf = membersOf' Nothing
membersOfR :: Name Organization -> FetchCount -> Request k (Vector SimpleUser)
membersOfR organization =
pagedQuery ["orgs", toPathPart organization, "members"] []
membersOfWithR :: Name Organization -> OrgMemberFilter -> OrgMemberRole -> FetchCount -> Request k (Vector SimpleUser)
membersOfWithR org f r =
pagedQuery ["orgs", toPathPart org, "members"] [("filter", Just f'), ("role", Just r')]
where
f' = case f of
OrgMemberFilter2faDisabled -> "2fa_disabled"
OrgMemberFilterAll -> "all"
r' = case r of
OrgMemberRoleAll -> "all"
OrgMemberRoleAdmin -> "admin"
OrgMemberRoleMember -> "member"
isMemberOf' :: Maybe Auth -> Name User -> Name Organization -> IO (Either Error Bool)
isMemberOf' auth user org =
executeRequestMaybe auth $ isMemberOfR user org
isMemberOf :: Name User -> Name Organization -> IO (Either Error Bool)
isMemberOf = isMemberOf' Nothing
isMemberOfR :: Name User -> Name Organization -> GenRequest 'MtStatus rw Bool
isMemberOfR user org =
Query [ "orgs", toPathPart org, "members", toPathPart user ] []
orgInvitationsR :: Name Organization -> FetchCount -> Request 'RA (Vector Invitation)
orgInvitationsR org = pagedQuery ["orgs", toPathPart org, "invitations"] []