github.com/blend/go-sdk@v1.20220411.3/grpcutil/calculator/v1/calculator_grpc.pb.go (about) 1 /* 2 3 Copyright (c) 2021 - Present. Blend Labs, Inc. All rights reserved 4 Blend Confidential - Restricted 5 6 */ 7 8 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 9 10 package v1 11 12 import ( 13 context "context" 14 15 grpc "google.golang.org/grpc" 16 codes "google.golang.org/grpc/codes" 17 status "google.golang.org/grpc/status" 18 ) 19 20 // This is a compile-time assertion to ensure that this generated file 21 // is compatible with the grpc package it is being compiled against. 22 const _ = grpc.SupportPackageIsVersion6 23 24 // CalculatorClient is the client API for Calculator service. 25 // 26 // 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. 27 type CalculatorClient interface { 28 Add(ctx context.Context, in *Numbers, opts ...grpc.CallOption) (*Number, error) 29 AddStream(ctx context.Context, opts ...grpc.CallOption) (Calculator_AddStreamClient, error) 30 Subtract(ctx context.Context, in *Numbers, opts ...grpc.CallOption) (*Number, error) 31 SubtractStream(ctx context.Context, opts ...grpc.CallOption) (Calculator_SubtractStreamClient, error) 32 Multiply(ctx context.Context, in *Numbers, opts ...grpc.CallOption) (*Number, error) 33 MultiplyStream(ctx context.Context, opts ...grpc.CallOption) (Calculator_MultiplyStreamClient, error) 34 Divide(ctx context.Context, in *Numbers, opts ...grpc.CallOption) (*Number, error) 35 DivideStream(ctx context.Context, opts ...grpc.CallOption) (Calculator_DivideStreamClient, error) 36 } 37 38 type calculatorClient struct { 39 cc grpc.ClientConnInterface 40 } 41 42 func NewCalculatorClient(cc grpc.ClientConnInterface) CalculatorClient { 43 return &calculatorClient{cc} 44 } 45 46 func (c *calculatorClient) Add(ctx context.Context, in *Numbers, opts ...grpc.CallOption) (*Number, error) { 47 out := new(Number) 48 err := c.cc.Invoke(ctx, "/v1.Calculator/Add", in, out, opts...) 49 if err != nil { 50 return nil, err 51 } 52 return out, nil 53 } 54 55 func (c *calculatorClient) AddStream(ctx context.Context, opts ...grpc.CallOption) (Calculator_AddStreamClient, error) { 56 stream, err := c.cc.NewStream(ctx, &_Calculator_serviceDesc.Streams[0], "/v1.Calculator/AddStream", opts...) 57 if err != nil { 58 return nil, err 59 } 60 x := &calculatorAddStreamClient{stream} 61 return x, nil 62 } 63 64 type Calculator_AddStreamClient interface { 65 Send(*Number) error 66 CloseAndRecv() (*Number, error) 67 grpc.ClientStream 68 } 69 70 type calculatorAddStreamClient struct { 71 grpc.ClientStream 72 } 73 74 func (x *calculatorAddStreamClient) Send(m *Number) error { 75 return x.ClientStream.SendMsg(m) 76 } 77 78 func (x *calculatorAddStreamClient) CloseAndRecv() (*Number, error) { 79 if err := x.ClientStream.CloseSend(); err != nil { 80 return nil, err 81 } 82 m := new(Number) 83 if err := x.ClientStream.RecvMsg(m); err != nil { 84 return nil, err 85 } 86 return m, nil 87 } 88 89 func (c *calculatorClient) Subtract(ctx context.Context, in *Numbers, opts ...grpc.CallOption) (*Number, error) { 90 out := new(Number) 91 err := c.cc.Invoke(ctx, "/v1.Calculator/Subtract", in, out, opts...) 92 if err != nil { 93 return nil, err 94 } 95 return out, nil 96 } 97 98 func (c *calculatorClient) SubtractStream(ctx context.Context, opts ...grpc.CallOption) (Calculator_SubtractStreamClient, error) { 99 stream, err := c.cc.NewStream(ctx, &_Calculator_serviceDesc.Streams[1], "/v1.Calculator/SubtractStream", opts...) 100 if err != nil { 101 return nil, err 102 } 103 x := &calculatorSubtractStreamClient{stream} 104 return x, nil 105 } 106 107 type Calculator_SubtractStreamClient interface { 108 Send(*Number) error 109 CloseAndRecv() (*Number, error) 110 grpc.ClientStream 111 } 112 113 type calculatorSubtractStreamClient struct { 114 grpc.ClientStream 115 } 116 117 func (x *calculatorSubtractStreamClient) Send(m *Number) error { 118 return x.ClientStream.SendMsg(m) 119 } 120 121 func (x *calculatorSubtractStreamClient) CloseAndRecv() (*Number, error) { 122 if err := x.ClientStream.CloseSend(); err != nil { 123 return nil, err 124 } 125 m := new(Number) 126 if err := x.ClientStream.RecvMsg(m); err != nil { 127 return nil, err 128 } 129 return m, nil 130 } 131 132 func (c *calculatorClient) Multiply(ctx context.Context, in *Numbers, opts ...grpc.CallOption) (*Number, error) { 133 out := new(Number) 134 err := c.cc.Invoke(ctx, "/v1.Calculator/Multiply", in, out, opts...) 135 if err != nil { 136 return nil, err 137 } 138 return out, nil 139 } 140 141 func (c *calculatorClient) MultiplyStream(ctx context.Context, opts ...grpc.CallOption) (Calculator_MultiplyStreamClient, error) { 142 stream, err := c.cc.NewStream(ctx, &_Calculator_serviceDesc.Streams[2], "/v1.Calculator/MultiplyStream", opts...) 143 if err != nil { 144 return nil, err 145 } 146 x := &calculatorMultiplyStreamClient{stream} 147 return x, nil 148 } 149 150 type Calculator_MultiplyStreamClient interface { 151 Send(*Number) error 152 CloseAndRecv() (*Number, error) 153 grpc.ClientStream 154 } 155 156 type calculatorMultiplyStreamClient struct { 157 grpc.ClientStream 158 } 159 160 func (x *calculatorMultiplyStreamClient) Send(m *Number) error { 161 return x.ClientStream.SendMsg(m) 162 } 163 164 func (x *calculatorMultiplyStreamClient) CloseAndRecv() (*Number, error) { 165 if err := x.ClientStream.CloseSend(); err != nil { 166 return nil, err 167 } 168 m := new(Number) 169 if err := x.ClientStream.RecvMsg(m); err != nil { 170 return nil, err 171 } 172 return m, nil 173 } 174 175 func (c *calculatorClient) Divide(ctx context.Context, in *Numbers, opts ...grpc.CallOption) (*Number, error) { 176 out := new(Number) 177 err := c.cc.Invoke(ctx, "/v1.Calculator/Divide", in, out, opts...) 178 if err != nil { 179 return nil, err 180 } 181 return out, nil 182 } 183 184 func (c *calculatorClient) DivideStream(ctx context.Context, opts ...grpc.CallOption) (Calculator_DivideStreamClient, error) { 185 stream, err := c.cc.NewStream(ctx, &_Calculator_serviceDesc.Streams[3], "/v1.Calculator/DivideStream", opts...) 186 if err != nil { 187 return nil, err 188 } 189 x := &calculatorDivideStreamClient{stream} 190 return x, nil 191 } 192 193 type Calculator_DivideStreamClient interface { 194 Send(*Number) error 195 CloseAndRecv() (*Number, error) 196 grpc.ClientStream 197 } 198 199 type calculatorDivideStreamClient struct { 200 grpc.ClientStream 201 } 202 203 func (x *calculatorDivideStreamClient) Send(m *Number) error { 204 return x.ClientStream.SendMsg(m) 205 } 206 207 func (x *calculatorDivideStreamClient) CloseAndRecv() (*Number, error) { 208 if err := x.ClientStream.CloseSend(); err != nil { 209 return nil, err 210 } 211 m := new(Number) 212 if err := x.ClientStream.RecvMsg(m); err != nil { 213 return nil, err 214 } 215 return m, nil 216 } 217 218 // CalculatorServer is the server API for Calculator service. 219 // All implementations must embed UnimplementedCalculatorServer 220 // for forward compatibility 221 type CalculatorServer interface { 222 Add(context.Context, *Numbers) (*Number, error) 223 AddStream(Calculator_AddStreamServer) error 224 Subtract(context.Context, *Numbers) (*Number, error) 225 SubtractStream(Calculator_SubtractStreamServer) error 226 Multiply(context.Context, *Numbers) (*Number, error) 227 MultiplyStream(Calculator_MultiplyStreamServer) error 228 Divide(context.Context, *Numbers) (*Number, error) 229 DivideStream(Calculator_DivideStreamServer) error 230 mustEmbedUnimplementedCalculatorServer() 231 } 232 233 // UnimplementedCalculatorServer must be embedded to have forward compatible implementations. 234 type UnimplementedCalculatorServer struct { 235 } 236 237 func (*UnimplementedCalculatorServer) Add(context.Context, *Numbers) (*Number, error) { 238 return nil, status.Errorf(codes.Unimplemented, "method Add not implemented") 239 } 240 func (*UnimplementedCalculatorServer) AddStream(Calculator_AddStreamServer) error { 241 return status.Errorf(codes.Unimplemented, "method AddStream not implemented") 242 } 243 func (*UnimplementedCalculatorServer) Subtract(context.Context, *Numbers) (*Number, error) { 244 return nil, status.Errorf(codes.Unimplemented, "method Subtract not implemented") 245 } 246 func (*UnimplementedCalculatorServer) SubtractStream(Calculator_SubtractStreamServer) error { 247 return status.Errorf(codes.Unimplemented, "method SubtractStream not implemented") 248 } 249 func (*UnimplementedCalculatorServer) Multiply(context.Context, *Numbers) (*Number, error) { 250 return nil, status.Errorf(codes.Unimplemented, "method Multiply not implemented") 251 } 252 func (*UnimplementedCalculatorServer) MultiplyStream(Calculator_MultiplyStreamServer) error { 253 return status.Errorf(codes.Unimplemented, "method MultiplyStream not implemented") 254 } 255 func (*UnimplementedCalculatorServer) Divide(context.Context, *Numbers) (*Number, error) { 256 return nil, status.Errorf(codes.Unimplemented, "method Divide not implemented") 257 } 258 func (*UnimplementedCalculatorServer) DivideStream(Calculator_DivideStreamServer) error { 259 return status.Errorf(codes.Unimplemented, "method DivideStream not implemented") 260 } 261 func (*UnimplementedCalculatorServer) mustEmbedUnimplementedCalculatorServer() {} 262 263 func RegisterCalculatorServer(s *grpc.Server, srv CalculatorServer) { 264 s.RegisterService(&_Calculator_serviceDesc, srv) 265 } 266 267 func _Calculator_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 268 in := new(Numbers) 269 if err := dec(in); err != nil { 270 return nil, err 271 } 272 if interceptor == nil { 273 return srv.(CalculatorServer).Add(ctx, in) 274 } 275 info := &grpc.UnaryServerInfo{ 276 Server: srv, 277 FullMethod: "/v1.Calculator/Add", 278 } 279 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 280 return srv.(CalculatorServer).Add(ctx, req.(*Numbers)) 281 } 282 return interceptor(ctx, in, info, handler) 283 } 284 285 func _Calculator_AddStream_Handler(srv interface{}, stream grpc.ServerStream) error { 286 return srv.(CalculatorServer).AddStream(&calculatorAddStreamServer{stream}) 287 } 288 289 type Calculator_AddStreamServer interface { 290 SendAndClose(*Number) error 291 Recv() (*Number, error) 292 grpc.ServerStream 293 } 294 295 type calculatorAddStreamServer struct { 296 grpc.ServerStream 297 } 298 299 func (x *calculatorAddStreamServer) SendAndClose(m *Number) error { 300 return x.ServerStream.SendMsg(m) 301 } 302 303 func (x *calculatorAddStreamServer) Recv() (*Number, error) { 304 m := new(Number) 305 if err := x.ServerStream.RecvMsg(m); err != nil { 306 return nil, err 307 } 308 return m, nil 309 } 310 311 func _Calculator_Subtract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 312 in := new(Numbers) 313 if err := dec(in); err != nil { 314 return nil, err 315 } 316 if interceptor == nil { 317 return srv.(CalculatorServer).Subtract(ctx, in) 318 } 319 info := &grpc.UnaryServerInfo{ 320 Server: srv, 321 FullMethod: "/v1.Calculator/Subtract", 322 } 323 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 324 return srv.(CalculatorServer).Subtract(ctx, req.(*Numbers)) 325 } 326 return interceptor(ctx, in, info, handler) 327 } 328 329 func _Calculator_SubtractStream_Handler(srv interface{}, stream grpc.ServerStream) error { 330 return srv.(CalculatorServer).SubtractStream(&calculatorSubtractStreamServer{stream}) 331 } 332 333 type Calculator_SubtractStreamServer interface { 334 SendAndClose(*Number) error 335 Recv() (*Number, error) 336 grpc.ServerStream 337 } 338 339 type calculatorSubtractStreamServer struct { 340 grpc.ServerStream 341 } 342 343 func (x *calculatorSubtractStreamServer) SendAndClose(m *Number) error { 344 return x.ServerStream.SendMsg(m) 345 } 346 347 func (x *calculatorSubtractStreamServer) Recv() (*Number, error) { 348 m := new(Number) 349 if err := x.ServerStream.RecvMsg(m); err != nil { 350 return nil, err 351 } 352 return m, nil 353 } 354 355 func _Calculator_Multiply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 356 in := new(Numbers) 357 if err := dec(in); err != nil { 358 return nil, err 359 } 360 if interceptor == nil { 361 return srv.(CalculatorServer).Multiply(ctx, in) 362 } 363 info := &grpc.UnaryServerInfo{ 364 Server: srv, 365 FullMethod: "/v1.Calculator/Multiply", 366 } 367 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 368 return srv.(CalculatorServer).Multiply(ctx, req.(*Numbers)) 369 } 370 return interceptor(ctx, in, info, handler) 371 } 372 373 func _Calculator_MultiplyStream_Handler(srv interface{}, stream grpc.ServerStream) error { 374 return srv.(CalculatorServer).MultiplyStream(&calculatorMultiplyStreamServer{stream}) 375 } 376 377 type Calculator_MultiplyStreamServer interface { 378 SendAndClose(*Number) error 379 Recv() (*Number, error) 380 grpc.ServerStream 381 } 382 383 type calculatorMultiplyStreamServer struct { 384 grpc.ServerStream 385 } 386 387 func (x *calculatorMultiplyStreamServer) SendAndClose(m *Number) error { 388 return x.ServerStream.SendMsg(m) 389 } 390 391 func (x *calculatorMultiplyStreamServer) Recv() (*Number, error) { 392 m := new(Number) 393 if err := x.ServerStream.RecvMsg(m); err != nil { 394 return nil, err 395 } 396 return m, nil 397 } 398 399 func _Calculator_Divide_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 400 in := new(Numbers) 401 if err := dec(in); err != nil { 402 return nil, err 403 } 404 if interceptor == nil { 405 return srv.(CalculatorServer).Divide(ctx, in) 406 } 407 info := &grpc.UnaryServerInfo{ 408 Server: srv, 409 FullMethod: "/v1.Calculator/Divide", 410 } 411 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 412 return srv.(CalculatorServer).Divide(ctx, req.(*Numbers)) 413 } 414 return interceptor(ctx, in, info, handler) 415 } 416 417 func _Calculator_DivideStream_Handler(srv interface{}, stream grpc.ServerStream) error { 418 return srv.(CalculatorServer).DivideStream(&calculatorDivideStreamServer{stream}) 419 } 420 421 type Calculator_DivideStreamServer interface { 422 SendAndClose(*Number) error 423 Recv() (*Number, error) 424 grpc.ServerStream 425 } 426 427 type calculatorDivideStreamServer struct { 428 grpc.ServerStream 429 } 430 431 func (x *calculatorDivideStreamServer) SendAndClose(m *Number) error { 432 return x.ServerStream.SendMsg(m) 433 } 434 435 func (x *calculatorDivideStreamServer) Recv() (*Number, error) { 436 m := new(Number) 437 if err := x.ServerStream.RecvMsg(m); err != nil { 438 return nil, err 439 } 440 return m, nil 441 } 442 443 var _Calculator_serviceDesc = grpc.ServiceDesc{ 444 ServiceName: "v1.Calculator", 445 HandlerType: (*CalculatorServer)(nil), 446 Methods: []grpc.MethodDesc{ 447 { 448 MethodName: "Add", 449 Handler: _Calculator_Add_Handler, 450 }, 451 { 452 MethodName: "Subtract", 453 Handler: _Calculator_Subtract_Handler, 454 }, 455 { 456 MethodName: "Multiply", 457 Handler: _Calculator_Multiply_Handler, 458 }, 459 { 460 MethodName: "Divide", 461 Handler: _Calculator_Divide_Handler, 462 }, 463 }, 464 Streams: []grpc.StreamDesc{ 465 { 466 StreamName: "AddStream", 467 Handler: _Calculator_AddStream_Handler, 468 ClientStreams: true, 469 }, 470 { 471 StreamName: "SubtractStream", 472 Handler: _Calculator_SubtractStream_Handler, 473 ClientStreams: true, 474 }, 475 { 476 StreamName: "MultiplyStream", 477 Handler: _Calculator_MultiplyStream_Handler, 478 ClientStreams: true, 479 }, 480 { 481 StreamName: "DivideStream", 482 Handler: _Calculator_DivideStream_Handler, 483 ClientStreams: true, 484 }, 485 }, 486 Metadata: "calculator.proto", 487 }