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