301 lines
9.2 KiB
Go
301 lines
9.2 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"
|
|
)
|
|
|
|
// EditRepoOption EditRepoOption options when editing a repository's properties
|
|
//
|
|
// swagger:model EditRepoOption
|
|
type EditRepoOption struct {
|
|
|
|
// either `true` to allow fast-forward-only merging pull requests, or `false` to prevent fast-forward-only merging.
|
|
AllowFastForwardOnly bool `json:"allow_fast_forward_only_merge,omitempty"`
|
|
|
|
// either `true` to allow mark pr as merged manually, or `false` to prevent it.
|
|
AllowManualMerge bool `json:"allow_manual_merge,omitempty"`
|
|
|
|
// either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.
|
|
AllowMerge bool `json:"allow_merge_commits,omitempty"`
|
|
|
|
// either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.
|
|
AllowRebase bool `json:"allow_rebase,omitempty"`
|
|
|
|
// either `true` to allow rebase with explicit merge commits (--no-ff), or `false` to prevent rebase with explicit merge commits.
|
|
AllowRebaseMerge bool `json:"allow_rebase_explicit,omitempty"`
|
|
|
|
// either `true` to allow updating pull request branch by rebase, or `false` to prevent it.
|
|
AllowRebaseUpdate bool `json:"allow_rebase_update,omitempty"`
|
|
|
|
// either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.
|
|
AllowSquash bool `json:"allow_squash_merge,omitempty"`
|
|
|
|
// set to `true` to archive this repository.
|
|
Archived bool `json:"archived,omitempty"`
|
|
|
|
// either `true` to enable AutodetectManualMerge, or `false` to prevent it. Note: In some special cases, misjudgments can occur.
|
|
AutodetectManualMerge bool `json:"autodetect_manual_merge,omitempty"`
|
|
|
|
// set to `true` to allow edits from maintainers by default
|
|
DefaultAllowMaintainerEdit bool `json:"default_allow_maintainer_edit,omitempty"`
|
|
|
|
// sets the default branch for this repository.
|
|
DefaultBranch string `json:"default_branch,omitempty"`
|
|
|
|
// set to `true` to delete pr branch after merge by default
|
|
DefaultDeleteBranchAfterMerge bool `json:"default_delete_branch_after_merge,omitempty"`
|
|
|
|
// set to a merge style to be used by this repository: "merge", "rebase", "rebase-merge", "squash", or "fast-forward-only".
|
|
DefaultMergeStyle string `json:"default_merge_style,omitempty"`
|
|
|
|
// a short description of the repository.
|
|
Description string `json:"description,omitempty"`
|
|
|
|
// enable prune - remove obsolete remote-tracking references when mirroring
|
|
EnablePrune bool `json:"enable_prune,omitempty"`
|
|
|
|
// either `true` to enable actions unit, or `false` to disable them.
|
|
HasActions bool `json:"has_actions,omitempty"`
|
|
|
|
// either `true` to enable issues for this repository or `false` to disable them.
|
|
HasIssues bool `json:"has_issues,omitempty"`
|
|
|
|
// either `true` to enable packages unit, or `false` to disable them.
|
|
HasPackages bool `json:"has_packages,omitempty"`
|
|
|
|
// either `true` to enable project unit, or `false` to disable them.
|
|
HasProjects bool `json:"has_projects,omitempty"`
|
|
|
|
// either `true` to allow pull requests, or `false` to prevent pull request.
|
|
HasPullRequests bool `json:"has_pull_requests,omitempty"`
|
|
|
|
// either `true` to enable releases unit, or `false` to disable them.
|
|
HasReleases bool `json:"has_releases,omitempty"`
|
|
|
|
// either `true` to enable the wiki for this repository or `false` to disable it.
|
|
HasWiki bool `json:"has_wiki,omitempty"`
|
|
|
|
// either `true` to ignore whitespace for conflicts, or `false` to not ignore whitespace.
|
|
IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts,omitempty"`
|
|
|
|
// set to a string like `8h30m0s` to set the mirror interval time
|
|
MirrorInterval string `json:"mirror_interval,omitempty"`
|
|
|
|
// name of the repository
|
|
Name string `json:"name,omitempty"`
|
|
|
|
// either `true` to make the repository private or `false` to make it public.
|
|
// Note: you will get a 422 error if the organization restricts changing repository visibility to organization
|
|
// owners and a non-owner tries to change the value of private.
|
|
Private bool `json:"private,omitempty"`
|
|
|
|
// `repo` to only allow repo-level projects, `owner` to only allow owner projects, `all` to allow both.
|
|
ProjectsMode string `json:"projects_mode,omitempty"`
|
|
|
|
// either `true` to make this repository a template or `false` to make it a normal repository
|
|
Template bool `json:"template,omitempty"`
|
|
|
|
// a URL with more information about the repository.
|
|
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"`
|
|
}
|
|
|
|
// Validate validates this edit repo option
|
|
func (m *EditRepoOption) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
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 len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *EditRepoOption) 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 *EditRepoOption) 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 *EditRepoOption) 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
|
|
}
|
|
|
|
// ContextValidate validate this edit repo option based on the context it is used
|
|
func (m *EditRepoOption) 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 len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *EditRepoOption) 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 *EditRepoOption) 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 *EditRepoOption) 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
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *EditRepoOption) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *EditRepoOption) UnmarshalBinary(b []byte) error {
|
|
var res EditRepoOption
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|