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

132 lines
3.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"
"encoding/json"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// CreateMilestoneOption CreateMilestoneOption options for creating a milestone
//
// swagger:model CreateMilestoneOption
type CreateMilestoneOption struct {
// deadline
// Format: date-time
Deadline strfmt.DateTime `json:"due_on,omitempty"`
// description
Description string `json:"description,omitempty"`
// state
// Enum: ["open","closed"]
State string `json:"state,omitempty"`
// title
Title string `json:"title,omitempty"`
}
// Validate validates this create milestone option
func (m *CreateMilestoneOption) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateDeadline(formats); err != nil {
res = append(res, err)
}
if err := m.validateState(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CreateMilestoneOption) validateDeadline(formats strfmt.Registry) error {
if swag.IsZero(m.Deadline) { // not required
return nil
}
if err := validate.FormatOf("due_on", "body", "date-time", m.Deadline.String(), formats); err != nil {
return err
}
return nil
}
var createMilestoneOptionTypeStatePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["open","closed"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
createMilestoneOptionTypeStatePropEnum = append(createMilestoneOptionTypeStatePropEnum, v)
}
}
const (
// CreateMilestoneOptionStateOpen captures enum value "open"
CreateMilestoneOptionStateOpen string = "open"
// CreateMilestoneOptionStateClosed captures enum value "closed"
CreateMilestoneOptionStateClosed string = "closed"
)
// prop value enum
func (m *CreateMilestoneOption) validateStateEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, createMilestoneOptionTypeStatePropEnum, true); err != nil {
return err
}
return nil
}
func (m *CreateMilestoneOption) validateState(formats strfmt.Registry) error {
if swag.IsZero(m.State) { // not required
return nil
}
// value enum
if err := m.validateStateEnum("state", "body", m.State); err != nil {
return err
}
return nil
}
// ContextValidate validates this create milestone option based on context it is used
func (m *CreateMilestoneOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *CreateMilestoneOption) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CreateMilestoneOption) UnmarshalBinary(b []byte) error {
var res CreateMilestoneOption
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}