206 lines
5.4 KiB
Go
206 lines
5.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"
|
|
"encoding/json"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// CreateRepoOption CreateRepoOption options when creating repository
|
|
//
|
|
// swagger:model CreateRepoOption
|
|
type CreateRepoOption struct {
|
|
|
|
// Whether the repository should be auto-initialized?
|
|
AutoInit bool `json:"auto_init,omitempty"`
|
|
|
|
// DefaultBranch of the repository (used when initializes and in template)
|
|
DefaultBranch string `json:"default_branch,omitempty"`
|
|
|
|
// Description of the repository to create
|
|
Description string `json:"description,omitempty"`
|
|
|
|
// Gitignores to use
|
|
Gitignores string `json:"gitignores,omitempty"`
|
|
|
|
// Label-Set to use
|
|
IssueLabels string `json:"issue_labels,omitempty"`
|
|
|
|
// License to use
|
|
License string `json:"license,omitempty"`
|
|
|
|
// Name of the repository to create
|
|
// Required: true
|
|
Name *string `json:"name"`
|
|
|
|
// ObjectFormatName of the underlying git repository
|
|
// Enum: ["sha1","sha256"]
|
|
ObjectFormatName string `json:"object_format_name,omitempty"`
|
|
|
|
// Whether the repository is private
|
|
Private bool `json:"private,omitempty"`
|
|
|
|
// Readme of the repository to create
|
|
Readme string `json:"readme,omitempty"`
|
|
|
|
// Whether the repository is template
|
|
Template bool `json:"template,omitempty"`
|
|
|
|
// TrustModel of the repository
|
|
// Enum: ["default","collaborator","committer","collaboratorcommitter"]
|
|
TrustModel string `json:"trust_model,omitempty"`
|
|
}
|
|
|
|
// Validate validates this create repo option
|
|
func (m *CreateRepoOption) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateName(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateObjectFormatName(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTrustModel(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *CreateRepoOption) validateName(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("name", "body", m.Name); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var createRepoOptionTypeObjectFormatNamePropEnum []interface{}
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["sha1","sha256"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
createRepoOptionTypeObjectFormatNamePropEnum = append(createRepoOptionTypeObjectFormatNamePropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// CreateRepoOptionObjectFormatNameSha1 captures enum value "sha1"
|
|
CreateRepoOptionObjectFormatNameSha1 string = "sha1"
|
|
|
|
// CreateRepoOptionObjectFormatNameSha256 captures enum value "sha256"
|
|
CreateRepoOptionObjectFormatNameSha256 string = "sha256"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *CreateRepoOption) validateObjectFormatNameEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, createRepoOptionTypeObjectFormatNamePropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *CreateRepoOption) 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
|
|
}
|
|
|
|
var createRepoOptionTypeTrustModelPropEnum []interface{}
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["default","collaborator","committer","collaboratorcommitter"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
createRepoOptionTypeTrustModelPropEnum = append(createRepoOptionTypeTrustModelPropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// CreateRepoOptionTrustModelDefault captures enum value "default"
|
|
CreateRepoOptionTrustModelDefault string = "default"
|
|
|
|
// CreateRepoOptionTrustModelCollaborator captures enum value "collaborator"
|
|
CreateRepoOptionTrustModelCollaborator string = "collaborator"
|
|
|
|
// CreateRepoOptionTrustModelCommitter captures enum value "committer"
|
|
CreateRepoOptionTrustModelCommitter string = "committer"
|
|
|
|
// CreateRepoOptionTrustModelCollaboratorcommitter captures enum value "collaboratorcommitter"
|
|
CreateRepoOptionTrustModelCollaboratorcommitter string = "collaboratorcommitter"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *CreateRepoOption) validateTrustModelEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, createRepoOptionTypeTrustModelPropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *CreateRepoOption) validateTrustModel(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.TrustModel) { // not required
|
|
return nil
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateTrustModelEnum("trust_model", "body", m.TrustModel); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validates this create repo option based on context it is used
|
|
func (m *CreateRepoOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *CreateRepoOption) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *CreateRepoOption) UnmarshalBinary(b []byte) error {
|
|
var res CreateRepoOption
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|