forked from keybase/client
/
avatars.go
144 lines (127 loc) · 3.71 KB
/
avatars.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// Auto-generated by avdl-compiler v1.4.0 (https://github.com/keybase/node-avdl-compiler)
// Input file: avdl/keybase1/avatars.avdl
package keybase1
import (
"github.com/keybase/go-framed-msgpack-rpc/rpc"
context "golang.org/x/net/context"
)
type AvatarUrl string
func (o AvatarUrl) DeepCopy() AvatarUrl {
return o
}
type AvatarFormat string
func (o AvatarFormat) DeepCopy() AvatarFormat {
return o
}
type LoadAvatarsRes struct {
Picmap map[string]map[AvatarFormat]AvatarUrl `codec:"picmap" json:"picmap"`
}
func (o LoadAvatarsRes) DeepCopy() LoadAvatarsRes {
return LoadAvatarsRes{
Picmap: (func(x map[string]map[AvatarFormat]AvatarUrl) map[string]map[AvatarFormat]AvatarUrl {
if x == nil {
return nil
}
ret := make(map[string]map[AvatarFormat]AvatarUrl, len(x))
for k, v := range x {
kCopy := k
vCopy := (func(x map[AvatarFormat]AvatarUrl) map[AvatarFormat]AvatarUrl {
if x == nil {
return nil
}
ret := make(map[AvatarFormat]AvatarUrl, len(x))
for k, v := range x {
kCopy := k.DeepCopy()
vCopy := v.DeepCopy()
ret[kCopy] = vCopy
}
return ret
})(v)
ret[kCopy] = vCopy
}
return ret
})(o.Picmap),
}
}
type AvatarClearCacheMsg struct {
Name string `codec:"name" json:"name"`
Formats []AvatarFormat `codec:"formats" json:"formats"`
Typ AvatarUpdateType `codec:"typ" json:"typ"`
}
func (o AvatarClearCacheMsg) DeepCopy() AvatarClearCacheMsg {
return AvatarClearCacheMsg{
Name: o.Name,
Formats: (func(x []AvatarFormat) []AvatarFormat {
if x == nil {
return nil
}
ret := make([]AvatarFormat, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.Formats),
Typ: o.Typ.DeepCopy(),
}
}
type LoadUserAvatarsArg struct {
Names []string `codec:"names" json:"names"`
Formats []AvatarFormat `codec:"formats" json:"formats"`
}
type LoadTeamAvatarsArg struct {
Names []string `codec:"names" json:"names"`
Formats []AvatarFormat `codec:"formats" json:"formats"`
}
type AvatarsInterface interface {
LoadUserAvatars(context.Context, LoadUserAvatarsArg) (LoadAvatarsRes, error)
LoadTeamAvatars(context.Context, LoadTeamAvatarsArg) (LoadAvatarsRes, error)
}
func AvatarsProtocol(i AvatarsInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.avatars",
Methods: map[string]rpc.ServeHandlerDescription{
"loadUserAvatars": {
MakeArg: func() interface{} {
var ret [1]LoadUserAvatarsArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]LoadUserAvatarsArg)
if !ok {
err = rpc.NewTypeError((*[1]LoadUserAvatarsArg)(nil), args)
return
}
ret, err = i.LoadUserAvatars(ctx, typedArgs[0])
return
},
},
"loadTeamAvatars": {
MakeArg: func() interface{} {
var ret [1]LoadTeamAvatarsArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]LoadTeamAvatarsArg)
if !ok {
err = rpc.NewTypeError((*[1]LoadTeamAvatarsArg)(nil), args)
return
}
ret, err = i.LoadTeamAvatars(ctx, typedArgs[0])
return
},
},
},
}
}
type AvatarsClient struct {
Cli rpc.GenericClient
}
func (c AvatarsClient) LoadUserAvatars(ctx context.Context, __arg LoadUserAvatarsArg) (res LoadAvatarsRes, err error) {
err = c.Cli.Call(ctx, "keybase.1.avatars.loadUserAvatars", []interface{}{__arg}, &res)
return
}
func (c AvatarsClient) LoadTeamAvatars(ctx context.Context, __arg LoadTeamAvatarsArg) (res LoadAvatarsRes, err error) {
err = c.Cli.Call(ctx, "keybase.1.avatars.loadTeamAvatars", []interface{}{__arg}, &res)
return
}