class Github::Repos

def branch(*args)


github.repos(user: 'user-name', repo: 'repo-name', branch: 'branch-name').branch
github.repos.branch user: 'user-name', repo: 'repo-name', branch: 'branch-name'
github.repos.branch 'user-name', 'repo-name', 'branch-name'
github = Github.new

= Examples

Get branch
def branch(*args)
  arguments(args, :required => [:user, :repo, :branch])
  params = arguments.params
  get_request("/repos/#{user}/#{repo}/branches/#{branch}", params)
end

def branches(*args)

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

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

github.repos(user: 'user-name', repo: 'repo-name').branches
github.repos.branches 'user-name', 'repo-name'
github = Github.new

= Examples

List branches
def branches(*args)
  arguments(args, :required => [:user, :repo])
  params = arguments.params
  response = get_request("/repos/#{user}/#{repo}/branches", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end

def collaborators(options={}, &block)

Access to Repos::Collaborators API
def collaborators(options={}, &block)
  @collaborators ||= ApiFactory.new('Repos::Collaborators', current_options.merge(options), &block)
end

def comments(options={}, &block)

Access to Repos::Comments API
def comments(options={}, &block)
  @commits ||= ApiFactory.new('Repos::Comments', current_options.merge(options), &block)
end

def commits(options={}, &block)

Access to Repos::Commits API
def commits(options={}, &block)
  @commits ||= ApiFactory.new('Repos::Commits', current_options.merge(options), &block)
end

def contents(options={}, &block)

Access to Repos::Contents API
def contents(options={}, &block)
  @contents ||= ApiFactory.new('Repos::Contents', current_options.merge(options), &block)
end

def contributors(*args)


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(*args)
  arguments(args, :required => [:user, :repo]) do
    sift %w[ anon ]
  end
  params = arguments.params
  response = get_request("/repos/#{user}/#{repo}/contributors", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def contributors(*args)


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(*args)
  arguments(args, :required => [:user, :repo]) do
    sift ['anon']
  end
  params = arguments.params
  response = get_request("/repos/#{user}/#{repo}/contributors", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def create(*args)


github.repos.create :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,
"private": false,
"homepage": "https://github.com",
"description": "This is your first repo",
github.repos.create "name": 'repo-name'
github = Github.new
= Examples

:gitignore_template Optional string - Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, “Haskell” Ignored if auto_init parameter is not provided.
:auto_init Optional boolean - true to create an initial commit with empty README. Default is false.
:team_id Optional number - The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization
:org Optional string - The organisation in which this repository will be created
: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
:private - Optional boolean - true to create a private repository, false to create a public one.
:homepage - Optional string
:description - Optional string
:name - Required string
= Parameters

Create a new repository for the autheticated user.
def create(*args)
  arguments(args) do
    sift VALID_REPO_OPTIONS + %w[ org ]
    assert_required %w[ name ]
  end
  params = arguments.params
  # Requires authenticated user
  if (org = params.delete("org"))
    post_request("/orgs/#{org}/repos", params.merge_default(DEFAULT_REPO_OPTIONS))
  else
    post_request("/user/repos", params.merge_default(DEFAULT_REPO_OPTIONS))
  end
end

def delete(*args)


github.repos.delete 'user-name', 'repo-name'
github = Github.new :oauth_token => '...'
= Examples

If OAuth is used, the delete_repo scope is required.
Deleting a repository requires admin access.

Delete a repository
def delete(*args)
  arguments(args, :required => [:user, :repo])
  params = arguments.params
  delete_request("/repos/#{user}/#{repo}", params)
end

def delete(*args)


github.repos.delete 'user-name', 'repo-name'
github = Github.new :oauth_token => '...'
= Examples

If OAuth is used, the delete_repo scope is required.
Deleting a repository requires admin access.

Delete a repository
def delete(*args)
  arguments(args, :required => [:user, :repo])
  params = arguments.params
  delete_request("/repos/#{user}/#{repo}", params)
end

def downloads(options={}, &block)

Access to Repos::Downloads API
def downloads(options={}, &block)
  @downloads ||= ApiFactory.new('Repos::Downloads', current_options.merge(options), &block)
end

def edit(*args)


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

= Examples

* :default_branch Optional string - Update the default branch for this repository.
* :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
:private - Optional boolean - false to create public reps, false to create a private one
* :homepage Optional string
* :description Optional string
* :name Required string
= Parameters

Edit a repository
def edit(*args)
  arguments(args, :required => [:user, :repo]) do
    sift VALID_REPO_OPTIONS
    assert_required %w[ name ]
  end
  params = arguments.params
  patch_request("/repos/#{user}/#{repo}", params.merge_default(DEFAULT_REPO_OPTIONS))
end

def forks(options={}, &block)

Access to Repos::Forks API
def forks(options={}, &block)
  @forks ||= ApiFactory.new('Repos::Forks', current_options.merge(options), &block)
end

def get(*args)


github.repos(user: 'user-name', repo: 'repo-name').get
github.repos.get user: 'user-name', repo: 'repo-name'
github.repos.get 'user-name', 'repo-name'
github = Github.new
= Examples

Get a repository
def get(*args)
  arguments(args, :required => [:user, :repo])
  params = arguments.params
  get_request("/repos/#{user}/#{repo}", params)
end

def hooks(options={}, &block)

Access to Repos::Hooks API
def hooks(options={}, &block)
  @hooks ||= ApiFactory.new('Repos::Hooks', current_options.merge(options), &block)
end

def keys(options={}, &block)

Access to Repos::Keys API
def keys(options={}, &block)
  @keys ||= ApiFactory.new('Repos::Keys', current_options.merge(options), &block)
end

def languages(*args)


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

List languages
def languages(*args)
  arguments(args, :required => [:user, :repo])
  params = arguments.params
  response = get_request("/repos/#{user}/#{repo}/languages", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def list(*args)


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

List repositories for the specified organisation.

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

List public repositories for the specified user.

github.repos.list :every { |repo| ... }
github.repos.list :every
github = Github.new
= Examples

* :since - the integer ID of the last Repository that you've seen.
= Parameters
This provides a dump of every repository, in the order that they were created.

List all repositories

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

List repositories for the authenticated user
def list(*args)
  arguments(args) do
    sift %w[ user org type sort direction since ]
  end
  params = arguments.params
  response = if (user_name = (params.delete("user")))
    get_request("/users/#{user_name}/repos", params)
  elsif (org_name = (params.delete("org")))
    get_request("/orgs/#{org_name}/repos", params)
  elsif args.map(&:to_s).include?("every")
    get_request("/repositories", params)
  else
    # For authenticated user
    get_request("/user/repos", params)
  end
  return response unless block_given?
  response.each { |el| yield el }
end

def merging(options={}, &block)

Access to Repos::Merging API
def merging(options={}, &block)
  @mergin ||= ApiFactory.new('Repos::Merging', current_options.merge(options), &block)
end

def pubsubhubbub(options={}, &block)

Access to Repos::PubSubHubbub API
def pubsubhubbub(options={}, &block)
  @pubsubhubbub ||= ApiFactory.new('Repos::PubSubHubbub', current_options.merge(options), &block)
end

def stats(options={}, &block)

Access to Repos::Statistics API
def stats(options={}, &block)
  @stats ||= ApiFactory.new('Repos::Statistics', current_options.merge(options), &block)
end

def statuses(options={}, &block)

Access to Repos::Statuses API
def statuses(options={}, &block)
  @statuses ||= ApiFactory.new('Repos::Statuses', current_options.merge(options), &block)
end

def tags(*args)


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

List tags
def tags(*args)
  arguments(args, :required => [:user, :repo])
  params = arguments.params
  response = get_request("/repos/#{user}/#{repo}/tags", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def teams(*args)


github.repos(user: 'user-name, repo: 'repo-name').teams

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

List teams
def teams(*args)
  arguments(args, :required => [:user, :repo])
  params = arguments.params
  response = get_request("/repos/#{user}/#{repo}/teams", params)
  return response unless block_given?
  response.each { |el| yield el }
end