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

113 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"
"github.com/go-openapi/validate"
)
// CreateIssueOption CreateIssueOption options to create one issue
//
// swagger:model CreateIssueOption
type CreateIssueOption struct {
// deprecated
Assignee string `json:"assignee,omitempty"`
// assignees
Assignees []string `json:"assignees"`
// body
Body string `json:"body,omitempty"`
// closed
Closed bool `json:"closed,omitempty"`
// deadline
// Format: date-time
Deadline strfmt.DateTime `json:"due_date,omitempty"`
// list of label ids
Labels []int64 `json:"labels"`
// milestone id
Milestone int64 `json:"milestone,omitempty"`
// ref
Ref string `json:"ref,omitempty"`
// title
// Required: true
Title *string `json:"title"`
}
// Validate validates this create issue option
func (m *CreateIssueOption) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateDeadline(formats); err != nil {
res = append(res, err)
}
if err := m.validateTitle(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CreateIssueOption) validateDeadline(formats strfmt.Registry) error {
if swag.IsZero(m.Deadline) { // not required
return nil
}
if err := validate.FormatOf("due_date", "body", "date-time", m.Deadline.String(), formats); err != nil {
return err
}
return nil
}
func (m *CreateIssueOption) validateTitle(formats strfmt.Registry) error {
if err := validate.Required("title", "body", m.Title); err != nil {
return err
}
return nil
}
// ContextValidate validates this create issue option based on context it is used
func (m *CreateIssueOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *CreateIssueOption) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CreateIssueOption) UnmarshalBinary(b []byte) error {
var res CreateIssueOption
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}