// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.vod.gate package placestream import ( "encoding/json" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" ) func init() { glex.RegisterType("place.stream.vod.gate", &VodGate{}) } // Record defining a single gated VOD comment. type VodGate struct { LexiconTypeID string `json:"$type,omitempty"` // hiddenComment: URI of the hidden VOD comment. HiddenComment string `json:"hiddenComment"` } // RecordTypeID implements glex.Record. func (t *VodGate) RecordTypeID() string { return "place.stream.vod.gate" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // VodGate and *VodGate marshal with $type. func (t VodGate) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.vod.gate" type alias VodGate return json.Marshal((alias)(t)) } func (t *VodGate) 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.vod.gate" return glex.MarshalCBOR(w, &cp) } func (t *VodGate) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }