mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
990 B
39 lines
990 B
8 years ago
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a MIT-style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
6 years ago
|
package structs
|
||
8 years ago
|
|
||
|
import (
|
||
8 years ago
|
"encoding/json"
|
||
8 years ago
|
)
|
||
|
|
||
7 years ago
|
// User represents a user
|
||
|
// swagger:model
|
||
8 years ago
|
type User struct {
|
||
7 years ago
|
// the user's id
|
||
7 years ago
|
ID int64 `json:"id"`
|
||
7 years ago
|
// the user's username
|
||
7 years ago
|
UserName string `json:"login"`
|
||
7 years ago
|
// the user's full name
|
||
7 years ago
|
FullName string `json:"full_name"`
|
||
7 years ago
|
// swagger:strfmt email
|
||
7 years ago
|
Email string `json:"email"`
|
||
7 years ago
|
// URL to the user's avatar
|
||
8 years ago
|
AvatarURL string `json:"avatar_url"`
|
||
7 years ago
|
// User locale
|
||
|
Language string `json:"language"`
|
||
6 years ago
|
// Is the user an administrator
|
||
|
IsAdmin bool `json:"is_admin"`
|
||
8 years ago
|
}
|
||
|
|
||
8 years ago
|
// MarshalJSON implements the json.Marshaler interface for User, adding field(s) for backward compatibility
|
||
|
func (u User) MarshalJSON() ([]byte, error) {
|
||
|
// Re-declaring User to avoid recursion
|
||
|
type shadow User
|
||
|
return json.Marshal(struct {
|
||
|
shadow
|
||
|
CompatUserName string `json:"username"`
|
||
|
}{shadow(u), u.UserName})
|
||
|
}
|