Add Location, Website and Biography to API (#15675)

pull/15650/head^2
KN4CK3R 4 years ago committed by GitHub
parent 5811e162ae
commit 67e10397af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      modules/convert/user.go
  2. 6
      modules/structs/user.go
  3. 15
      templates/swagger/v1_json.tmpl

@ -45,6 +45,9 @@ func toUser(user *models.User, signed, authed bool) *api.User {
AvatarURL: user.AvatarLink(),
Created: user.CreatedUnix.AsTime(),
Restricted: user.IsRestricted,
Location: user.Location,
Website: user.Website,
Description: user.Description,
}
// hide primary email if API caller is anonymous or user keep email private
if signed && (!user.KeepEmailPrivate || authed) {

@ -33,6 +33,12 @@ type User struct {
Created time.Time `json:"created,omitempty"`
// Is user restricted
Restricted bool `json:"restricted"`
// the user's location
Location string `json:"location"`
// the user's website
Website string `json:"website"`
// the user's biography
Description string `json:"bio"`
}
// MarshalJSON implements the json.Marshaler interface for User, adding field(s) for backward compatibility

@ -16251,6 +16251,11 @@
"type": "string",
"x-go-name": "AvatarURL"
},
"bio": {
"description": "the user's biography",
"type": "string",
"x-go-name": "Description"
},
"created": {
"type": "string",
"format": "date-time",
@ -16287,6 +16292,11 @@
"format": "date-time",
"x-go-name": "LastLogin"
},
"location": {
"description": "the user's location",
"type": "string",
"x-go-name": "Location"
},
"login": {
"description": "the user's username",
"type": "string",
@ -16296,6 +16306,11 @@
"description": "Is user restricted",
"type": "boolean",
"x-go-name": "Restricted"
},
"website": {
"description": "the user's website",
"type": "string",
"x-go-name": "Website"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"

Loading…
Cancel
Save