From 77c77fbd42a2cafcb31ecf042a94141a7ca31c98 Mon Sep 17 00:00:00 2001 From: Anton Antonov Date: Tue, 14 Nov 2017 05:27:30 +0200 Subject: 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//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 --- routes/api/v1/api.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'routes/api/v1/api.go') 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) -- cgit v1.2.3