Monorepo for Tangled tangled.org
2

Configure Feed

Select the types of activity you want to include in your feed.

1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 3package tangled 4 5// schema: sh.tangled.feed.star 6 7import ( 8 "bytes" 9 "encoding/json" 10 "fmt" 11 "io" 12 13 "github.com/bluesky-social/indigo/lex/util" 14 cbg "github.com/whyrusleeping/cbor-gen" 15) 16 17const ( 18 FeedStarNSID = "sh.tangled.feed.star" 19) 20 21func init() { 22 util.RegisterType("sh.tangled.feed.star", &FeedStar{}) 23} // 24// RECORDTYPE: FeedStar 25type FeedStar struct { 26 LexiconTypeID string `json:"$type,const=sh.tangled.feed.star" cborgen:"$type,const=sh.tangled.feed.star"` 27 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 28 Subject *FeedStar_Subject `json:"subject" cborgen:"subject"` 29} 30 31// FeedStar_Repo is a "repo" in the sh.tangled.feed.star schema. 32// 33// RECORDTYPE: FeedStar_Repo 34type FeedStar_Repo struct { 35 LexiconTypeID string `json:"$type,const=sh.tangled.feed.star#repo" cborgen:"$type,const=sh.tangled.feed.star#repo"` 36 Did string `json:"did" cborgen:"did"` 37} 38 39// FeedStar_String is a "string" in the sh.tangled.feed.star schema. 40// 41// RECORDTYPE: FeedStar_String 42type FeedStar_String struct { 43 LexiconTypeID string `json:"$type,const=sh.tangled.feed.star#string" cborgen:"$type,const=sh.tangled.feed.star#string"` 44 Uri string `json:"uri" cborgen:"uri"` 45} 46 47type FeedStar_Subject struct { 48 FeedStar_Repo *FeedStar_Repo 49 FeedStar_String *FeedStar_String 50} 51 52func (t *FeedStar_Subject) MarshalJSON() ([]byte, error) { 53 if t.FeedStar_Repo != nil { 54 t.FeedStar_Repo.LexiconTypeID = "sh.tangled.feed.star#repo" 55 return json.Marshal(t.FeedStar_Repo) 56 } 57 if t.FeedStar_String != nil { 58 t.FeedStar_String.LexiconTypeID = "sh.tangled.feed.star#string" 59 return json.Marshal(t.FeedStar_String) 60 } 61 return nil, fmt.Errorf("cannot marshal empty enum") 62} 63func (t *FeedStar_Subject) UnmarshalJSON(b []byte) error { 64 typ, err := util.TypeExtract(b) 65 if err != nil { 66 return err 67 } 68 69 switch typ { 70 case "sh.tangled.feed.star#repo": 71 t.FeedStar_Repo = new(FeedStar_Repo) 72 return json.Unmarshal(b, t.FeedStar_Repo) 73 case "sh.tangled.feed.star#string": 74 t.FeedStar_String = new(FeedStar_String) 75 return json.Unmarshal(b, t.FeedStar_String) 76 77 default: 78 return fmt.Errorf("closed enums must have a matching value") 79 } 80} 81 82func (t *FeedStar_Subject) MarshalCBOR(w io.Writer) error { 83 84 if t == nil { 85 _, err := w.Write(cbg.CborNull) 86 return err 87 } 88 if t.FeedStar_Repo != nil { 89 return t.FeedStar_Repo.MarshalCBOR(w) 90 } 91 if t.FeedStar_String != nil { 92 return t.FeedStar_String.MarshalCBOR(w) 93 } 94 return fmt.Errorf("cannot cbor marshal empty enum") 95} 96func (t *FeedStar_Subject) UnmarshalCBOR(r io.Reader) error { 97 typ, b, err := util.CborTypeExtractReader(r) 98 if err != nil { 99 return err 100 } 101 102 switch typ { 103 case "sh.tangled.feed.star#repo": 104 t.FeedStar_Repo = new(FeedStar_Repo) 105 return t.FeedStar_Repo.UnmarshalCBOR(bytes.NewReader(b)) 106 case "sh.tangled.feed.star#string": 107 t.FeedStar_String = new(FeedStar_String) 108 return t.FeedStar_String.UnmarshalCBOR(bytes.NewReader(b)) 109 110 default: 111 return fmt.Errorf("closed enums must have a matching value") 112 } 113}