File: Watching.hs

package info (click to toggle)
haskell-github 0.8-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 444 kB
  • sloc: haskell: 2,572; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,332 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
-- | The repo watching API as described on
-- <http://developer.github.com/v3/repos/watching/>.
module Github.Repos.Watching (
 watchersFor
,watchersFor'
,reposWatchedBy
,reposWatchedBy'
,module Github.Data
) where

import Github.Data
import Github.Private

-- | The list of users that are watching the specified Github repo.
--
-- > watchersFor "thoughtbot" "paperclip"
watchersFor :: String -> String -> IO (Either Error [GithubOwner])
watchersFor = watchersFor' Nothing

-- | The list of users that are watching the specified Github repo.
-- | With authentication
--
-- > watchersFor' (Just (GithubUser (user, password))) "thoughtbot" "paperclip"
watchersFor' :: Maybe GithubAuth -> String -> String -> IO (Either Error [GithubOwner])
watchersFor' auth userName reqRepoName =
  githubGet' auth ["repos", userName, reqRepoName, "watchers"]

-- | All the public repos watched by the specified user.
--
-- > reposWatchedBy "croaky"
reposWatchedBy :: String -> IO (Either Error [Repo])
reposWatchedBy = reposWatchedBy' Nothing

-- | All the public repos watched by the specified user.
-- | With authentication
--
-- > reposWatchedBy' (Just (GithubUser (user, password))) "croaky"
reposWatchedBy' :: Maybe GithubAuth -> String -> IO (Either Error [Repo])
reposWatchedBy' auth userName = githubGet' auth ["users", userName, "watched"]