Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
1.3 kB · 51 lines
Go
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152// 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)}