module GitHub.Endpoints.Organizations.Members (
membersOfR,
membersOfWithR,
isMemberOfR,
orgInvitationsR,
module GitHub.Data,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import Prelude ()
membersOfR :: Name Organization -> FetchCount -> Request k (Vector SimpleUser)
membersOfR :: forall (k :: RW).
Name Organization -> FetchCount -> Request k (Vector SimpleUser)
membersOfR Name Organization
organization =
Paths -> QueryString -> FetchCount -> Request k (Vector SimpleUser)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery [Text
"orgs", Name Organization -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Organization
organization, Text
"members"] []
membersOfWithR :: Name Organization -> OrgMemberFilter -> OrgMemberRole -> FetchCount -> Request k (Vector SimpleUser)
membersOfWithR :: forall (k :: RW).
Name Organization
-> OrgMemberFilter
-> OrgMemberRole
-> FetchCount
-> Request k (Vector SimpleUser)
membersOfWithR Name Organization
org OrgMemberFilter
f OrgMemberRole
r =
Paths -> QueryString -> FetchCount -> Request k (Vector SimpleUser)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery [Text
"orgs", Name Organization -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Organization
org, Text
"members"] [(ByteString
"filter", ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just ByteString
f'), (ByteString
"role", ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just ByteString
r')]
where
f' :: ByteString
f' = case OrgMemberFilter
f of
OrgMemberFilter
OrgMemberFilter2faDisabled -> ByteString
"2fa_disabled"
OrgMemberFilter
OrgMemberFilterAll -> ByteString
"all"
r' :: ByteString
r' = case OrgMemberRole
r of
OrgMemberRole
OrgMemberRoleAll -> ByteString
"all"
OrgMemberRole
OrgMemberRoleAdmin -> ByteString
"admin"
OrgMemberRole
OrgMemberRoleMember -> ByteString
"member"
isMemberOfR :: Name User -> Name Organization -> GenRequest 'MtStatus rw Bool
isMemberOfR :: forall (rw :: RW).
Name User -> Name Organization -> GenRequest 'MtStatus rw Bool
isMemberOfR Name User
user Name Organization
org =
Paths -> QueryString -> GenRequest 'MtStatus rw Bool
forall (mt :: MediaType (*)) (rw :: RW) a.
Paths -> QueryString -> GenRequest mt rw a
Query [ Text
"orgs", Name Organization -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Organization
org, Text
"members", Name User -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name User
user ] []
orgInvitationsR :: Name Organization -> FetchCount -> Request 'RA (Vector Invitation)
orgInvitationsR :: Name Organization -> FetchCount -> Request 'RA (Vector Invitation)
orgInvitationsR Name Organization
org = Paths
-> QueryString -> FetchCount -> Request 'RA (Vector Invitation)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery [Text
"orgs", Name Organization -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Organization
org, Text
"invitations"] []