// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.metadata.configuration package placestream import ( "encoding/json" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" ) func init() { glex.RegisterType("place.stream.metadata.configuration", &MetadataConfiguration{}) } // Default metadata record for livestream including content warnings, rights, and distribution policy type MetadataConfiguration struct { LexiconTypeID string `json:"$type,omitempty"` ContentRights *MetadataContentRights `json:"contentRights,omitempty"` ContentWarnings *MetadataContentWarnings `json:"contentWarnings,omitempty"` DistributionPolicy *MetadataDistributionPolicy `json:"distributionPolicy,omitempty"` } // RecordTypeID implements glex.Record. func (t *MetadataConfiguration) RecordTypeID() string { return "place.stream.metadata.configuration" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // MetadataConfiguration and *MetadataConfiguration marshal with $type. func (t MetadataConfiguration) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.metadata.configuration" type alias MetadataConfiguration return json.Marshal((alias)(t)) } func (t *MetadataConfiguration) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } // stamp $type on a copy so marshal never mutates the record cp := *t cp.LexiconTypeID = "place.stream.metadata.configuration" return glex.MarshalCBOR(w, &cp) } func (t *MetadataConfiguration) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }