diff options
author | Antoine GIRARD <sapk@users.noreply.github.com> | 2017-08-21 13:13:47 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-08-21 14:13:47 +0300 |
commit | fd8e8a421ae21f8c68eaad195bdd4881e1d34b21 (patch) | |
tree | 2c651e0f39a0360496d1fbbd1f4d0fd03ec9a95f /routers/api | |
parent | 951c909a67bb6f1f8577fb1e61f22dca2bc3c07f (diff) | |
download | gitea-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')
-rw-r--r-- | routers/api/v1/admin/org.go | 15 | ||||
-rw-r--r-- | routers/api/v1/admin/repo.go | 15 | ||||
-rw-r--r-- | routers/api/v1/admin/user.go | 57 | ||||
-rw-r--r-- | routers/api/v1/api.go | 22 | ||||
-rw-r--r-- | routers/api/v1/misc/markdown.go | 4 | ||||
-rw-r--r-- | routers/api/v1/misc/version.go | 2 | ||||
-rw-r--r-- | routers/api/v1/org/hook.go | 56 | ||||
-rw-r--r-- | routers/api/v1/org/member.go | 66 | ||||
-rw-r--r-- | routers/api/v1/repo/fork.go | 4 | ||||
-rw-r--r-- | routers/api/v1/repo/hook.go | 14 | ||||
-rw-r--r-- | routers/api/v1/repo/repo.go | 29 | ||||
-rw-r--r-- | routers/api/v1/user/app.go | 4 | ||||
-rw-r--r-- | routers/api/v1/user/follower.go | 16 | ||||
-rw-r--r-- | routers/api/v1/user/gpg_key.go | 10 | ||||
-rw-r--r-- | routers/api/v1/user/key.go | 10 | ||||
-rw-r--r-- | routers/api/v1/user/repo.go | 6 | ||||
-rw-r--r-- | routers/api/v1/user/star.go | 10 | ||||
-rw-r--r-- | routers/api/v1/user/user.go | 6 | ||||
-rw-r--r-- | routers/api/v1/user/watch.go | 10 |
19 files changed, 294 insertions, 62 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 diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 23c7c7c305..b658c972f1 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -23,6 +23,28 @@ // - application/json // - text/html // +// Security: +// - BasicAuth: [] +// - Token: [] +// - AccessToken: [] +// - AuthorizationHeaderToken: [] +// +// SecurityDefinitions: +// BasicAuth: +// type: basic +// Token: +// type: apiKey +// name: token +// in: query +// AccessToken: +// type: apiKey +// name: access_token +// in: query +// AuthorizationHeaderToken: +// type: apiKey +// name: Authorization +// in: header +// // swagger:meta package v1 diff --git a/routers/api/v1/misc/markdown.go b/routers/api/v1/misc/markdown.go index 0d346a9270..933488301b 100644 --- a/routers/api/v1/misc/markdown.go +++ b/routers/api/v1/misc/markdown.go @@ -14,7 +14,7 @@ import ( // Markdown render markdown document to HTML func Markdown(ctx *context.APIContext, form api.MarkdownOption) { - // swagger:route POST /markdown renderMarkdown + // swagger:route POST /markdown miscellaneous renderMarkdown // // Consumes: // - application/json @@ -52,7 +52,7 @@ func Markdown(ctx *context.APIContext, form api.MarkdownOption) { // MarkdownRaw render raw markdown HTML func MarkdownRaw(ctx *context.APIContext) { - // swagger:route POST /markdown/raw renderMarkdownRaw + // swagger:route POST /markdown/raw miscellaneous renderMarkdownRaw // // Consumes: // - text/plain diff --git a/routers/api/v1/misc/version.go b/routers/api/v1/misc/version.go index 873326a2cc..1780398bf9 100644 --- a/routers/api/v1/misc/version.go +++ b/routers/api/v1/misc/version.go @@ -12,7 +12,7 @@ import ( // Version shows the version of the Gitea server func Version(ctx *context.APIContext) { - // swagger:route GET /version getVersion + // swagger:route GET /version miscellaneous getVersion // // Return Gitea running version. // diff --git a/routers/api/v1/org/hook.go b/routers/api/v1/org/hook.go index 3a0b74ac21..d8a4c45fc8 100644 --- a/routers/api/v1/org/hook.go +++ b/routers/api/v1/org/hook.go @@ -15,6 +15,15 @@ import ( // ListHooks list an organziation's webhooks func ListHooks(ctx *context.APIContext) { + // swagger:route GET /orgs/{orgname}/hooks organization orgListHooks + // + // Produces: + // - application/json + // + // Responses: + // 200: HookList + // 500: error + org := ctx.Org.Organization orgHooks, err := models.GetWebhooksByOrgID(org.ID) if err != nil { @@ -30,6 +39,16 @@ func ListHooks(ctx *context.APIContext) { // GetHook get an organization's hook by id func GetHook(ctx *context.APIContext) { + // swagger:route GET /orgs/{orgname}/hooks/{id} organization orgGetHook + // + // Produces: + // - application/json + // + // Responses: + // 200: Hook + // 404: notFound + // 500: error + org := ctx.Org.Organization hookID := ctx.ParamsInt64(":id") hook, err := utils.GetOrgHook(ctx, org.ID, hookID) @@ -41,6 +60,19 @@ func GetHook(ctx *context.APIContext) { // CreateHook create a hook for an organization func CreateHook(ctx *context.APIContext, form api.CreateHookOption) { + // swagger:route POST /orgs/{orgname}/hooks/ organization orgCreateHook + // + // Consumes: + // - application/json + // + // Produces: + // - application/json + // + // Responses: + // 201: Hook + // 422: validationError + // 500: error + if !utils.CheckCreateHookOption(ctx, &form) { return } @@ -49,12 +81,36 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) { // EditHook modify a hook of a repository func EditHook(ctx *context.APIContext, form api.EditHookOption) { + // swagger:route PATCH /orgs/{orgname}/hooks/{id} organization orgEditHook + // + // Consumes: + // - application/json + // + // Produces: + // - application/json + // + // Responses: + // 200: Hook + // 422: validationError + // 404: notFound + // 500: error + hookID := ctx.ParamsInt64(":id") utils.EditOrgHook(ctx, &form, hookID) } // DeleteHook delete a hook of an organization func DeleteHook(ctx *context.APIContext) { + // swagger:route DELETE /orgs/{orgname}/hooks/{id} organization orgDeleteHook + // + // Produces: + // - application/json + // + // Responses: + // 204: empty + // 404: notFound + // 500: error + org := ctx.Org.Organization hookID := ctx.ParamsInt64(":id") if err := models.DeleteWebhookByOrgID(org.ID, hookID); err != nil { diff --git a/routers/api/v1/org/member.go b/routers/api/v1/org/member.go index 476025e644..3495370556 100644 --- a/routers/api/v1/org/member.go +++ b/routers/api/v1/org/member.go @@ -53,17 +53,45 @@ func listMembers(ctx *context.APIContext, publicOnly bool) { // ListMembers list an organization's members func ListMembers(ctx *context.APIContext) { + // swagger:route GET /orgs/{orgname}/members organization orgListMembers + // + // Produces: + // - application/json + // + // Responses: + // 200: UserList + // 500: error + publicOnly := ctx.User == nil || !ctx.Org.Organization.IsOrgMember(ctx.User.ID) listMembers(ctx, publicOnly) } // ListPublicMembers list an organization's public members func ListPublicMembers(ctx *context.APIContext) { + // swagger:route GET /orgs/{orgname}/public_members organization orgListPublicMembers + // + // Produces: + // - application/json + // + // Responses: + // 200: UserList + // 500: error + listMembers(ctx, true) } // IsMember check if a user is a member of an organization func IsMember(ctx *context.APIContext) { + // swagger:route GET /orgs/{orgname}/members/{username} organization orgIsMember + // + // Produces: + // - application/json + // + // Responses: + // 204: empty + // 302: redirect + // 404: notFound + userToCheck := user.GetUserByParams(ctx) if ctx.Written() { return @@ -85,6 +113,15 @@ func IsMember(ctx *context.APIContext) { // IsPublicMember check if a user is a public member of an organization func IsPublicMember(ctx *context.APIContext) { + // swagger:route GET /orgs/{orgname}/public_members/{username} organization orgIsPublicMember + // + // Produces: + // - application/json + // + // Responses: + // 204: empty + // 404: notFound + userToCheck := user.GetUserByParams(ctx) if ctx.Written() { return @@ -98,6 +135,16 @@ func IsPublicMember(ctx *context.APIContext) { // PublicizeMember make a member's membership public func PublicizeMember(ctx *context.APIContext) { + // swagger:route PUT /orgs/{orgname}/public_members/{username} organization orgPublicizeMember + // + // Produces: + // - application/json + // + // Responses: + // 204: empty + // 403: forbidden + // 500: error + userToPublicize := user.GetUserByParams(ctx) if ctx.Written() { return @@ -116,6 +163,16 @@ func PublicizeMember(ctx *context.APIContext) { // ConcealMember make a member's membership not public func ConcealMember(ctx *context.APIContext) { + // swagger:route DELETE /orgs/{orgname}/public_members/{username} organization orgConcealMember + // + // Produces: + // - application/json + // + // Responses: + // 204: empty + // 403: forbidden + // 500: error + userToConceal := user.GetUserByParams(ctx) if ctx.Written() { return @@ -134,6 +191,15 @@ func ConcealMember(ctx *context.APIContext) { // DeleteMember remove a member from an organization func DeleteMember(ctx *context.APIContext) { + // swagger:route DELETE /orgs/{orgname}/members/{username} organization orgDeleteMember + // + // Produces: + // - application/json + // + // Responses: + // 204: empty + // 500: error + member := user.GetUserByParams(ctx) if ctx.Written() { return diff --git a/routers/api/v1/repo/fork.go b/routers/api/v1/repo/fork.go index 25464dbd78..e4f45004de 100644 --- a/routers/api/v1/repo/fork.go +++ b/routers/api/v1/repo/fork.go @@ -14,7 +14,7 @@ import ( // ListForks list a repository's forks func ListForks(ctx *context.APIContext) { - // swagger:route GET /repos/{owner}/{repo}/forks listForks + // swagger:route GET /repos/{owner}/{repo}/forks repository listForks // // Produces: // - application/json @@ -42,7 +42,7 @@ func ListForks(ctx *context.APIContext) { // CreateFork create a fork of a repo func CreateFork(ctx *context.APIContext, form api.CreateForkOption) { - // swagger:route POST /repos/{owner}/{repo}/forks createFork + // swagger:route POST /repos/{owner}/{repo}/forks repository createFork // // Produces: // - application/json diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go index 93dcd081d7..72dfeff3d0 100644 --- a/routers/api/v1/repo/hook.go +++ b/routers/api/v1/repo/hook.go @@ -15,13 +15,13 @@ import ( // ListHooks list all hooks of a repository func ListHooks(ctx *context.APIContext) { - // swagger:route GET /repos/{username}/{reponame}/hooks + // swagger:route GET /repos/{username}/{reponame}/hooks repository repoListHooks // // Produces: // - application/json // // Responses: - // 200: apiHooks + // 200: HookList // 500: error hooks, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID) @@ -50,7 +50,7 @@ func GetHook(ctx *context.APIContext) { // CreateHook create a hook for a repository func CreateHook(ctx *context.APIContext, form api.CreateHookOption) { - // swagger:route POST /repos/{username}/{reponame}/hooks + // swagger:route POST /repos/{username}/{reponame}/hooks repository repoCreateHook // // Consumes: // - application/json @@ -59,7 +59,7 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) { // - application/json // // Responses: - // 200: apiHook + // 200: Hook // 422: validationError // 500: error @@ -71,13 +71,13 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) { // EditHook modify a hook of a repository func EditHook(ctx *context.APIContext, form api.EditHookOption) { - // swagger:route PATCH /repos/{username}/{reponame}/hooks/{id} + // swagger:route PATCH /repos/{username}/{reponame}/hooks/{id} repository repoEditHook // // Produces: // - application/json // // Responses: - // 200: apiHook //TODO + // 200: Hook // 422: validationError // 500: error @@ -87,7 +87,7 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) { // DeleteHook delete a hook of a repository func DeleteHook(ctx *context.APIContext) { - // swagger:route DELETE /repos/{username}/{reponame}/hooks/{id} + // swagger:route DELETE /repos/{username}/{reponame}/hooks/{id} repository repoDeleteHook // // Produces: // - application/json diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index e44159817e..e8bf026511 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -20,7 +20,7 @@ import ( // Search repositories via options func Search(ctx *context.APIContext) { - // swagger:route GET /repos/search repoSearch + // swagger:route GET /repos/search repository repoSearch // // Produces: // - application/json @@ -130,8 +130,21 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR } // Create one repository of mine -// see https://github.com/gogits/go-gogs-client/wiki/Repositories#create func Create(ctx *context.APIContext, opt api.CreateRepoOption) { + // swagger:route POST /user/repos repository user createCurrentUserRepo + // + // Consumes: + // - application/json + // + // Produces: + // - application/json + // + // Responses: + // 201: Repository + // 403: forbidden + // 422: validationError + // 500: error + // Shouldn't reach this condition, but just in case. if ctx.User.IsOrganization() { ctx.Error(422, "", "not allowed creating repository for organization") @@ -142,7 +155,7 @@ func Create(ctx *context.APIContext, opt api.CreateRepoOption) { // CreateOrgRepo create one repository of the organization func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) { - // swagger:route POST /org/{org}/repos createOrgRepo + // swagger:route POST /org/{org}/repos organization createOrgRepo // // Consumes: // - application/json @@ -175,7 +188,7 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) { // Migrate migrate remote git repository to gitea func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) { - // swagger:route POST /repos/migrate + // swagger:route POST /repos/migrate repository repoMigrate // // Consumes: // - application/json @@ -260,7 +273,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) { // Get one repository func Get(ctx *context.APIContext) { - // swagger:route GET /repos/{username}/{reponame} + // swagger:route GET /repos/{username}/{reponame} repository repoGet // // Produces: // - application/json @@ -274,7 +287,7 @@ func Get(ctx *context.APIContext) { // GetByID returns a single Repository func GetByID(ctx *context.APIContext) { - // swagger:route GET /repositories/{id} + // swagger:route GET /repositories/{id} repository repoGetByID // // Produces: // - application/json @@ -306,7 +319,7 @@ func GetByID(ctx *context.APIContext) { // Delete one repository func Delete(ctx *context.APIContext) { - // swagger:route DELETE /repos/{username}/{reponame} + // swagger:route DELETE /repos/{username}/{reponame} repository repoDelete // // Produces: // - application/json @@ -339,7 +352,7 @@ func Delete(ctx *context.APIContext) { // MirrorSync adds a mirrored repository to the sync queue func MirrorSync(ctx *context.APIContext) { - // swagger:route POST /repos/{username}/{reponame}/mirror-sync repoMirrorSync + // swagger:route POST /repos/{username}/{reponame}/mirror-sync repository repoMirrorSync // // Produces: // - application/json diff --git a/routers/api/v1/user/app.go b/routers/api/v1/user/app.go index 88837a71a2..1d722e36e4 100644 --- a/routers/api/v1/user/app.go +++ b/routers/api/v1/user/app.go @@ -13,7 +13,7 @@ import ( // ListAccessTokens list all the access tokens func ListAccessTokens(ctx *context.APIContext) { - // swagger:route GET /users/{username}/tokens userGetTokens + // swagger:route GET /users/{username}/tokens user userGetTokens // // Produces: // - application/json @@ -40,7 +40,7 @@ func ListAccessTokens(ctx *context.APIContext) { // CreateAccessToken create access tokens func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption) { - // swagger:route POST /users/{username} /tokens userCreateToken + // swagger:route POST /users/{username} /tokens user userCreateToken // // Consumes: // - application/json diff --git a/routers/api/v1/user/follower.go b/routers/api/v1/user/follower.go index 84240c7957..55a0b032db 100644 --- a/routers/api/v1/user/follower.go +++ b/routers/api/v1/user/follower.go @@ -30,7 +30,7 @@ func listUserFollowers(ctx *context.APIContext, u *models.User) { // ListMyFollowers list all my followers func ListMyFollowers(ctx *context.APIContext) { - // swagger:route GET /user/followers userCurrentListFollowers + // swagger:route GET /user/followers user userCurrentListFollowers // // Produces: // - application/json @@ -44,7 +44,7 @@ func ListMyFollowers(ctx *context.APIContext) { // ListFollowers list user's followers func ListFollowers(ctx *context.APIContext) { - // swagger:route GET /users/:username/followers userListFollowers + // swagger:route GET /users/:username/followers user userListFollowers // // Produces: // - application/json @@ -71,7 +71,7 @@ func listUserFollowing(ctx *context.APIContext, u *models.User) { // ListMyFollowing list all my followings func ListMyFollowing(ctx *context.APIContext) { - // swagger:route GET /user/following userCurrentListFollowing + // swagger:route GET /user/following user userCurrentListFollowing // // Produces: // - application/json @@ -85,7 +85,7 @@ func ListMyFollowing(ctx *context.APIContext) { // ListFollowing list user's followings func ListFollowing(ctx *context.APIContext) { - // swagger:route GET /users/{username}/following userListFollowing + // swagger:route GET /users/{username}/following user userListFollowing // // Produces: // - application/json @@ -111,7 +111,7 @@ func checkUserFollowing(ctx *context.APIContext, u *models.User, followID int64) // CheckMyFollowing check if the repo is followed by me func CheckMyFollowing(ctx *context.APIContext) { - // swagger:route GET /user/following/{username} userCurrentCheckFollowing + // swagger:route GET /user/following/{username} user userCurrentCheckFollowing // // Responses: // 204: empty @@ -126,7 +126,7 @@ func CheckMyFollowing(ctx *context.APIContext) { // CheckFollowing check if the repo is followed by user func CheckFollowing(ctx *context.APIContext) { - // swagger:route GET /users/{username}/following/:target userCheckFollowing + // swagger:route GET /users/{username}/following/:target user userCheckFollowing // // Responses: // 204: empty @@ -145,7 +145,7 @@ func CheckFollowing(ctx *context.APIContext) { // Follow follow one repository func Follow(ctx *context.APIContext) { - // swagger:route PUT /user/following/{username} userCurrentPutFollow + // swagger:route PUT /user/following/{username} user userCurrentPutFollow // // Responses: // 204: empty @@ -164,7 +164,7 @@ func Follow(ctx *context.APIContext) { // Unfollow unfollow one repository func Unfollow(ctx *context.APIContext) { - // swagger:route DELETE /user/following/{username} userCurrentDeleteFollow + // swagger:route DELETE /user/following/{username} user userCurrentDeleteFollow // // Responses: // 204: empty diff --git a/routers/api/v1/user/gpg_key.go b/routers/api/v1/user/gpg_key.go index 8c5e171b7f..96ff6e88ba 100644 --- a/routers/api/v1/user/gpg_key.go +++ b/routers/api/v1/user/gpg_key.go @@ -34,7 +34,7 @@ func listGPGKeys(ctx *context.APIContext, uid int64) { //ListGPGKeys get the GPG key list of a user func ListGPGKeys(ctx *context.APIContext) { - // swagger:route GET /users/{username}/gpg_keys userListGPGKeys + // swagger:route GET /users/{username}/gpg_keys user userListGPGKeys // // Produces: // - application/json @@ -52,7 +52,7 @@ func ListGPGKeys(ctx *context.APIContext) { //ListMyGPGKeys get the GPG key list of the logged user func ListMyGPGKeys(ctx *context.APIContext) { - // swagger:route GET /user/gpg_keys userCurrentListGPGKeys + // swagger:route GET /user/gpg_keys user userCurrentListGPGKeys // // Produces: // - application/json @@ -66,7 +66,7 @@ func ListMyGPGKeys(ctx *context.APIContext) { //GetGPGKey get the GPG key based on a id func GetGPGKey(ctx *context.APIContext) { - // swagger:route GET /user/gpg_keys/{id} userCurrentGetGPGKey + // swagger:route GET /user/gpg_keys/{id} user userCurrentGetGPGKey // // Produces: // - application/json @@ -100,7 +100,7 @@ func CreateUserGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption, uid //CreateGPGKey associate a GPG key to the current user func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) { - // swagger:route POST /user/gpg_keys userCurrentPostGPGKey + // swagger:route POST /user/gpg_keys user userCurrentPostGPGKey // // Consumes: // - application/json @@ -118,7 +118,7 @@ func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) { //DeleteGPGKey remove a GPG key associated to the current user func DeleteGPGKey(ctx *context.APIContext) { - // swagger:route DELETE /user/gpg_keys/{id} userCurrentDeleteGPGKey + // swagger:route DELETE /user/gpg_keys/{id} user userCurrentDeleteGPGKey // // Produces: // - application/json diff --git a/routers/api/v1/user/key.go b/routers/api/v1/user/key.go index a53ed2f8c9..1772ef4d25 100644 --- a/routers/api/v1/user/key.go +++ b/routers/api/v1/user/key.go @@ -55,7 +55,7 @@ func listPublicKeys(ctx *context.APIContext, uid int64) { // ListMyPublicKeys list all my public keys func ListMyPublicKeys(ctx *context.APIContext) { - // swagger:route GET /user/keys userCurrentListKeys + // swagger:route GET /user/keys user userCurrentListKeys // // Produces: // - application/json @@ -69,7 +69,7 @@ func ListMyPublicKeys(ctx *context.APIContext) { // ListPublicKeys list all user's public keys func ListPublicKeys(ctx *context.APIContext) { - // swagger:route GET /users/{username}/keys userListKeys + // swagger:route GET /users/{username}/keys user userListKeys // // Produces: // - application/json @@ -87,7 +87,7 @@ func ListPublicKeys(ctx *context.APIContext) { // GetPublicKey get one public key func GetPublicKey(ctx *context.APIContext) { - // swagger:route GET /user/keys/{id} userCurrentGetKey + // swagger:route GET /user/keys/{id} user userCurrentGetKey // // Produces: // - application/json @@ -130,7 +130,7 @@ func CreateUserPublicKey(ctx *context.APIContext, form api.CreateKeyOption, uid // CreatePublicKey create one public key for me func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) { - // swagger:route POST /user/keys userCurrentPostKey + // swagger:route POST /user/keys user userCurrentPostKey // // Consumes: // - application/json @@ -148,7 +148,7 @@ func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) { // DeletePublicKey delete one public key of mine func DeletePublicKey(ctx *context.APIContext) { - // swagger:route DELETE /user/keys/{id} userCurrentDeleteKey + // swagger:route DELETE /user/keys/{id} user userCurrentDeleteKey // // Produces: // - application/json diff --git a/routers/api/v1/user/repo.go b/routers/api/v1/user/repo.go index b4a4653faa..f119632e39 100644 --- a/routers/api/v1/user/repo.go +++ b/routers/api/v1/user/repo.go @@ -36,7 +36,7 @@ func listUserRepos(ctx *context.APIContext, u *models.User) { // ListUserRepos - list the repos owned by the given user. func ListUserRepos(ctx *context.APIContext) { - // swagger:route GET /users/{username}/repos userListRepos + // swagger:route GET /users/{username}/repos user userListRepos // // Produces: // - application/json @@ -54,7 +54,7 @@ func ListUserRepos(ctx *context.APIContext) { // ListMyRepos - list the repositories you own or have access to. func ListMyRepos(ctx *context.APIContext) { - // swagger:route GET /user/repos userCurrentListRepos + // swagger:route GET /user/repos user userCurrentListRepos // // Produces: // - application/json @@ -87,7 +87,7 @@ func ListMyRepos(ctx *context.APIContext) { // ListOrgRepos - list the repositories of an organization. func ListOrgRepos(ctx *context.APIContext) { - // swagger:route GET /orgs/{org}/repos orgListRepos + // swagger:route GET /orgs/{orgname}/repos organization orgListRepos // // Produces: // - application/json diff --git a/routers/api/v1/user/star.go b/routers/api/v1/user/star.go index 49d704cb2e..6f943a2712 100644 --- a/routers/api/v1/user/star.go +++ b/routers/api/v1/user/star.go @@ -33,7 +33,7 @@ func getStarredRepos(userID int64, private bool) ([]*api.Repository, error) { // GetStarredRepos returns the repos that the user specified by the APIContext // has starred func GetStarredRepos(ctx *context.APIContext) { - // swagger:route GET /users/{username}/starred userListStarred + // swagger:route GET /users/{username}/starred user userListStarred // // Produces: // - application/json @@ -53,7 +53,7 @@ func GetStarredRepos(ctx *context.APIContext) { // GetMyStarredRepos returns the repos that the authenticated user has starred func GetMyStarredRepos(ctx *context.APIContext) { - // swagger:route GET /user/starred userCurrentListStarred + // swagger:route GET /user/starred user userCurrentListStarred // // Produces: // - application/json @@ -71,7 +71,7 @@ func GetMyStarredRepos(ctx *context.APIContext) { // IsStarring returns whether the authenticated is starring the repo func IsStarring(ctx *context.APIContext) { - // swagger:route GET /user/starred/{username}/{reponame} userCurrentCheckStarring + // swagger:route GET /user/starred/{username}/{reponame} user userCurrentCheckStarring // // Responses: // 204: empty @@ -86,7 +86,7 @@ func IsStarring(ctx *context.APIContext) { // Star the repo specified in the APIContext, as the authenticated user func Star(ctx *context.APIContext) { - // swagger:route PUT /user/starred/{username}/{reponame} userCurrentPutStar + // swagger:route PUT /user/starred/{username}/{reponame} user userCurrentPutStar // // Responses: // 204: empty @@ -102,7 +102,7 @@ func Star(ctx *context.APIContext) { // Unstar the repo specified in the APIContext, as the authenticated user func Unstar(ctx *context.APIContext) { - // swagger:route DELETE /user/starred/{username}/{reponame} userCurrentDeleteStar + // swagger:route DELETE /user/starred/{username}/{reponame} user userCurrentDeleteStar // // Responses: // 204: empty diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go index cdb55c0d81..0ab6eaf44c 100644 --- a/routers/api/v1/user/user.go +++ b/routers/api/v1/user/user.go @@ -17,7 +17,7 @@ import ( // Search search users func Search(ctx *context.APIContext) { - // swagger:route GET /users/search userSearch + // swagger:route GET /users/search user userSearch // // Produces: // - application/json @@ -65,7 +65,7 @@ func Search(ctx *context.APIContext) { // GetInfo get user's information func GetInfo(ctx *context.APIContext) { - // swagger:route GET /users/{username} userGet + // swagger:route GET /users/{username} user userGet // // Produces: // - application/json @@ -94,7 +94,7 @@ func GetInfo(ctx *context.APIContext) { // GetAuthenticatedUser get curent user's information func GetAuthenticatedUser(ctx *context.APIContext) { - // swagger:route GET /user userGetCurrent + // swagger:route GET /user user userGetCurrent // // Produces: // - application/json diff --git a/routers/api/v1/user/watch.go b/routers/api/v1/user/watch.go index 230c819202..18628c91d1 100644 --- a/routers/api/v1/user/watch.go +++ b/routers/api/v1/user/watch.go @@ -33,7 +33,7 @@ func getWatchedRepos(userID int64, private bool) ([]*api.Repository, error) { // GetWatchedRepos returns the repos that the user specified in ctx is watching func GetWatchedRepos(ctx *context.APIContext) { - // swagger:route GET /users/{username}/subscriptions userListSubscriptions + // swagger:route GET /users/{username}/subscriptions user userListSubscriptions // // Produces: // - application/json @@ -53,7 +53,7 @@ func GetWatchedRepos(ctx *context.APIContext) { // GetMyWatchedRepos returns the repos that the authenticated user is watching func GetMyWatchedRepos(ctx *context.APIContext) { - // swagger:route GET /user/subscriptions userCurrentListSubscriptions + // swagger:route GET /user/subscriptions user userCurrentListSubscriptions // // Produces: // - application/json @@ -72,7 +72,7 @@ func GetMyWatchedRepos(ctx *context.APIContext) { // IsWatching returns whether the authenticated user is watching the repo // specified in ctx func IsWatching(ctx *context.APIContext) { - // swagger:route GET /repos/{username}/{reponame}/subscription userCurrentCheckSubscription + // swagger:route GET /repos/{username}/{reponame}/subscription repository userCurrentCheckSubscription // // Responses: // 200: WatchInfo @@ -94,7 +94,7 @@ func IsWatching(ctx *context.APIContext) { // Watch the repo specified in ctx, as the authenticated user func Watch(ctx *context.APIContext) { - // swagger:route PUT /repos/{username}/{reponame}/subscription userCurrentPutSubscription + // swagger:route PUT /repos/{username}/{reponame}/subscription repository userCurrentPutSubscription // // Responses: // 200: WatchInfo @@ -118,7 +118,7 @@ func Watch(ctx *context.APIContext) { // Unwatch the repo specified in ctx, as the authenticated user func Unwatch(ctx *context.APIContext) { - // swagger:route DELETE /repos/{username}/{reponame}/subscription userCurrentDeleteSubscription + // swagger:route DELETE /repos/{username}/{reponame}/subscription repository userCurrentDeleteSubscription // // Responses: // 204: empty |