mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
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
This commit is contained in:
committed by
Kim "BKC" Carlbäcker
parent
bb5f694fc5
commit
3edb0c5894
@@ -12,8 +12,16 @@ import (
|
||||
)
|
||||
|
||||
// ListAccessTokens list all the access tokens
|
||||
// see https://github.com/gogits/go-gogs-client/wiki/Users#list-access-tokens-for-a-user
|
||||
func ListAccessTokens(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/{username}/tokens userGetTokens
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: AccessTokenList
|
||||
// 500: error
|
||||
|
||||
tokens, err := models.ListAccessTokens(ctx.User.ID)
|
||||
if err != nil {
|
||||
ctx.Error(500, "ListAccessTokens", err)
|
||||
@@ -31,8 +39,19 @@ func ListAccessTokens(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
// CreateAccessToken create access tokens
|
||||
// see https://github.com/gogits/go-gogs-client/wiki/Users#create-a-access-token
|
||||
func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption) {
|
||||
// swagger:route POST /users/{username} /tokens userCreateToken
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: AccessToken
|
||||
// 500: error
|
||||
|
||||
t := &models.AccessToken{
|
||||
UID: ctx.User.ID,
|
||||
Name: form.Name,
|
||||
|
Reference in New Issue
Block a user