autogits/bots-common/gitea-generated/models/file_delete_response.go
Adam Majer 598ecbbd5a .
2024-07-07 21:12:40 +02:00

164 lines
3.8 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"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// FileDeleteResponse FileDeleteResponse contains information about a repo's file that was deleted
//
// swagger:model FileDeleteResponse
type FileDeleteResponse struct {
// content
Content interface{} `json:"content,omitempty"`
// commit
Commit *FileCommitResponse `json:"commit,omitempty"`
// verification
Verification *PayloadCommitVerification `json:"verification,omitempty"`
}
// Validate validates this file delete response
func (m *FileDeleteResponse) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCommit(formats); err != nil {
res = append(res, err)
}
if err := m.validateVerification(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *FileDeleteResponse) validateCommit(formats strfmt.Registry) error {
if swag.IsZero(m.Commit) { // not required
return nil
}
if m.Commit != nil {
if err := m.Commit.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("commit")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("commit")
}
return err
}
}
return nil
}
func (m *FileDeleteResponse) validateVerification(formats strfmt.Registry) error {
if swag.IsZero(m.Verification) { // not required
return nil
}
if m.Verification != nil {
if err := m.Verification.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("verification")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("verification")
}
return err
}
}
return nil
}
// ContextValidate validate this file delete response based on the context it is used
func (m *FileDeleteResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateCommit(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateVerification(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *FileDeleteResponse) contextValidateCommit(ctx context.Context, formats strfmt.Registry) error {
if m.Commit != nil {
if swag.IsZero(m.Commit) { // not required
return nil
}
if err := m.Commit.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("commit")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("commit")
}
return err
}
}
return nil
}
func (m *FileDeleteResponse) contextValidateVerification(ctx context.Context, formats strfmt.Registry) error {
if m.Verification != nil {
if swag.IsZero(m.Verification) { // not required
return nil
}
if err := m.Verification.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("verification")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("verification")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *FileDeleteResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *FileDeleteResponse) UnmarshalBinary(b []byte) error {
var res FileDeleteResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}