// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.vod.comment 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.vod.comment", &VodComment{}) } // Record containing a comment on a VOD. type VodComment struct { LexiconTypeID string `json:"$type,omitempty"` // createdAt: Client-declared timestamp when this comment was created. CreatedAt string `json:"createdAt"` // facets: Annotations of text (mentions, URLs, etc) Facets []RichtextFacet `json:"facets,omitempty"` Reply *VodComment_ReplyRef `json:"reply,omitempty"` // text: The comment text content. Text string `json:"text"` // video: AT-URI of the place.stream.video record this comment belongs to. Video string `json:"video"` } // RecordTypeID implements glex.Record. func (t *VodComment) RecordTypeID() string { return "place.stream.vod.comment" } // MarshalJSON stamps the $type field, like MarshalCBOR does. The value // receiver operates on a copy, so the record is never mutated and both // VodComment and *VodComment marshal with $type. func (t VodComment) MarshalJSON() ([]byte, error) { t.LexiconTypeID = "place.stream.vod.comment" type alias VodComment return json.Marshal((alias)(t)) } func (t *VodComment) 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.comment" return glex.MarshalCBOR(w, &cp) } func (t *VodComment) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) } // VodComment_ReplyRef is a "replyRef" in the place.stream.vod.comment schema. type VodComment_ReplyRef struct { LexiconTypeID string `json:"$type,omitempty"` Parent comatproto.RepoStrongRef `json:"parent"` Root comatproto.RepoStrongRef `json:"root"` } // RecordTypeID implements glex.Record. func (t *VodComment_ReplyRef) RecordTypeID() string { return "place.stream.vod.comment#replyRef" } func (t *VodComment_ReplyRef) 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.comment#replyRef" return glex.MarshalCBOR(w, &cp) } func (t *VodComment_ReplyRef) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) }