diff --git a/src/owners/owners.jl b/src/owners/owners.jl index 82b7134..d29eeda 100644 --- a/src/owners/owners.jl +++ b/src/owners/owners.jl @@ -79,6 +79,12 @@ end end end +@api_default function members(api::GitHubAPI, org::Owner; public_only=false, options...) + scope = public_only ? "public_members" : "members" + results, page_data = gh_get_paged_json(api, "/orgs/$(name(org))/$scope"; options...) + map(Owner, results), page_data +end + @api_default function orgs(api::GitHubAPI, owner; options...) results, page_data = gh_get_paged_json(api, "/users/$(name(owner))/orgs"; options...) return map(Owner, results), page_data diff --git a/test/read_only_api_tests.jl b/test/read_only_api_tests.jl index 21a7c6e..860b7a3 100644 --- a/test/read_only_api_tests.jl +++ b/test/read_only_api_tests.jl @@ -41,6 +41,8 @@ auth = authenticate(string(circshift(["bcc", "3fc", "03a", "33e", # test GitHub.orgs @test hasghobj("JuliaWeb", first(orgs("jrevels"; auth = auth))) + members, _ = members(Owner("JuliaLang"); auth = auth) + @test length(members) > 1 # test GitHub.followers, GitHub.following @test hasghobj("jrevels", first(followers(testuser; auth = auth)))