// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. package org_tangled // schema: org.tangled.feed.defs import ( "encoding/json" "fmt" comatprototypes "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/lex/util" ) const () // FeedDefs_CommentView is a "commentView" in the org.tangled.feed.defs schema. type FeedDefs_CommentView struct { Body *FeedDefs_CommentView_Body `json:"body" cborgen:"body"` Cid string `json:"cid" cborgen:"cid"` CreatedAt string `json:"createdAt" cborgen:"createdAt"` // editor: Who wrote this version (`x-tngl-editor`). A knot-hosted comment's uri names the repo, not the writer. Editor *string `json:"editor,omitempty" cborgen:"editor,omitempty"` Embed *FeedDefs_CommentView_Embed `json:"embed,omitempty" cborgen:"embed,omitempty"` ReplyTo *comatprototypes.RepoStrongRef `json:"replyTo,omitempty" cborgen:"replyTo,omitempty"` Subject *comatprototypes.RepoStrongRef `json:"subject" cborgen:"subject"` Uri string `json:"uri" cborgen:"uri"` } type FeedDefs_CommentView_Body struct { MarkupMarkdown *MarkupMarkdown } func (t *FeedDefs_CommentView_Body) MarshalJSON() ([]byte, error) { if t.MarkupMarkdown != nil { t.MarkupMarkdown.LexiconTypeID = "org.tangled.markup.markdown" return json.Marshal(t.MarkupMarkdown) } return nil, fmt.Errorf("cannot marshal empty enum") } func (t *FeedDefs_CommentView_Body) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err } switch typ { case "org.tangled.markup.markdown": t.MarkupMarkdown = new(MarkupMarkdown) return json.Unmarshal(b, t.MarkupMarkdown) default: return nil } } type FeedDefs_CommentView_Embed struct { EmbedCommit_View *EmbedCommit_View } func (t *FeedDefs_CommentView_Embed) MarshalJSON() ([]byte, error) { if t.EmbedCommit_View != nil { t.EmbedCommit_View.LexiconTypeID = "org.tangled.embed.commit#view" return json.Marshal(t.EmbedCommit_View) } return nil, fmt.Errorf("cannot marshal empty enum") } func (t *FeedDefs_CommentView_Embed) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err } switch typ { case "org.tangled.embed.commit#view": t.EmbedCommit_View = new(EmbedCommit_View) return json.Unmarshal(b, t.EmbedCommit_View) default: return nil } }