github.com/Finschia/finschia-sdk@v0.48.1/client/grpc/node/query.pb.gw.go (about) 1 // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. 2 // source: cosmos/base/node/v1beta1/query.proto 3 4 /* 5 Package node is a reverse proxy. 6 7 It translates gRPC into RESTful JSON APIs. 8 */ 9 package node 10 11 import ( 12 "context" 13 "io" 14 "net/http" 15 16 "github.com/golang/protobuf/descriptor" 17 "github.com/golang/protobuf/proto" 18 "github.com/grpc-ecosystem/grpc-gateway/runtime" 19 "github.com/grpc-ecosystem/grpc-gateway/utilities" 20 "google.golang.org/grpc" 21 "google.golang.org/grpc/codes" 22 "google.golang.org/grpc/grpclog" 23 "google.golang.org/grpc/status" 24 ) 25 26 // Suppress "imported and not used" errors 27 var _ codes.Code 28 var _ io.Reader 29 var _ status.Status 30 var _ = runtime.String 31 var _ = utilities.NewDoubleArray 32 var _ = descriptor.ForMessage 33 34 func request_Service_Config_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 35 var protoReq ConfigRequest 36 var metadata runtime.ServerMetadata 37 38 msg, err := client.Config(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 39 return msg, metadata, err 40 41 } 42 43 func local_request_Service_Config_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 44 var protoReq ConfigRequest 45 var metadata runtime.ServerMetadata 46 47 msg, err := server.Config(ctx, &protoReq) 48 return msg, metadata, err 49 50 } 51 52 // RegisterServiceHandlerServer registers the http handlers for service Service to "mux". 53 // UnaryRPC :call ServiceServer directly. 54 // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. 55 // Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterServiceHandlerFromEndpoint instead. 56 func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServiceServer) error { 57 58 mux.Handle("GET", pattern_Service_Config_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 59 ctx, cancel := context.WithCancel(req.Context()) 60 defer cancel() 61 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 62 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 63 if err != nil { 64 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 65 return 66 } 67 resp, md, err := local_request_Service_Config_0(rctx, inboundMarshaler, server, req, pathParams) 68 ctx = runtime.NewServerMetadataContext(ctx, md) 69 if err != nil { 70 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 71 return 72 } 73 74 forward_Service_Config_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 75 76 }) 77 78 return nil 79 } 80 81 // RegisterServiceHandlerFromEndpoint is same as RegisterServiceHandler but 82 // automatically dials to "endpoint" and closes the connection when "ctx" gets done. 83 func RegisterServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { 84 conn, err := grpc.Dial(endpoint, opts...) 85 if err != nil { 86 return err 87 } 88 defer func() { 89 if err != nil { 90 if cerr := conn.Close(); cerr != nil { 91 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 92 } 93 return 94 } 95 go func() { 96 <-ctx.Done() 97 if cerr := conn.Close(); cerr != nil { 98 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 99 } 100 }() 101 }() 102 103 return RegisterServiceHandler(ctx, mux, conn) 104 } 105 106 // RegisterServiceHandler registers the http handlers for service Service to "mux". 107 // The handlers forward requests to the grpc endpoint over "conn". 108 func RegisterServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { 109 return RegisterServiceHandlerClient(ctx, mux, NewServiceClient(conn)) 110 } 111 112 // RegisterServiceHandlerClient registers the http handlers for service Service 113 // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ServiceClient". 114 // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ServiceClient" 115 // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in 116 // "ServiceClient" to call the correct interceptors. 117 func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServiceClient) error { 118 119 mux.Handle("GET", pattern_Service_Config_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 120 ctx, cancel := context.WithCancel(req.Context()) 121 defer cancel() 122 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 123 rctx, err := runtime.AnnotateContext(ctx, mux, req) 124 if err != nil { 125 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 126 return 127 } 128 resp, md, err := request_Service_Config_0(rctx, inboundMarshaler, client, req, pathParams) 129 ctx = runtime.NewServerMetadataContext(ctx, md) 130 if err != nil { 131 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 132 return 133 } 134 135 forward_Service_Config_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 136 137 }) 138 139 return nil 140 } 141 142 var ( 143 pattern_Service_Config_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"cosmos", "base", "node", "v1beta1", "config"}, "", runtime.AssumeColonVerbOpt(false))) 144 ) 145 146 var ( 147 forward_Service_Config_0 = runtime.ForwardResponseMessage 148 )