Skip to content

Commit 4db32ad

Browse files
committed
Resolve #94: Implement /user/repos
1 parent 69a772d commit 4db32ad

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

Github/All.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,11 @@ module Github.All (
203203
--
204204
-- Missing endpoints:
205205
--
206-
-- * List your repositories
207206
-- * List all public repositories
208207
-- * List Teams
209208
-- * Get Branch
210209
-- * Enabling and disabling branch protection
210+
currentUserReposR,
211211
userReposR,
212212

213213
-- ** Collaborators

Github/Repos.hs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
-- <http://developer.github.com/v3/repos/>
77
module Github.Repos (
88
-- * Querying repositories
9+
currentUserRepos,
10+
currentUserReposR,
911
userRepos,
1012
userRepos',
1113
userReposR,
@@ -69,6 +71,19 @@ repoPublicityQueryString Member = [("type", Just "member")]
6971
repoPublicityQueryString Public = [("type", Just "public")]
7072
repoPublicityQueryString Private = [("type", Just "private")]
7173

74+
-- | List your repositories.
75+
currentUserRepos :: GithubAuth -> RepoPublicity -> IO (Either Error (Vector Repo))
76+
currentUserRepos auth publicity =
77+
executeRequest auth $ currentUserReposR publicity Nothing
78+
79+
-- | List your repositories.
80+
-- See <https://developer.github.com/v3/repos/#list-your-repositories>
81+
currentUserReposR :: RepoPublicity -> Maybe Count -> GithubRequest k(Vector Repo)
82+
currentUserReposR publicity =
83+
GithubPagedGet ["user", "repos"] qs
84+
where
85+
qs = repoPublicityQueryString publicity
86+
7287
-- | The repos for a user, by their login. Can be restricted to just repos they
7388
-- own, are a member of, or publicize. Private repos will return empty list.
7489
--

github.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ test-suite github-test
118118
other-modules:
119119
Github.CommitsSpec
120120
Github.OrganizationsSpec
121+
Github.ReposSpec
121122
Github.SearchSpec
122123
Github.UsersSpec
123124
main-is: Spec.hs

0 commit comments

Comments
 (0)