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

101 lines
2.1 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"
"github.com/go-openapi/validate"
)
// CreateLabelOption CreateLabelOption options for creating a label
//
// swagger:model CreateLabelOption
type CreateLabelOption struct {
// color
// Example: #00aabb
// Required: true
Color *string `json:"color"`
// description
Description string `json:"description,omitempty"`
// exclusive
// Example: false
Exclusive bool `json:"exclusive,omitempty"`
// is archived
// Example: false
IsArchived bool `json:"is_archived,omitempty"`
// name
// Required: true
Name *string `json:"name"`
}
// Validate validates this create label option
func (m *CreateLabelOption) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateColor(formats); err != nil {
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CreateLabelOption) validateColor(formats strfmt.Registry) error {
if err := validate.Required("color", "body", m.Color); err != nil {
return err
}
return nil
}
func (m *CreateLabelOption) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
return nil
}
// ContextValidate validates this create label option based on context it is used
func (m *CreateLabelOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *CreateLabelOption) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CreateLabelOption) UnmarshalBinary(b []byte) error {
var res CreateLabelOption
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}