337 lines
8.5 KiB
Go
337 lines
8.5 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"
|
|
"encoding/json"
|
|
"strconv"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// UserCreateForm user create form
|
|
//
|
|
// swagger:model UserCreateForm
|
|
type UserCreateForm struct {
|
|
|
|
// account number
|
|
AccountNumber string `json:"accountNumber,omitempty"`
|
|
|
|
// alias
|
|
Alias string `json:"alias,omitempty"`
|
|
|
|
// The hexadecimal color code (default: #d2d6de)
|
|
Color string `json:"color,omitempty"`
|
|
|
|
// email
|
|
// Required: true
|
|
Email *string `json:"email"`
|
|
|
|
// enabled
|
|
Enabled bool `json:"enabled,omitempty"`
|
|
|
|
// language
|
|
// Required: true
|
|
// Enum: [ar cs da de de_AT de_CH el en en_GB eo es eu fa fi fo fr he hr hu it ja ko nb_NO nl pl pt pt_BR ro ru sk sv tr uk vi zh_CN]
|
|
Language *string `json:"language"`
|
|
|
|
// Plain API token
|
|
PlainAPIToken string `json:"plainApiToken,omitempty"`
|
|
|
|
// Plain text password
|
|
// Required: true
|
|
PlainPassword *string `json:"plainPassword"`
|
|
|
|
// roles
|
|
Roles []string `json:"roles"`
|
|
|
|
// timezone
|
|
// Required: true
|
|
Timezone *string `json:"timezone"`
|
|
|
|
// title
|
|
Title string `json:"title,omitempty"`
|
|
|
|
// username
|
|
// Required: true
|
|
Username *string `json:"username"`
|
|
}
|
|
|
|
// Validate validates this user create form
|
|
func (m *UserCreateForm) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateEmail(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateLanguage(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validatePlainPassword(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateRoles(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTimezone(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateUsername(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *UserCreateForm) validateEmail(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("email", "body", m.Email); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var userCreateFormTypeLanguagePropEnum []interface{}
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["ar","cs","da","de","de_AT","de_CH","el","en","en_GB","eo","es","eu","fa","fi","fo","fr","he","hr","hu","it","ja","ko","nb_NO","nl","pl","pt","pt_BR","ro","ru","sk","sv","tr","uk","vi","zh_CN"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
userCreateFormTypeLanguagePropEnum = append(userCreateFormTypeLanguagePropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// UserCreateFormLanguageAr captures enum value "ar"
|
|
UserCreateFormLanguageAr string = "ar"
|
|
|
|
// UserCreateFormLanguageCs captures enum value "cs"
|
|
UserCreateFormLanguageCs string = "cs"
|
|
|
|
// UserCreateFormLanguageDa captures enum value "da"
|
|
UserCreateFormLanguageDa string = "da"
|
|
|
|
// UserCreateFormLanguageDe captures enum value "de"
|
|
UserCreateFormLanguageDe string = "de"
|
|
|
|
// UserCreateFormLanguageDeAT captures enum value "de_AT"
|
|
UserCreateFormLanguageDeAT string = "de_AT"
|
|
|
|
// UserCreateFormLanguageDeCH captures enum value "de_CH"
|
|
UserCreateFormLanguageDeCH string = "de_CH"
|
|
|
|
// UserCreateFormLanguageEl captures enum value "el"
|
|
UserCreateFormLanguageEl string = "el"
|
|
|
|
// UserCreateFormLanguageEn captures enum value "en"
|
|
UserCreateFormLanguageEn string = "en"
|
|
|
|
// UserCreateFormLanguageEnGB captures enum value "en_GB"
|
|
UserCreateFormLanguageEnGB string = "en_GB"
|
|
|
|
// UserCreateFormLanguageEo captures enum value "eo"
|
|
UserCreateFormLanguageEo string = "eo"
|
|
|
|
// UserCreateFormLanguageEs captures enum value "es"
|
|
UserCreateFormLanguageEs string = "es"
|
|
|
|
// UserCreateFormLanguageEu captures enum value "eu"
|
|
UserCreateFormLanguageEu string = "eu"
|
|
|
|
// UserCreateFormLanguageFa captures enum value "fa"
|
|
UserCreateFormLanguageFa string = "fa"
|
|
|
|
// UserCreateFormLanguageFi captures enum value "fi"
|
|
UserCreateFormLanguageFi string = "fi"
|
|
|
|
// UserCreateFormLanguageFo captures enum value "fo"
|
|
UserCreateFormLanguageFo string = "fo"
|
|
|
|
// UserCreateFormLanguageFr captures enum value "fr"
|
|
UserCreateFormLanguageFr string = "fr"
|
|
|
|
// UserCreateFormLanguageHe captures enum value "he"
|
|
UserCreateFormLanguageHe string = "he"
|
|
|
|
// UserCreateFormLanguageHr captures enum value "hr"
|
|
UserCreateFormLanguageHr string = "hr"
|
|
|
|
// UserCreateFormLanguageHu captures enum value "hu"
|
|
UserCreateFormLanguageHu string = "hu"
|
|
|
|
// UserCreateFormLanguageIt captures enum value "it"
|
|
UserCreateFormLanguageIt string = "it"
|
|
|
|
// UserCreateFormLanguageJa captures enum value "ja"
|
|
UserCreateFormLanguageJa string = "ja"
|
|
|
|
// UserCreateFormLanguageKo captures enum value "ko"
|
|
UserCreateFormLanguageKo string = "ko"
|
|
|
|
// UserCreateFormLanguageNbNO captures enum value "nb_NO"
|
|
UserCreateFormLanguageNbNO string = "nb_NO"
|
|
|
|
// UserCreateFormLanguageNl captures enum value "nl"
|
|
UserCreateFormLanguageNl string = "nl"
|
|
|
|
// UserCreateFormLanguagePl captures enum value "pl"
|
|
UserCreateFormLanguagePl string = "pl"
|
|
|
|
// UserCreateFormLanguagePt captures enum value "pt"
|
|
UserCreateFormLanguagePt string = "pt"
|
|
|
|
// UserCreateFormLanguagePtBR captures enum value "pt_BR"
|
|
UserCreateFormLanguagePtBR string = "pt_BR"
|
|
|
|
// UserCreateFormLanguageRo captures enum value "ro"
|
|
UserCreateFormLanguageRo string = "ro"
|
|
|
|
// UserCreateFormLanguageRu captures enum value "ru"
|
|
UserCreateFormLanguageRu string = "ru"
|
|
|
|
// UserCreateFormLanguageSk captures enum value "sk"
|
|
UserCreateFormLanguageSk string = "sk"
|
|
|
|
// UserCreateFormLanguageSv captures enum value "sv"
|
|
UserCreateFormLanguageSv string = "sv"
|
|
|
|
// UserCreateFormLanguageTr captures enum value "tr"
|
|
UserCreateFormLanguageTr string = "tr"
|
|
|
|
// UserCreateFormLanguageUk captures enum value "uk"
|
|
UserCreateFormLanguageUk string = "uk"
|
|
|
|
// UserCreateFormLanguageVi captures enum value "vi"
|
|
UserCreateFormLanguageVi string = "vi"
|
|
|
|
// UserCreateFormLanguageZhCN captures enum value "zh_CN"
|
|
UserCreateFormLanguageZhCN string = "zh_CN"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *UserCreateForm) validateLanguageEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, userCreateFormTypeLanguagePropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *UserCreateForm) validateLanguage(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("language", "body", m.Language); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateLanguageEnum("language", "body", *m.Language); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *UserCreateForm) validatePlainPassword(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("plainPassword", "body", m.PlainPassword); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var userCreateFormRolesItemsEnum []interface{}
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["ROLE_TEAMLEAD","ROLE_ADMIN","ROLE_SUPER_ADMIN"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
userCreateFormRolesItemsEnum = append(userCreateFormRolesItemsEnum, v)
|
|
}
|
|
}
|
|
|
|
func (m *UserCreateForm) validateRolesItemsEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, userCreateFormRolesItemsEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *UserCreateForm) validateRoles(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Roles) { // not required
|
|
return nil
|
|
}
|
|
|
|
for i := 0; i < len(m.Roles); i++ {
|
|
|
|
// value enum
|
|
if err := m.validateRolesItemsEnum("roles"+"."+strconv.Itoa(i), "body", m.Roles[i]); err != nil {
|
|
return err
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *UserCreateForm) validateTimezone(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("timezone", "body", m.Timezone); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *UserCreateForm) validateUsername(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("username", "body", m.Username); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validates this user create form based on context it is used
|
|
func (m *UserCreateForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *UserCreateForm) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *UserCreateForm) UnmarshalBinary(b []byte) error {
|
|
var res UserCreateForm
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|