-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseabird.proto
267 lines (209 loc) · 7.13 KB
/
seabird.proto
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
syntax = "proto3";
package seabird;
import "common.proto";
option java_package = "io.coded.seabird.seabird";
option go_package = ".;pb";
// Note that the IDs exposed by the Backend, User, and Channel are opaque IDs
// which seabird-core will handle and route to the correct backend.
message Event {
oneof inner {
// Events sent by chat backends.
common.MessageEvent message = 1;
common.PrivateMessageEvent private_message = 2;
common.MentionEvent mention = 3;
common.CommandEvent command = 4;
common.ActionEvent action = 5;
common.PrivateActionEvent private_action = 6;
// Events sent by plugins and other clients. Generally, these are only
// needed for special cases.
SendMessageEvent send_message = 7;
SendPrivateMessageEvent send_private_message = 8;
PerformActionEvent perform_action = 9;
PerformPrivateActionEvent perform_private_action = 10;
}
map<string, string> tags = 11;
}
// Request and response objects
message StreamEventsRequest {
// A registry of commands this plugin responds to. A plugin MUST register all
// commands it responds to in order to receive those events. The
// CommandMetadata's name MUST match the map key, or an error will be
// returned.
//
// NOTE: help is a reserved command and cannot be registered by plugins.
map<string, CommandMetadata> commands = 1;
}
// CommandMetadata groups together a command's name along with short in-line
// help and the full private help.
//
// An example for the "help" command might be a name of "help", a short_help of
// "<command>" and an long help of "With no arguments, lists all available
// commands. With an argument, display the long help for an item."
message CommandMetadata {
string name = 1;
string short_help = 2;
string full_help = 3;
}
// Requests a plugin can make. Each Request has a corresponding Event which has
// a sender field added and the tags removed (because they are lifted up to the
// higher level Event message). These message types must be kept in sync.
// Perform an action in a given channel.
message PerformActionRequest {
string channel_id = 1;
string text = 2;
common.Block root_block = 4;
map<string, string> tags = 3;
}
message PerformActionResponse {
}
// PerformActionEvent will be emitted whenever a plugin or other client calls
// PerformAction. Note that this will be emitted every time PerformAction is
// called, not when it succeeds. The additional sender param refers to the
// client sending the message.
message PerformActionEvent {
string sender = 1;
string channel_id = 2;
string text = 3;
common.Block root_block = 4;
}
// Perform an action in a private message.
message PerformPrivateActionRequest {
string user_id = 1;
string text = 2;
common.Block root_block = 4;
map<string, string> tags = 3;
}
message PerformPrivateActionResponse {
}
// PerformPrivateActionEvent will be emitted whenever a plugin or other client
// calls PerformPrivateAction. Note that this will be emitted every time
// PerformPrivateAction is called, not when it succeeds. The additional sender
// param refers to the client sending the message.
message PerformPrivateActionEvent {
string sender = 1;
string user_id = 2;
string text = 3;
common.Block root_block = 4;
}
// Send a message to a given a channel.
message SendMessageRequest {
string channel_id = 1;
string text = 2;
common.Block root_block = 4;
map<string, string> tags = 3;
}
message SendMessageResponse {
}
// SendMessageEvent will be emitted whenever a plugin or other client calls
// SendMessage. Note that this will be emitted every time SendMessage is
// called, not when it succeeds. The additional sender param refers to the
// client sending the message.
message SendMessageEvent {
string sender = 1;
string channel_id = 2;
string text = 3;
common.Block root_block = 4;
}
// Send a private message to a given user.
message SendPrivateMessageRequest {
string user_id = 1;
string text = 2;
common.Block root_block = 4;
map<string, string> tags = 3;
}
message SendPrivateMessageResponse {
}
// SendPrivateMessageEvent will be emitted whenever a plugin or other client
// calls SendPrivateMessage. Note that this will be emitted every time
// SendPrivateMessage is called, not when it succeeds.The additional sender
// param refers to the client sending the message.
message SendPrivateMessageEvent {
string sender = 1;
string user_id = 2;
string text = 3;
common.Block root_block = 4;
}
// Request to join a channel.
message JoinChannelRequest {
string backend_id = 1;
// NOTE: this channel_name is the only place name is used for an identifier -
// all other times channels will be referred to by ID.
string channel_name = 2;
map<string, string> tags = 3;
}
message JoinChannelResponse {
}
// Request to leave a channel.
message LeaveChannelRequest {
string channel_id = 1;
string exit_message = 2;
map<string, string> tags = 3;
}
message LeaveChannelResponse {
}
// Request to list all connected backends.
message ListBackendsRequest {
}
message ListBackendsResponse {
repeated common.Backend backends = 1;
}
// Get info about a specific connected backend.
message BackendInfoRequest {
string backend_id = 1;
}
message BackendInfoResponse {
common.Backend backend = 1;
map<string, string> metadata = 2;
}
message ListChannelsRequest {
string backend_id = 1;
}
message ListChannelsResponse {
repeated common.Channel channels = 1;
}
message ChannelInfoRequest {
string channel_id = 1;
}
message ChannelInfoResponse {
common.Channel channel = 1;
}
message UpdateChannelInfoRequest {
string channel_id = 1;
string topic = 2;
map<string, string> tags = 3;
}
message UpdateChannelInfoResponse {
}
// A request for metadata about the running core instance.
message CoreInfoRequest {
}
// Metadata about the running core instance.
message CoreInfoResponse {
uint64 startup_timestamp = 1;
uint64 current_timestamp = 2;
}
message CommandsRequest {
}
message CommandsResponse {
map<string, CommandMetadata> commands = 1;
}
service Seabird {
rpc StreamEvents(StreamEventsRequest) returns (stream Event);
// Chat actions
rpc PerformAction(PerformActionRequest) returns (PerformActionResponse);
rpc PerformPrivateAction(PerformPrivateActionRequest) returns (PerformPrivateActionResponse);
rpc SendMessage(SendMessageRequest) returns (SendMessageResponse);
rpc SendPrivateMessage(SendPrivateMessageRequest) returns (SendPrivateMessageResponse);
rpc JoinChannel(JoinChannelRequest) returns (JoinChannelResponse);
rpc LeaveChannel(LeaveChannelRequest) returns (LeaveChannelResponse);
rpc UpdateChannelInfo(UpdateChannelInfoRequest) returns (UpdateChannelInfoResponse);
// Chat backend introspection
rpc ListBackends(ListBackendsRequest) returns (ListBackendsResponse);
rpc GetBackendInfo(BackendInfoRequest) returns (BackendInfoResponse);
// Chat connection introspection
rpc ListChannels(ListChannelsRequest) returns (ListChannelsResponse);
rpc GetChannelInfo(ChannelInfoRequest) returns (ChannelInfoResponse);
// Seabird introspection
rpc GetCoreInfo(CoreInfoRequest) returns (CoreInfoResponse);
rpc RegisteredCommands(CommandsRequest) returns (CommandsResponse);
}