class Github::Repos

def branches(user_name=nil, repo_name=nil, params={})


@repos.branches 'user-name', 'repo-name'
@repos = Github::Repos.new

@github.repos.branches 'user-name', 'repo-name'
@github = Github.new

= Examples

List branches
def branches(user_name=nil, repo_name=nil, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless (user? && repo?)
  _normalize_params_keys(params)
  response = get("/repos/#{user}/#{repo}/branches", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def contributors(user_name=nil, repo_name=nil, params={})


@github.repos.contributors 'user-name','repo-name' { |cont| ... }
@github.repos.contributors 'user-name','repo-name'
@github = Github.new

= Examples

:anon - Optional flag. Set to 1 or true to include anonymous contributors.
= Parameters

List contributors
def contributors(user_name=nil, repo_name=nil, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _normalize_params_keys(params)
  _filter_params_keys(['anon'], params)
  response = get("/repos/#{user}/#{repo}/contributors", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def create_repo(*args)


@github.repos.create_repo :name => 'repo-name', :org => 'organisation-name'
@github = Github.new :oauth_token => '...'
Examples:

must be a member of this organisation
Create a new repository in this organisation. The authenticated user

"has_downloads": true
"has_wiki": true,
"has_issues": true,
"public": true,
"homepage": "https://github.com",
"description": "This is your first repo",
@github.repos.create_repo "name" => 'repo-name'
@github = Github.new
= Examples

:has_downloads Optional boolean - true to enable downloads for this repository
:has_wiki - Optional boolean - true to enable the wiki for this repository, false to disable it. Default is true
:has_issues - Optional boolean - true to enable issues for this repository, false to disable them
:public - Optional boolean - true to create public repo, false to create a private one
:homepage - Optional string
:description - Optional string
:name - Required string
= Parameters

Create a new repository for the autheticated user.
def create_repo(*args)
  params = args.last.is_a?(Hash) ? args.pop : {}
  _normalize_params_keys(params)
  _filter_params_keys(VALID_REPO_OPTIONS + %w[ org ], params)
  raise ArgumentError, "Required params are: :name" unless _validate_inputs(%w[ name ], params)
  # Requires authenticated user
  if (org = params.delete("org"))
    post("/orgs/#{org}/repos", DEFAULT_REPO_OPTIONS.merge(params))
  else
    post("/user/repos", DEFAULT_REPO_OPTIONS.merge(params))
  end
end

def edit_repo(user_name=nil, repo_name=nil, params={})


@github.repos.edit_repo('user-name', 'repo-name', { :name => 'hello-world', :description => 'This is your first repo', :homepage => "https://github.com", :public => true, :has_issues => true })
@github = Github.new

= Examples

* :has_downloads Optional boolean - true to enable downloads for this repository
* :has_wiki Optional boolean - true to enable the wiki for this repository, false to disable it. Default is true
* :has_issues Optional boolean - true to enable issues for this repository, false to disable them
* :public Optional boolean - true to create public repo, false to create a private one
* :homepage Optional string
* :description Optional string
* :name Required string
= Parameters

Edit a repository
def edit_repo(user_name=nil, repo_name=nil, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _normalize_params_keys(params)
  _filter_params_keys(VALID_REPO_OPTIONS, params)
  raise ArgumentError, "Required params are: #{%w[ :name ] }" unless _validate_inputs(%w[ name ], params)
  patch("/repos/#{user}/#{repo}", DEFAULT_REPO_OPTIONS.merge(params))
end

def get_repo(user_name=nil, repo_name=nil, params={})


@github.repos.get_repo('user-name', 'repo-name')
@github = Github.new
= Examples

Get a repository
def get_repo(user_name=nil, repo_name=nil, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _normalize_params_keys(params)
  get("/repos/#{user}/#{repo}", params)
end

def initialize(options = {})

Creates new Repositories API
def initialize(options = {})
  super(options)
end

def languages(user_name=nil, repo_name=nil, params={})


@github.repos.languages('user-name', 'repo-name') { |lang| ... }
@github.repos.languages('user-name', 'repo-name')
@github = Github.new
= Examples

List languages
def languages(user_name=nil, repo_name=nil, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _normalize_params_keys(params)
  response = get("/repos/#{user}/#{repo}/languages", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def repos(*args)


@github.repos.list_repos :org => 'org-name', { |repo| ... }
@github.repos.list_repos :org => 'org-name'
@github = Github.new
= Examples

List repositories for the specified organisation.

github.repos.list_repos :user => 'user-name', { |repo| ... }
github.repos.list_repos :user => 'user-name'
github = Github.new
= Examples

List public repositories for the specified user.

@github.repos.list_repos { |repo| ... }
@github.repos.list_repos
@github = Github.new :oauth_token => '...'
= Examples

List repositories for the authenticated user
def repos(*args)
  params = args.last.is_a?(Hash) ? args.pop : {}
  _normalize_params_keys(params)
  # _merge_user_into_params!(params) unless params.has_key?('user')
  _filter_params_keys(%w[ org user type ], params)
  response = if (user_name = params.delete("user"))
    get("/users/#{user_name}/repos")
  elsif (org_name = params.delete("org"))
    get("/orgs/#{org_name}/repos", params)
  else
    # For authenticated user
    get("/user/repos", params)
  end
  return response unless block_given?
  response.each { |el| yield el }
end

def tags(user_name=nil, repo_name=nil, params={})


@github.repos.tags('user-name', 'repo-name') { |tag| ... }
@github.repos.tags('user-name', 'repo-name')
@github = Github.new
= Examples

List tags
def tags(user_name=nil, repo_name=nil, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _normalize_params_keys(params)
  response = get("/repos/#{user}/#{repo}/tags", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def teams(user_name=nil, repo_name=nil, params={})


@github.repos.teams('user-name', 'repo-name') { |team| ... }
@github.repos.teams('user-name', 'repo-name')
@github = Github.new
== Examples

List teams
def teams(user_name=nil, repo_name=nil, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _normalize_params_keys(params)
  response = get("/repos/#{user}/#{repo}/teams", params)
  return response unless block_given?
  response.each { |el| yield el }
end