This repository has been archived by the owner on Jul 7, 2020. It is now read-only.
forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
notify_ctl.go
93 lines (84 loc) · 2.89 KB
/
notify_ctl.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
// Auto-generated by avdl-compiler v1.3.22 (https://github.com/keybase/node-avdl-compiler)
// Input file: avdl/keybase1/notify_ctl.avdl
package keybase1
import (
"github.com/keybase/go-framed-msgpack-rpc/rpc"
context "golang.org/x/net/context"
)
type NotificationChannels struct {
Session bool `codec:"session" json:"session"`
Users bool `codec:"users" json:"users"`
Kbfs bool `codec:"kbfs" json:"kbfs"`
Tracking bool `codec:"tracking" json:"tracking"`
Favorites bool `codec:"favorites" json:"favorites"`
Paperkeys bool `codec:"paperkeys" json:"paperkeys"`
Keyfamily bool `codec:"keyfamily" json:"keyfamily"`
Service bool `codec:"service" json:"service"`
App bool `codec:"app" json:"app"`
Chat bool `codec:"chat" json:"chat"`
PGP bool `codec:"pgp" json:"pgp"`
Kbfsrequest bool `codec:"kbfsrequest" json:"kbfsrequest"`
Badges bool `codec:"badges" json:"badges"`
Reachability bool `codec:"reachability" json:"reachability"`
Team bool `codec:"team" json:"team"`
Ephemeral bool `codec:"ephemeral" json:"ephemeral"`
Chatkbfsedits bool `codec:"chatkbfsedits" json:"chatkbfsedits"`
}
func (o NotificationChannels) DeepCopy() NotificationChannels {
return NotificationChannels{
Session: o.Session,
Users: o.Users,
Kbfs: o.Kbfs,
Tracking: o.Tracking,
Favorites: o.Favorites,
Paperkeys: o.Paperkeys,
Keyfamily: o.Keyfamily,
Service: o.Service,
App: o.App,
Chat: o.Chat,
PGP: o.PGP,
Kbfsrequest: o.Kbfsrequest,
Badges: o.Badges,
Reachability: o.Reachability,
Team: o.Team,
Ephemeral: o.Ephemeral,
Chatkbfsedits: o.Chatkbfsedits,
}
}
type SetNotificationsArg struct {
Channels NotificationChannels `codec:"channels" json:"channels"`
}
type NotifyCtlInterface interface {
SetNotifications(context.Context, NotificationChannels) error
}
func NotifyCtlProtocol(i NotifyCtlInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.notifyCtl",
Methods: map[string]rpc.ServeHandlerDescription{
"setNotifications": {
MakeArg: func() interface{} {
ret := make([]SetNotificationsArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]SetNotificationsArg)
if !ok {
err = rpc.NewTypeError((*[]SetNotificationsArg)(nil), args)
return
}
err = i.SetNotifications(ctx, (*typedArgs)[0].Channels)
return
},
MethodType: rpc.MethodCall,
},
},
}
}
type NotifyCtlClient struct {
Cli rpc.GenericClient
}
func (c NotifyCtlClient) SetNotifications(ctx context.Context, channels NotificationChannels) (err error) {
__arg := SetNotificationsArg{Channels: channels}
err = c.Cli.Call(ctx, "keybase.1.notifyCtl.setNotifications", []interface{}{__arg}, nil)
return
}