1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
3package bsky
4
5// schema: app.bsky.feed.generator
6
7import (
8 "bytes"
9 "encoding/json"
10 "fmt"
11 "io"
12
13 comatprototypes "github.com/bluesky-social/indigo/api/atproto"
14 "github.com/bluesky-social/indigo/lex/util"
15 cbg "github.com/whyrusleeping/cbor-gen"
16)
17
18func init() {
19 util.RegisterType("app.bsky.feed.generator", &FeedGenerator{})
20} //
21// RECORDTYPE: FeedGenerator
22type FeedGenerator struct {
23 LexiconTypeID string `json:"$type,const=app.bsky.feed.generator" cborgen:"$type,const=app.bsky.feed.generator"`
24 // acceptsInteractions: Declaration that a feed accepts feedback interactions from a client through app.bsky.feed.sendInteractions
25 AcceptsInteractions *bool `json:"acceptsInteractions,omitempty" cborgen:"acceptsInteractions,omitempty"`
26 Avatar *util.LexBlob `json:"avatar,omitempty" cborgen:"avatar,omitempty"`
27 ContentMode *string `json:"contentMode,omitempty" cborgen:"contentMode,omitempty"`
28 CreatedAt string `json:"createdAt" cborgen:"createdAt"`
29 Description *string `json:"description,omitempty" cborgen:"description,omitempty"`
30 DescriptionFacets []*RichtextFacet `json:"descriptionFacets,omitempty" cborgen:"descriptionFacets,omitempty"`
31 Did string `json:"did" cborgen:"did"`
32 DisplayName string `json:"displayName" cborgen:"displayName"`
33 // labels: Self-label values
34 Labels *FeedGenerator_Labels `json:"labels,omitempty" cborgen:"labels,omitempty"`
35}
36
37// Self-label values
38type FeedGenerator_Labels struct {
39 LabelDefs_SelfLabels *comatprototypes.LabelDefs_SelfLabels
40}
41
42func (t *FeedGenerator_Labels) MarshalJSON() ([]byte, error) {
43 if t.LabelDefs_SelfLabels != nil {
44 t.LabelDefs_SelfLabels.LexiconTypeID = "com.atproto.label.defs#selfLabels"
45 return json.Marshal(t.LabelDefs_SelfLabels)
46 }
47 return nil, fmt.Errorf("cannot marshal empty enum")
48}
49func (t *FeedGenerator_Labels) UnmarshalJSON(b []byte) error {
50 typ, err := util.TypeExtract(b)
51 if err != nil {
52 return err
53 }
54
55 switch typ {
56 case "com.atproto.label.defs#selfLabels":
57 t.LabelDefs_SelfLabels = new(comatprototypes.LabelDefs_SelfLabels)
58 return json.Unmarshal(b, t.LabelDefs_SelfLabels)
59
60 default:
61 return nil
62 }
63}
64
65func (t *FeedGenerator_Labels) MarshalCBOR(w io.Writer) error {
66
67 if t == nil {
68 _, err := w.Write(cbg.CborNull)
69 return err
70 }
71 if t.LabelDefs_SelfLabels != nil {
72 return t.LabelDefs_SelfLabels.MarshalCBOR(w)
73 }
74 return fmt.Errorf("cannot cbor marshal empty enum")
75}
76func (t *FeedGenerator_Labels) UnmarshalCBOR(r io.Reader) error {
77 typ, b, err := util.CborTypeExtractReader(r)
78 if err != nil {
79 return err
80 }
81
82 switch typ {
83 case "com.atproto.label.defs#selfLabels":
84 t.LabelDefs_SelfLabels = new(comatprototypes.LabelDefs_SelfLabels)
85 return t.LabelDefs_SelfLabels.UnmarshalCBOR(bytes.NewReader(b))
86
87 default:
88 return nil
89 }
90}