github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/client/grpc/reflection/reflection.pb.gw.go (about)

     1  // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
     2  // source: cosmos/base/reflection/v1beta1/reflection.proto
     3  
     4  /*
     5  Package reflection is a reverse proxy.
     6  
     7  It translates gRPC into RESTful JSON APIs.
     8  */
     9  package reflection
    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_ReflectionService_ListAllInterfaces_0(ctx context.Context, marshaler runtime.Marshaler, client ReflectionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
    35  	var protoReq ListAllInterfacesRequest
    36  	var metadata runtime.ServerMetadata
    37  
    38  	msg, err := client.ListAllInterfaces(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
    39  	return msg, metadata, err
    40  
    41  }
    42  
    43  func local_request_ReflectionService_ListAllInterfaces_0(ctx context.Context, marshaler runtime.Marshaler, server ReflectionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
    44  	var protoReq ListAllInterfacesRequest
    45  	var metadata runtime.ServerMetadata
    46  
    47  	msg, err := server.ListAllInterfaces(ctx, &protoReq)
    48  	return msg, metadata, err
    49  
    50  }
    51  
    52  func request_ReflectionService_ListImplementations_0(ctx context.Context, marshaler runtime.Marshaler, client ReflectionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
    53  	var protoReq ListImplementationsRequest
    54  	var metadata runtime.ServerMetadata
    55  
    56  	var (
    57  		val string
    58  		ok  bool
    59  		err error
    60  		_   = err
    61  	)
    62  
    63  	val, ok = pathParams["interface_name"]
    64  	if !ok {
    65  		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "interface_name")
    66  	}
    67  
    68  	protoReq.InterfaceName, err = runtime.String(val)
    69  
    70  	if err != nil {
    71  		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "interface_name", err)
    72  	}
    73  
    74  	msg, err := client.ListImplementations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
    75  	return msg, metadata, err
    76  
    77  }
    78  
    79  func local_request_ReflectionService_ListImplementations_0(ctx context.Context, marshaler runtime.Marshaler, server ReflectionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
    80  	var protoReq ListImplementationsRequest
    81  	var metadata runtime.ServerMetadata
    82  
    83  	var (
    84  		val string
    85  		ok  bool
    86  		err error
    87  		_   = err
    88  	)
    89  
    90  	val, ok = pathParams["interface_name"]
    91  	if !ok {
    92  		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "interface_name")
    93  	}
    94  
    95  	protoReq.InterfaceName, err = runtime.String(val)
    96  
    97  	if err != nil {
    98  		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "interface_name", err)
    99  	}
   100  
   101  	msg, err := server.ListImplementations(ctx, &protoReq)
   102  	return msg, metadata, err
   103  
   104  }
   105  
   106  // RegisterReflectionServiceHandlerServer registers the http handlers for service ReflectionService to "mux".
   107  // UnaryRPC     :call ReflectionServiceServer directly.
   108  // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
   109  // Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterReflectionServiceHandlerFromEndpoint instead.
   110  func RegisterReflectionServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ReflectionServiceServer) error {
   111  
   112  	mux.Handle("GET", pattern_ReflectionService_ListAllInterfaces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   113  		ctx, cancel := context.WithCancel(req.Context())
   114  		defer cancel()
   115  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   116  		rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
   117  		if err != nil {
   118  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   119  			return
   120  		}
   121  		resp, md, err := local_request_ReflectionService_ListAllInterfaces_0(rctx, inboundMarshaler, server, req, pathParams)
   122  		ctx = runtime.NewServerMetadataContext(ctx, md)
   123  		if err != nil {
   124  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   125  			return
   126  		}
   127  
   128  		forward_ReflectionService_ListAllInterfaces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   129  
   130  	})
   131  
   132  	mux.Handle("GET", pattern_ReflectionService_ListImplementations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   133  		ctx, cancel := context.WithCancel(req.Context())
   134  		defer cancel()
   135  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   136  		rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
   137  		if err != nil {
   138  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   139  			return
   140  		}
   141  		resp, md, err := local_request_ReflectionService_ListImplementations_0(rctx, inboundMarshaler, server, req, pathParams)
   142  		ctx = runtime.NewServerMetadataContext(ctx, md)
   143  		if err != nil {
   144  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   145  			return
   146  		}
   147  
   148  		forward_ReflectionService_ListImplementations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   149  
   150  	})
   151  
   152  	return nil
   153  }
   154  
   155  // RegisterReflectionServiceHandlerFromEndpoint is same as RegisterReflectionServiceHandler but
   156  // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
   157  func RegisterReflectionServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
   158  	conn, err := grpc.Dial(endpoint, opts...)
   159  	if err != nil {
   160  		return err
   161  	}
   162  	defer func() {
   163  		if err != nil {
   164  			if cerr := conn.Close(); cerr != nil {
   165  				grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
   166  			}
   167  			return
   168  		}
   169  		go func() {
   170  			<-ctx.Done()
   171  			if cerr := conn.Close(); cerr != nil {
   172  				grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
   173  			}
   174  		}()
   175  	}()
   176  
   177  	return RegisterReflectionServiceHandler(ctx, mux, conn)
   178  }
   179  
   180  // RegisterReflectionServiceHandler registers the http handlers for service ReflectionService to "mux".
   181  // The handlers forward requests to the grpc endpoint over "conn".
   182  func RegisterReflectionServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
   183  	return RegisterReflectionServiceHandlerClient(ctx, mux, NewReflectionServiceClient(conn))
   184  }
   185  
   186  // RegisterReflectionServiceHandlerClient registers the http handlers for service ReflectionService
   187  // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ReflectionServiceClient".
   188  // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ReflectionServiceClient"
   189  // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
   190  // "ReflectionServiceClient" to call the correct interceptors.
   191  func RegisterReflectionServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ReflectionServiceClient) error {
   192  
   193  	mux.Handle("GET", pattern_ReflectionService_ListAllInterfaces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   194  		ctx, cancel := context.WithCancel(req.Context())
   195  		defer cancel()
   196  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   197  		rctx, err := runtime.AnnotateContext(ctx, mux, req)
   198  		if err != nil {
   199  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   200  			return
   201  		}
   202  		resp, md, err := request_ReflectionService_ListAllInterfaces_0(rctx, inboundMarshaler, client, req, pathParams)
   203  		ctx = runtime.NewServerMetadataContext(ctx, md)
   204  		if err != nil {
   205  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   206  			return
   207  		}
   208  
   209  		forward_ReflectionService_ListAllInterfaces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   210  
   211  	})
   212  
   213  	mux.Handle("GET", pattern_ReflectionService_ListImplementations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   214  		ctx, cancel := context.WithCancel(req.Context())
   215  		defer cancel()
   216  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   217  		rctx, err := runtime.AnnotateContext(ctx, mux, req)
   218  		if err != nil {
   219  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   220  			return
   221  		}
   222  		resp, md, err := request_ReflectionService_ListImplementations_0(rctx, inboundMarshaler, client, req, pathParams)
   223  		ctx = runtime.NewServerMetadataContext(ctx, md)
   224  		if err != nil {
   225  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   226  			return
   227  		}
   228  
   229  		forward_ReflectionService_ListImplementations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   230  
   231  	})
   232  
   233  	return nil
   234  }
   235  
   236  var (
   237  	pattern_ReflectionService_ListAllInterfaces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"cosmos", "base", "reflection", "v1beta1", "interfaces"}, "", runtime.AssumeColonVerbOpt(true)))
   238  
   239  	pattern_ReflectionService_ListImplementations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"cosmos", "base", "reflection", "v1beta1", "interfaces", "interface_name", "implementations"}, "", runtime.AssumeColonVerbOpt(true)))
   240  )
   241  
   242  var (
   243  	forward_ReflectionService_ListAllInterfaces_0 = runtime.ForwardResponseMessage
   244  
   245  	forward_ReflectionService_ListImplementations_0 = runtime.ForwardResponseMessage
   246  )