You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
870 B

  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package admin
  5. import (
  6. api "code.gitea.io/sdk/gitea"
  7. "code.gitea.io/gitea/modules/context"
  8. "code.gitea.io/gitea/routers/api/v1/repo"
  9. "code.gitea.io/gitea/routers/api/v1/user"
  10. )
  11. // CreateRepo api for creating a repository
  12. func CreateRepo(ctx *context.APIContext, form api.CreateRepoOption) {
  13. // swagger:route POST /admin/users/{username}/repos admin adminCreateRepo
  14. //
  15. // Consumes:
  16. // - application/json
  17. //
  18. // Produces:
  19. // - application/json
  20. //
  21. // Responses:
  22. // 201: Repository
  23. // 403: forbidden
  24. // 422: validationError
  25. // 500: error
  26. owner := user.GetUserByParams(ctx)
  27. if ctx.Written() {
  28. return
  29. }
  30. repo.CreateUserRepo(ctx, owner, form)
  31. }