lib/api/plex/plex_models/invalid_error.go

118 lines
2.5 KiB
Go
Raw Permalink Normal View History

2023-10-09 21:34:42 +00:00
// Code generated by go-swagger; DO NOT EDIT.
package plex_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"
)
// InvalidError invalid error
//
// swagger:model InvalidError
type InvalidError struct {
Error
// details
Details []string `json:"details"`
}
// UnmarshalJSON unmarshals this object from a JSON structure
func (m *InvalidError) UnmarshalJSON(raw []byte) error {
// AO0
var aO0 Error
if err := swag.ReadJSON(raw, &aO0); err != nil {
return err
}
m.Error = aO0
// AO1
var dataAO1 struct {
Details []string `json:"details"`
}
if err := swag.ReadJSON(raw, &dataAO1); err != nil {
return err
}
m.Details = dataAO1.Details
return nil
}
// MarshalJSON marshals this object to a JSON structure
func (m InvalidError) MarshalJSON() ([]byte, error) {
_parts := make([][]byte, 0, 2)
aO0, err := swag.WriteJSON(m.Error)
if err != nil {
return nil, err
}
_parts = append(_parts, aO0)
var dataAO1 struct {
Details []string `json:"details"`
}
dataAO1.Details = m.Details
jsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)
if errAO1 != nil {
return nil, errAO1
}
_parts = append(_parts, jsonDataAO1)
return swag.ConcatJSON(_parts...), nil
}
// Validate validates this invalid error
func (m *InvalidError) Validate(formats strfmt.Registry) error {
var res []error
// validation for a type composition with Error
if err := m.Error.Validate(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// ContextValidate validate this invalid error based on the context it is used
func (m *InvalidError) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
// validation for a type composition with Error
if err := m.Error.ContextValidate(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// MarshalBinary interface implementation
func (m *InvalidError) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *InvalidError) UnmarshalBinary(b []byte) error {
var res InvalidError
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}