class Github::Orgs::Teams

def add_member(team_name, member_name, params={})


github.orgs.teams.add_member 'team-name', '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_name, member_name, params={})
  _validate_presence_of team_name, member_name
  normalize! params
  put_request("/teams/#{team_name}/members/#{member_name}", params)
end

def add_repo(team_name, user_name, repo_name, params={})


github.orgs.teams.add_repo 'team-name', '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_name, user_name, repo_name, params={})
  _validate_presence_of team_name, user_name, repo_name
  normalize! params
  put_request("/teams/#{team_name}/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={})
  _validate_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_name, params={})


github.orgs.teams.delete 'team-name'
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_name, params={})
  _validate_presence_of team_name
  normalize! params
  delete_request("/teams/#{team_name}", params)
end

def edit(team_name, params={})


"permission" => "push"
"name" => "new team name",
github.orgs.teams.edit 'team-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
: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_name, params={})
  _validate_presence_of team_name
  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_name}", params)
end

def get(team_name, params={})


github.orgs.teams.get 'team-name'
github = Github.new :oauth_token => '...'
= Examples

Get a team
def get(team_name, params={})
  _validate_presence_of team_name
  normalize! params
  get_request("/teams/#{team_name}", 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={})
  _validate_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_name, params={})


github.orgs.teams.list_members 'team-name' { |member| ... }
github.orgs.teams.list_members 'team-name'
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_name, params={})
  _validate_presence_of team_name
  normalize! params
  response = get_request("/teams/#{team_name}/members", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def list_repos(team_name, params={})


github.orgs.teams.list_repos 'team-name'
github = Github.new :oauth_token => '...'
= Examples

List team repositories
def list_repos(team_name, params={})
  _validate_presence_of team_name
  normalize! params
  response = get_request("/teams/#{team_name}/repos", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def remove_member(team_name, member_name, params={})


github.orgs.teams.remove_member 'team-name', '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_name, member_name, params={})
  _validate_presence_of team_name, member_name
  normalize! params
  delete_request("/teams/#{team_name}/members/#{member_name}", params)
end

def remove_repo(team_name, user_name, repo_name, params={})


github.orgs.teams.remove_repo 'team-name', '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_name, user_name, repo_name, params={})
  _validate_presence_of team_name, user_name, repo_name
  normalize! params
  delete_request("/teams/#{team_name}/repos/#{user_name}/#{repo_name}", params)
end

def team_member?(team_name, member_name, params={})


github.orgs.teams.team_member? 'team-name', 'user-name'
github = Github.new :oauth_token => '...'
= Examples

Check if a user is a member of a team
def team_member?(team_name, member_name, params={})
  _validate_presence_of team_name, member_name
  normalize! params
  get_request("/teams/#{team_name}/members/#{member_name}", params)
  true
rescue Github::Error::NotFound
  false
end

def team_repo?(team_name, user_name, repo_name, params={})


github.orgs.teams.team_repo? 'team-name', 'user-name', 'repo-name'
github = Github.new :oauth_token => '...'
= Examples

Check if a repository belongs to a team
def team_repo?(team_name, user_name, repo_name, params={})
  _validate_presence_of team_name, user_name, repo_name
  normalize! params
  get_request("/teams/#{team_name}/repos/#{user_name}/#{repo_name}", params)
  true
rescue Github::Error::NotFound
  false
end