autogits/bots-common/gitea-generated/models/user.go

172 lines
3.8 KiB
Go
Raw Normal View History

2024-07-07 21:08:41 +02:00
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// User User represents a user
//
// swagger:model User
type User struct {
// URL to the user's avatar
AvatarURL string `json:"avatar_url,omitempty"`
// created
// Format: date-time
Created strfmt.DateTime `json:"created,omitempty"`
// the user's description
Description string `json:"description,omitempty"`
// email
// Format: email
Email strfmt.Email `json:"email,omitempty"`
// user counts
Followers int64 `json:"followers_count,omitempty"`
// following
Following int64 `json:"following_count,omitempty"`
// the user's full name
FullName string `json:"full_name,omitempty"`
// URL to the user's gitea page
HTMLURL string `json:"html_url,omitempty"`
// the user's id
ID int64 `json:"id,omitempty"`
// Is user active
IsActive bool `json:"active,omitempty"`
// Is the user an administrator
IsAdmin bool `json:"is_admin,omitempty"`
// User locale
Language string `json:"language,omitempty"`
// last login
// Format: date-time
LastLogin strfmt.DateTime `json:"last_login,omitempty"`
// the user's location
Location string `json:"location,omitempty"`
// the user's authentication sign-in name.
LoginName *string `json:"login_name,omitempty"`
// Is user login prohibited
ProhibitLogin bool `json:"prohibit_login,omitempty"`
// Is user restricted
Restricted bool `json:"restricted,omitempty"`
// The ID of the user's Authentication Source
SourceID int64 `json:"source_id,omitempty"`
// starred repos
StarredRepos int64 `json:"starred_repos_count,omitempty"`
// the user's username
UserName string `json:"login,omitempty"`
// User visibility level option: public, limited, private
Visibility string `json:"visibility,omitempty"`
// the user's website
Website string `json:"website,omitempty"`
}
// Validate validates this user
func (m *User) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCreated(formats); err != nil {
res = append(res, err)
}
if err := m.validateEmail(formats); err != nil {
res = append(res, err)
}
if err := m.validateLastLogin(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *User) validateCreated(formats strfmt.Registry) error {
if swag.IsZero(m.Created) { // not required
return nil
}
if err := validate.FormatOf("created", "body", "date-time", m.Created.String(), formats); err != nil {
return err
}
return nil
}
func (m *User) validateEmail(formats strfmt.Registry) error {
if swag.IsZero(m.Email) { // not required
return nil
}
if err := validate.FormatOf("email", "body", "email", m.Email.String(), formats); err != nil {
return err
}
return nil
}
func (m *User) validateLastLogin(formats strfmt.Registry) error {
if swag.IsZero(m.LastLogin) { // not required
return nil
}
if err := validate.FormatOf("last_login", "body", "date-time", m.LastLogin.String(), formats); err != nil {
return err
}
return nil
}
// ContextValidate validates this user based on context it is used
func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *User) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *User) UnmarshalBinary(b []byte) error {
var res User
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}