// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.chat.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.chat.gate", &ChatGate{}) } // Record defining a single gated chat message. type ChatGate struct { LexiconTypeID string `json:"$type,omitempty"` // hiddenMessage: URI of the hidden chat message. HiddenMessage string `json:"hiddenMessage"` } // RecordTypeID implements glex.Record. func (t *ChatGate) RecordTypeID() string { return "place.stream.chat.gate" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // ChatGate and *ChatGate marshal with $type. func (t ChatGate) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.chat.gate" type alias ChatGate return json.Marshal((alias)(t)) } func (t *ChatGate) 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.chat.gate" return glex.MarshalCBOR(w, &cp) } func (t *ChatGate) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }