-
Notifications
You must be signed in to change notification settings - Fork 89
/
actorprofile.go
88 lines (75 loc) · 2.64 KB
/
actorprofile.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
package bsky
// schema: app.bsky.actor.profile
import (
"bytes"
"encoding/json"
"fmt"
"io"
comatprototypes "github.com/bluesky-social/indigo/api/atproto"
"github.com/bluesky-social/indigo/lex/util"
cbg "github.com/whyrusleeping/cbor-gen"
)
func init() {
util.RegisterType("app.bsky.actor.profile", &ActorProfile{})
} //
// RECORDTYPE: ActorProfile
type ActorProfile struct {
LexiconTypeID string `json:"$type,const=app.bsky.actor.profile" cborgen:"$type,const=app.bsky.actor.profile"`
// avatar: Small image to be displayed next to posts from account. AKA, 'profile picture'
Avatar *util.LexBlob `json:"avatar,omitempty" cborgen:"avatar,omitempty"`
// banner: Larger horizontal image to display behind profile view.
Banner *util.LexBlob `json:"banner,omitempty" cborgen:"banner,omitempty"`
// description: Free-form profile description text.
Description *string `json:"description,omitempty" cborgen:"description,omitempty"`
DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"`
// labels: Self-label values, specific to the Bluesky application, on the overall account.
Labels *ActorProfile_Labels `json:"labels,omitempty" cborgen:"labels,omitempty"`
}
// Self-label values, specific to the Bluesky application, on the overall account.
type ActorProfile_Labels struct {
LabelDefs_SelfLabels *comatprototypes.LabelDefs_SelfLabels
}
func (t *ActorProfile_Labels) MarshalJSON() ([]byte, error) {
if t.LabelDefs_SelfLabels != nil {
t.LabelDefs_SelfLabels.LexiconTypeID = "com.atproto.label.defs#selfLabels"
return json.Marshal(t.LabelDefs_SelfLabels)
}
return nil, fmt.Errorf("cannot marshal empty enum")
}
func (t *ActorProfile_Labels) UnmarshalJSON(b []byte) error {
typ, err := util.TypeExtract(b)
if err != nil {
return err
}
switch typ {
case "com.atproto.label.defs#selfLabels":
t.LabelDefs_SelfLabels = new(comatprototypes.LabelDefs_SelfLabels)
return json.Unmarshal(b, t.LabelDefs_SelfLabels)
default:
return nil
}
}
func (t *ActorProfile_Labels) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if t.LabelDefs_SelfLabels != nil {
return t.LabelDefs_SelfLabels.MarshalCBOR(w)
}
return fmt.Errorf("cannot cbor marshal empty enum")
}
func (t *ActorProfile_Labels) UnmarshalCBOR(r io.Reader) error {
typ, b, err := util.CborTypeExtractReader(r)
if err != nil {
return err
}
switch typ {
case "com.atproto.label.defs#selfLabels":
t.LabelDefs_SelfLabels = new(comatprototypes.LabelDefs_SelfLabels)
return t.LabelDefs_SelfLabels.UnmarshalCBOR(bytes.NewReader(b))
default:
return nil
}
}