/
featured_bot.go
188 lines (171 loc) · 5.35 KB
/
featured_bot.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
// Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler)
// Input file: avdl/keybase1/featured_bot.avdl
package keybase1
import (
"github.com/keybase/go-framed-msgpack-rpc/rpc"
context "golang.org/x/net/context"
"time"
)
type FeaturedBot struct {
BotAlias string `codec:"botAlias" json:"botAlias"`
Description string `codec:"description" json:"description"`
ExtendedDescription string `codec:"extendedDescription" json:"extendedDescription"`
ExtendedDescriptionRaw string `codec:"extendedDescriptionRaw" json:"extendedDescriptionRaw"`
BotUsername string `codec:"botUsername" json:"botUsername"`
OwnerTeam *string `codec:"ownerTeam,omitempty" json:"ownerTeam,omitempty"`
OwnerUser *string `codec:"ownerUser,omitempty" json:"ownerUser,omitempty"`
Rank int `codec:"rank" json:"rank"`
IsPromoted bool `codec:"isPromoted" json:"isPromoted"`
}
func (o FeaturedBot) DeepCopy() FeaturedBot {
return FeaturedBot{
BotAlias: o.BotAlias,
Description: o.Description,
ExtendedDescription: o.ExtendedDescription,
ExtendedDescriptionRaw: o.ExtendedDescriptionRaw,
BotUsername: o.BotUsername,
OwnerTeam: (func(x *string) *string {
if x == nil {
return nil
}
tmp := (*x)
return &tmp
})(o.OwnerTeam),
OwnerUser: (func(x *string) *string {
if x == nil {
return nil
}
tmp := (*x)
return &tmp
})(o.OwnerUser),
Rank: o.Rank,
IsPromoted: o.IsPromoted,
}
}
type FeaturedBotsRes struct {
Bots []FeaturedBot `codec:"bots" json:"bots"`
IsLastPage bool `codec:"isLastPage" json:"isLastPage"`
}
func (o FeaturedBotsRes) DeepCopy() FeaturedBotsRes {
return FeaturedBotsRes{
Bots: (func(x []FeaturedBot) []FeaturedBot {
if x == nil {
return nil
}
ret := make([]FeaturedBot, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.Bots),
IsLastPage: o.IsLastPage,
}
}
type SearchRes struct {
Bots []FeaturedBot `codec:"bots" json:"bots"`
IsLastPage bool `codec:"isLastPage" json:"isLastPage"`
}
func (o SearchRes) DeepCopy() SearchRes {
return SearchRes{
Bots: (func(x []FeaturedBot) []FeaturedBot {
if x == nil {
return nil
}
ret := make([]FeaturedBot, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.Bots),
IsLastPage: o.IsLastPage,
}
}
type FeaturedBotsArg struct {
Limit int `codec:"limit" json:"limit"`
Offset int `codec:"offset" json:"offset"`
SkipCache bool `codec:"skipCache" json:"skipCache"`
}
type SearchArg struct {
Query string `codec:"query" json:"query"`
Limit int `codec:"limit" json:"limit"`
Offset int `codec:"offset" json:"offset"`
}
type SearchLocalArg struct {
Query string `codec:"query" json:"query"`
Limit int `codec:"limit" json:"limit"`
SkipCache bool `codec:"skipCache" json:"skipCache"`
}
type FeaturedBotInterface interface {
FeaturedBots(context.Context, FeaturedBotsArg) (FeaturedBotsRes, error)
Search(context.Context, SearchArg) (SearchRes, error)
SearchLocal(context.Context, SearchLocalArg) (SearchRes, error)
}
func FeaturedBotProtocol(i FeaturedBotInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.featuredBot",
Methods: map[string]rpc.ServeHandlerDescription{
"featuredBots": {
MakeArg: func() interface{} {
var ret [1]FeaturedBotsArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]FeaturedBotsArg)
if !ok {
err = rpc.NewTypeError((*[1]FeaturedBotsArg)(nil), args)
return
}
ret, err = i.FeaturedBots(ctx, typedArgs[0])
return
},
},
"search": {
MakeArg: func() interface{} {
var ret [1]SearchArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]SearchArg)
if !ok {
err = rpc.NewTypeError((*[1]SearchArg)(nil), args)
return
}
ret, err = i.Search(ctx, typedArgs[0])
return
},
},
"searchLocal": {
MakeArg: func() interface{} {
var ret [1]SearchLocalArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]SearchLocalArg)
if !ok {
err = rpc.NewTypeError((*[1]SearchLocalArg)(nil), args)
return
}
ret, err = i.SearchLocal(ctx, typedArgs[0])
return
},
},
},
}
}
type FeaturedBotClient struct {
Cli rpc.GenericClient
}
func (c FeaturedBotClient) FeaturedBots(ctx context.Context, __arg FeaturedBotsArg) (res FeaturedBotsRes, err error) {
err = c.Cli.Call(ctx, "keybase.1.featuredBot.featuredBots", []interface{}{__arg}, &res, 0*time.Millisecond)
return
}
func (c FeaturedBotClient) Search(ctx context.Context, __arg SearchArg) (res SearchRes, err error) {
err = c.Cli.Call(ctx, "keybase.1.featuredBot.search", []interface{}{__arg}, &res, 0*time.Millisecond)
return
}
func (c FeaturedBotClient) SearchLocal(ctx context.Context, __arg SearchLocalArg) (res SearchRes, err error) {
err = c.Cli.Call(ctx, "keybase.1.featuredBot.searchLocal", []interface{}{__arg}, &res, 0*time.Millisecond)
return
}