module Github::Repos::Commits

def commit(user_name, repo_name, sha, params={})


@github.repos.commit 'user-name', 'repo-name', '6dcb09b5b57875f334f61aebed6')
@github = Github.new
= Examples

Gets a single commit
def commit(user_name, repo_name, sha, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of sha
  _normalize_params_keys(params)
  get("/repos/#{user}/#{repo}/commits/#{sha}", params)
end

def commit_comment(user_name, repo_name, comment_id, params={})


@github.repos.commit_comment 'user-name', 'repo-name', 'comment-id'
@github = Github.new
= Examples

Gets a single commit comment
def commit_comment(user_name, repo_name, comment_id, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of comment_id
  _normalize_params_keys(params)
  get("/repos/#{user}/#{repo}/comments/#{comment_id}", params)
end

def commit_comments(user_name, repo_name, sha, params={})


@github.repos.commit_comments 'user-name', 'repo-name', '6dcb09b5b57875f334f61aebed695e2e4193db5e'
@github = Github.new
= Examples

List comments for a single commit
def commit_comments(user_name, repo_name, sha, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of sha
  _normalize_params_keys(params)
  response = get("/repos/#{user}/#{repo}/commits/#{sha}/comments", params)
  return response unless block_given?
  response.each { |el| yield el }
end

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


@github.repos.commits 'user-name', 'repo-name', :sha => '...' { |commit| ... }
@github.repos.commits 'user-name', 'repo-name', :sha => '...'
@github = Github.new
= Examples

* :path Optional string. Only commits containing this file path will be returned
* :sha Optional string. Sha or branch to start listing commits from.
= Parameters

List commits on a repository
def commits(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(%w[ sha path], params)
  response = get("/repos/#{user}/#{repo}/commits", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def create_comment(user_name, repo_name, sha, params={})


"position" => 4
"path" => "file1.txt",
"line" => 1,
"commit_id" => "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"body" => "Nice change",
@github.repos.create_comment 'user-name', 'repo-name', 'sha-key',
@github = Github.new
= Examples

* :position - Required number - Line index in the diff to comment on.
* :path - Required string - Relative path of the file to comment on.
* :line - Required number - Line number in the file to comment on.
* :comment_id - Required string - Sha of the commit to comment on.
* :body - Required string.
= Inputs

Creates a commit comment
def create_comment(user_name, repo_name, sha, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of sha
  _normalize_params_keys(params)
  _filter_params_keys(REQUIRED_COMMENT_PARAMS, params)
  raise ArgumentError, "Expected following inputs to the method: #{REQUIRED_COMMENT_PARAMS.join(', ')}" unless _validate_inputs(REQUIRED_COMMENT_PARAMS, params)
  post("/repos/#{user}/#{repo}/commits/#{sha}/comments", params)
end

def delete_comment(user_name, repo_name, comment_id, params={})


@github.repos.delete_comment 'user-name', 'repo-name', 'comment-id'
@github = Github.new
= Examples

Deletes a commit comment
def delete_comment(user_name, repo_name, comment_id, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of comment_id
  _normalize_params_keys(params)
  delete("/repos/#{user}/#{repo}/comments/#{comment_id}", params)
end

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


@github.repos.repo_comments 'user-name', 'repo-name' { |com| ... }
@github.repos.repo_comments 'user-name', 'repo-name'
@github = Github.new
= Examples

List commit comments for a repository
def repo_comments(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}/comments")
  return response unless block_given?
  response.each { |el| yield el }
end

def update_comment(user_name, repo_name, comment_id, params={})


"body" => "Nice change"
@github.repos.update_comment 'user-name', 'repo-name', 'comment-id',
@github = Github.new
= Examples

* :body - Required string.
= Inputs

Update a commit comment
def update_comment(user_name, repo_name, comment_id, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of comment_id
  _normalize_params_keys(params)
  raise ArgumentError, "expected following inputs to the method: 'body'" unless _validate_inputs(["body"], params)
  patch("/repos/#{user}/#{repo}/comments/#{comment_id}", params)
end