module Github::Repos::Watching

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


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

You need to be authenticated to watch a repository

Watch a repository
def start_watching(user_name, repo_name, params={})
  _validate_presence_of user_name, repo_name
  _normalize_params_keys(params)
  put("/user/watched/#{user_name}/#{repo_name}")
end

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


@github.repos.start_watching 'user-name', 'repo-name'
@github = Github.new
= Examples
You need to be authenticated to stop watching a repository.

Stop watching a repository
def stop_watching(user_name, repo_name, params={})
  _validate_presence_of user_name, repo_name
  _normalize_params_keys(params)
  delete("/user/watched/#{user_name}/#{repo_name}")
end

def watched(user_name=nil, params={})


@github.repos.watched
@github = Github.new :oauth_token => '...'
= Examples

List repos being watched by the authenticated user

@github.repos.watched
@github = Github.new :user => 'user-name'
= Examples

List repos being watched by a user
def watched(user_name=nil, params={})
  _update_user_repo_params(user_name)
  _normalize_params_keys(params)
  response = if user
    get("/users/#{user}/watched")
  else
    get("/user/watched")
  end
  return response unless block_given?
  response.each { |el| yield el }
end

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


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

List repo watchers
def watchers(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}/watchers")
  return response unless block_given?
  response.each { |el| yield el }
end

def watching?(user_name, repo_name, params={})


@github.repos.watching? 'user-name', 'repo-name'
@github = Github.new
= Examples
Returns true if this repo is watched by you, false otherwise

Check if you are watching a repository
def watching?(user_name, repo_name, params={})
  _validate_presence_of user_name, repo_name
  _normalize_params_keys(params)
  get("/user/watched/#{user_name}/#{repo_name}")
  true
rescue Github::ResourceNotFound
  false
end