An unofficial terminal client for Tangled, optimized for humans and agents. tgcli.wisp.place
cli atproto go tangled
Something went wrong. Try again.
4.6 kB · 191 lines
Go
at next-dev
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
// Lexicon schema: org.tangled.feed.comment
package tangledlex
import ( "bytes" "encoding/json" "fmt" "io"
comatproto "github.com/bluesky-social/indigo/api/atproto" lexutil "github.com/bluesky-social/indigo/lex/util" cbg "github.com/whyrusleeping/cbor-gen")
func init() { lexutil.RegisterType("org.tangled.feed.comment", &FeedComment{})}
type FeedComment struct { LexiconTypeID string `json:"$type" 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 *comatproto.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("can not marshal empty union as JSON")}
func (t *FeedComment_Body) UnmarshalJSON(b []byte) error { typ, err := lexutil.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("can not marshal empty union as CBOR")}
func (t *FeedComment_Body) UnmarshalCBOR(r io.Reader) error { typ, b, err := lexutil.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("can not marshal empty union as JSON")}
func (t *FeedComment_Embed) UnmarshalJSON(b []byte) error { typ, err := lexutil.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("can not marshal empty union as CBOR")}
func (t *FeedComment_Embed) UnmarshalCBOR(r io.Reader) error { typ, b, err := lexutil.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 *comatproto.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("can not marshal empty union as JSON")}
func (t *FeedComment_Subject) UnmarshalJSON(b []byte) error { typ, err := lexutil.TypeExtract(b) if err != nil { return err }
switch typ { case "com.atproto.repo.strongRef": t.RepoStrongRef = new(comatproto.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("can not marshal empty union as CBOR")}
func (t *FeedComment_Subject) UnmarshalCBOR(r io.Reader) error { typ, b, err := lexutil.CborTypeExtractReader(r) if err != nil { return err }
switch typ { case "com.atproto.repo.strongRef": t.RepoStrongRef = new(comatproto.RepoStrongRef) return t.RepoStrongRef.UnmarshalCBOR(bytes.NewReader(b)) default: return nil }}