diff options
author | Anton Antonov <anton.synd.antonov@gmail.com> | 2017-11-14 05:27:30 +0200 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2017-11-13 22:27:30 -0500 |
commit | 77c77fbd42a2cafcb31ecf042a94141a7ca31c98 (patch) | |
tree | 39b1d951de585516de217604b10ace525ec1f43e /routes/api/v1/api.go | |
parent | 9b4054f1fc3a92c7c582770a2c9997213434a792 (diff) |
api: add endpoint /api/v1/user/orgs (#4835)
* Add API endpoint /api/v1/user/orgs
The difference between this endpoint and
/api/v1/admin/users/<username>/orgs,
is that here you're creating a repo with the `user`
that corresponds to the API token you're using.
* Extract duplicate API org creation
Diffstat (limited to 'routes/api/v1/api.go')
-rw-r--r-- | routes/api/v1/api.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/routes/api/v1/api.go b/routes/api/v1/api.go index 510c54cf..da811c25 100644 --- a/routes/api/v1/api.go +++ b/routes/api/v1/api.go @@ -316,7 +316,8 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/issues", reqToken(), repo.ListUserIssues) // Organizations - m.Get("/user/orgs", reqToken(), org.ListMyOrgs) + m.Combo("/user/orgs", reqToken()).Get(org.ListMyOrgs).Post(bind(api.CreateOrgOption{}), org.CreateMyOrg) + m.Get("/users/:username/orgs", org.ListUserOrgs) m.Group("/orgs/:orgname", func() { m.Combo("").Get(org.Get).Patch(bind(api.EditOrgOption{}), org.Edit) |