// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.live.recommendations package placestream import ( "encoding/json" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" ) func init() { glex.RegisterType("place.stream.live.recommendations", &LiveRecommendations{}) } // A list of recommended streamers, in order of preference type LiveRecommendations struct { LexiconTypeID string `json:"$type,omitempty"` // createdAt: Client-declared timestamp when this list was created. CreatedAt string `json:"createdAt"` // streamers: Ordered list of recommended streamer DIDs Streamers []string `json:"streamers"` } // RecordTypeID implements glex.Record. func (t *LiveRecommendations) RecordTypeID() string { return "place.stream.live.recommendations" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // LiveRecommendations and *LiveRecommendations marshal with $type. func (t LiveRecommendations) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.live.recommendations" type alias LiveRecommendations return json.Marshal((alias)(t)) } func (t *LiveRecommendations) 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.live.recommendations" return glex.MarshalCBOR(w, &cp) } func (t *LiveRecommendations) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }