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/v1/user | |
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/v1/user')
-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 |
8 files changed, 36 insertions, 36 deletions
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 |