File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
GitHub/Endpoints/Organizations Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -158,9 +158,10 @@ module GitHub (
158158 -- ** Members
159159 -- | See <https://developer.github.com/v3/orgs/members/>
160160 --
161- -- Missing endpoints: All except /Members List/
161+ -- Missing endpoints: All except /Members List/ and /Check Membership/
162162 membersOfR ,
163163 membersOfWithR ,
164+ isMemberOfR ,
164165
165166 -- ** Teams
166167 -- | See <https://developer.github.com/v3/orgs/teams/>
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ module GitHub.Endpoints.Organizations.Members (
1010 membersOf' ,
1111 membersOfR ,
1212 membersOfWithR ,
13+ isMemberOf ,
14+ isMemberOf' ,
15+ isMemberOfR ,
1316 module GitHub.Data ,
1417 ) where
1518
@@ -54,3 +57,25 @@ membersOfWithR org f r =
5457 OrgMemberRoleAll -> " all"
5558 OrgMemberRoleAdmin -> " admin"
5659 OrgMemberRoleMember -> " member"
60+
61+ -- | Check if a user is a member of an organization,
62+ -- | with or without authentication.
63+ --
64+ -- > isMemberOf' (Just $ OAuth "token") "phadej" "haskell-infra"
65+ isMemberOf' :: Maybe Auth -> Name User -> Name Organization -> IO (Either Error Bool )
66+ isMemberOf' auth user org =
67+ executeRequestMaybe auth $ isMemberOfR user org
68+
69+ -- | Check if a user is a member of an organization,
70+ -- | without authentication.
71+ --
72+ -- > isMemberOf "phadej" "haskell-infra"
73+ isMemberOf :: Name User -> Name Organization -> IO (Either Error Bool )
74+ isMemberOf = isMemberOf' Nothing
75+
76+ -- | Check if a user is a member of an organization.
77+ --
78+ -- See <https://developer.github.com/v3/orgs/members/#check-membership>
79+ isMemberOfR :: Name User -> Name Organization -> Request k Bool
80+ isMemberOfR user org = StatusQuery statusOnlyOk $
81+ Query [ " orgs" , toPathPart org, " members" , toPathPart user ] []
You can’t perform that action at this time.
0 commit comments