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

154 lines
3.3 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"
)
// EditUserOption EditUserOption edit user options
//
// swagger:model EditUserOption
type EditUserOption struct {
// active
Active bool `json:"active,omitempty"`
// admin
Admin bool `json:"admin,omitempty"`
// allow create organization
AllowCreateOrganization bool `json:"allow_create_organization,omitempty"`
// allow git hook
AllowGitHook bool `json:"allow_git_hook,omitempty"`
// allow import local
AllowImportLocal bool `json:"allow_import_local,omitempty"`
// description
Description string `json:"description,omitempty"`
// email
// Format: email
Email strfmt.Email `json:"email,omitempty"`
// full name
FullName string `json:"full_name,omitempty"`
// location
Location string `json:"location,omitempty"`
// login name
// Required: true
LoginName *string `json:"login_name"`
// max repo creation
MaxRepoCreation int64 `json:"max_repo_creation,omitempty"`
// must change password
MustChangePassword bool `json:"must_change_password,omitempty"`
// password
Password string `json:"password,omitempty"`
// prohibit login
ProhibitLogin bool `json:"prohibit_login,omitempty"`
// restricted
Restricted bool `json:"restricted,omitempty"`
// source ID
// Required: true
SourceID *int64 `json:"source_id"`
// visibility
Visibility string `json:"visibility,omitempty"`
// website
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
}