forked from forgejo/forgejo
[API] creat org repo call same as github (#9186)
* deprecate /api/v1/org/{org}/repos in favour of /api/v1/orgs/{org}/repos + cleanup api repository routes a bit * remove redundant code * use upstream function for api cal * make generate-swagger Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
07520431ae
commit
e8ea0695b0
3 changed files with 85 additions and 12 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue