aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/user/follower.go
diff options
context:
space:
mode:
authorAntoine GIRARD <sapk@users.noreply.github.com>2017-05-02 15:35:59 +0200
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-05-02 15:35:59 +0200
commit3edb0c58943c003ed3f209b2197d1f43484a3432 (patch)
treee5849cead5053ab505a2c5dc1342111c6bcf0816 /routers/api/v1/user/follower.go
parentbb5f694fc57c3ade9c13e841b9a237f4e192da22 (diff)
downloadgitea-3edb0c58943c003ed3f209b2197d1f43484a3432.tar.gz
gitea-3edb0c58943c003ed3f209b2197d1f43484a3432.zip
Generate swagger json (#1402)
- Generate swagger.json into public/ - Add swagger-ui auto-installation - Add footer link to local swagger-ui - Add /swagger url for using app url. - Fix Swagger-UI version via git tag
Diffstat (limited to 'routers/api/v1/user/follower.go')
-rw-r--r--routers/api/v1/user/follower.go66
1 files changed, 60 insertions, 6 deletions
diff --git a/routers/api/v1/user/follower.go b/routers/api/v1/user/follower.go
index ff043c9de9..84240c7957 100644
--- a/routers/api/v1/user/follower.go
+++ b/routers/api/v1/user/follower.go
@@ -30,12 +30,29 @@ func listUserFollowers(ctx *context.APIContext, u *models.User) {
// ListMyFollowers list all my followers
func ListMyFollowers(ctx *context.APIContext) {
+ // swagger:route GET /user/followers userCurrentListFollowers
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 200: UserList
+ // 500: error
+
listUserFollowers(ctx, ctx.User)
}
// ListFollowers list user's followers
-// see https://github.com/gogits/go-gogs-client/wiki/Users-Followers#list-followers-of-a-user
func ListFollowers(ctx *context.APIContext) {
+ // swagger:route GET /users/:username/followers userListFollowers
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 200: UserList
+ // 500: error
+
u := GetUserByParams(ctx)
if ctx.Written() {
return
@@ -54,12 +71,29 @@ func listUserFollowing(ctx *context.APIContext, u *models.User) {
// ListMyFollowing list all my followings
func ListMyFollowing(ctx *context.APIContext) {
+ // swagger:route GET /user/following userCurrentListFollowing
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 200: UserList
+ // 500: error
+
listUserFollowing(ctx, ctx.User)
}
// ListFollowing list user's followings
-// see https://github.com/gogits/go-gogs-client/wiki/Users-Followers#list-users-followed-by-another-user
func ListFollowing(ctx *context.APIContext) {
+ // swagger:route GET /users/{username}/following userListFollowing
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 200: UserList
+ // 500: error
+
u := GetUserByParams(ctx)
if ctx.Written() {
return
@@ -76,8 +110,13 @@ func checkUserFollowing(ctx *context.APIContext, u *models.User, followID int64)
}
// CheckMyFollowing check if the repo is followed by me
-// see https://github.com/gogits/go-gogs-client/wiki/Users-Followers#check-if-you-are-following-a-user
func CheckMyFollowing(ctx *context.APIContext) {
+ // swagger:route GET /user/following/{username} userCurrentCheckFollowing
+ //
+ // Responses:
+ // 204: empty
+ // 404: notFound
+
target := GetUserByParams(ctx)
if ctx.Written() {
return
@@ -86,8 +125,13 @@ func CheckMyFollowing(ctx *context.APIContext) {
}
// CheckFollowing check if the repo is followed by user
-// see https://github.com/gogits/go-gogs-client/wiki/Users-Followers#check-if-one-user-follows-another
func CheckFollowing(ctx *context.APIContext) {
+ // swagger:route GET /users/{username}/following/:target userCheckFollowing
+ //
+ // Responses:
+ // 204: empty
+ // 404: notFound
+
u := GetUserByParams(ctx)
if ctx.Written() {
return
@@ -100,8 +144,13 @@ func CheckFollowing(ctx *context.APIContext) {
}
// Follow follow one repository
-// see https://github.com/gogits/go-gogs-client/wiki/Users-Followers#follow-a-user
func Follow(ctx *context.APIContext) {
+ // swagger:route PUT /user/following/{username} userCurrentPutFollow
+ //
+ // Responses:
+ // 204: empty
+ // 500: error
+
target := GetUserByParams(ctx)
if ctx.Written() {
return
@@ -114,8 +163,13 @@ func Follow(ctx *context.APIContext) {
}
// Unfollow unfollow one repository
-// see https://github.com/gogits/go-gogs-client/wiki/Users-Followers#unfollow-a-user
func Unfollow(ctx *context.APIContext) {
+ // swagger:route DELETE /user/following/{username} userCurrentDeleteFollow
+ //
+ // Responses:
+ // 204: empty
+ // 500: error
+
target := GetUserByParams(ctx)
if ctx.Written() {
return