Skip to content

Commit

Permalink
add way to get org members
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Sep 29, 2023
1 parent 5ae97ba commit a7efd5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/owners/owners.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions test/read_only_api_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit a7efd5b

Please sign in to comment.