Skip to content

Commit 7bea055

Browse files
kmadelunknwon
authored andcommitted
API support to list repos by org and user (#45)
1 parent c317bcf commit 7bea055

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

repo.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ func (c *Client) ListMyRepos() ([]*Repository, error) {
4747
return repos, c.getParsedResponse("GET", "/user/repos", nil, nil, &repos)
4848
}
4949

50+
func (c *Client) ListUserRepos(user string) ([]*Repository, error) {
51+
repos := make([]*Repository, 0, 10)
52+
return repos, c.getParsedResponse("GET", fmt.Sprintf("/users/%s/repos", user), nil, nil, &repos)
53+
}
54+
55+
func (c *Client) ListOrgRepos(org string) ([]*Repository, error) {
56+
repos := make([]*Repository, 0, 10)
57+
return repos, c.getParsedResponse("GET", fmt.Sprintf("/orgs/%s/repos", org), nil, nil, &repos)
58+
}
59+
5060
type CreateRepoOption struct {
5161
Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"`
5262
Description string `json:"description" binding:"MaxSize(255)"`

0 commit comments

Comments
 (0)