File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ -- | The repo starring API as described on
2+ -- <http://developer.github.com/v3/repos/starring/>.
3+ module Github.Repos.Starring (
4+ stargazersFor
5+ ,reposStarredBy
6+ ,myStarred
7+ ,module Github.Data
8+ ) where
9+
10+ import Github.Data
11+ import Github.Data.Definitions
12+ import Github.Private
13+
14+ -- | The list of users that have starred the specified Github repo.
15+ --
16+ -- > userInfoFor' Nothing "mike-burns"
17+ stargazersFor :: Maybe GithubAuth -> String -> String -> IO (Either Error [GithubOwner ])
18+ stargazersFor auth userName repoName =
19+ githubGet' auth [" repos" , userName, repoName, " stargazers" ]
20+
21+ -- | All the public repos starred by the specified user.
22+ --
23+ -- > reposStarredBy Nothing "croaky"
24+ reposStarredBy :: Maybe GithubAuth -> String -> IO (Either Error [Repo ])
25+ reposStarredBy auth userName = githubGet' auth [" users" , userName, " starred" ]
26+
27+ -- | All the repos starred by the authenticated user.
28+ myStarred :: GithubAuth -> IO (Either Error [Repo ])
29+ myStarred auth = githubGet' (Just auth) [" user" , " starred" ]
Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ Extra-source-files: README.md
9696 ,samples/Repos/ShowRepo.hs
9797 ,samples/Repos/Watching/ListWatched.hs
9898 ,samples/Repos/Watching/ListWatchers.hs
99+ ,samples/Repos/Starring/ListStarred.hs
99100 ,samples/Users/Followers/ListFollowers.hs
100101 ,samples/Users/Followers/ListFollowing.hs
101102 ,samples/Users/ShowUser.hs
@@ -134,6 +135,7 @@ Library
134135 Github.Repos.Commits,
135136 Github.Repos.Forks,
136137 Github.Repos.Watching,
138+ Github.Repos.Starring,
137139 Github.Users,
138140 Github.Users.Followers
139141
Original file line number Diff line number Diff line change 1+ module ListStarred where
2+
3+ import qualified Github.Repos.Starring as Github
4+ import Data.List (intercalate )
5+ import Data.Maybe (fromMaybe )
6+
7+ main = do
8+ possibleRepos <- Github. reposStarredBy Nothing " mike-burns"
9+ putStrLn $ either ((" Error: " ++ ) . show )
10+ (intercalate " \n\n " . map formatRepo)
11+ possibleRepos
12+
13+ formatRepo repo =
14+ (Github. repoName repo) ++ " \t " ++
15+ (fromMaybe " " $ Github. repoDescription repo) ++ " \n " ++
16+ (Github. repoHtmlUrl repo) ++ " \n " ++
17+ (Github. repoCloneUrl repo) ++ " \t " ++
18+ (formatDate $ Github. repoUpdatedAt repo) ++ " \n " ++
19+ formatLanguage (Github. repoLanguage repo)
20+
21+ formatDate = show . Github. fromGithubDate
22+
23+ formatLanguage (Just language) = " language: " ++ language ++ " \t "
24+ formatLanguage Nothing = " "
You can’t perform that action at this time.
0 commit comments