autogits/bots-common/gitea-generated/models/add_time_option.go

95 lines
2.0 KiB
Go
Raw Normal View History

2024-07-07 21:08:41 +02:00
// 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"
)
// AddTimeOption AddTimeOption options for adding time to an issue
//
// swagger:model AddTimeOption
type AddTimeOption struct {
// created
// Format: date-time
Created strfmt.DateTime `json:"created,omitempty"`
// time in seconds
// Required: true
Time *int64 `json:"time"`
// User who spent the time (optional)
User string `json:"user_name,omitempty"`
}
// Validate validates this add time option
func (m *AddTimeOption) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCreated(formats); err != nil {
res = append(res, err)
}
if err := m.validateTime(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *AddTimeOption) validateCreated(formats strfmt.Registry) error {
if swag.IsZero(m.Created) { // not required
return nil
}
if err := validate.FormatOf("created", "body", "date-time", m.Created.String(), formats); err != nil {
return err
}
return nil
}
func (m *AddTimeOption) validateTime(formats strfmt.Registry) error {
if err := validate.Required("time", "body", m.Time); err != nil {
return err
}
return nil
}
// ContextValidate validates this add time option based on context it is used
func (m *AddTimeOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *AddTimeOption) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AddTimeOption) UnmarshalBinary(b []byte) error {
var res AddTimeOption
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}