Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
Go
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144// 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: FeedCommenttype 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"` Embed *FeedComment_Embed `json:"embed,omitempty" cborgen:"embed,omitempty"` // 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 }}
type FeedComment_Embed struct { EmbedCommit *EmbedCommit}
func (t *FeedComment_Embed) MarshalJSON() ([]byte, error) { if t.EmbedCommit != nil { t.EmbedCommit.LexiconTypeID = "sh.tangled.embed.commit" return json.Marshal(t.EmbedCommit) } return nil, fmt.Errorf("cannot marshal empty enum")}func (t *FeedComment_Embed) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err }
switch typ { case "sh.tangled.embed.commit": t.EmbedCommit = new(EmbedCommit) return json.Unmarshal(b, t.EmbedCommit)
default: return nil }}
func (t *FeedComment_Embed) MarshalCBOR(w io.Writer) error {
if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.EmbedCommit != nil { return t.EmbedCommit.MarshalCBOR(w) } return fmt.Errorf("cannot cbor marshal empty enum")}func (t *FeedComment_Embed) UnmarshalCBOR(r io.Reader) error { typ, b, err := util.CborTypeExtractReader(r) if err != nil { return err }
switch typ { case "sh.tangled.embed.commit": t.EmbedCommit = new(EmbedCommit) return t.EmbedCommit.UnmarshalCBOR(bytes.NewReader(b))
default: return nil }}