1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
3package bsky
4
5// schema: app.bsky.actor.profile
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.actor.profile", &ActorProfile{})
20} //
21// RECORDTYPE: ActorProfile
22type ActorProfile struct {
23 LexiconTypeID string `json:"$type,const=app.bsky.actor.profile" cborgen:"$type,const=app.bsky.actor.profile"`
24 // avatar: Small image to be displayed next to posts from account. AKA, 'profile picture'
25 Avatar *util.LexBlob `json:"avatar,omitempty" cborgen:"avatar,omitempty"`
26 // banner: Larger horizontal image to display behind profile view.
27 Banner *util.LexBlob `json:"banner,omitempty" cborgen:"banner,omitempty"`
28 CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"`
29 // description: Free-form profile description text.
30 Description *string `json:"description,omitempty" cborgen:"description,omitempty"`
31 DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"`
32 JoinedViaStarterPack *comatprototypes.RepoStrongRef `json:"joinedViaStarterPack,omitempty" cborgen:"joinedViaStarterPack,omitempty"`
33 // labels: Self-label values, specific to the Bluesky application, on the overall account.
34 Labels *ActorProfile_Labels `json:"labels,omitempty" cborgen:"labels,omitempty"`
35 PinnedPost *comatprototypes.RepoStrongRef `json:"pinnedPost,omitempty" cborgen:"pinnedPost,omitempty"`
36}
37
38// Self-label values, specific to the Bluesky application, on the overall account.
39type ActorProfile_Labels struct {
40 LabelDefs_SelfLabels *comatprototypes.LabelDefs_SelfLabels
41}
42
43func (t *ActorProfile_Labels) MarshalJSON() ([]byte, error) {
44 if t.LabelDefs_SelfLabels != nil {
45 t.LabelDefs_SelfLabels.LexiconTypeID = "com.atproto.label.defs#selfLabels"
46 return json.Marshal(t.LabelDefs_SelfLabels)
47 }
48 return nil, fmt.Errorf("cannot marshal empty enum")
49}
50func (t *ActorProfile_Labels) UnmarshalJSON(b []byte) error {
51 typ, err := util.TypeExtract(b)
52 if err != nil {
53 return err
54 }
55
56 switch typ {
57 case "com.atproto.label.defs#selfLabels":
58 t.LabelDefs_SelfLabels = new(comatprototypes.LabelDefs_SelfLabels)
59 return json.Unmarshal(b, t.LabelDefs_SelfLabels)
60
61 default:
62 return nil
63 }
64}
65
66func (t *ActorProfile_Labels) MarshalCBOR(w io.Writer) error {
67
68 if t == nil {
69 _, err := w.Write(cbg.CborNull)
70 return err
71 }
72 if t.LabelDefs_SelfLabels != nil {
73 return t.LabelDefs_SelfLabels.MarshalCBOR(w)
74 }
75 return fmt.Errorf("cannot cbor marshal empty enum")
76}
77func (t *ActorProfile_Labels) UnmarshalCBOR(r io.Reader) error {
78 typ, b, err := util.CborTypeExtractReader(r)
79 if err != nil {
80 return err
81 }
82
83 switch typ {
84 case "com.atproto.label.defs#selfLabels":
85 t.LabelDefs_SelfLabels = new(comatprototypes.LabelDefs_SelfLabels)
86 return t.LabelDefs_SelfLabels.UnmarshalCBOR(bytes.NewReader(b))
87
88 default:
89 return nil
90 }
91}