mirror of https://github.com/vernonkeenan/lib
253 lines
6.5 KiB
Go
253 lines
6.5 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
// (c) 2012-2020 by Taxnexus, Inc.
|
|
// All rights reserved worldwide.
|
|
// Proprietary product; unlicensed use is not allowed
|
|
|
|
package research_models
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag/jsonutils"
|
|
"github.com/go-openapi/swag/typeutils"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// PortfolioEnrichmentSource One immutable public web citation used by portfolio_enrichment.v1; no page body or credential data is retained
|
|
//
|
|
// swagger:model PortfolioEnrichmentSource
|
|
type PortfolioEnrichmentSource struct {
|
|
|
|
// excerpt hash
|
|
// Pattern: ^sha256:[a-f0-9]{64}$
|
|
ExcerptHash string `json:"ExcerptHash,omitempty"`
|
|
|
|
// ID
|
|
// Required: true
|
|
// Format: uuid
|
|
ID *strfmt.UUID `json:"ID"`
|
|
|
|
// locator
|
|
// Max Length: 512
|
|
Locator string `json:"Locator,omitempty"`
|
|
|
|
// retrieved date
|
|
// Required: true
|
|
// Format: date-time
|
|
RetrievedDate *strfmt.DateTime `json:"RetrievedDate"`
|
|
|
|
// source class
|
|
// Required: true
|
|
// Enum: ["official","regulatory","independent_reporting","analyst_research","marketplace","other"]
|
|
SourceClass *string `json:"SourceClass"`
|
|
|
|
// title
|
|
// Max Length: 512
|
|
Title string `json:"Title,omitempty"`
|
|
|
|
// URL
|
|
// Required: true
|
|
// Max Length: 2048
|
|
// Format: uri
|
|
URL *strfmt.URI `json:"URL"`
|
|
}
|
|
|
|
// Validate validates this portfolio enrichment source
|
|
func (m *PortfolioEnrichmentSource) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateExcerptHash(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateLocator(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateRetrievedDate(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateSourceClass(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTitle(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateURL(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentSource) validateExcerptHash(formats strfmt.Registry) error {
|
|
if typeutils.IsZero(m.ExcerptHash) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.Pattern("ExcerptHash", "body", m.ExcerptHash, `^sha256:[a-f0-9]{64}$`); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentSource) validateID(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("ID", "body", m.ID); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.FormatOf("ID", "body", "uuid", m.ID.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentSource) validateLocator(formats strfmt.Registry) error {
|
|
if typeutils.IsZero(m.Locator) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.MaxLength("Locator", "body", m.Locator, 512); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentSource) validateRetrievedDate(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("RetrievedDate", "body", m.RetrievedDate); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.FormatOf("RetrievedDate", "body", "date-time", m.RetrievedDate.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var portfolioEnrichmentSourceTypeSourceClassPropEnum []any
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["official","regulatory","independent_reporting","analyst_research","marketplace","other"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
portfolioEnrichmentSourceTypeSourceClassPropEnum = append(portfolioEnrichmentSourceTypeSourceClassPropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// PortfolioEnrichmentSourceSourceClassOfficial captures enum value "official"
|
|
PortfolioEnrichmentSourceSourceClassOfficial string = "official"
|
|
|
|
// PortfolioEnrichmentSourceSourceClassRegulatory captures enum value "regulatory"
|
|
PortfolioEnrichmentSourceSourceClassRegulatory string = "regulatory"
|
|
|
|
// PortfolioEnrichmentSourceSourceClassIndependentReporting captures enum value "independent_reporting"
|
|
PortfolioEnrichmentSourceSourceClassIndependentReporting string = "independent_reporting"
|
|
|
|
// PortfolioEnrichmentSourceSourceClassAnalystResearch captures enum value "analyst_research"
|
|
PortfolioEnrichmentSourceSourceClassAnalystResearch string = "analyst_research"
|
|
|
|
// PortfolioEnrichmentSourceSourceClassMarketplace captures enum value "marketplace"
|
|
PortfolioEnrichmentSourceSourceClassMarketplace string = "marketplace"
|
|
|
|
// PortfolioEnrichmentSourceSourceClassOther captures enum value "other"
|
|
PortfolioEnrichmentSourceSourceClassOther string = "other"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *PortfolioEnrichmentSource) validateSourceClassEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, portfolioEnrichmentSourceTypeSourceClassPropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentSource) validateSourceClass(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("SourceClass", "body", m.SourceClass); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateSourceClassEnum("SourceClass", "body", *m.SourceClass); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentSource) validateTitle(formats strfmt.Registry) error {
|
|
if typeutils.IsZero(m.Title) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.MaxLength("Title", "body", m.Title, 512); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentSource) validateURL(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("URL", "body", m.URL); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("URL", "body", m.URL.String(), 2048); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.FormatOf("URL", "body", "uri", m.URL.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validates this portfolio enrichment source based on context it is used
|
|
func (m *PortfolioEnrichmentSource) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *PortfolioEnrichmentSource) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return jsonutils.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *PortfolioEnrichmentSource) UnmarshalBinary(b []byte) error {
|
|
var res PortfolioEnrichmentSource
|
|
if err := jsonutils.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|