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

119 lines
2.9 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"
)
// GenerateRepoOption GenerateRepoOption options when creating repository using a template
//
// swagger:model GenerateRepoOption
type GenerateRepoOption struct {
// include avatar of the template repo
Avatar bool `json:"avatar,omitempty"`
// Default branch of the new repository
DefaultBranch string `json:"default_branch,omitempty"`
// Description of the repository to create
Description string `json:"description,omitempty"`
// include git content of default branch in template repo
GitContent bool `json:"git_content,omitempty"`
// include git hooks in template repo
GitHooks bool `json:"git_hooks,omitempty"`
// include labels in template repo
Labels bool `json:"labels,omitempty"`
// Name of the repository to create
// Required: true
Name *string `json:"name"`
// The organization or person who will own the new repository
// Required: true
Owner *string `json:"owner"`
// Whether the repository is private
Private bool `json:"private,omitempty"`
// include protected branches in template repo
ProtectedBranch bool `json:"protected_branch,omitempty"`
// include topics in template repo
Topics bool `json:"topics,omitempty"`
// include webhooks in template repo
Webhooks bool `json:"webhooks,omitempty"`
}
// Validate validates this generate repo option
func (m *GenerateRepoOption) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateName(formats); err != nil {
res = append(res, err)
}
if err := m.validateOwner(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *GenerateRepoOption) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
return nil
}
func (m *GenerateRepoOption) validateOwner(formats strfmt.Registry) error {
if err := validate.Required("owner", "body", m.Owner); err != nil {
return err
}
return nil
}
// ContextValidate validates this generate repo option based on context it is used
func (m *GenerateRepoOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *GenerateRepoOption) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *GenerateRepoOption) UnmarshalBinary(b []byte) error {
var res GenerateRepoOption
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}