-
Notifications
You must be signed in to change notification settings - Fork 180
/
chat.micro.go
337 lines (284 loc) · 9.87 KB
/
chat.micro.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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
/*
* Copyright (c) 2018. Abstrium SAS <team (at) pydio.com>
* This file is part of Pydio Cells.
*
* Pydio Cells is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pydio Cells is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Pydio Cells. If not, see <http://www.gnu.org/licenses/>.
*
* The latest code can be found at <https://pydio.com>.
*/
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: chat.proto
/*
Package chat is a generated protocol buffer package.
It is generated from these files:
chat.proto
It has these top-level messages:
ChatRoom
ChatMessage
PutRoomRequest
PutRoomResponse
PostMessageRequest
PostMessageResponse
DeleteMessageRequest
DeleteMessageResponse
ListMessagesRequest
ListMessagesResponse
ListRoomsRequest
ListRoomsResponse
DeleteRoomRequest
DeleteRoomResponse
ChatEvent
WebSocketMessage
*/
package chat
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/pydio/cells/common/proto/activity"
import (
client "github.com/micro/go-micro/client"
server "github.com/micro/go-micro/server"
context "context"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ client.Option
var _ server.Option
// Client API for ChatService service
type ChatServiceClient interface {
PutRoom(ctx context.Context, in *PutRoomRequest, opts ...client.CallOption) (*PutRoomResponse, error)
DeleteRoom(ctx context.Context, in *DeleteRoomRequest, opts ...client.CallOption) (*DeleteRoomResponse, error)
ListRooms(ctx context.Context, in *ListRoomsRequest, opts ...client.CallOption) (ChatService_ListRoomsClient, error)
ListMessages(ctx context.Context, in *ListMessagesRequest, opts ...client.CallOption) (ChatService_ListMessagesClient, error)
PostMessage(ctx context.Context, in *PostMessageRequest, opts ...client.CallOption) (*PostMessageResponse, error)
DeleteMessage(ctx context.Context, in *DeleteMessageRequest, opts ...client.CallOption) (*DeleteMessageResponse, error)
}
type chatServiceClient struct {
c client.Client
serviceName string
}
func NewChatServiceClient(serviceName string, c client.Client) ChatServiceClient {
if c == nil {
c = client.NewClient()
}
if len(serviceName) == 0 {
serviceName = "chat"
}
return &chatServiceClient{
c: c,
serviceName: serviceName,
}
}
func (c *chatServiceClient) PutRoom(ctx context.Context, in *PutRoomRequest, opts ...client.CallOption) (*PutRoomResponse, error) {
req := c.c.NewRequest(c.serviceName, "ChatService.PutRoom", in)
out := new(PutRoomResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *chatServiceClient) DeleteRoom(ctx context.Context, in *DeleteRoomRequest, opts ...client.CallOption) (*DeleteRoomResponse, error) {
req := c.c.NewRequest(c.serviceName, "ChatService.DeleteRoom", in)
out := new(DeleteRoomResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *chatServiceClient) ListRooms(ctx context.Context, in *ListRoomsRequest, opts ...client.CallOption) (ChatService_ListRoomsClient, error) {
req := c.c.NewRequest(c.serviceName, "ChatService.ListRooms", &ListRoomsRequest{})
stream, err := c.c.Stream(ctx, req, opts...)
if err != nil {
return nil, err
}
if err := stream.Send(in); err != nil {
return nil, err
}
return &chatServiceListRoomsClient{stream}, nil
}
type ChatService_ListRoomsClient interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Recv() (*ListRoomsResponse, error)
}
type chatServiceListRoomsClient struct {
stream client.Streamer
}
func (x *chatServiceListRoomsClient) Close() error {
return x.stream.Close()
}
func (x *chatServiceListRoomsClient) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *chatServiceListRoomsClient) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *chatServiceListRoomsClient) Recv() (*ListRoomsResponse, error) {
m := new(ListRoomsResponse)
err := x.stream.Recv(m)
if err != nil {
return nil, err
}
return m, nil
}
func (c *chatServiceClient) ListMessages(ctx context.Context, in *ListMessagesRequest, opts ...client.CallOption) (ChatService_ListMessagesClient, error) {
req := c.c.NewRequest(c.serviceName, "ChatService.ListMessages", &ListMessagesRequest{})
stream, err := c.c.Stream(ctx, req, opts...)
if err != nil {
return nil, err
}
if err := stream.Send(in); err != nil {
return nil, err
}
return &chatServiceListMessagesClient{stream}, nil
}
type ChatService_ListMessagesClient interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Recv() (*ListMessagesResponse, error)
}
type chatServiceListMessagesClient struct {
stream client.Streamer
}
func (x *chatServiceListMessagesClient) Close() error {
return x.stream.Close()
}
func (x *chatServiceListMessagesClient) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *chatServiceListMessagesClient) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *chatServiceListMessagesClient) Recv() (*ListMessagesResponse, error) {
m := new(ListMessagesResponse)
err := x.stream.Recv(m)
if err != nil {
return nil, err
}
return m, nil
}
func (c *chatServiceClient) PostMessage(ctx context.Context, in *PostMessageRequest, opts ...client.CallOption) (*PostMessageResponse, error) {
req := c.c.NewRequest(c.serviceName, "ChatService.PostMessage", in)
out := new(PostMessageResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *chatServiceClient) DeleteMessage(ctx context.Context, in *DeleteMessageRequest, opts ...client.CallOption) (*DeleteMessageResponse, error) {
req := c.c.NewRequest(c.serviceName, "ChatService.DeleteMessage", in)
out := new(DeleteMessageResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for ChatService service
type ChatServiceHandler interface {
PutRoom(context.Context, *PutRoomRequest, *PutRoomResponse) error
DeleteRoom(context.Context, *DeleteRoomRequest, *DeleteRoomResponse) error
ListRooms(context.Context, *ListRoomsRequest, ChatService_ListRoomsStream) error
ListMessages(context.Context, *ListMessagesRequest, ChatService_ListMessagesStream) error
PostMessage(context.Context, *PostMessageRequest, *PostMessageResponse) error
DeleteMessage(context.Context, *DeleteMessageRequest, *DeleteMessageResponse) error
}
func RegisterChatServiceHandler(s server.Server, hdlr ChatServiceHandler, opts ...server.HandlerOption) {
s.Handle(s.NewHandler(&ChatService{hdlr}, opts...))
}
type ChatService struct {
ChatServiceHandler
}
func (h *ChatService) PutRoom(ctx context.Context, in *PutRoomRequest, out *PutRoomResponse) error {
return h.ChatServiceHandler.PutRoom(ctx, in, out)
}
func (h *ChatService) DeleteRoom(ctx context.Context, in *DeleteRoomRequest, out *DeleteRoomResponse) error {
return h.ChatServiceHandler.DeleteRoom(ctx, in, out)
}
func (h *ChatService) ListRooms(ctx context.Context, stream server.Streamer) error {
m := new(ListRoomsRequest)
if err := stream.Recv(m); err != nil {
return err
}
return h.ChatServiceHandler.ListRooms(ctx, m, &chatServiceListRoomsStream{stream})
}
type ChatService_ListRoomsStream interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*ListRoomsResponse) error
}
type chatServiceListRoomsStream struct {
stream server.Streamer
}
func (x *chatServiceListRoomsStream) Close() error {
return x.stream.Close()
}
func (x *chatServiceListRoomsStream) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *chatServiceListRoomsStream) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *chatServiceListRoomsStream) Send(m *ListRoomsResponse) error {
return x.stream.Send(m)
}
func (h *ChatService) ListMessages(ctx context.Context, stream server.Streamer) error {
m := new(ListMessagesRequest)
if err := stream.Recv(m); err != nil {
return err
}
return h.ChatServiceHandler.ListMessages(ctx, m, &chatServiceListMessagesStream{stream})
}
type ChatService_ListMessagesStream interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*ListMessagesResponse) error
}
type chatServiceListMessagesStream struct {
stream server.Streamer
}
func (x *chatServiceListMessagesStream) Close() error {
return x.stream.Close()
}
func (x *chatServiceListMessagesStream) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *chatServiceListMessagesStream) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *chatServiceListMessagesStream) Send(m *ListMessagesResponse) error {
return x.stream.Send(m)
}
func (h *ChatService) PostMessage(ctx context.Context, in *PostMessageRequest, out *PostMessageResponse) error {
return h.ChatServiceHandler.PostMessage(ctx, in, out)
}
func (h *ChatService) DeleteMessage(ctx context.Context, in *DeleteMessageRequest, out *DeleteMessageResponse) error {
return h.ChatServiceHandler.DeleteMessage(ctx, in, out)
}