class Github::Orgs::Teams
def add_member(team_id, member_name, params={})
github.orgs.teams.add_member 'team-id', 'user-name'
github = Github.new :oauth_token => '...'
= Examples
In order to add a user to a team, the authenticated user must have ‘admin’ permissions to the team or be an owner of the org that the team is associated with.
Add a team member
def add_member(team_id, member_name, params={}) assert_presence_of team_id, member_name normalize! params put_request("/teams/#{team_id}/members/#{member_name}", params) end
def add_repo(team_id, user_name, repo_name, params={})
github.orgs.teams.add_repo 'team-id', 'user-name', 'repo-name'
github = Github.new :oauth_token => '...'
= Examples
by the organization.
must be owned by the organization, or a direct for of a repo owned
an owner of the org that the team is associated with. Also, the repo
In order to add a repo to a team, the authenticated user must be
Add a team repository
def add_repo(team_id, user_name, repo_name, params={}) assert_presence_of team_id, user_name, repo_name normalize! params put_request("/teams/#{team_id}/repos/#{user_name}/#{repo_name}", params) end
def create(org_name, params={})
]
"github/dotfiles"
"repo_names" => [
"permission" => "push",
"name" => "new team",
github.orgs.teams.create 'org-name',
github = Github.new :oauth_token => '...'
= Examples
* admin - team members can pull, push and administor these repositories.
* push - team members can pull and push, but not administor this repositores.
* pull - team members can pull, but not push or administor this repositories. Default
:permission - Optional string
:repo_names - Optional array of strings
:name - Required string
= Inputs
In order to create a team, the authenticated user must be an owner of:org.
Create a team
def create(org_name, params={}) assert_presence_of org_name normalize! params filter! VALID_TEAM_PARAM_NAMES, params assert_valid_values(VALID_TEAM_PARAM_VALUES, params) assert_required_keys(%w[ name ], params) post_request("/orgs/#{org_name}/teams", params) end
def delete(team_id, params={})
github.orgs.teams.delete 'team-id'
github = Github.new :oauth_token => '...'
= Examples
In order to delete a team, the authenticated user must be an owner of the org that the team is associated with
Delete a team
def delete(team_id, params={}) assert_presence_of team_id normalize! params delete_request("/teams/#{team_id}", params) end
def edit(team_id, params={})
"permission" => "push"
"name" => "new team name",
github.orgs.teams.edit 'team-id',
github = Github.new :oauth_token => '...'
= Examples
* admin - team members can pull, push and administor these repositories.
* push - team members can pull and push, but not administor this repositores.
* pull - team members can pull, but not push or administor this repositories. Default
:permission - Optional string
:name - Required string
= Inputs
In order to edit a team, the authenticated user must be an owner of the org that the team is associated with.
Edit a team
def edit(team_id, params={}) assert_presence_of team_id normalize! params filter! VALID_TEAM_PARAM_NAMES, params assert_valid_values(VALID_TEAM_PARAM_VALUES, params) assert_required_keys(%w[ name ], params) patch_request("/teams/#{team_id}", params) end
def get(team_id, params={})
github.orgs.teams.get 'team-id'
github = Github.new :oauth_token => '...'
= Examples
Get a team
def get(team_id, params={}) assert_presence_of team_id normalize! params get_request("/teams/#{team_id}", params) end
def list(org_name, params={})
github.orgs.teams.list 'org-name'
github = Github.new :oauth_token => '...'
= Examples
List teams
def list(org_name, params={}) assert_presence_of org_name normalize! params response = get_request("/orgs/#{org_name}/teams", params) return response unless block_given? response.each { |el| yield el } end
def list_members(team_id, params={})
github.orgs.teams.list_members 'team-id' { |member| ... }
github.orgs.teams.list_members 'team-id'
github = Github.new :oauth_token => '...'
= Examples
In order to list members in a team, the authenticated user must be a member of the team.
List team members
def list_members(team_id, params={}) assert_presence_of team_id normalize! params response = get_request("/teams/#{team_id}/members", params) return response unless block_given? response.each { |el| yield el } end
def list_repos(team_id, params={})
github.orgs.teams.list_repos 'team-id'
github = Github.new :oauth_token => '...'
= Examples
List team repositories
def list_repos(team_id, params={}) assert_presence_of team_id normalize! params response = get_request("/teams/#{team_id}/repos", params) return response unless block_given? response.each { |el| yield el } end
def remove_member(team_id, member_name, params={})
github.orgs.teams.remove_member 'team-id', 'member-name'
github = Github.new :oauth_token => '...'
= Examples
note: This does not delete the user, it just remove them from the team.
the team is associated with.
have ‘admin’ permissions to the team or be an owner of the org that
In order to remove a user from a team, the authenticated user must
Remove a team member
def remove_member(team_id, member_name, params={}) assert_presence_of team_id, member_name normalize! params delete_request("/teams/#{team_id}/members/#{member_name}", params) end
def remove_repo(team_id, user_name, repo_name, params={})
github.orgs.teams.remove_repo 'team-id', 'user-name', 'repo-name'
github = Github.new :oauth_token => '...'
= Examples
note: This does not delete the repo, it just removes it from the team.
an owner of the org that the team is associated with.
In order to add a repo to a team, the authenticated user must be
Remove a team repository
def remove_repo(team_id, user_name, repo_name, params={}) assert_presence_of team_id, user_name, repo_name normalize! params delete_request("/teams/#{team_id}/repos/#{user_name}/#{repo_name}", params) end
def team_member?(team_id, member_name, params={})
github.orgs.teams.team_member? 'team-id', 'user-name'
github = Github.new :oauth_token => '...'
= Examples
Check if a user is a member of a team
def team_member?(team_id, member_name, params={}) assert_presence_of team_id, member_name normalize! params get_request("/teams/#{team_id}/members/#{member_name}", params) true rescue Github::Error::NotFound false end
def team_repo?(team_id, user_name, repo_name, params={})
github.orgs.teams.team_repo? 'team-id', 'user-name', 'repo-name'
github = Github.new :oauth_token => '...'
= Examples
Check if a repository belongs to a team
def team_repo?(team_id, user_name, repo_name, params={}) assert_presence_of team_id, user_name, repo_name normalize! params get_request("/teams/#{team_id}/repos/#{user_name}/#{repo_name}", params) true rescue Github::Error::NotFound false end