diff options
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/api.go | 13 | ||||
-rw-r--r-- | routers/api/v1/repo/repo.go | 38 |
2 files changed, 41 insertions, 10 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index ccce00e2b2..fd7f7c05cf 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -604,17 +604,15 @@ func RegisterRoutes(m *macaron.Macaron) { }, reqToken()) // Repositories - m.Post("/org/:org/repos", reqToken(), bind(api.CreateRepoOption{}), repo.CreateOrgRepo) + m.Post("/org/:org/repos", reqToken(), bind(api.CreateRepoOption{}), repo.CreateOrgRepoDeprecated) + + m.Combo("/repositories/:id", reqToken()).Get(repo.GetByID) m.Group("/repos", func() { m.Get("/search", repo.Search) - }) - m.Get("/repos/issues/search", repo.SearchIssues) + m.Get("/issues/search", repo.SearchIssues) - m.Combo("/repositories/:id", reqToken()).Get(repo.GetByID) - - m.Group("/repos", func() { m.Post("/migrate", reqToken(), bind(auth.MigrateRepoForm{}), repo.Migrate) m.Group("/:username/:reponame", func() { @@ -824,10 +822,11 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/users/:username/orgs", org.ListUserOrgs) m.Post("/orgs", reqToken(), bind(api.CreateOrgOption{}), org.Create) m.Group("/orgs/:orgname", func() { - m.Get("/repos", user.ListOrgRepos) m.Combo("").Get(org.Get). Patch(reqToken(), reqOrgOwnership(), bind(api.EditOrgOption{}), org.Edit). Delete(reqToken(), reqOrgOwnership(), org.Delete) + m.Combo("/repos").Get(user.ListOrgRepos). + Post(reqToken(), bind(api.CreateRepoOption{}), repo.CreateOrgRepo) m.Group("/members", func() { m.Get("", org.ListMembers) m.Combo("/:username").Get(org.IsMember). diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 8f34d8cca3..ae834beadf 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -283,11 +283,12 @@ func Create(ctx *context.APIContext, opt api.CreateRepoOption) { CreateUserRepo(ctx, ctx.User, opt) } -// CreateOrgRepo create one repository of the organization -func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) { - // swagger:operation POST /org/{org}/repos organization createOrgRepo +// CreateOrgRepoDeprecated create one repository of the organization +func CreateOrgRepoDeprecated(ctx *context.APIContext, opt api.CreateRepoOption) { + // swagger:operation POST /org/{org}/repos organization createOrgRepoDeprecated // --- // summary: Create a repository in an organization + // deprecated: true // consumes: // - application/json // produces: @@ -310,6 +311,37 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) { // "403": // "$ref": "#/responses/forbidden" + CreateOrgRepo(ctx, opt) +} + +// CreateOrgRepo create one repository of the organization +func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) { + // swagger:operation POST /orgs/{org}/repos organization createOrgRepo + // --- + // summary: Create a repository in an organization + // deprecated: true + // consumes: + // - application/json + // produces: + // - application/json + // parameters: + // - name: org + // in: path + // description: name of organization + // type: string + // required: true + // - name: body + // in: body + // schema: + // "$ref": "#/definitions/CreateRepoOption" + // responses: + // "201": + // "$ref": "#/responses/Repository" + // "404": + // "$ref": "#/responses/notFound" + // "403": + // "$ref": "#/responses/forbidden" + org, err := models.GetOrgByName(ctx.Params(":org")) if err != nil { if models.IsErrOrgNotExist(err) { |