Files
autogits/common/gitea-generated/models/edit_user_option.go

154 lines
3.8 KiB
Go

// 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"
)
// EditUserOption EditUserOption edit user options
//
// swagger:model EditUserOption
type EditUserOption struct {
// Whether the user account is active
Active bool `json:"active,omitempty"`
// Whether the user has administrator privileges
Admin bool `json:"admin,omitempty"`
// Whether the user can create organizations
AllowCreateOrganization bool `json:"allow_create_organization,omitempty"`
// Whether the user can use Git hooks
AllowGitHook bool `json:"allow_git_hook,omitempty"`
// Whether the user can import local repositories
AllowImportLocal bool `json:"allow_import_local,omitempty"`
// The user's personal description or bio
Description string `json:"description,omitempty"`
// email
// Format: email
Email strfmt.Email `json:"email,omitempty"`
// The full display name of the user
FullName string `json:"full_name,omitempty"`
// The user's location or address
Location string `json:"location,omitempty"`
// identifier of the user, provided by the external authenticator (if configured)
// Required: true
LoginName *string `json:"login_name"`
// Maximum number of repositories the user can create
MaxRepoCreation int64 `json:"max_repo_creation,omitempty"`
// Whether the user must change password on next login
MustChangePassword bool `json:"must_change_password,omitempty"`
// The plain text password for the user
Password string `json:"password,omitempty"`
// Whether the user is prohibited from logging in
ProhibitLogin bool `json:"prohibit_login,omitempty"`
// Whether the user has restricted access privileges
Restricted bool `json:"restricted,omitempty"`
// source ID
// Required: true
SourceID *int64 `json:"source_id"`
// User visibility level: public, limited, or private
Visibility string `json:"visibility,omitempty"`
// The user's personal website URL
Website string `json:"website,omitempty"`
}
// Validate validates this edit user option
func (m *EditUserOption) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateEmail(formats); err != nil {
res = append(res, err)
}
if err := m.validateLoginName(formats); err != nil {
res = append(res, err)
}
if err := m.validateSourceID(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *EditUserOption) 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 *EditUserOption) validateLoginName(formats strfmt.Registry) error {
if err := validate.Required("login_name", "body", m.LoginName); err != nil {
return err
}
return nil
}
func (m *EditUserOption) validateSourceID(formats strfmt.Registry) error {
if err := validate.Required("source_id", "body", m.SourceID); err != nil {
return err
}
return nil
}
// ContextValidate validates this edit user option based on context it is used
func (m *EditUserOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *EditUserOption) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *EditUserOption) UnmarshalBinary(b []byte) error {
var res EditUserOption
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}