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

692 lines
16 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"
"encoding/json"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// Repository Repository represents a repository
//
// swagger:model Repository
type Repository struct {
// allow fast forward only
AllowFastForwardOnly bool `json:"allow_fast_forward_only_merge,omitempty"`
// allow merge
AllowMerge bool `json:"allow_merge_commits,omitempty"`
// allow rebase
AllowRebase bool `json:"allow_rebase,omitempty"`
// allow rebase merge
AllowRebaseMerge bool `json:"allow_rebase_explicit,omitempty"`
// allow rebase update
AllowRebaseUpdate bool `json:"allow_rebase_update,omitempty"`
// allow squash
AllowSquash bool `json:"allow_squash_merge,omitempty"`
// archived
Archived bool `json:"archived,omitempty"`
// archived at
// Format: date-time
ArchivedAt strfmt.DateTime `json:"archived_at,omitempty"`
// avatar URL
AvatarURL string `json:"avatar_url,omitempty"`
// clone URL
CloneURL string `json:"clone_url,omitempty"`
// created
// Format: date-time
Created strfmt.DateTime `json:"created_at,omitempty"`
// default allow maintainer edit
DefaultAllowMaintainerEdit bool `json:"default_allow_maintainer_edit,omitempty"`
// default branch
DefaultBranch string `json:"default_branch,omitempty"`
// default delete branch after merge
DefaultDeleteBranchAfterMerge bool `json:"default_delete_branch_after_merge,omitempty"`
// default merge style
DefaultMergeStyle string `json:"default_merge_style,omitempty"`
// description
Description string `json:"description,omitempty"`
// empty
Empty bool `json:"empty,omitempty"`
// fork
Fork bool `json:"fork,omitempty"`
// forks
Forks int64 `json:"forks_count,omitempty"`
// full name
FullName string `json:"full_name,omitempty"`
// HTML URL
HTMLURL string `json:"html_url,omitempty"`
// has actions
HasActions bool `json:"has_actions,omitempty"`
// has issues
HasIssues bool `json:"has_issues,omitempty"`
// has packages
HasPackages bool `json:"has_packages,omitempty"`
// has projects
HasProjects bool `json:"has_projects,omitempty"`
// has pull requests
HasPullRequests bool `json:"has_pull_requests,omitempty"`
// has releases
HasReleases bool `json:"has_releases,omitempty"`
// has wiki
HasWiki bool `json:"has_wiki,omitempty"`
// ID
ID int64 `json:"id,omitempty"`
// ignore whitespace conflicts
IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts,omitempty"`
// internal
Internal bool `json:"internal,omitempty"`
// language
Language string `json:"language,omitempty"`
// languages URL
LanguagesURL string `json:"languages_url,omitempty"`
// link
Link string `json:"link,omitempty"`
// mirror
Mirror bool `json:"mirror,omitempty"`
// mirror interval
MirrorInterval string `json:"mirror_interval,omitempty"`
// mirror updated
// Format: date-time
MirrorUpdated strfmt.DateTime `json:"mirror_updated,omitempty"`
// name
Name string `json:"name,omitempty"`
// ObjectFormatName of the underlying git repository
// Enum: ["sha1","sha256"]
ObjectFormatName string `json:"object_format_name,omitempty"`
// open issues
OpenIssues int64 `json:"open_issues_count,omitempty"`
// open pulls
OpenPulls int64 `json:"open_pr_counter,omitempty"`
// original URL
OriginalURL string `json:"original_url,omitempty"`
// private
Private bool `json:"private,omitempty"`
// projects mode
ProjectsMode string `json:"projects_mode,omitempty"`
// releases
Releases int64 `json:"release_counter,omitempty"`
// SSH URL
SSHURL string `json:"ssh_url,omitempty"`
// size
Size int64 `json:"size,omitempty"`
// stars
Stars int64 `json:"stars_count,omitempty"`
// template
Template bool `json:"template,omitempty"`
// URL
URL string `json:"url,omitempty"`
// updated
// Format: date-time
Updated strfmt.DateTime `json:"updated_at,omitempty"`
// watchers
Watchers int64 `json:"watchers_count,omitempty"`
// website
Website string `json:"website,omitempty"`
// external tracker
ExternalTracker *ExternalTracker `json:"external_tracker,omitempty"`
// external wiki
ExternalWiki *ExternalWiki `json:"external_wiki,omitempty"`
// internal tracker
InternalTracker *InternalTracker `json:"internal_tracker,omitempty"`
// owner
Owner *User `json:"owner,omitempty"`
// parent
Parent *Repository `json:"parent,omitempty"`
// permissions
Permissions *Permission `json:"permissions,omitempty"`
// repo transfer
RepoTransfer *RepoTransfer `json:"repo_transfer,omitempty"`
}
// Validate validates this repository
func (m *Repository) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateArchivedAt(formats); err != nil {
res = append(res, err)
}
if err := m.validateCreated(formats); err != nil {
res = append(res, err)
}
if err := m.validateMirrorUpdated(formats); err != nil {
res = append(res, err)
}
if err := m.validateObjectFormatName(formats); err != nil {
res = append(res, err)
}
if err := m.validateUpdated(formats); err != nil {
res = append(res, err)
}
if err := m.validateExternalTracker(formats); err != nil {
res = append(res, err)
}
if err := m.validateExternalWiki(formats); err != nil {
res = append(res, err)
}
if err := m.validateInternalTracker(formats); err != nil {
res = append(res, err)
}
if err := m.validateOwner(formats); err != nil {
res = append(res, err)
}
if err := m.validateParent(formats); err != nil {
res = append(res, err)
}
if err := m.validatePermissions(formats); err != nil {
res = append(res, err)
}
if err := m.validateRepoTransfer(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Repository) validateArchivedAt(formats strfmt.Registry) error {
if swag.IsZero(m.ArchivedAt) { // not required
return nil
}
if err := validate.FormatOf("archived_at", "body", "date-time", m.ArchivedAt.String(), formats); err != nil {
return err
}
return nil
}
func (m *Repository) validateCreated(formats strfmt.Registry) error {
if swag.IsZero(m.Created) { // not required
return nil
}
if err := validate.FormatOf("created_at", "body", "date-time", m.Created.String(), formats); err != nil {
return err
}
return nil
}
func (m *Repository) validateMirrorUpdated(formats strfmt.Registry) error {
if swag.IsZero(m.MirrorUpdated) { // not required
return nil
}
if err := validate.FormatOf("mirror_updated", "body", "date-time", m.MirrorUpdated.String(), formats); err != nil {
return err
}
return nil
}
var repositoryTypeObjectFormatNamePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["sha1","sha256"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
repositoryTypeObjectFormatNamePropEnum = append(repositoryTypeObjectFormatNamePropEnum, v)
}
}
const (
// RepositoryObjectFormatNameSha1 captures enum value "sha1"
RepositoryObjectFormatNameSha1 string = "sha1"
// RepositoryObjectFormatNameSha256 captures enum value "sha256"
RepositoryObjectFormatNameSha256 string = "sha256"
)
// prop value enum
func (m *Repository) validateObjectFormatNameEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, repositoryTypeObjectFormatNamePropEnum, true); err != nil {
return err
}
return nil
}
func (m *Repository) validateObjectFormatName(formats strfmt.Registry) error {
if swag.IsZero(m.ObjectFormatName) { // not required
return nil
}
// value enum
if err := m.validateObjectFormatNameEnum("object_format_name", "body", m.ObjectFormatName); err != nil {
return err
}
return nil
}
func (m *Repository) validateUpdated(formats strfmt.Registry) error {
if swag.IsZero(m.Updated) { // not required
return nil
}
if err := validate.FormatOf("updated_at", "body", "date-time", m.Updated.String(), formats); err != nil {
return err
}
return nil
}
func (m *Repository) validateExternalTracker(formats strfmt.Registry) error {
if swag.IsZero(m.ExternalTracker) { // not required
return nil
}
if m.ExternalTracker != nil {
if err := m.ExternalTracker.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("external_tracker")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("external_tracker")
}
return err
}
}
return nil
}
func (m *Repository) validateExternalWiki(formats strfmt.Registry) error {
if swag.IsZero(m.ExternalWiki) { // not required
return nil
}
if m.ExternalWiki != nil {
if err := m.ExternalWiki.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("external_wiki")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("external_wiki")
}
return err
}
}
return nil
}
func (m *Repository) validateInternalTracker(formats strfmt.Registry) error {
if swag.IsZero(m.InternalTracker) { // not required
return nil
}
if m.InternalTracker != nil {
if err := m.InternalTracker.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("internal_tracker")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("internal_tracker")
}
return err
}
}
return nil
}
func (m *Repository) validateOwner(formats strfmt.Registry) error {
if swag.IsZero(m.Owner) { // not required
return nil
}
if m.Owner != nil {
if err := m.Owner.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("owner")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("owner")
}
return err
}
}
return nil
}
func (m *Repository) validateParent(formats strfmt.Registry) error {
if swag.IsZero(m.Parent) { // not required
return nil
}
if m.Parent != nil {
if err := m.Parent.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("parent")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("parent")
}
return err
}
}
return nil
}
func (m *Repository) validatePermissions(formats strfmt.Registry) error {
if swag.IsZero(m.Permissions) { // not required
return nil
}
if m.Permissions != nil {
if err := m.Permissions.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("permissions")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("permissions")
}
return err
}
}
return nil
}
func (m *Repository) validateRepoTransfer(formats strfmt.Registry) error {
if swag.IsZero(m.RepoTransfer) { // not required
return nil
}
if m.RepoTransfer != nil {
if err := m.RepoTransfer.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("repo_transfer")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("repo_transfer")
}
return err
}
}
return nil
}
// ContextValidate validate this repository based on the context it is used
func (m *Repository) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateExternalTracker(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateExternalWiki(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateInternalTracker(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateOwner(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateParent(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidatePermissions(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateRepoTransfer(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Repository) contextValidateExternalTracker(ctx context.Context, formats strfmt.Registry) error {
if m.ExternalTracker != nil {
if swag.IsZero(m.ExternalTracker) { // not required
return nil
}
if err := m.ExternalTracker.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("external_tracker")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("external_tracker")
}
return err
}
}
return nil
}
func (m *Repository) contextValidateExternalWiki(ctx context.Context, formats strfmt.Registry) error {
if m.ExternalWiki != nil {
if swag.IsZero(m.ExternalWiki) { // not required
return nil
}
if err := m.ExternalWiki.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("external_wiki")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("external_wiki")
}
return err
}
}
return nil
}
func (m *Repository) contextValidateInternalTracker(ctx context.Context, formats strfmt.Registry) error {
if m.InternalTracker != nil {
if swag.IsZero(m.InternalTracker) { // not required
return nil
}
if err := m.InternalTracker.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("internal_tracker")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("internal_tracker")
}
return err
}
}
return nil
}
func (m *Repository) contextValidateOwner(ctx context.Context, formats strfmt.Registry) error {
if m.Owner != nil {
if swag.IsZero(m.Owner) { // not required
return nil
}
if err := m.Owner.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("owner")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("owner")
}
return err
}
}
return nil
}
func (m *Repository) contextValidateParent(ctx context.Context, formats strfmt.Registry) error {
if m.Parent != nil {
if swag.IsZero(m.Parent) { // not required
return nil
}
if err := m.Parent.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("parent")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("parent")
}
return err
}
}
return nil
}
func (m *Repository) contextValidatePermissions(ctx context.Context, formats strfmt.Registry) error {
if m.Permissions != nil {
if swag.IsZero(m.Permissions) { // not required
return nil
}
if err := m.Permissions.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("permissions")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("permissions")
}
return err
}
}
return nil
}
func (m *Repository) contextValidateRepoTransfer(ctx context.Context, formats strfmt.Registry) error {
if m.RepoTransfer != nil {
if swag.IsZero(m.RepoTransfer) { // not required
return nil
}
if err := m.RepoTransfer.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("repo_transfer")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("repo_transfer")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *Repository) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Repository) UnmarshalBinary(b []byte) error {
var res Repository
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}