github.com/InjectiveLabs/sdk-go@v1.53.0/exchange/portfolio_rpc/pb/injective_portfolio_rpc.pb.gw.go (about) 1 // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. 2 // source: injective_portfolio_rpc.proto 3 4 /* 5 Package injective_portfolio_rpcpb is a reverse proxy. 6 7 It translates gRPC into RESTful JSON APIs. 8 */ 9 package injective_portfolio_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_InjectivePortfolioRPC_TokenHolders_0(ctx context.Context, marshaler runtime.Marshaler, client InjectivePortfolioRPCClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 35 var protoReq TokenHoldersRequest 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.TokenHolders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 47 return msg, metadata, err 48 49 } 50 51 func local_request_InjectivePortfolioRPC_TokenHolders_0(ctx context.Context, marshaler runtime.Marshaler, server InjectivePortfolioRPCServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 52 var protoReq TokenHoldersRequest 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.TokenHolders(ctx, &protoReq) 64 return msg, metadata, err 65 66 } 67 68 func request_InjectivePortfolioRPC_AccountPortfolio_0(ctx context.Context, marshaler runtime.Marshaler, client InjectivePortfolioRPCClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 69 var protoReq AccountPortfolioRequest 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.AccountPortfolio(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 81 return msg, metadata, err 82 83 } 84 85 func local_request_InjectivePortfolioRPC_AccountPortfolio_0(ctx context.Context, marshaler runtime.Marshaler, server InjectivePortfolioRPCServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 86 var protoReq AccountPortfolioRequest 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.AccountPortfolio(ctx, &protoReq) 98 return msg, metadata, err 99 100 } 101 102 func request_InjectivePortfolioRPC_AccountPortfolioBalances_0(ctx context.Context, marshaler runtime.Marshaler, client InjectivePortfolioRPCClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 103 var protoReq AccountPortfolioBalancesRequest 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 msg, err := client.AccountPortfolioBalances(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 115 return msg, metadata, err 116 117 } 118 119 func local_request_InjectivePortfolioRPC_AccountPortfolioBalances_0(ctx context.Context, marshaler runtime.Marshaler, server InjectivePortfolioRPCServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 120 var protoReq AccountPortfolioBalancesRequest 121 var metadata runtime.ServerMetadata 122 123 newReader, berr := utilities.IOReaderFactory(req.Body) 124 if berr != nil { 125 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 126 } 127 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { 128 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 129 } 130 131 msg, err := server.AccountPortfolioBalances(ctx, &protoReq) 132 return msg, metadata, err 133 134 } 135 136 func request_InjectivePortfolioRPC_StreamAccountPortfolio_0(ctx context.Context, marshaler runtime.Marshaler, client InjectivePortfolioRPCClient, req *http.Request, pathParams map[string]string) (InjectivePortfolioRPC_StreamAccountPortfolioClient, runtime.ServerMetadata, error) { 137 var protoReq StreamAccountPortfolioRequest 138 var metadata runtime.ServerMetadata 139 140 newReader, berr := utilities.IOReaderFactory(req.Body) 141 if berr != nil { 142 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 143 } 144 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { 145 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 146 } 147 148 stream, err := client.StreamAccountPortfolio(ctx, &protoReq) 149 if err != nil { 150 return nil, metadata, err 151 } 152 header, err := stream.Header() 153 if err != nil { 154 return nil, metadata, err 155 } 156 metadata.HeaderMD = header 157 return stream, metadata, nil 158 159 } 160 161 // RegisterInjectivePortfolioRPCHandlerServer registers the http handlers for service InjectivePortfolioRPC to "mux". 162 // UnaryRPC :call InjectivePortfolioRPCServer directly. 163 // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. 164 // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterInjectivePortfolioRPCHandlerFromEndpoint instead. 165 func RegisterInjectivePortfolioRPCHandlerServer(ctx context.Context, mux *runtime.ServeMux, server InjectivePortfolioRPCServer) error { 166 167 mux.Handle("POST", pattern_InjectivePortfolioRPC_TokenHolders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 168 ctx, cancel := context.WithCancel(req.Context()) 169 defer cancel() 170 var stream runtime.ServerTransportStream 171 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 172 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 173 var err error 174 var annotatedContext context.Context 175 annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/injective_portfolio_rpc.InjectivePortfolioRPC/TokenHolders", runtime.WithHTTPPathPattern("/injective_portfolio_rpc.InjectivePortfolioRPC/TokenHolders")) 176 if err != nil { 177 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 178 return 179 } 180 resp, md, err := local_request_InjectivePortfolioRPC_TokenHolders_0(annotatedContext, inboundMarshaler, server, req, pathParams) 181 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 182 annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) 183 if err != nil { 184 runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) 185 return 186 } 187 188 forward_InjectivePortfolioRPC_TokenHolders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 189 190 }) 191 192 mux.Handle("POST", pattern_InjectivePortfolioRPC_AccountPortfolio_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 var err error 199 var annotatedContext context.Context 200 annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/injective_portfolio_rpc.InjectivePortfolioRPC/AccountPortfolio", runtime.WithHTTPPathPattern("/injective_portfolio_rpc.InjectivePortfolioRPC/AccountPortfolio")) 201 if err != nil { 202 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 203 return 204 } 205 resp, md, err := local_request_InjectivePortfolioRPC_AccountPortfolio_0(annotatedContext, inboundMarshaler, server, req, pathParams) 206 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 207 annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) 208 if err != nil { 209 runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) 210 return 211 } 212 213 forward_InjectivePortfolioRPC_AccountPortfolio_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 214 215 }) 216 217 mux.Handle("POST", pattern_InjectivePortfolioRPC_AccountPortfolioBalances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 218 ctx, cancel := context.WithCancel(req.Context()) 219 defer cancel() 220 var stream runtime.ServerTransportStream 221 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 222 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 223 var err error 224 var annotatedContext context.Context 225 annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/injective_portfolio_rpc.InjectivePortfolioRPC/AccountPortfolioBalances", runtime.WithHTTPPathPattern("/injective_portfolio_rpc.InjectivePortfolioRPC/AccountPortfolioBalances")) 226 if err != nil { 227 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 228 return 229 } 230 resp, md, err := local_request_InjectivePortfolioRPC_AccountPortfolioBalances_0(annotatedContext, inboundMarshaler, server, req, pathParams) 231 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 232 annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) 233 if err != nil { 234 runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) 235 return 236 } 237 238 forward_InjectivePortfolioRPC_AccountPortfolioBalances_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 239 240 }) 241 242 mux.Handle("POST", pattern_InjectivePortfolioRPC_StreamAccountPortfolio_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 243 err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") 244 _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 245 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 246 return 247 }) 248 249 return nil 250 } 251 252 // RegisterInjectivePortfolioRPCHandlerFromEndpoint is same as RegisterInjectivePortfolioRPCHandler but 253 // automatically dials to "endpoint" and closes the connection when "ctx" gets done. 254 func RegisterInjectivePortfolioRPCHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { 255 conn, err := grpc.Dial(endpoint, opts...) 256 if err != nil { 257 return err 258 } 259 defer func() { 260 if err != nil { 261 if cerr := conn.Close(); cerr != nil { 262 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 263 } 264 return 265 } 266 go func() { 267 <-ctx.Done() 268 if cerr := conn.Close(); cerr != nil { 269 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 270 } 271 }() 272 }() 273 274 return RegisterInjectivePortfolioRPCHandler(ctx, mux, conn) 275 } 276 277 // RegisterInjectivePortfolioRPCHandler registers the http handlers for service InjectivePortfolioRPC to "mux". 278 // The handlers forward requests to the grpc endpoint over "conn". 279 func RegisterInjectivePortfolioRPCHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { 280 return RegisterInjectivePortfolioRPCHandlerClient(ctx, mux, NewInjectivePortfolioRPCClient(conn)) 281 } 282 283 // RegisterInjectivePortfolioRPCHandlerClient registers the http handlers for service InjectivePortfolioRPC 284 // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "InjectivePortfolioRPCClient". 285 // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "InjectivePortfolioRPCClient" 286 // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in 287 // "InjectivePortfolioRPCClient" to call the correct interceptors. 288 func RegisterInjectivePortfolioRPCHandlerClient(ctx context.Context, mux *runtime.ServeMux, client InjectivePortfolioRPCClient) error { 289 290 mux.Handle("POST", pattern_InjectivePortfolioRPC_TokenHolders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 291 ctx, cancel := context.WithCancel(req.Context()) 292 defer cancel() 293 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 294 var err error 295 var annotatedContext context.Context 296 annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/injective_portfolio_rpc.InjectivePortfolioRPC/TokenHolders", runtime.WithHTTPPathPattern("/injective_portfolio_rpc.InjectivePortfolioRPC/TokenHolders")) 297 if err != nil { 298 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 299 return 300 } 301 resp, md, err := request_InjectivePortfolioRPC_TokenHolders_0(annotatedContext, inboundMarshaler, client, req, pathParams) 302 annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) 303 if err != nil { 304 runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) 305 return 306 } 307 308 forward_InjectivePortfolioRPC_TokenHolders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 309 310 }) 311 312 mux.Handle("POST", pattern_InjectivePortfolioRPC_AccountPortfolio_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 313 ctx, cancel := context.WithCancel(req.Context()) 314 defer cancel() 315 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 316 var err error 317 var annotatedContext context.Context 318 annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/injective_portfolio_rpc.InjectivePortfolioRPC/AccountPortfolio", runtime.WithHTTPPathPattern("/injective_portfolio_rpc.InjectivePortfolioRPC/AccountPortfolio")) 319 if err != nil { 320 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 321 return 322 } 323 resp, md, err := request_InjectivePortfolioRPC_AccountPortfolio_0(annotatedContext, inboundMarshaler, client, req, pathParams) 324 annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) 325 if err != nil { 326 runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) 327 return 328 } 329 330 forward_InjectivePortfolioRPC_AccountPortfolio_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 331 332 }) 333 334 mux.Handle("POST", pattern_InjectivePortfolioRPC_AccountPortfolioBalances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 335 ctx, cancel := context.WithCancel(req.Context()) 336 defer cancel() 337 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 338 var err error 339 var annotatedContext context.Context 340 annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/injective_portfolio_rpc.InjectivePortfolioRPC/AccountPortfolioBalances", runtime.WithHTTPPathPattern("/injective_portfolio_rpc.InjectivePortfolioRPC/AccountPortfolioBalances")) 341 if err != nil { 342 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 343 return 344 } 345 resp, md, err := request_InjectivePortfolioRPC_AccountPortfolioBalances_0(annotatedContext, inboundMarshaler, client, req, pathParams) 346 annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) 347 if err != nil { 348 runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) 349 return 350 } 351 352 forward_InjectivePortfolioRPC_AccountPortfolioBalances_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 353 354 }) 355 356 mux.Handle("POST", pattern_InjectivePortfolioRPC_StreamAccountPortfolio_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 357 ctx, cancel := context.WithCancel(req.Context()) 358 defer cancel() 359 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 360 var err error 361 var annotatedContext context.Context 362 annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/injective_portfolio_rpc.InjectivePortfolioRPC/StreamAccountPortfolio", runtime.WithHTTPPathPattern("/injective_portfolio_rpc.InjectivePortfolioRPC/StreamAccountPortfolio")) 363 if err != nil { 364 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 365 return 366 } 367 resp, md, err := request_InjectivePortfolioRPC_StreamAccountPortfolio_0(annotatedContext, inboundMarshaler, client, req, pathParams) 368 annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) 369 if err != nil { 370 runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) 371 return 372 } 373 374 forward_InjectivePortfolioRPC_StreamAccountPortfolio_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) 375 376 }) 377 378 return nil 379 } 380 381 var ( 382 pattern_InjectivePortfolioRPC_TokenHolders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"injective_portfolio_rpc.InjectivePortfolioRPC", "TokenHolders"}, "")) 383 384 pattern_InjectivePortfolioRPC_AccountPortfolio_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"injective_portfolio_rpc.InjectivePortfolioRPC", "AccountPortfolio"}, "")) 385 386 pattern_InjectivePortfolioRPC_AccountPortfolioBalances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"injective_portfolio_rpc.InjectivePortfolioRPC", "AccountPortfolioBalances"}, "")) 387 388 pattern_InjectivePortfolioRPC_StreamAccountPortfolio_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"injective_portfolio_rpc.InjectivePortfolioRPC", "StreamAccountPortfolio"}, "")) 389 ) 390 391 var ( 392 forward_InjectivePortfolioRPC_TokenHolders_0 = runtime.ForwardResponseMessage 393 394 forward_InjectivePortfolioRPC_AccountPortfolio_0 = runtime.ForwardResponseMessage 395 396 forward_InjectivePortfolioRPC_AccountPortfolioBalances_0 = runtime.ForwardResponseMessage 397 398 forward_InjectivePortfolioRPC_StreamAccountPortfolio_0 = runtime.ForwardResponseStream 399 )