Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
219
pkg/ota_api/models/common_supplier_account.go
Normal file
219
pkg/ota_api/models/common_supplier_account.go
Normal file
@@ -0,0 +1,219 @@
|
||||
// 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"
|
||||
)
|
||||
|
||||
// CommonSupplierAccount common supplier account
|
||||
//
|
||||
// swagger:model common.SupplierAccount
|
||||
type CommonSupplierAccount struct {
|
||||
|
||||
// address
|
||||
// Required: true
|
||||
// Max Length: 100
|
||||
Address *string `json:"address"`
|
||||
|
||||
// company
|
||||
// Required: true
|
||||
// Max Length: 100
|
||||
Company *string `json:"company"`
|
||||
|
||||
// contact
|
||||
// Required: true
|
||||
// Max Length: 50
|
||||
Contact *string `json:"contact"`
|
||||
|
||||
// ecus
|
||||
// Required: true
|
||||
// Max Items: 100
|
||||
// Min Items: 1
|
||||
Ecus []string `json:"ecus"`
|
||||
|
||||
// email
|
||||
// Required: true
|
||||
// Max Length: 1000
|
||||
Email *string `json:"email"`
|
||||
|
||||
// program
|
||||
// Required: true
|
||||
// Max Length: 100
|
||||
Program *string `json:"program"`
|
||||
|
||||
// supplier organization id
|
||||
// Example: 0
|
||||
SupplierOrganizationID string `json:"supplier_organization_id,omitempty"`
|
||||
|
||||
// telephone
|
||||
// Required: true
|
||||
// Max Length: 20
|
||||
Telephone *string `json:"telephone"`
|
||||
}
|
||||
|
||||
// Validate validates this common supplier account
|
||||
func (m *CommonSupplierAccount) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateAddress(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateCompany(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateContact(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateEcus(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateEmail(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateProgram(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateTelephone(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CommonSupplierAccount) validateAddress(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("address", "body", m.Address); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := validate.MaxLength("address", "body", *m.Address, 100); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CommonSupplierAccount) validateCompany(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("company", "body", m.Company); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := validate.MaxLength("company", "body", *m.Company, 100); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CommonSupplierAccount) validateContact(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("contact", "body", m.Contact); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := validate.MaxLength("contact", "body", *m.Contact, 50); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CommonSupplierAccount) validateEcus(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("ecus", "body", m.Ecus); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
iEcusSize := int64(len(m.Ecus))
|
||||
|
||||
if err := validate.MinItems("ecus", "body", iEcusSize, 1); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := validate.MaxItems("ecus", "body", iEcusSize, 100); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CommonSupplierAccount) validateEmail(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("email", "body", m.Email); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := validate.MaxLength("email", "body", *m.Email, 1000); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CommonSupplierAccount) validateProgram(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("program", "body", m.Program); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := validate.MaxLength("program", "body", *m.Program, 100); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CommonSupplierAccount) validateTelephone(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("telephone", "body", m.Telephone); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := validate.MaxLength("telephone", "body", *m.Telephone, 20); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this common supplier account based on context it is used
|
||||
func (m *CommonSupplierAccount) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *CommonSupplierAccount) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *CommonSupplierAccount) UnmarshalBinary(b []byte) error {
|
||||
var res CommonSupplierAccount
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user