go-gitea/models/submit_pull_review_options.go
jolheiser 021242f2ad
initial commit
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2023-04-11 22:59:19 -05:00

104 lines
2.4 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"
)
// SubmitPullReviewOptions SubmitPullReviewOptions are options to submit a pending pull review
//
// swagger:model SubmitPullReviewOptions
type SubmitPullReviewOptions struct {
// body
Body string `json:"body,omitempty"`
// event
Event ReviewStateType `json:"event,omitempty"`
}
// Validate validates this submit pull review options
func (m *SubmitPullReviewOptions) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateEvent(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *SubmitPullReviewOptions) validateEvent(formats strfmt.Registry) error {
if swag.IsZero(m.Event) { // not required
return nil
}
if err := m.Event.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("event")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("event")
}
return err
}
return nil
}
// ContextValidate validate this submit pull review options based on the context it is used
func (m *SubmitPullReviewOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateEvent(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *SubmitPullReviewOptions) contextValidateEvent(ctx context.Context, formats strfmt.Registry) error {
if err := m.Event.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("event")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("event")
}
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *SubmitPullReviewOptions) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *SubmitPullReviewOptions) UnmarshalBinary(b []byte) error {
var res SubmitPullReviewOptions
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}