1// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
2// versions:
3// - protoc-gen-go-grpc v1.1.0
4// - protoc             v3.14.0
5// source: examples/features/proto/echo/echo.proto
6
7package echo
8
9import (
10	context "context"
11	grpc "google.golang.org/grpc"
12	codes "google.golang.org/grpc/codes"
13	status "google.golang.org/grpc/status"
14)
15
16// This is a compile-time assertion to ensure that this generated file
17// is compatible with the grpc package it is being compiled against.
18// Requires gRPC-Go v1.32.0 or later.
19const _ = grpc.SupportPackageIsVersion7
20
21// EchoClient is the client API for Echo service.
22//
23// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
24type EchoClient interface {
25	// UnaryEcho is unary echo.
26	UnaryEcho(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error)
27	// ServerStreamingEcho is server side streaming.
28	ServerStreamingEcho(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (Echo_ServerStreamingEchoClient, error)
29	// ClientStreamingEcho is client side streaming.
30	ClientStreamingEcho(ctx context.Context, opts ...grpc.CallOption) (Echo_ClientStreamingEchoClient, error)
31	// BidirectionalStreamingEcho is bidi streaming.
32	BidirectionalStreamingEcho(ctx context.Context, opts ...grpc.CallOption) (Echo_BidirectionalStreamingEchoClient, error)
33}
34
35type echoClient struct {
36	cc grpc.ClientConnInterface
37}
38
39func NewEchoClient(cc grpc.ClientConnInterface) EchoClient {
40	return &echoClient{cc}
41}
42
43func (c *echoClient) UnaryEcho(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error) {
44	out := new(EchoResponse)
45	err := c.cc.Invoke(ctx, "/grpc.examples.echo.Echo/UnaryEcho", in, out, opts...)
46	if err != nil {
47		return nil, err
48	}
49	return out, nil
50}
51
52func (c *echoClient) ServerStreamingEcho(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (Echo_ServerStreamingEchoClient, error) {
53	stream, err := c.cc.NewStream(ctx, &Echo_ServiceDesc.Streams[0], "/grpc.examples.echo.Echo/ServerStreamingEcho", opts...)
54	if err != nil {
55		return nil, err
56	}
57	x := &echoServerStreamingEchoClient{stream}
58	if err := x.ClientStream.SendMsg(in); err != nil {
59		return nil, err
60	}
61	if err := x.ClientStream.CloseSend(); err != nil {
62		return nil, err
63	}
64	return x, nil
65}
66
67type Echo_ServerStreamingEchoClient interface {
68	Recv() (*EchoResponse, error)
69	grpc.ClientStream
70}
71
72type echoServerStreamingEchoClient struct {
73	grpc.ClientStream
74}
75
76func (x *echoServerStreamingEchoClient) Recv() (*EchoResponse, error) {
77	m := new(EchoResponse)
78	if err := x.ClientStream.RecvMsg(m); err != nil {
79		return nil, err
80	}
81	return m, nil
82}
83
84func (c *echoClient) ClientStreamingEcho(ctx context.Context, opts ...grpc.CallOption) (Echo_ClientStreamingEchoClient, error) {
85	stream, err := c.cc.NewStream(ctx, &Echo_ServiceDesc.Streams[1], "/grpc.examples.echo.Echo/ClientStreamingEcho", opts...)
86	if err != nil {
87		return nil, err
88	}
89	x := &echoClientStreamingEchoClient{stream}
90	return x, nil
91}
92
93type Echo_ClientStreamingEchoClient interface {
94	Send(*EchoRequest) error
95	CloseAndRecv() (*EchoResponse, error)
96	grpc.ClientStream
97}
98
99type echoClientStreamingEchoClient struct {
100	grpc.ClientStream
101}
102
103func (x *echoClientStreamingEchoClient) Send(m *EchoRequest) error {
104	return x.ClientStream.SendMsg(m)
105}
106
107func (x *echoClientStreamingEchoClient) CloseAndRecv() (*EchoResponse, error) {
108	if err := x.ClientStream.CloseSend(); err != nil {
109		return nil, err
110	}
111	m := new(EchoResponse)
112	if err := x.ClientStream.RecvMsg(m); err != nil {
113		return nil, err
114	}
115	return m, nil
116}
117
118func (c *echoClient) BidirectionalStreamingEcho(ctx context.Context, opts ...grpc.CallOption) (Echo_BidirectionalStreamingEchoClient, error) {
119	stream, err := c.cc.NewStream(ctx, &Echo_ServiceDesc.Streams[2], "/grpc.examples.echo.Echo/BidirectionalStreamingEcho", opts...)
120	if err != nil {
121		return nil, err
122	}
123	x := &echoBidirectionalStreamingEchoClient{stream}
124	return x, nil
125}
126
127type Echo_BidirectionalStreamingEchoClient interface {
128	Send(*EchoRequest) error
129	Recv() (*EchoResponse, error)
130	grpc.ClientStream
131}
132
133type echoBidirectionalStreamingEchoClient struct {
134	grpc.ClientStream
135}
136
137func (x *echoBidirectionalStreamingEchoClient) Send(m *EchoRequest) error {
138	return x.ClientStream.SendMsg(m)
139}
140
141func (x *echoBidirectionalStreamingEchoClient) Recv() (*EchoResponse, error) {
142	m := new(EchoResponse)
143	if err := x.ClientStream.RecvMsg(m); err != nil {
144		return nil, err
145	}
146	return m, nil
147}
148
149// EchoServer is the server API for Echo service.
150// All implementations must embed UnimplementedEchoServer
151// for forward compatibility
152type EchoServer interface {
153	// UnaryEcho is unary echo.
154	UnaryEcho(context.Context, *EchoRequest) (*EchoResponse, error)
155	// ServerStreamingEcho is server side streaming.
156	ServerStreamingEcho(*EchoRequest, Echo_ServerStreamingEchoServer) error
157	// ClientStreamingEcho is client side streaming.
158	ClientStreamingEcho(Echo_ClientStreamingEchoServer) error
159	// BidirectionalStreamingEcho is bidi streaming.
160	BidirectionalStreamingEcho(Echo_BidirectionalStreamingEchoServer) error
161	mustEmbedUnimplementedEchoServer()
162}
163
164// UnimplementedEchoServer must be embedded to have forward compatible implementations.
165type UnimplementedEchoServer struct {
166}
167
168func (UnimplementedEchoServer) UnaryEcho(context.Context, *EchoRequest) (*EchoResponse, error) {
169	return nil, status.Errorf(codes.Unimplemented, "method UnaryEcho not implemented")
170}
171func (UnimplementedEchoServer) ServerStreamingEcho(*EchoRequest, Echo_ServerStreamingEchoServer) error {
172	return status.Errorf(codes.Unimplemented, "method ServerStreamingEcho not implemented")
173}
174func (UnimplementedEchoServer) ClientStreamingEcho(Echo_ClientStreamingEchoServer) error {
175	return status.Errorf(codes.Unimplemented, "method ClientStreamingEcho not implemented")
176}
177func (UnimplementedEchoServer) BidirectionalStreamingEcho(Echo_BidirectionalStreamingEchoServer) error {
178	return status.Errorf(codes.Unimplemented, "method BidirectionalStreamingEcho not implemented")
179}
180func (UnimplementedEchoServer) mustEmbedUnimplementedEchoServer() {}
181
182// UnsafeEchoServer may be embedded to opt out of forward compatibility for this service.
183// Use of this interface is not recommended, as added methods to EchoServer will
184// result in compilation errors.
185type UnsafeEchoServer interface {
186	mustEmbedUnimplementedEchoServer()
187}
188
189func RegisterEchoServer(s grpc.ServiceRegistrar, srv EchoServer) {
190	s.RegisterService(&Echo_ServiceDesc, srv)
191}
192
193func _Echo_UnaryEcho_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
194	in := new(EchoRequest)
195	if err := dec(in); err != nil {
196		return nil, err
197	}
198	if interceptor == nil {
199		return srv.(EchoServer).UnaryEcho(ctx, in)
200	}
201	info := &grpc.UnaryServerInfo{
202		Server:     srv,
203		FullMethod: "/grpc.examples.echo.Echo/UnaryEcho",
204	}
205	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
206		return srv.(EchoServer).UnaryEcho(ctx, req.(*EchoRequest))
207	}
208	return interceptor(ctx, in, info, handler)
209}
210
211func _Echo_ServerStreamingEcho_Handler(srv interface{}, stream grpc.ServerStream) error {
212	m := new(EchoRequest)
213	if err := stream.RecvMsg(m); err != nil {
214		return err
215	}
216	return srv.(EchoServer).ServerStreamingEcho(m, &echoServerStreamingEchoServer{stream})
217}
218
219type Echo_ServerStreamingEchoServer interface {
220	Send(*EchoResponse) error
221	grpc.ServerStream
222}
223
224type echoServerStreamingEchoServer struct {
225	grpc.ServerStream
226}
227
228func (x *echoServerStreamingEchoServer) Send(m *EchoResponse) error {
229	return x.ServerStream.SendMsg(m)
230}
231
232func _Echo_ClientStreamingEcho_Handler(srv interface{}, stream grpc.ServerStream) error {
233	return srv.(EchoServer).ClientStreamingEcho(&echoClientStreamingEchoServer{stream})
234}
235
236type Echo_ClientStreamingEchoServer interface {
237	SendAndClose(*EchoResponse) error
238	Recv() (*EchoRequest, error)
239	grpc.ServerStream
240}
241
242type echoClientStreamingEchoServer struct {
243	grpc.ServerStream
244}
245
246func (x *echoClientStreamingEchoServer) SendAndClose(m *EchoResponse) error {
247	return x.ServerStream.SendMsg(m)
248}
249
250func (x *echoClientStreamingEchoServer) Recv() (*EchoRequest, error) {
251	m := new(EchoRequest)
252	if err := x.ServerStream.RecvMsg(m); err != nil {
253		return nil, err
254	}
255	return m, nil
256}
257
258func _Echo_BidirectionalStreamingEcho_Handler(srv interface{}, stream grpc.ServerStream) error {
259	return srv.(EchoServer).BidirectionalStreamingEcho(&echoBidirectionalStreamingEchoServer{stream})
260}
261
262type Echo_BidirectionalStreamingEchoServer interface {
263	Send(*EchoResponse) error
264	Recv() (*EchoRequest, error)
265	grpc.ServerStream
266}
267
268type echoBidirectionalStreamingEchoServer struct {
269	grpc.ServerStream
270}
271
272func (x *echoBidirectionalStreamingEchoServer) Send(m *EchoResponse) error {
273	return x.ServerStream.SendMsg(m)
274}
275
276func (x *echoBidirectionalStreamingEchoServer) Recv() (*EchoRequest, error) {
277	m := new(EchoRequest)
278	if err := x.ServerStream.RecvMsg(m); err != nil {
279		return nil, err
280	}
281	return m, nil
282}
283
284// Echo_ServiceDesc is the grpc.ServiceDesc for Echo service.
285// It's only intended for direct use with grpc.RegisterService,
286// and not to be introspected or modified (even as a copy)
287var Echo_ServiceDesc = grpc.ServiceDesc{
288	ServiceName: "grpc.examples.echo.Echo",
289	HandlerType: (*EchoServer)(nil),
290	Methods: []grpc.MethodDesc{
291		{
292			MethodName: "UnaryEcho",
293			Handler:    _Echo_UnaryEcho_Handler,
294		},
295	},
296	Streams: []grpc.StreamDesc{
297		{
298			StreamName:    "ServerStreamingEcho",
299			Handler:       _Echo_ServerStreamingEcho_Handler,
300			ServerStreams: true,
301		},
302		{
303			StreamName:    "ClientStreamingEcho",
304			Handler:       _Echo_ClientStreamingEcho_Handler,
305			ClientStreams: true,
306		},
307		{
308			StreamName:    "BidirectionalStreamingEcho",
309			Handler:       _Echo_BidirectionalStreamingEcho_Handler,
310			ServerStreams: true,
311			ClientStreams: true,
312		},
313	},
314	Metadata: "examples/features/proto/echo/echo.proto",
315}
316