class Github::Repos::Comments

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


"position" => 4
"path" => "file1.txt",
"line" => 1,
"commit_id" => "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"body" => "Nice change",
github.repos.comments.create '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(user_name, repo_name, sha, params={})
  set :user => user_name, :repo => repo_name
  assert_presence_of user, repo, sha
  normalize! params
  filter! VALID_COMMENT_OPTIONS, params
  assert_required_keys(REQUIRED_COMMENT_OPTIONS, params)
  post_request("/repos/#{user}/#{repo}/commits/#{sha}/comments", params)
end

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


github.repos.comments.delete 'user-name', 'repo-name', 'comment-id'
github = Github.new
= Examples

Deletes a commit comment
def delete(user_name, repo_name, comment_id, params={})
  set :user => user_name, :repo => repo_name
  assert_presence_of user, repo, comment_id
  normalize! params
  delete_request("/repos/#{user}/#{repo}/comments/#{comment_id}", params)
end

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


github.repos.comments.get 'user-name', 'repo-name', 'comment-id'
github = Github.new
= Examples

Gets a single commit comment
def get(user_name, repo_name, comment_id, params={})
  set :user => user_name, :repo => repo_name
  assert_presence_of user, repo, comment_id
  normalize! params
  get_request("/repos/#{user}/#{repo}/comments/#{comment_id}", params)
end

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


:sha => '6dcb09b5b57875f334f61aebed695e2e4193db5e'
github.repos.comments.list 'user-name', 'repo-name',
= Examples

List comments for a single commit

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

List commit comments for a repository
def list(user_name, repo_name, params={})
  set :user => user_name, :repo => repo_name
  assert_presence_of user, repo
  normalize! params
  response = if (sha = params.delete('sha'))
    get_request("/repos/#{user}/#{repo}/commits/#{sha}/comments", params)
  else
    get_request("/repos/#{user}/#{repo}/comments", params)
  end
  return response unless block_given?
  response.each { |el| yield el }
end

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


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

* :body - Required string.
= Inputs

Update a commit comment
def update(user_name, repo_name, comment_id, params={})
  set :user => user_name, :repo => repo_name
  assert_presence_of user, repo, comment_id
  normalize! params
  assert_required_keys(REQUIRED_COMMENT_OPTIONS, params)
  patch_request("/repos/#{user}/#{repo}/comments/#{comment_id}", params)
end