code.gitea.io/gitea@v1.21.7/routers/api/v1/admin/repo.go (about) 1 // Copyright 2015 The Gogs Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package admin 5 6 import ( 7 "code.gitea.io/gitea/modules/context" 8 api "code.gitea.io/gitea/modules/structs" 9 "code.gitea.io/gitea/modules/web" 10 "code.gitea.io/gitea/routers/api/v1/repo" 11 ) 12 13 // CreateRepo api for creating a repository 14 func CreateRepo(ctx *context.APIContext) { 15 // swagger:operation POST /admin/users/{username}/repos admin adminCreateRepo 16 // --- 17 // summary: Create a repository on behalf of a user 18 // consumes: 19 // - application/json 20 // produces: 21 // - application/json 22 // parameters: 23 // - name: username 24 // in: path 25 // description: username of the user. This user will own the created repository 26 // type: string 27 // required: true 28 // - name: repository 29 // in: body 30 // required: true 31 // schema: { "$ref": "#/definitions/CreateRepoOption" } 32 // responses: 33 // "201": 34 // "$ref": "#/responses/Repository" 35 // "400": 36 // "$ref": "#/responses/error" 37 // "403": 38 // "$ref": "#/responses/forbidden" 39 // "404": 40 // "$ref": "#/responses/notFound" 41 // "409": 42 // "$ref": "#/responses/error" 43 // "422": 44 // "$ref": "#/responses/validationError" 45 46 form := web.GetForm(ctx).(*api.CreateRepoOption) 47 48 repo.CreateUserRepo(ctx, ctx.ContextUser, *form) 49 }