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

143 lines
3.6 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"
)
// EditTeamOption EditTeamOption options for editing a team
//
// swagger:model EditTeamOption
type EditTeamOption struct {
// can create org repo
CanCreateOrgRepo bool `json:"can_create_org_repo,omitempty"`
// description
Description string `json:"description,omitempty"`
// includes all repositories
IncludesAllRepositories bool `json:"includes_all_repositories,omitempty"`
// name
// Required: true
Name *string `json:"name"`
// permission
// Enum: ["read","write","admin"]
Permission string `json:"permission,omitempty"`
// units
// Example: ["repo.code","repo.issues","repo.ext_issues","repo.wiki","repo.pulls","repo.releases","repo.projects","repo.ext_wiki"]
Units []string `json:"units"`
// units map
// Example: {"repo.code":"read","repo.ext_issues":"none","repo.ext_wiki":"none","repo.issues":"write","repo.projects":"none","repo.pulls":"owner","repo.releases":"none","repo.wiki":"admin"}
UnitsMap map[string]string `json:"units_map,omitempty"`
}
// Validate validates this edit team option
func (m *EditTeamOption) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateName(formats); err != nil {
res = append(res, err)
}
if err := m.validatePermission(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *EditTeamOption) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
return nil
}
var editTeamOptionTypePermissionPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["read","write","admin"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
editTeamOptionTypePermissionPropEnum = append(editTeamOptionTypePermissionPropEnum, v)
}
}
const (
// EditTeamOptionPermissionRead captures enum value "read"
EditTeamOptionPermissionRead string = "read"
// EditTeamOptionPermissionWrite captures enum value "write"
EditTeamOptionPermissionWrite string = "write"
// EditTeamOptionPermissionAdmin captures enum value "admin"
EditTeamOptionPermissionAdmin string = "admin"
)
// prop value enum
func (m *EditTeamOption) validatePermissionEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, editTeamOptionTypePermissionPropEnum, true); err != nil {
return err
}
return nil
}
func (m *EditTeamOption) validatePermission(formats strfmt.Registry) error {
if swag.IsZero(m.Permission) { // not required
return nil
}
// value enum
if err := m.validatePermissionEnum("permission", "body", m.Permission); err != nil {
return err
}
return nil
}
// ContextValidate validates this edit team option based on context it is used
func (m *EditTeamOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *EditTeamOption) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *EditTeamOption) UnmarshalBinary(b []byte) error {
var res EditTeamOption
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}