diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-11-12 23:02:25 -0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-11-13 09:02:25 +0200 |
commit | f26f4a7e01f9c380c261fa5bc21bd7e48f2f2f9f (patch) | |
tree | 39c2fc0abc5a10f80f8fa31b3bd57ec3604bf7fd /routers/api/v1/user/repo.go | |
parent | 4287d100b39ff89e297ba8945e54fb5911226974 (diff) | |
download | gitea-f26f4a7e01f9c380c261fa5bc21bd7e48f2f2f9f.tar.gz gitea-f26f4a7e01f9c380c261fa5bc21bd7e48f2f2f9f.zip |
Update swagger documentation (#2899)
* Update swagger documentation
Add docs for missing endpoints
Add documentation for request parameters
Make parameter naming consistent
Fix response documentation
* Restore delete comments
Diffstat (limited to 'routers/api/v1/user/repo.go')
-rw-r--r-- | routers/api/v1/user/repo.go | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/routers/api/v1/user/repo.go b/routers/api/v1/user/repo.go index f119632e39..38fe76cad4 100644 --- a/routers/api/v1/user/repo.go +++ b/routers/api/v1/user/repo.go @@ -36,15 +36,20 @@ 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 user userListRepos - // - // Produces: - // - application/json - // - // Responses: - // 200: RepositoryList - // 500: error - + // swagger:operation GET /users/{username}/repos user userListRepos + // --- + // summary: List the repos owned by the given user + // produces: + // - application/json + // parameters: + // - name: username + // in: path + // description: username of user + // type: string + // required: true + // responses: + // "200": + // "$ref": "#/responses/RepositoryList" user := GetUserByParams(ctx) if ctx.Written() { return @@ -54,14 +59,14 @@ 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 user userCurrentListRepos - // - // Produces: - // - application/json - // - // Responses: - // 200: RepositoryList - // 500: error + // swagger:operation GET /user/repos user userCurrentListRepos + // --- + // summary: List the repos that the authenticated user owns or has access to + // produces: + // - application/json + // responses: + // "200": + // "$ref": "#/responses/RepositoryList" ownRepos, err := models.GetUserRepositories(ctx.User.ID, true, 1, ctx.User.NumRepos, "") if err != nil { ctx.Error(500, "GetUserRepositories", err) @@ -87,14 +92,19 @@ func ListMyRepos(ctx *context.APIContext) { // ListOrgRepos - list the repositories of an organization. func ListOrgRepos(ctx *context.APIContext) { - // swagger:route GET /orgs/{orgname}/repos organization orgListRepos - // - // Produces: - // - application/json - // - // Responses: - // 200: RepositoryList - // 500: error - + // swagger:operation GET /orgs/{org}/repos organization orgListRepos + // --- + // summary: List an organization's repos + // produces: + // - application/json + // parameters: + // - name: org + // in: path + // description: name of the organization + // type: string + // required: true + // responses: + // "200": + // "$ref": "#/responses/RepositoryList" listUserRepos(ctx, ctx.Org.Organization) } |