github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/icamauth/types/query.pb.gw.go (about) 1 // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. 2 // source: gaia/icamauth/v1beta1/query.proto 3 4 /* 5 Package types is a reverse proxy. 6 7 It translates gRPC into RESTful JSON APIs. 8 */ 9 package types 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/metadata" 24 "google.golang.org/grpc/status" 25 ) 26 27 // Suppress "imported and not used" errors 28 var _ codes.Code 29 var _ io.Reader 30 var _ status.Status 31 var _ = runtime.String 32 var _ = utilities.NewDoubleArray 33 var _ = descriptor.ForMessage 34 var _ = metadata.Join 35 36 func request_Query_InterchainAccount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 37 var protoReq QueryInterchainAccountRequest 38 var metadata runtime.ServerMetadata 39 40 var ( 41 val string 42 ok bool 43 err error 44 _ = err 45 ) 46 47 val, ok = pathParams["owner"] 48 if !ok { 49 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") 50 } 51 52 protoReq.Owner, err = runtime.String(val) 53 54 if err != nil { 55 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) 56 } 57 58 val, ok = pathParams["connection_id"] 59 if !ok { 60 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "connection_id") 61 } 62 63 protoReq.ConnectionId, err = runtime.String(val) 64 65 if err != nil { 66 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "connection_id", err) 67 } 68 69 msg, err := client.InterchainAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 70 return msg, metadata, err 71 72 } 73 74 func local_request_Query_InterchainAccount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 75 var protoReq QueryInterchainAccountRequest 76 var metadata runtime.ServerMetadata 77 78 var ( 79 val string 80 ok bool 81 err error 82 _ = err 83 ) 84 85 val, ok = pathParams["owner"] 86 if !ok { 87 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") 88 } 89 90 protoReq.Owner, err = runtime.String(val) 91 92 if err != nil { 93 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) 94 } 95 96 val, ok = pathParams["connection_id"] 97 if !ok { 98 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "connection_id") 99 } 100 101 protoReq.ConnectionId, err = runtime.String(val) 102 103 if err != nil { 104 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "connection_id", err) 105 } 106 107 msg, err := server.InterchainAccount(ctx, &protoReq) 108 return msg, metadata, err 109 110 } 111 112 // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". 113 // UnaryRPC :call QueryServer directly. 114 // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. 115 // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. 116 func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { 117 118 mux.Handle("GET", pattern_Query_InterchainAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 119 ctx, cancel := context.WithCancel(req.Context()) 120 defer cancel() 121 var stream runtime.ServerTransportStream 122 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 123 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 124 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 125 if err != nil { 126 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 127 return 128 } 129 resp, md, err := local_request_Query_InterchainAccount_0(rctx, inboundMarshaler, server, req, pathParams) 130 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 131 ctx = runtime.NewServerMetadataContext(ctx, md) 132 if err != nil { 133 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 134 return 135 } 136 137 forward_Query_InterchainAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 138 139 }) 140 141 return nil 142 } 143 144 // RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but 145 // automatically dials to "endpoint" and closes the connection when "ctx" gets done. 146 func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { 147 conn, err := grpc.Dial(endpoint, opts...) 148 if err != nil { 149 return err 150 } 151 defer func() { 152 if err != nil { 153 if cerr := conn.Close(); cerr != nil { 154 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 155 } 156 return 157 } 158 go func() { 159 <-ctx.Done() 160 if cerr := conn.Close(); cerr != nil { 161 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 162 } 163 }() 164 }() 165 166 return RegisterQueryHandler(ctx, mux, conn) 167 } 168 169 // RegisterQueryHandler registers the http handlers for service Query to "mux". 170 // The handlers forward requests to the grpc endpoint over "conn". 171 func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { 172 return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) 173 } 174 175 // RegisterQueryHandlerClient registers the http handlers for service Query 176 // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". 177 // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" 178 // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in 179 // "QueryClient" to call the correct interceptors. 180 func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { 181 182 mux.Handle("GET", pattern_Query_InterchainAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 183 ctx, cancel := context.WithCancel(req.Context()) 184 defer cancel() 185 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 186 rctx, err := runtime.AnnotateContext(ctx, mux, req) 187 if err != nil { 188 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 189 return 190 } 191 resp, md, err := request_Query_InterchainAccount_0(rctx, inboundMarshaler, client, req, pathParams) 192 ctx = runtime.NewServerMetadataContext(ctx, md) 193 if err != nil { 194 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 195 return 196 } 197 198 forward_Query_InterchainAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 199 200 }) 201 202 return nil 203 } 204 205 var ( 206 pattern_Query_InterchainAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"gaia", "icamauth", "v1beta1", "interchain_account", "owner", "connection", "connection_id"}, "", runtime.AssumeColonVerbOpt(true))) 207 ) 208 209 var ( 210 forward_Query_InterchainAccount_0 = runtime.ForwardResponseMessage 211 )