From 7bea055c4a353c98a948453ca969e4d37bec89a1 Mon Sep 17 00:00:00 2001 From: Kurt Madel Date: Sun, 28 Aug 2016 08:35:23 -0400 Subject: [PATCH] API support to list repos by org and user (#45) --- repo.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/repo.go b/repo.go index 280eaba..f3b393c 100644 --- a/repo.go +++ b/repo.go @@ -47,6 +47,16 @@ func (c *Client) ListMyRepos() ([]*Repository, error) { return repos, c.getParsedResponse("GET", "/user/repos", nil, nil, &repos) } +func (c *Client) ListUserRepos(user string) ([]*Repository, error) { + repos := make([]*Repository, 0, 10) + return repos, c.getParsedResponse("GET", fmt.Sprintf("/users/%s/repos", user), nil, nil, &repos) +} + +func (c *Client) ListOrgRepos(org string) ([]*Repository, error) { + repos := make([]*Repository, 0, 10) + return repos, c.getParsedResponse("GET", fmt.Sprintf("/orgs/%s/repos", org), nil, nil, &repos) +} + type CreateRepoOption struct { Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"` Description string `json:"description" binding:"MaxSize(255)"`