All checks were successful
continuous-integration/drone/push Build is passing
161 lines
3.5 KiB
Go
161 lines
3.5 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"
|
|
)
|
|
|
|
// Marker Marker represents the last read position within a user's timelines.
|
|
//
|
|
// swagger:model Marker
|
|
type Marker struct {
|
|
|
|
// home
|
|
Home *TimelineMarker `json:"home,omitempty"`
|
|
|
|
// notifications
|
|
Notifications *TimelineMarker `json:"notifications,omitempty"`
|
|
}
|
|
|
|
// Validate validates this marker
|
|
func (m *Marker) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateHome(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateNotifications(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Marker) validateHome(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Home) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Home != nil {
|
|
if err := m.Home.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("home")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("home")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Marker) validateNotifications(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Notifications) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Notifications != nil {
|
|
if err := m.Notifications.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("notifications")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("notifications")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this marker based on the context it is used
|
|
func (m *Marker) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateHome(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateNotifications(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Marker) contextValidateHome(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.Home != nil {
|
|
|
|
if swag.IsZero(m.Home) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Home.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("home")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("home")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Marker) contextValidateNotifications(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.Notifications != nil {
|
|
|
|
if swag.IsZero(m.Notifications) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Notifications.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("notifications")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("notifications")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *Marker) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *Marker) UnmarshalBinary(b []byte) error {
|
|
var res Marker
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|