code.vegaprotocol.io/vega@v0.79.0/protos/blockexplorer/api/v1/blockexplorer.pb.gw.go (about) 1 // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. 2 // source: blockexplorer/api/v1/blockexplorer.proto 3 4 /* 5 Package v1 is a reverse proxy. 6 7 It translates gRPC into RESTful JSON APIs. 8 */ 9 package v1 10 11 import ( 12 "context" 13 "io" 14 "net/http" 15 16 "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" 17 "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" 18 "google.golang.org/grpc" 19 "google.golang.org/grpc/codes" 20 "google.golang.org/grpc/grpclog" 21 "google.golang.org/grpc/metadata" 22 "google.golang.org/grpc/status" 23 "google.golang.org/protobuf/proto" 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 _ = metadata.Join 33 34 func request_BlockExplorerService_GetTransaction_0(ctx context.Context, marshaler runtime.Marshaler, client BlockExplorerServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 35 var protoReq GetTransactionRequest 36 var metadata runtime.ServerMetadata 37 38 var ( 39 val string 40 ok bool 41 err error 42 _ = err 43 ) 44 45 val, ok = pathParams["hash"] 46 if !ok { 47 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") 48 } 49 50 protoReq.Hash, err = runtime.String(val) 51 if err != nil { 52 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) 53 } 54 55 msg, err := client.GetTransaction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 56 return msg, metadata, err 57 58 } 59 60 func local_request_BlockExplorerService_GetTransaction_0(ctx context.Context, marshaler runtime.Marshaler, server BlockExplorerServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 61 var protoReq GetTransactionRequest 62 var metadata runtime.ServerMetadata 63 64 var ( 65 val string 66 ok bool 67 err error 68 _ = err 69 ) 70 71 val, ok = pathParams["hash"] 72 if !ok { 73 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") 74 } 75 76 protoReq.Hash, err = runtime.String(val) 77 if err != nil { 78 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) 79 } 80 81 msg, err := server.GetTransaction(ctx, &protoReq) 82 return msg, metadata, err 83 84 } 85 86 var ( 87 filter_BlockExplorerService_ListTransactions_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} 88 ) 89 90 func request_BlockExplorerService_ListTransactions_0(ctx context.Context, marshaler runtime.Marshaler, client BlockExplorerServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 91 var protoReq ListTransactionsRequest 92 var metadata runtime.ServerMetadata 93 94 if err := req.ParseForm(); err != nil { 95 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 96 } 97 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BlockExplorerService_ListTransactions_0); err != nil { 98 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 99 } 100 101 msg, err := client.ListTransactions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 102 return msg, metadata, err 103 104 } 105 106 func local_request_BlockExplorerService_ListTransactions_0(ctx context.Context, marshaler runtime.Marshaler, server BlockExplorerServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 107 var protoReq ListTransactionsRequest 108 var metadata runtime.ServerMetadata 109 110 if err := req.ParseForm(); err != nil { 111 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 112 } 113 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BlockExplorerService_ListTransactions_0); err != nil { 114 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 115 } 116 117 msg, err := server.ListTransactions(ctx, &protoReq) 118 return msg, metadata, err 119 120 } 121 122 func request_BlockExplorerService_Info_0(ctx context.Context, marshaler runtime.Marshaler, client BlockExplorerServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 123 var protoReq InfoRequest 124 var metadata runtime.ServerMetadata 125 126 msg, err := client.Info(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 127 return msg, metadata, err 128 129 } 130 131 func local_request_BlockExplorerService_Info_0(ctx context.Context, marshaler runtime.Marshaler, server BlockExplorerServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 132 var protoReq InfoRequest 133 var metadata runtime.ServerMetadata 134 135 msg, err := server.Info(ctx, &protoReq) 136 return msg, metadata, err 137 138 } 139 140 // RegisterBlockExplorerServiceHandlerServer registers the http handlers for service BlockExplorerService to "mux". 141 // UnaryRPC :call BlockExplorerServiceServer directly. 142 // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. 143 // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterBlockExplorerServiceHandlerFromEndpoint instead. 144 func RegisterBlockExplorerServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BlockExplorerServiceServer) error { 145 146 mux.Handle("GET", pattern_BlockExplorerService_GetTransaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 147 ctx, cancel := context.WithCancel(req.Context()) 148 defer cancel() 149 var stream runtime.ServerTransportStream 150 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 151 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 152 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blockexplorer.api.v1.BlockExplorerService/GetTransaction", runtime.WithHTTPPathPattern("/transactions/{hash}")) 153 if err != nil { 154 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 155 return 156 } 157 resp, md, err := local_request_BlockExplorerService_GetTransaction_0(rctx, inboundMarshaler, server, req, pathParams) 158 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 159 ctx = runtime.NewServerMetadataContext(ctx, md) 160 if err != nil { 161 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 162 return 163 } 164 165 forward_BlockExplorerService_GetTransaction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 166 167 }) 168 169 mux.Handle("GET", pattern_BlockExplorerService_ListTransactions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 170 ctx, cancel := context.WithCancel(req.Context()) 171 defer cancel() 172 var stream runtime.ServerTransportStream 173 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 174 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 175 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blockexplorer.api.v1.BlockExplorerService/ListTransactions", runtime.WithHTTPPathPattern("/transactions")) 176 if err != nil { 177 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 178 return 179 } 180 resp, md, err := local_request_BlockExplorerService_ListTransactions_0(rctx, inboundMarshaler, server, req, pathParams) 181 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 182 ctx = runtime.NewServerMetadataContext(ctx, md) 183 if err != nil { 184 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 185 return 186 } 187 188 forward_BlockExplorerService_ListTransactions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 189 190 }) 191 192 mux.Handle("GET", pattern_BlockExplorerService_Info_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 193 ctx, cancel := context.WithCancel(req.Context()) 194 defer cancel() 195 var stream runtime.ServerTransportStream 196 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 197 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 198 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blockexplorer.api.v1.BlockExplorerService/Info", runtime.WithHTTPPathPattern("/info")) 199 if err != nil { 200 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 201 return 202 } 203 resp, md, err := local_request_BlockExplorerService_Info_0(rctx, inboundMarshaler, server, req, pathParams) 204 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 205 ctx = runtime.NewServerMetadataContext(ctx, md) 206 if err != nil { 207 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 208 return 209 } 210 211 forward_BlockExplorerService_Info_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 212 213 }) 214 215 return nil 216 } 217 218 // RegisterBlockExplorerServiceHandlerFromEndpoint is same as RegisterBlockExplorerServiceHandler but 219 // automatically dials to "endpoint" and closes the connection when "ctx" gets done. 220 func RegisterBlockExplorerServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { 221 conn, err := grpc.Dial(endpoint, opts...) 222 if err != nil { 223 return err 224 } 225 defer func() { 226 if err != nil { 227 if cerr := conn.Close(); cerr != nil { 228 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 229 } 230 return 231 } 232 go func() { 233 <-ctx.Done() 234 if cerr := conn.Close(); cerr != nil { 235 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 236 } 237 }() 238 }() 239 240 return RegisterBlockExplorerServiceHandler(ctx, mux, conn) 241 } 242 243 // RegisterBlockExplorerServiceHandler registers the http handlers for service BlockExplorerService to "mux". 244 // The handlers forward requests to the grpc endpoint over "conn". 245 func RegisterBlockExplorerServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { 246 return RegisterBlockExplorerServiceHandlerClient(ctx, mux, NewBlockExplorerServiceClient(conn)) 247 } 248 249 // RegisterBlockExplorerServiceHandlerClient registers the http handlers for service BlockExplorerService 250 // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BlockExplorerServiceClient". 251 // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BlockExplorerServiceClient" 252 // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in 253 // "BlockExplorerServiceClient" to call the correct interceptors. 254 func RegisterBlockExplorerServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BlockExplorerServiceClient) error { 255 256 mux.Handle("GET", pattern_BlockExplorerService_GetTransaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 257 ctx, cancel := context.WithCancel(req.Context()) 258 defer cancel() 259 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 260 rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blockexplorer.api.v1.BlockExplorerService/GetTransaction", runtime.WithHTTPPathPattern("/transactions/{hash}")) 261 if err != nil { 262 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 263 return 264 } 265 resp, md, err := request_BlockExplorerService_GetTransaction_0(rctx, inboundMarshaler, client, req, pathParams) 266 ctx = runtime.NewServerMetadataContext(ctx, md) 267 if err != nil { 268 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 269 return 270 } 271 272 forward_BlockExplorerService_GetTransaction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 273 274 }) 275 276 mux.Handle("GET", pattern_BlockExplorerService_ListTransactions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 277 ctx, cancel := context.WithCancel(req.Context()) 278 defer cancel() 279 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 280 rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blockexplorer.api.v1.BlockExplorerService/ListTransactions", runtime.WithHTTPPathPattern("/transactions")) 281 if err != nil { 282 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 283 return 284 } 285 resp, md, err := request_BlockExplorerService_ListTransactions_0(rctx, inboundMarshaler, client, req, pathParams) 286 ctx = runtime.NewServerMetadataContext(ctx, md) 287 if err != nil { 288 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 289 return 290 } 291 292 forward_BlockExplorerService_ListTransactions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 293 294 }) 295 296 mux.Handle("GET", pattern_BlockExplorerService_Info_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 297 ctx, cancel := context.WithCancel(req.Context()) 298 defer cancel() 299 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 300 rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blockexplorer.api.v1.BlockExplorerService/Info", runtime.WithHTTPPathPattern("/info")) 301 if err != nil { 302 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 303 return 304 } 305 resp, md, err := request_BlockExplorerService_Info_0(rctx, inboundMarshaler, client, req, pathParams) 306 ctx = runtime.NewServerMetadataContext(ctx, md) 307 if err != nil { 308 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 309 return 310 } 311 312 forward_BlockExplorerService_Info_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 313 314 }) 315 316 return nil 317 } 318 319 var ( 320 pattern_BlockExplorerService_GetTransaction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"transactions", "hash"}, "")) 321 322 pattern_BlockExplorerService_ListTransactions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"transactions"}, "")) 323 324 pattern_BlockExplorerService_Info_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"info"}, "")) 325 ) 326 327 var ( 328 forward_BlockExplorerService_GetTransaction_0 = runtime.ForwardResponseMessage 329 330 forward_BlockExplorerService_ListTransactions_0 = runtime.ForwardResponseMessage 331 332 forward_BlockExplorerService_Info_0 = runtime.ForwardResponseMessage 333 )