// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. package tangled // schema: sh.tangled.feed.comment import ( "bytes" "encoding/json" "fmt" "io" comatprototypes "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/lex/util" cbg "github.com/whyrusleeping/cbor-gen" ) const ( FeedCommentNSID = "sh.tangled.feed.comment" ) func init() { util.RegisterType("sh.tangled.feed.comment", &FeedComment{}) } // // RECORDTYPE: FeedComment type FeedComment struct { LexiconTypeID string `json:"$type,const=sh.tangled.feed.comment" cborgen:"$type,const=sh.tangled.feed.comment"` Body *FeedComment_Body `json:"body" cborgen:"body"` CreatedAt string `json:"createdAt" cborgen:"createdAt"` // pullRoundIdx: optional pull submission round index. required when subject is sh.tangled.repo.pull PullRoundIdx *int64 `json:"pullRoundIdx,omitempty" cborgen:"pullRoundIdx,omitempty"` ReplyTo *comatprototypes.RepoStrongRef `json:"replyTo,omitempty" cborgen:"replyTo,omitempty"` Subject *comatprototypes.RepoStrongRef `json:"subject" cborgen:"subject"` } type FeedComment_Body struct { MarkupMarkdown *MarkupMarkdown } func (t *FeedComment_Body) MarshalJSON() ([]byte, error) { if t.MarkupMarkdown != nil { t.MarkupMarkdown.LexiconTypeID = "sh.tangled.markup.markdown" return json.Marshal(t.MarkupMarkdown) } return nil, fmt.Errorf("cannot marshal empty enum") } func (t *FeedComment_Body) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err } switch typ { case "sh.tangled.markup.markdown": t.MarkupMarkdown = new(MarkupMarkdown) return json.Unmarshal(b, t.MarkupMarkdown) default: return nil } } func (t *FeedComment_Body) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.MarkupMarkdown != nil { return t.MarkupMarkdown.MarshalCBOR(w) } return fmt.Errorf("cannot cbor marshal empty enum") } func (t *FeedComment_Body) UnmarshalCBOR(r io.Reader) error { typ, b, err := util.CborTypeExtractReader(r) if err != nil { return err } switch typ { case "sh.tangled.markup.markdown": t.MarkupMarkdown = new(MarkupMarkdown) return t.MarkupMarkdown.UnmarshalCBOR(bytes.NewReader(b)) default: return nil } }