Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add repos function for teams #182

Merged
merged 1 commit into from
Jul 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ GitHub.jl implements a bunch of methods that make REST requests to GitHub's API.


#### Teams
| method | return type | documentation |
|-----------------|------------------------------|----------------------------------------------------------------------------------------------|
| `members(team)` | `Tuple{Vector{Owner}, Dict}` | get team members as [users](https://developer.github.com/v3/orgs/teams/#get-team-membership) |
| method | return type | documentation |
|----------------------|------------------------------|----------------------------------------------------------------------------------------------------------|
| `members(team)` | `Tuple{Vector{Owner}, Dict}` | get team members as [users](https://developer.github.com/v3/orgs/teams/#get-team-membership) |
| `repos(owner, team)` | `Tuple{Vector{Repo}, Dict}` | get team repositories as [users](https://docs.github.com/en/rest/reference/teams#list-team-repositories) |


#### Repositories
Expand Down
5 changes: 5 additions & 0 deletions src/owners/teams.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ namefield(t::Team) = t.id
results, page_data = gh_get_paged_json(api, "/teams/$(name(team))/members"; options...)
return map(Owner, results), page_data
end

@api_default function repos(api::GitHubAPI, owner::Owner, team::Team; options...)
results, page_data = gh_get_paged_json(api, "/orgs/$(owner.login)/teams/$(team.slug)/repos"; options...)
return map(Repo, results), page_data
end