Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
3.6 kB · 113 lines
Go
at icy/tmrrpn
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
package org_tangled
// schema: org.tangled.feed.subscription
import ( "bytes" "encoding/json" "fmt" "io"
"github.com/bluesky-social/indigo/lex/util" cbg "github.com/whyrusleeping/cbor-gen")
const ( FeedSubscriptionNSID = "org.tangled.feed.subscription")
func init() { util.RegisterType("org.tangled.feed.subscription", &FeedSubscription{})} //// RECORDTYPE: FeedSubscriptiontype FeedSubscription struct { LexiconTypeID string `json:"$type,const=org.tangled.feed.subscription" cborgen:"$type,const=org.tangled.feed.subscription"` CreatedAt string `json:"createdAt" cborgen:"createdAt"` Subject *FeedSubscription_Subject `json:"subject" cborgen:"subject"`}
// FeedSubscription_Record is a "record" in the org.tangled.feed.subscription schema.//// RECORDTYPE: FeedSubscription_Recordtype FeedSubscription_Record struct { LexiconTypeID string `json:"$type,const=org.tangled.feed.subscription#record" cborgen:"$type,const=org.tangled.feed.subscription#record"` Uri string `json:"uri" cborgen:"uri"`}
// FeedSubscription_Repo is a "repo" in the org.tangled.feed.subscription schema.//// RECORDTYPE: FeedSubscription_Repotype FeedSubscription_Repo struct { LexiconTypeID string `json:"$type,const=org.tangled.feed.subscription#repo" cborgen:"$type,const=org.tangled.feed.subscription#repo"` Did string `json:"did" cborgen:"did"`}
type FeedSubscription_Subject struct { FeedSubscription_Record *FeedSubscription_Record FeedSubscription_Repo *FeedSubscription_Repo}
func (t *FeedSubscription_Subject) MarshalJSON() ([]byte, error) { if t.FeedSubscription_Record != nil { t.FeedSubscription_Record.LexiconTypeID = "org.tangled.feed.subscription#record" return json.Marshal(t.FeedSubscription_Record) } if t.FeedSubscription_Repo != nil { t.FeedSubscription_Repo.LexiconTypeID = "org.tangled.feed.subscription#repo" return json.Marshal(t.FeedSubscription_Repo) } return nil, fmt.Errorf("cannot marshal empty enum")}func (t *FeedSubscription_Subject) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err }
switch typ { case "org.tangled.feed.subscription#record": t.FeedSubscription_Record = new(FeedSubscription_Record) return json.Unmarshal(b, t.FeedSubscription_Record) case "org.tangled.feed.subscription#repo": t.FeedSubscription_Repo = new(FeedSubscription_Repo) return json.Unmarshal(b, t.FeedSubscription_Repo)
default: return fmt.Errorf("closed enums must have a matching value") }}
func (t *FeedSubscription_Subject) MarshalCBOR(w io.Writer) error {
if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.FeedSubscription_Record != nil { return t.FeedSubscription_Record.MarshalCBOR(w) } if t.FeedSubscription_Repo != nil { return t.FeedSubscription_Repo.MarshalCBOR(w) } return fmt.Errorf("cannot cbor marshal empty enum")}func (t *FeedSubscription_Subject) UnmarshalCBOR(r io.Reader) error { typ, b, err := util.CborTypeExtractReader(r) if err != nil { return err }
switch typ { case "org.tangled.feed.subscription#record": t.FeedSubscription_Record = new(FeedSubscription_Record) return t.FeedSubscription_Record.UnmarshalCBOR(bytes.NewReader(b)) case "org.tangled.feed.subscription#repo": t.FeedSubscription_Repo = new(FeedSubscription_Repo) return t.FeedSubscription_Repo.UnmarshalCBOR(bytes.NewReader(b))
default: return fmt.Errorf("closed enums must have a matching value") }}