github.com/InjectiveLabs/sdk-go@v1.53.0/exchange/auction_rpc/pb/injective_auction_rpc.pb.gw.go (about) 1 // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. 2 // source: injective_auction_rpc.proto 3 4 /* 5 Package injective_auction_rpcpb is a reverse proxy. 6 7 It translates gRPC into RESTful JSON APIs. 8 */ 9 package injective_auction_rpcpb 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_InjectiveAuctionRPC_AuctionEndpoint_0(ctx context.Context, marshaler runtime.Marshaler, client InjectiveAuctionRPCClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 35 var protoReq AuctionEndpointRequest 36 var metadata runtime.ServerMetadata 37 38 newReader, berr := utilities.IOReaderFactory(req.Body) 39 if berr != nil { 40 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 41 } 42 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { 43 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 44 } 45 46 msg, err := client.AuctionEndpoint(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 47 return msg, metadata, err 48 49 } 50 51 func local_request_InjectiveAuctionRPC_AuctionEndpoint_0(ctx context.Context, marshaler runtime.Marshaler, server InjectiveAuctionRPCServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 52 var protoReq AuctionEndpointRequest 53 var metadata runtime.ServerMetadata 54 55 newReader, berr := utilities.IOReaderFactory(req.Body) 56 if berr != nil { 57 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 58 } 59 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { 60 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 61 } 62 63 msg, err := server.AuctionEndpoint(ctx, &protoReq) 64 return msg, metadata, err 65 66 } 67 68 func request_InjectiveAuctionRPC_Auctions_0(ctx context.Context, marshaler runtime.Marshaler, client InjectiveAuctionRPCClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 69 var protoReq AuctionsRequest 70 var metadata runtime.ServerMetadata 71 72 newReader, berr := utilities.IOReaderFactory(req.Body) 73 if berr != nil { 74 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 75 } 76 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { 77 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 78 } 79 80 msg, err := client.Auctions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 81 return msg, metadata, err 82 83 } 84 85 func local_request_InjectiveAuctionRPC_Auctions_0(ctx context.Context, marshaler runtime.Marshaler, server InjectiveAuctionRPCServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 86 var protoReq AuctionsRequest 87 var metadata runtime.ServerMetadata 88 89 newReader, berr := utilities.IOReaderFactory(req.Body) 90 if berr != nil { 91 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 92 } 93 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { 94 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 95 } 96 97 msg, err := server.Auctions(ctx, &protoReq) 98 return msg, metadata, err 99 100 } 101 102 func request_InjectiveAuctionRPC_StreamBids_0(ctx context.Context, marshaler runtime.Marshaler, client InjectiveAuctionRPCClient, req *http.Request, pathParams map[string]string) (InjectiveAuctionRPC_StreamBidsClient, runtime.ServerMetadata, error) { 103 var protoReq StreamBidsRequest 104 var metadata runtime.ServerMetadata 105 106 newReader, berr := utilities.IOReaderFactory(req.Body) 107 if berr != nil { 108 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 109 } 110 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { 111 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 112 } 113 114 stream, err := client.StreamBids(ctx, &protoReq) 115 if err != nil { 116 return nil, metadata, err 117 } 118 header, err := stream.Header() 119 if err != nil { 120 return nil, metadata, err 121 } 122 metadata.HeaderMD = header 123 return stream, metadata, nil 124 125 } 126 127 // RegisterInjectiveAuctionRPCHandlerServer registers the http handlers for service InjectiveAuctionRPC to "mux". 128 // UnaryRPC :call InjectiveAuctionRPCServer directly. 129 // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. 130 // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterInjectiveAuctionRPCHandlerFromEndpoint instead. 131 func RegisterInjectiveAuctionRPCHandlerServer(ctx context.Context, mux *runtime.ServeMux, server InjectiveAuctionRPCServer) error { 132 133 mux.Handle("POST", pattern_InjectiveAuctionRPC_AuctionEndpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 134 ctx, cancel := context.WithCancel(req.Context()) 135 defer cancel() 136 var stream runtime.ServerTransportStream 137 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 138 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 139 var err error 140 var annotatedContext context.Context 141 annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/injective_auction_rpc.InjectiveAuctionRPC/AuctionEndpoint", runtime.WithHTTPPathPattern("/injective_auction_rpc.InjectiveAuctionRPC/AuctionEndpoint")) 142 if err != nil { 143 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 144 return 145 } 146 resp, md, err := local_request_InjectiveAuctionRPC_AuctionEndpoint_0(annotatedContext, inboundMarshaler, server, req, pathParams) 147 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 148 annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) 149 if err != nil { 150 runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) 151 return 152 } 153 154 forward_InjectiveAuctionRPC_AuctionEndpoint_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 155 156 }) 157 158 mux.Handle("POST", pattern_InjectiveAuctionRPC_Auctions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 159 ctx, cancel := context.WithCancel(req.Context()) 160 defer cancel() 161 var stream runtime.ServerTransportStream 162 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 163 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 164 var err error 165 var annotatedContext context.Context 166 annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/injective_auction_rpc.InjectiveAuctionRPC/Auctions", runtime.WithHTTPPathPattern("/injective_auction_rpc.InjectiveAuctionRPC/Auctions")) 167 if err != nil { 168 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 169 return 170 } 171 resp, md, err := local_request_InjectiveAuctionRPC_Auctions_0(annotatedContext, inboundMarshaler, server, req, pathParams) 172 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 173 annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) 174 if err != nil { 175 runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) 176 return 177 } 178 179 forward_InjectiveAuctionRPC_Auctions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 180 181 }) 182 183 mux.Handle("POST", pattern_InjectiveAuctionRPC_StreamBids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 184 err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") 185 _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 186 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 187 return 188 }) 189 190 return nil 191 } 192 193 // RegisterInjectiveAuctionRPCHandlerFromEndpoint is same as RegisterInjectiveAuctionRPCHandler but 194 // automatically dials to "endpoint" and closes the connection when "ctx" gets done. 195 func RegisterInjectiveAuctionRPCHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { 196 conn, err := grpc.Dial(endpoint, opts...) 197 if err != nil { 198 return err 199 } 200 defer func() { 201 if err != nil { 202 if cerr := conn.Close(); cerr != nil { 203 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 204 } 205 return 206 } 207 go func() { 208 <-ctx.Done() 209 if cerr := conn.Close(); cerr != nil { 210 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 211 } 212 }() 213 }() 214 215 return RegisterInjectiveAuctionRPCHandler(ctx, mux, conn) 216 } 217 218 // RegisterInjectiveAuctionRPCHandler registers the http handlers for service InjectiveAuctionRPC to "mux". 219 // The handlers forward requests to the grpc endpoint over "conn". 220 func RegisterInjectiveAuctionRPCHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { 221 return RegisterInjectiveAuctionRPCHandlerClient(ctx, mux, NewInjectiveAuctionRPCClient(conn)) 222 } 223 224 // RegisterInjectiveAuctionRPCHandlerClient registers the http handlers for service InjectiveAuctionRPC 225 // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "InjectiveAuctionRPCClient". 226 // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "InjectiveAuctionRPCClient" 227 // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in 228 // "InjectiveAuctionRPCClient" to call the correct interceptors. 229 func RegisterInjectiveAuctionRPCHandlerClient(ctx context.Context, mux *runtime.ServeMux, client InjectiveAuctionRPCClient) error { 230 231 mux.Handle("POST", pattern_InjectiveAuctionRPC_AuctionEndpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 232 ctx, cancel := context.WithCancel(req.Context()) 233 defer cancel() 234 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 235 var err error 236 var annotatedContext context.Context 237 annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/injective_auction_rpc.InjectiveAuctionRPC/AuctionEndpoint", runtime.WithHTTPPathPattern("/injective_auction_rpc.InjectiveAuctionRPC/AuctionEndpoint")) 238 if err != nil { 239 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 240 return 241 } 242 resp, md, err := request_InjectiveAuctionRPC_AuctionEndpoint_0(annotatedContext, inboundMarshaler, client, req, pathParams) 243 annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) 244 if err != nil { 245 runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) 246 return 247 } 248 249 forward_InjectiveAuctionRPC_AuctionEndpoint_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 250 251 }) 252 253 mux.Handle("POST", pattern_InjectiveAuctionRPC_Auctions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 254 ctx, cancel := context.WithCancel(req.Context()) 255 defer cancel() 256 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 257 var err error 258 var annotatedContext context.Context 259 annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/injective_auction_rpc.InjectiveAuctionRPC/Auctions", runtime.WithHTTPPathPattern("/injective_auction_rpc.InjectiveAuctionRPC/Auctions")) 260 if err != nil { 261 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 262 return 263 } 264 resp, md, err := request_InjectiveAuctionRPC_Auctions_0(annotatedContext, inboundMarshaler, client, req, pathParams) 265 annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) 266 if err != nil { 267 runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) 268 return 269 } 270 271 forward_InjectiveAuctionRPC_Auctions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 272 273 }) 274 275 mux.Handle("POST", pattern_InjectiveAuctionRPC_StreamBids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 276 ctx, cancel := context.WithCancel(req.Context()) 277 defer cancel() 278 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 279 var err error 280 var annotatedContext context.Context 281 annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/injective_auction_rpc.InjectiveAuctionRPC/StreamBids", runtime.WithHTTPPathPattern("/injective_auction_rpc.InjectiveAuctionRPC/StreamBids")) 282 if err != nil { 283 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 284 return 285 } 286 resp, md, err := request_InjectiveAuctionRPC_StreamBids_0(annotatedContext, inboundMarshaler, client, req, pathParams) 287 annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) 288 if err != nil { 289 runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) 290 return 291 } 292 293 forward_InjectiveAuctionRPC_StreamBids_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) 294 295 }) 296 297 return nil 298 } 299 300 var ( 301 pattern_InjectiveAuctionRPC_AuctionEndpoint_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"injective_auction_rpc.InjectiveAuctionRPC", "AuctionEndpoint"}, "")) 302 303 pattern_InjectiveAuctionRPC_Auctions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"injective_auction_rpc.InjectiveAuctionRPC", "Auctions"}, "")) 304 305 pattern_InjectiveAuctionRPC_StreamBids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"injective_auction_rpc.InjectiveAuctionRPC", "StreamBids"}, "")) 306 ) 307 308 var ( 309 forward_InjectiveAuctionRPC_AuctionEndpoint_0 = runtime.ForwardResponseMessage 310 311 forward_InjectiveAuctionRPC_Auctions_0 = runtime.ForwardResponseMessage 312 313 forward_InjectiveAuctionRPC_StreamBids_0 = runtime.ForwardResponseStream 314 )