forked from adamm/autogits
109 lines
2.8 KiB
Go
109 lines
2.8 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"
|
|
)
|
|
|
|
// AddCollaboratorOption AddCollaboratorOption options when adding a user as a collaborator of a repository
|
|
//
|
|
// swagger:model AddCollaboratorOption
|
|
type AddCollaboratorOption struct {
|
|
|
|
// permission
|
|
// Enum: ["read","write","admin"]
|
|
Permission string `json:"permission,omitempty"`
|
|
}
|
|
|
|
// Validate validates this add collaborator option
|
|
func (m *AddCollaboratorOption) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validatePermission(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
var addCollaboratorOptionTypePermissionPropEnum []interface{}
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["read","write","admin"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
addCollaboratorOptionTypePermissionPropEnum = append(addCollaboratorOptionTypePermissionPropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// AddCollaboratorOptionPermissionRead captures enum value "read"
|
|
AddCollaboratorOptionPermissionRead string = "read"
|
|
|
|
// AddCollaboratorOptionPermissionWrite captures enum value "write"
|
|
AddCollaboratorOptionPermissionWrite string = "write"
|
|
|
|
// AddCollaboratorOptionPermissionAdmin captures enum value "admin"
|
|
AddCollaboratorOptionPermissionAdmin string = "admin"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *AddCollaboratorOption) validatePermissionEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, addCollaboratorOptionTypePermissionPropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *AddCollaboratorOption) 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 add collaborator option based on context it is used
|
|
func (m *AddCollaboratorOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *AddCollaboratorOption) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *AddCollaboratorOption) UnmarshalBinary(b []byte) error {
|
|
var res AddCollaboratorOption
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|