add ID as an output for list API

This commit is contained in:
Gitea 2018-06-12 19:06:50 -04:00
parent e211c28452
commit 112ec99322
3 changed files with 7 additions and 0 deletions

View File

@ -7512,6 +7512,10 @@
"AccessToken": {
"description": "AccessToken represents a API access token.",
"headers": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},

View File

@ -39,6 +39,7 @@ func ListAccessTokens(ctx *context.APIContext) {
apiTokens[i] = &api.AccessToken{
Name: tokens[i].Name,
Sha1: tokens[i].Sha1,
ID: tokens[i].ID,
}
}
ctx.JSON(200, &apiTokens)
@ -73,6 +74,7 @@ func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption
ctx.JSON(201, &api.AccessToken{
Name: t.Name,
Sha1: t.Sha1,
ID: t.ID,
})
}

View File

@ -22,6 +22,7 @@ func BasicAuthEncode(user, pass string) string {
type AccessToken struct {
Name string `json:"name"`
Sha1 string `json:"sha1"`
ID int64 `json:"id"`
}
// AccessTokenList represents a list of API access token.