summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/admin
diff options
context:
space:
mode:
authorAntoine GIRARD <sapk@users.noreply.github.com>2017-08-21 13:13:47 +0200
committerLauris BH <lauris@nix.lv>2017-08-21 14:13:47 +0300
commitfd8e8a421ae21f8c68eaad195bdd4881e1d34b21 (patch)
tree2c651e0f39a0360496d1fbbd1f4d0fd03ec9a95f /routers/api/v1/admin
parent951c909a67bb6f1f8577fb1e61f22dca2bc3c07f (diff)
downloadgitea-fd8e8a421ae21f8c68eaad195bdd4881e1d34b21.tar.gz
gitea-fd8e8a421ae21f8c68eaad195bdd4881e1d34b21.zip
Improve swagger doc (#2274)
* Add swagger comment for adminCreateOrg * Add swagger comment for admin route * add hook swagger doc * Add tags * Add auth * Fix name of responses * Edit name method * Update vendor * make generate-swagger
Diffstat (limited to 'routers/api/v1/admin')
-rw-r--r--routers/api/v1/admin/org.go15
-rw-r--r--routers/api/v1/admin/repo.go15
-rw-r--r--routers/api/v1/admin/user.go57
3 files changed, 81 insertions, 6 deletions
diff --git a/routers/api/v1/admin/org.go b/routers/api/v1/admin/org.go
index 706e2cedeb..99c9cf0b95 100644
--- a/routers/api/v1/admin/org.go
+++ b/routers/api/v1/admin/org.go
@@ -14,8 +14,21 @@ import (
)
// CreateOrg api for create organization
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Organizations#create-a-new-organization
func CreateOrg(ctx *context.APIContext, form api.CreateOrgOption) {
+ // swagger:route POST /admin/users/{username}/orgs admin adminCreateOrg
+ //
+ // Consumes:
+ // - application/json
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 201: Organization
+ // 403: forbidden
+ // 422: validationError
+ // 500: error
+
u := user.GetUserByParams(ctx)
if ctx.Written() {
return
diff --git a/routers/api/v1/admin/repo.go b/routers/api/v1/admin/repo.go
index a52d462137..232fb988c8 100644
--- a/routers/api/v1/admin/repo.go
+++ b/routers/api/v1/admin/repo.go
@@ -13,8 +13,21 @@ import (
)
// CreateRepo api for creating a repository
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Repositories#create-a-new-repository
func CreateRepo(ctx *context.APIContext, form api.CreateRepoOption) {
+ // swagger:route POST /admin/users/{username}/repos admin adminCreateRepo
+ //
+ // Consumes:
+ // - application/json
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 201: Repository
+ // 403: forbidden
+ // 422: validationError
+ // 500: error
+
owner := user.GetUserByParams(ctx)
if ctx.Written() {
return
diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go
index 36fea14f11..74cbba8cde 100644
--- a/routers/api/v1/admin/user.go
+++ b/routers/api/v1/admin/user.go
@@ -35,8 +35,21 @@ func parseLoginSource(ctx *context.APIContext, u *models.User, sourceID int64, l
}
// CreateUser api for creating a user
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-new-user
func CreateUser(ctx *context.APIContext, form api.CreateUserOption) {
+ // swagger:route POST /admin/users admin adminCreateUser
+ //
+ // Consumes:
+ // - application/json
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 201: User
+ // 403: forbidden
+ // 422: validationError
+ // 500: error
+
u := &models.User{
Name: form.Username,
FullName: form.FullName,
@@ -73,8 +86,21 @@ func CreateUser(ctx *context.APIContext, form api.CreateUserOption) {
}
// EditUser api for modifying a user's information
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#edit-an-existing-user
func EditUser(ctx *context.APIContext, form api.EditUserOption) {
+ // swagger:route PATCH /admin/users/{username} admin adminEditUser
+ //
+ // Consumes:
+ // - application/json
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 200: User
+ // 403: forbidden
+ // 422: validationError
+ // 500: error
+
u := user.GetUserByParams(ctx)
if ctx.Written() {
return
@@ -130,8 +156,18 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) {
}
// DeleteUser api for deleting a user
-// https://github.com/gogits/go-gogs-client/wiki/Administration-Users#delete-a-user
func DeleteUser(ctx *context.APIContext) {
+ // swagger:route DELETE /admin/users/{username} admin adminDeleteUser
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 204: empty
+ // 403: forbidden
+ // 422: validationError
+ // 500: error
+
u := user.GetUserByParams(ctx)
if ctx.Written() {
return
@@ -152,8 +188,21 @@ func DeleteUser(ctx *context.APIContext) {
}
// CreatePublicKey api for creating a public key to a user
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-public-key-for-user
func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
+ // swagger:route POST /admin/users/{username}/keys admin adminCreatePublicKey
+ //
+ // Consumes:
+ // - application/json
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 201: PublicKey
+ // 403: forbidden
+ // 422: validationError
+ // 500: error
+
u := user.GetUserByParams(ctx)
if ctx.Written() {
return