diff options
| author | 2012-03-01 19:41:46 +0100 | |
|---|---|---|
| committer | 2012-03-01 19:43:26 +0100 | |
| commit | 5d7ee35eb23f193ec79a1a7b24ea87c6f1bc28b8 (patch) | |
| tree | c90ab9489c5217151c1f1c716aea8fa39b303393 /pygithub3/services/repos/watchers.py | |
| parent | WIP on services.repos doc (diff) | |
| download | python-github3-5d7ee35eb23f193ec79a1a7b24ea87c6f1bc28b8.tar.xz python-github3-5d7ee35eb23f193ec79a1a7b24ea87c6f1bc28b8.zip | |
Complete services.repos doc
Also add Mimetypes doc
Diffstat (limited to '')
| -rw-r--r-- | pygithub3/services/repos/watchers.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/pygithub3/services/repos/watchers.py b/pygithub3/services/repos/watchers.py index 8598590..7bcede5 100644 --- a/pygithub3/services/repos/watchers.py +++ b/pygithub3/services/repos/watchers.py @@ -5,27 +5,87 @@ from . import Service class Watchers(Service): + """ Consume `Watching API + <http://developer.github.com/v3/repos/watching>`_ """ def list(self, user=None, repo=None): + """ Get repository's watchers + + :param str user: Username + :param str repo: Repository + :returns: A :doc:`result` + + .. note:: + Remember :ref:`config precedence` + """ request = self.make_request('repos.watchers.list', user=user, repo=repo) return self._get_result(request) def list_repos(self, user=None): + """ Get repositories being watched by a user + + :param str user: Username + :returns: A :doc:`result` + + If you call it without user and you are authenticated, get the + repositories being watched by the authenticated user. + + .. warning:: + If you aren't authenticated and call without user, it returns 403 + + :: + + watchers_service.list_repos('copitux') + watchers_service.list_repos() + """ request = self.make_request('repos.watchers.list_repos', user=user) return self._get_result(request) def is_watching(self, user=None, repo=None): + """ Check if authenticated user is watching a repository + + :param str user: Username + :param str repo: Repository + + .. note:: + Remember :ref:`config precedence` + + .. warning:: + You must be authenticated + """ request = self.make_request('repos.watchers.is_watching', user=user, repo=repo) return self._bool(request) def watch(self, user=None, repo=None): + """ Watch a repository + + :param str user: Username + :param str repo: Repository + + .. note:: + Remember :ref:`config precedence` + + .. warning:: + You must be authenticated + """ request = self.make_request('repos.watchers.watch', user=user, repo=repo) self._put(request) def unwatch(self, user=None, repo=None): + """ Stop watching a repository + + :param str user: Username + :param str repo: Repository + + .. note:: + Remember :ref:`config precedence` + + .. warning:: + You must be authenticated + """ request = self.make_request('repos.watchers.unwatch', user=user, repo=repo) self._delete(request) |
