All checks were successful
continuous-integration/drone/push Build is passing
175 lines
4.0 KiB
Go
175 lines
4.0 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"
|
|
)
|
|
|
|
// SwaggerCollection SwaggerCollection represents an ActivityPub Collection.
|
|
//
|
|
// swagger:model SwaggerCollection
|
|
type SwaggerCollection struct {
|
|
|
|
// ActivityStreams JSON-LD context.
|
|
// A string or an array of strings, or more
|
|
// complex nested items.
|
|
// Example: https://www.w3.org/ns/activitystreams
|
|
Context interface{} `json:"@context,omitempty"`
|
|
|
|
// ActivityStreams ID.
|
|
// Example: https://example.org/users/some_user/statuses/106717595988259568/replies
|
|
ID string `json:"id,omitempty"`
|
|
|
|
// ActivityStreams type.
|
|
// Example: Collection
|
|
Type string `json:"type,omitempty"`
|
|
|
|
// first
|
|
First *SwaggerCollectionPage `json:"first,omitempty"`
|
|
|
|
// last
|
|
Last *SwaggerCollectionPage `json:"last,omitempty"`
|
|
}
|
|
|
|
// Validate validates this swagger collection
|
|
func (m *SwaggerCollection) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateFirst(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateLast(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *SwaggerCollection) validateFirst(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.First) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.First != nil {
|
|
if err := m.First.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("first")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("first")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *SwaggerCollection) validateLast(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Last) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Last != nil {
|
|
if err := m.Last.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("last")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("last")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this swagger collection based on the context it is used
|
|
func (m *SwaggerCollection) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateFirst(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateLast(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *SwaggerCollection) contextValidateFirst(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.First != nil {
|
|
|
|
if swag.IsZero(m.First) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.First.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("first")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("first")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *SwaggerCollection) contextValidateLast(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.Last != nil {
|
|
|
|
if swag.IsZero(m.Last) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Last.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("last")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("last")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *SwaggerCollection) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *SwaggerCollection) UnmarshalBinary(b []byte) error {
|
|
var res SwaggerCollection
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|