mirror of https://github.com/vernonkeenan/lib
105 lines
2.2 KiB
Go
105 lines
2.2 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
// (c) 2012-2020 by Taxnexus, Inc.
|
|
// All rights reserved worldwide.
|
|
// Proprietary product; unlicensed use is not allowed
|
|
|
|
package members_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"
|
|
)
|
|
|
|
// Credentials credentials
|
|
//
|
|
// swagger:model credentials
|
|
type Credentials struct {
|
|
|
|
// email
|
|
// Example: user@example.com
|
|
// Required: true
|
|
// Format: email
|
|
Email *strfmt.Email `json:"email"`
|
|
|
|
// password
|
|
// Example: p@55w0rd-example
|
|
// Required: true
|
|
// Min Length: 12
|
|
Password *string `json:"password"`
|
|
}
|
|
|
|
// Validate validates this credentials
|
|
func (m *Credentials) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateEmail(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validatePassword(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Credentials) validateEmail(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("email", "body", m.Email); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.FormatOf("email", "body", "email", m.Email.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Credentials) validatePassword(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("password", "body", m.Password); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MinLength("password", "body", *m.Password, 12); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validates this credentials based on context it is used
|
|
func (m *Credentials) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *Credentials) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *Credentials) UnmarshalBinary(b []byte) error {
|
|
var res Credentials
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|