lib/api/members/members_models/password_recovery_completio...

105 lines
2.5 KiB
Go
Raw Permalink Normal View History

// 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
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/validate"
)
// PasswordRecoveryCompletion Secret-bearing single-use recovery completion request.
//
// swagger:model PasswordRecoveryCompletion
type PasswordRecoveryCompletion struct {
// Plaintext new password; Members enforces 12-64 valid UTF-8 bytes.
// Required: true
// Format: password
NewPassword *strfmt.Password `json:"newPassword"`
// token
// Required: true
// Max Length: 512
// Min Length: 32
Token *string `json:"token"`
}
// Validate validates this password recovery completion
func (m *PasswordRecoveryCompletion) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateNewPassword(formats); err != nil {
res = append(res, err)
}
if err := m.validateToken(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *PasswordRecoveryCompletion) validateNewPassword(formats strfmt.Registry) error {
if err := validate.Required("newPassword", "body", m.NewPassword); err != nil {
return err
}
if err := validate.FormatOf("newPassword", "body", "password", m.NewPassword.String(), formats); err != nil {
return err
}
return nil
}
func (m *PasswordRecoveryCompletion) validateToken(formats strfmt.Registry) error {
if err := validate.Required("token", "body", m.Token); err != nil {
return err
}
if err := validate.MinLength("token", "body", *m.Token, 32); err != nil {
return err
}
if err := validate.MaxLength("token", "body", *m.Token, 512); err != nil {
return err
}
return nil
}
// ContextValidate validates this password recovery completion based on context it is used
func (m *PasswordRecoveryCompletion) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *PasswordRecoveryCompletion) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *PasswordRecoveryCompletion) UnmarshalBinary(b []byte) error {
var res PasswordRecoveryCompletion
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}