// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.chat.profile package placestream import ( "encoding/json" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" comatproto "stream.place/streamplace/pkg/comatproto" ) func init() { glex.RegisterType("place.stream.chat.profile", &ChatProfile{}) } // Record containing customizations for a user's chat profile. type ChatProfile struct { LexiconTypeID string `json:"$type,omitempty"` // badges: Badge selections for display in chat. Badges *ChatProfile_BadgeSelections `json:"badges,omitempty"` Color *ChatProfile_Color `json:"color,omitempty"` // selfLabels: Self-applied labels for this profile, e.g. 'bot'. SelfLabels []string `json:"selfLabels,omitempty"` } // RecordTypeID implements glex.Record. func (t *ChatProfile) RecordTypeID() string { return "place.stream.chat.profile" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // ChatProfile and *ChatProfile marshal with $type. func (t ChatProfile) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.chat.profile" type alias ChatProfile return json.Marshal((alias)(t)) } func (t *ChatProfile) 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.profile" return glex.MarshalCBOR(w, &cp) } func (t *ChatProfile) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) } // ChatProfile_BadgeSelections is a "badgeSelections" in the place.stream.chat.profile schema. // // Selected badges for display in chat, organized by slot. type ChatProfile_BadgeSelections struct { LexiconTypeID string `json:"$type,omitempty"` // global: Selected globally-issued badge (e.g. event badge). Global *comatproto.RepoStrongRef `json:"global,omitempty"` // streamer: Selected streamer-issued badges, one per streamer channel. Streamer []ChatProfile_StreamerBadgeSelection `json:"streamer,omitempty"` } // RecordTypeID implements glex.Record. func (t *ChatProfile_BadgeSelections) RecordTypeID() string { return "place.stream.chat.profile#badgeSelections" } func (t *ChatProfile_BadgeSelections) 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.profile#badgeSelections" return glex.MarshalCBOR(w, &cp) } func (t *ChatProfile_BadgeSelections) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) } // ChatProfile_Color is a "color" in the place.stream.chat.profile schema. // // Customizations for the color of a user's name in chat type ChatProfile_Color struct { LexiconTypeID string `json:"$type,omitempty"` Blue int64 `json:"blue"` Green int64 `json:"green"` Red int64 `json:"red"` } // RecordTypeID implements glex.Record. func (t *ChatProfile_Color) RecordTypeID() string { return "place.stream.chat.profile#color" } func (t *ChatProfile_Color) 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.profile#color" return glex.MarshalCBOR(w, &cp) } func (t *ChatProfile_Color) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) } // ChatProfile_StreamerBadgeSelection is a "streamerBadgeSelection" in the place.stream.chat.profile schema. // // A selected badge for a specific streamer's channel. type ChatProfile_StreamerBadgeSelection struct { LexiconTypeID string `json:"$type,omitempty"` // badge: Strong reference to the selected place.stream.badge.issuance record. Badge comatproto.RepoStrongRef `json:"badge"` // streamer: DID of the streamer whose channel this selection applies to. Streamer string `json:"streamer"` } // RecordTypeID implements glex.Record. func (t *ChatProfile_StreamerBadgeSelection) RecordTypeID() string { return "place.stream.chat.profile#streamerBadgeSelection" } func (t *ChatProfile_StreamerBadgeSelection) 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.profile#streamerBadgeSelection" return glex.MarshalCBOR(w, &cp) } func (t *ChatProfile_StreamerBadgeSelection) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }