-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
notify_badges.go
286 lines (263 loc) · 8.56 KB
/
notify_badges.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
// Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler)
// Input file: avdl/keybase1/notify_badges.avdl
package keybase1
import (
gregor1 "github.com/keybase/client/go/protocol/gregor1"
"github.com/keybase/go-framed-msgpack-rpc/rpc"
context "golang.org/x/net/context"
"time"
)
type ChatConversationID []byte
func (o ChatConversationID) DeepCopy() ChatConversationID {
return (func(x []byte) []byte {
if x == nil {
return nil
}
return append([]byte{}, x...)
})(o)
}
type TeamMemberOutReset struct {
TeamID TeamID `codec:"teamID" json:"teamID"`
Teamname string `codec:"teamname" json:"teamname"`
Username string `codec:"username" json:"username"`
Uid UID `codec:"uid" json:"uid"`
Id gregor1.MsgID `codec:"id" json:"id"`
}
func (o TeamMemberOutReset) DeepCopy() TeamMemberOutReset {
return TeamMemberOutReset{
TeamID: o.TeamID.DeepCopy(),
Teamname: o.Teamname,
Username: o.Username,
Uid: o.Uid.DeepCopy(),
Id: o.Id.DeepCopy(),
}
}
type DeletedTeamInfo struct {
TeamName string `codec:"teamName" json:"teamName"`
DeletedBy string `codec:"deletedBy" json:"deletedBy"`
Id gregor1.MsgID `codec:"id" json:"id"`
}
func (o DeletedTeamInfo) DeepCopy() DeletedTeamInfo {
return DeletedTeamInfo{
TeamName: o.TeamName,
DeletedBy: o.DeletedBy,
Id: o.Id.DeepCopy(),
}
}
type WalletAccountInfo struct {
AccountID string `codec:"accountID" json:"accountID"`
NumUnread int `codec:"numUnread" json:"numUnread"`
}
func (o WalletAccountInfo) DeepCopy() WalletAccountInfo {
return WalletAccountInfo{
AccountID: o.AccountID,
NumUnread: o.NumUnread,
}
}
type ResetState struct {
EndTime Time `codec:"endTime" json:"end_time"`
Active bool `codec:"active" json:"active"`
}
func (o ResetState) DeepCopy() ResetState {
return ResetState{
EndTime: o.EndTime.DeepCopy(),
Active: o.Active,
}
}
type WotUpdate struct {
Voucher string `codec:"voucher" json:"voucher"`
Vouchee string `codec:"vouchee" json:"vouchee"`
Status WotStatusType `codec:"status" json:"status"`
}
func (o WotUpdate) DeepCopy() WotUpdate {
return WotUpdate{
Voucher: o.Voucher,
Vouchee: o.Vouchee,
Status: o.Status.DeepCopy(),
}
}
type BadgeState struct {
NewTlfs int `codec:"newTlfs" json:"newTlfs"`
RekeysNeeded int `codec:"rekeysNeeded" json:"rekeysNeeded"`
NewFollowers int `codec:"newFollowers" json:"newFollowers"`
InboxVers int `codec:"inboxVers" json:"inboxVers"`
HomeTodoItems int `codec:"homeTodoItems" json:"homeTodoItems"`
UnverifiedEmails int `codec:"unverifiedEmails" json:"unverifiedEmails"`
UnverifiedPhones int `codec:"unverifiedPhones" json:"unverifiedPhones"`
SmallTeamBadgeCount int `codec:"smallTeamBadgeCount" json:"smallTeamBadgeCount"`
BigTeamBadgeCount int `codec:"bigTeamBadgeCount" json:"bigTeamBadgeCount"`
NewTeamAccessRequestCount int `codec:"newTeamAccessRequestCount" json:"newTeamAccessRequestCount"`
NewDevices []DeviceID `codec:"newDevices" json:"newDevices"`
RevokedDevices []DeviceID `codec:"revokedDevices" json:"revokedDevices"`
Conversations []BadgeConversationInfo `codec:"conversations" json:"conversations"`
NewGitRepoGlobalUniqueIDs []string `codec:"newGitRepoGlobalUniqueIDs" json:"newGitRepoGlobalUniqueIDs"`
NewTeams []TeamID `codec:"newTeams" json:"newTeams"`
DeletedTeams []DeletedTeamInfo `codec:"deletedTeams" json:"deletedTeams"`
TeamsWithResetUsers []TeamMemberOutReset `codec:"teamsWithResetUsers" json:"teamsWithResetUsers"`
UnreadWalletAccounts []WalletAccountInfo `codec:"unreadWalletAccounts" json:"unreadWalletAccounts"`
WotUpdates map[string]WotUpdate `codec:"wotUpdates" json:"wotUpdates"`
ResetState ResetState `codec:"resetState" json:"resetState"`
}
func (o BadgeState) DeepCopy() BadgeState {
return BadgeState{
NewTlfs: o.NewTlfs,
RekeysNeeded: o.RekeysNeeded,
NewFollowers: o.NewFollowers,
InboxVers: o.InboxVers,
HomeTodoItems: o.HomeTodoItems,
UnverifiedEmails: o.UnverifiedEmails,
UnverifiedPhones: o.UnverifiedPhones,
SmallTeamBadgeCount: o.SmallTeamBadgeCount,
BigTeamBadgeCount: o.BigTeamBadgeCount,
NewTeamAccessRequestCount: o.NewTeamAccessRequestCount,
NewDevices: (func(x []DeviceID) []DeviceID {
if x == nil {
return nil
}
ret := make([]DeviceID, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.NewDevices),
RevokedDevices: (func(x []DeviceID) []DeviceID {
if x == nil {
return nil
}
ret := make([]DeviceID, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.RevokedDevices),
Conversations: (func(x []BadgeConversationInfo) []BadgeConversationInfo {
if x == nil {
return nil
}
ret := make([]BadgeConversationInfo, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.Conversations),
NewGitRepoGlobalUniqueIDs: (func(x []string) []string {
if x == nil {
return nil
}
ret := make([]string, len(x))
for i, v := range x {
vCopy := v
ret[i] = vCopy
}
return ret
})(o.NewGitRepoGlobalUniqueIDs),
NewTeams: (func(x []TeamID) []TeamID {
if x == nil {
return nil
}
ret := make([]TeamID, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.NewTeams),
DeletedTeams: (func(x []DeletedTeamInfo) []DeletedTeamInfo {
if x == nil {
return nil
}
ret := make([]DeletedTeamInfo, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.DeletedTeams),
TeamsWithResetUsers: (func(x []TeamMemberOutReset) []TeamMemberOutReset {
if x == nil {
return nil
}
ret := make([]TeamMemberOutReset, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.TeamsWithResetUsers),
UnreadWalletAccounts: (func(x []WalletAccountInfo) []WalletAccountInfo {
if x == nil {
return nil
}
ret := make([]WalletAccountInfo, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.UnreadWalletAccounts),
WotUpdates: (func(x map[string]WotUpdate) map[string]WotUpdate {
if x == nil {
return nil
}
ret := make(map[string]WotUpdate, len(x))
for k, v := range x {
kCopy := k
vCopy := v.DeepCopy()
ret[kCopy] = vCopy
}
return ret
})(o.WotUpdates),
ResetState: o.ResetState.DeepCopy(),
}
}
type BadgeConversationInfo struct {
ConvID ChatConversationID `codec:"convID" json:"convID"`
BadgeCount int `codec:"badgeCount" json:"badgeCount"`
UnreadMessages int `codec:"unreadMessages" json:"unreadMessages"`
}
func (o BadgeConversationInfo) DeepCopy() BadgeConversationInfo {
return BadgeConversationInfo{
ConvID: o.ConvID.DeepCopy(),
BadgeCount: o.BadgeCount,
UnreadMessages: o.UnreadMessages,
}
}
type BadgeStateArg struct {
BadgeState BadgeState `codec:"badgeState" json:"badgeState"`
}
type NotifyBadgesInterface interface {
BadgeState(context.Context, BadgeState) error
}
func NotifyBadgesProtocol(i NotifyBadgesInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.NotifyBadges",
Methods: map[string]rpc.ServeHandlerDescription{
"badgeState": {
MakeArg: func() interface{} {
var ret [1]BadgeStateArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]BadgeStateArg)
if !ok {
err = rpc.NewTypeError((*[1]BadgeStateArg)(nil), args)
return
}
err = i.BadgeState(ctx, typedArgs[0].BadgeState)
return
},
},
},
}
}
type NotifyBadgesClient struct {
Cli rpc.GenericClient
}
func (c NotifyBadgesClient) BadgeState(ctx context.Context, badgeState BadgeState) (err error) {
__arg := BadgeStateArg{BadgeState: badgeState}
err = c.Cli.Notify(ctx, "keybase.1.NotifyBadges.badgeState", []interface{}{__arg}, 0*time.Millisecond)
return
}