summaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorAaron Walker <awwalker3@gmail.com>2017-07-13 04:14:15 -0700
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-07-13 13:14:15 +0200
commit6a3c03762a37f593ec8101c2005836ca44683e1d (patch)
treee0d47eef90cceef4563de05f480c0abcf707c4e2 /routers/api
parentf011d6d4d7a53a99c9d213f686412513fe78d6a7 (diff)
downloadgitea-6a3c03762a37f593ec8101c2005836ca44683e1d.tar.gz
gitea-6a3c03762a37f593ec8101c2005836ca44683e1d.zip
API: support '/orgs/:org/repos' (#2047)
* API: support '/orgs/:org/repos'
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/api.go1
-rw-r--r--routers/api/v1/user/repo.go18
2 files changed, 19 insertions, 0 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index 8dda892955..bac5af7be6 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -458,6 +458,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/user/orgs", reqToken(), org.ListMyOrgs)
m.Get("/users/:username/orgs", org.ListUserOrgs)
m.Group("/orgs/:orgname", func() {
+ m.Get("/repos", user.ListOrgRepos)
m.Combo("").Get(org.Get).
Patch(reqToken(), reqOrgOwnership(), bind(api.EditOrgOption{}), org.Edit)
m.Group("/members", func() {
diff --git a/routers/api/v1/user/repo.go b/routers/api/v1/user/repo.go
index c929da5e37..b4a4653faa 100644
--- a/routers/api/v1/user/repo.go
+++ b/routers/api/v1/user/repo.go
@@ -1,3 +1,7 @@
+// Copyright 2017 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
package user
import (
@@ -80,3 +84,17 @@ func ListMyRepos(ctx *context.APIContext) {
}
ctx.JSON(200, &apiRepos)
}
+
+// ListOrgRepos - list the repositories of an organization.
+func ListOrgRepos(ctx *context.APIContext) {
+ // swagger:route GET /orgs/{org}/repos orgListRepos
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 200: RepositoryList
+ // 500: error
+
+ listUserRepos(ctx, ctx.Org.Organization)
+}