github.com/grpc-ecosystem/grpc-gateway/v2@v2.19.1/examples/internal/proto/examplepb/echo_service_grpc.pb.go (about) 1 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 // versions: 3 // - protoc-gen-go-grpc v1.2.0 4 // - protoc (unknown) 5 // source: examples/internal/proto/examplepb/echo_service.proto 6 7 package examplepb 8 9 import ( 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. 19 const _ = grpc.SupportPackageIsVersion7 20 21 // EchoServiceClient is the client API for EchoService 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. 24 type EchoServiceClient interface { 25 // Echo method receives a simple message and returns it. 26 // 27 // The message posted as the id parameter will also be 28 // returned. 29 Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) 30 // EchoBody method receives a simple message and returns it. 31 EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) 32 // EchoDelete method receives a simple message and returns it. 33 EchoDelete(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) 34 // EchoPatch method receives a NonStandardUpdateRequest and returns it. 35 EchoPatch(ctx context.Context, in *DynamicMessageUpdate, opts ...grpc.CallOption) (*DynamicMessageUpdate, error) 36 // EchoUnauthorized method receives a simple message and returns it. It must 37 // always return a google.rpc.Code of `UNAUTHENTICATED` and a HTTP Status code 38 // of 401. 39 EchoUnauthorized(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) 40 } 41 42 type echoServiceClient struct { 43 cc grpc.ClientConnInterface 44 } 45 46 func NewEchoServiceClient(cc grpc.ClientConnInterface) EchoServiceClient { 47 return &echoServiceClient{cc} 48 } 49 50 func (c *echoServiceClient) Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { 51 out := new(SimpleMessage) 52 err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", in, out, opts...) 53 if err != nil { 54 return nil, err 55 } 56 return out, nil 57 } 58 59 func (c *echoServiceClient) EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { 60 out := new(SimpleMessage) 61 err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoBody", in, out, opts...) 62 if err != nil { 63 return nil, err 64 } 65 return out, nil 66 } 67 68 func (c *echoServiceClient) EchoDelete(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { 69 out := new(SimpleMessage) 70 err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoDelete", in, out, opts...) 71 if err != nil { 72 return nil, err 73 } 74 return out, nil 75 } 76 77 func (c *echoServiceClient) EchoPatch(ctx context.Context, in *DynamicMessageUpdate, opts ...grpc.CallOption) (*DynamicMessageUpdate, error) { 78 out := new(DynamicMessageUpdate) 79 err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoPatch", in, out, opts...) 80 if err != nil { 81 return nil, err 82 } 83 return out, nil 84 } 85 86 func (c *echoServiceClient) EchoUnauthorized(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) { 87 out := new(SimpleMessage) 88 err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoUnauthorized", in, out, opts...) 89 if err != nil { 90 return nil, err 91 } 92 return out, nil 93 } 94 95 // EchoServiceServer is the server API for EchoService service. 96 // All implementations should embed UnimplementedEchoServiceServer 97 // for forward compatibility 98 type EchoServiceServer interface { 99 // Echo method receives a simple message and returns it. 100 // 101 // The message posted as the id parameter will also be 102 // returned. 103 Echo(context.Context, *SimpleMessage) (*SimpleMessage, error) 104 // EchoBody method receives a simple message and returns it. 105 EchoBody(context.Context, *SimpleMessage) (*SimpleMessage, error) 106 // EchoDelete method receives a simple message and returns it. 107 EchoDelete(context.Context, *SimpleMessage) (*SimpleMessage, error) 108 // EchoPatch method receives a NonStandardUpdateRequest and returns it. 109 EchoPatch(context.Context, *DynamicMessageUpdate) (*DynamicMessageUpdate, error) 110 // EchoUnauthorized method receives a simple message and returns it. It must 111 // always return a google.rpc.Code of `UNAUTHENTICATED` and a HTTP Status code 112 // of 401. 113 EchoUnauthorized(context.Context, *SimpleMessage) (*SimpleMessage, error) 114 } 115 116 // UnimplementedEchoServiceServer should be embedded to have forward compatible implementations. 117 type UnimplementedEchoServiceServer struct { 118 } 119 120 func (UnimplementedEchoServiceServer) Echo(context.Context, *SimpleMessage) (*SimpleMessage, error) { 121 return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") 122 } 123 func (UnimplementedEchoServiceServer) EchoBody(context.Context, *SimpleMessage) (*SimpleMessage, error) { 124 return nil, status.Errorf(codes.Unimplemented, "method EchoBody not implemented") 125 } 126 func (UnimplementedEchoServiceServer) EchoDelete(context.Context, *SimpleMessage) (*SimpleMessage, error) { 127 return nil, status.Errorf(codes.Unimplemented, "method EchoDelete not implemented") 128 } 129 func (UnimplementedEchoServiceServer) EchoPatch(context.Context, *DynamicMessageUpdate) (*DynamicMessageUpdate, error) { 130 return nil, status.Errorf(codes.Unimplemented, "method EchoPatch not implemented") 131 } 132 func (UnimplementedEchoServiceServer) EchoUnauthorized(context.Context, *SimpleMessage) (*SimpleMessage, error) { 133 return nil, status.Errorf(codes.Unimplemented, "method EchoUnauthorized not implemented") 134 } 135 136 // UnsafeEchoServiceServer may be embedded to opt out of forward compatibility for this service. 137 // Use of this interface is not recommended, as added methods to EchoServiceServer will 138 // result in compilation errors. 139 type UnsafeEchoServiceServer interface { 140 mustEmbedUnimplementedEchoServiceServer() 141 } 142 143 func RegisterEchoServiceServer(s grpc.ServiceRegistrar, srv EchoServiceServer) { 144 s.RegisterService(&EchoService_ServiceDesc, srv) 145 } 146 147 func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 148 in := new(SimpleMessage) 149 if err := dec(in); err != nil { 150 return nil, err 151 } 152 if interceptor == nil { 153 return srv.(EchoServiceServer).Echo(ctx, in) 154 } 155 info := &grpc.UnaryServerInfo{ 156 Server: srv, 157 FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.EchoService/Echo", 158 } 159 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 160 return srv.(EchoServiceServer).Echo(ctx, req.(*SimpleMessage)) 161 } 162 return interceptor(ctx, in, info, handler) 163 } 164 165 func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 166 in := new(SimpleMessage) 167 if err := dec(in); err != nil { 168 return nil, err 169 } 170 if interceptor == nil { 171 return srv.(EchoServiceServer).EchoBody(ctx, in) 172 } 173 info := &grpc.UnaryServerInfo{ 174 Server: srv, 175 FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoBody", 176 } 177 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 178 return srv.(EchoServiceServer).EchoBody(ctx, req.(*SimpleMessage)) 179 } 180 return interceptor(ctx, in, info, handler) 181 } 182 183 func _EchoService_EchoDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 184 in := new(SimpleMessage) 185 if err := dec(in); err != nil { 186 return nil, err 187 } 188 if interceptor == nil { 189 return srv.(EchoServiceServer).EchoDelete(ctx, in) 190 } 191 info := &grpc.UnaryServerInfo{ 192 Server: srv, 193 FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoDelete", 194 } 195 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 196 return srv.(EchoServiceServer).EchoDelete(ctx, req.(*SimpleMessage)) 197 } 198 return interceptor(ctx, in, info, handler) 199 } 200 201 func _EchoService_EchoPatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 202 in := new(DynamicMessageUpdate) 203 if err := dec(in); err != nil { 204 return nil, err 205 } 206 if interceptor == nil { 207 return srv.(EchoServiceServer).EchoPatch(ctx, in) 208 } 209 info := &grpc.UnaryServerInfo{ 210 Server: srv, 211 FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoPatch", 212 } 213 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 214 return srv.(EchoServiceServer).EchoPatch(ctx, req.(*DynamicMessageUpdate)) 215 } 216 return interceptor(ctx, in, info, handler) 217 } 218 219 func _EchoService_EchoUnauthorized_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 220 in := new(SimpleMessage) 221 if err := dec(in); err != nil { 222 return nil, err 223 } 224 if interceptor == nil { 225 return srv.(EchoServiceServer).EchoUnauthorized(ctx, in) 226 } 227 info := &grpc.UnaryServerInfo{ 228 Server: srv, 229 FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.EchoService/EchoUnauthorized", 230 } 231 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 232 return srv.(EchoServiceServer).EchoUnauthorized(ctx, req.(*SimpleMessage)) 233 } 234 return interceptor(ctx, in, info, handler) 235 } 236 237 // EchoService_ServiceDesc is the grpc.ServiceDesc for EchoService service. 238 // It's only intended for direct use with grpc.RegisterService, 239 // and not to be introspected or modified (even as a copy) 240 var EchoService_ServiceDesc = grpc.ServiceDesc{ 241 ServiceName: "grpc.gateway.examples.internal.proto.examplepb.EchoService", 242 HandlerType: (*EchoServiceServer)(nil), 243 Methods: []grpc.MethodDesc{ 244 { 245 MethodName: "Echo", 246 Handler: _EchoService_Echo_Handler, 247 }, 248 { 249 MethodName: "EchoBody", 250 Handler: _EchoService_EchoBody_Handler, 251 }, 252 { 253 MethodName: "EchoDelete", 254 Handler: _EchoService_EchoDelete_Handler, 255 }, 256 { 257 MethodName: "EchoPatch", 258 Handler: _EchoService_EchoPatch_Handler, 259 }, 260 { 261 MethodName: "EchoUnauthorized", 262 Handler: _EchoService_EchoUnauthorized_Handler, 263 }, 264 }, 265 Streams: []grpc.StreamDesc{}, 266 Metadata: "examples/internal/proto/examplepb/echo_service.proto", 267 }