Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
4.7 kB · 195 lines
Go
at master
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
package org_tangled
// schema: org.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 = "org.tangled.feed.comment")
func init() { util.RegisterType("org.tangled.feed.comment", &FeedComment{})} //// RECORDTYPE: FeedCommenttype FeedComment struct { LexiconTypeID string `json:"$type,const=org.tangled.feed.comment" cborgen:"$type,const=org.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"` ReplyTo *comatprototypes.RepoStrongRef `json:"replyTo,omitempty" cborgen:"replyTo,omitempty"` Subject *FeedComment_Subject `json:"subject" cborgen:"subject"`}
type FeedComment_Body struct { MarkupMarkdown *MarkupMarkdown}
func (t *FeedComment_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 *FeedComment_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 }}
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 "org.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 = "org.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 "org.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 "org.tangled.embed.commit": t.EmbedCommit = new(EmbedCommit) return t.EmbedCommit.UnmarshalCBOR(bytes.NewReader(b))
default: return nil }}
type FeedComment_Subject struct { RepoStrongRef *comatprototypes.RepoStrongRef}
func (t *FeedComment_Subject) MarshalJSON() ([]byte, error) { if t.RepoStrongRef != nil { t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" return json.Marshal(t.RepoStrongRef) } return nil, fmt.Errorf("cannot marshal empty enum")}func (t *FeedComment_Subject) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err }
switch typ { case "com.atproto.repo.strongRef": t.RepoStrongRef = new(comatprototypes.RepoStrongRef) return json.Unmarshal(b, t.RepoStrongRef)
default: return nil }}
func (t *FeedComment_Subject) MarshalCBOR(w io.Writer) error {
if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.RepoStrongRef != nil { return t.RepoStrongRef.MarshalCBOR(w) } return fmt.Errorf("cannot cbor marshal empty enum")}func (t *FeedComment_Subject) UnmarshalCBOR(r io.Reader) error { typ, b, err := util.CborTypeExtractReader(r) if err != nil { return err }
switch typ { case "com.atproto.repo.strongRef": t.RepoStrongRef = new(comatprototypes.RepoStrongRef) return t.RepoStrongRef.UnmarshalCBOR(bytes.NewReader(b))
default: return nil }}