github.com/s7techlab/cckit@v0.10.5/examples/token/service/config_erc20/config_erc20.pb.gw.go (about) 1 // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. 2 // source: token/service/config_erc20/config_erc20.proto 3 4 /* 5 Package config_erc20 is a reverse proxy. 6 7 It translates gRPC into RESTful JSON APIs. 8 */ 9 package config_erc20 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 "google.golang.org/protobuf/types/known/emptypb" 26 ) 27 28 // Suppress "imported and not used" errors 29 var _ codes.Code 30 var _ io.Reader 31 var _ status.Status 32 var _ = runtime.String 33 var _ = utilities.NewDoubleArray 34 var _ = descriptor.ForMessage 35 var _ = metadata.Join 36 37 func request_ConfigERC20Service_GetName_0(ctx context.Context, marshaler runtime.Marshaler, client ConfigERC20ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 38 var protoReq emptypb.Empty 39 var metadata runtime.ServerMetadata 40 41 msg, err := client.GetName(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 42 return msg, metadata, err 43 44 } 45 46 func local_request_ConfigERC20Service_GetName_0(ctx context.Context, marshaler runtime.Marshaler, server ConfigERC20ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 47 var protoReq emptypb.Empty 48 var metadata runtime.ServerMetadata 49 50 msg, err := server.GetName(ctx, &protoReq) 51 return msg, metadata, err 52 53 } 54 55 func request_ConfigERC20Service_GetSymbol_0(ctx context.Context, marshaler runtime.Marshaler, client ConfigERC20ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 56 var protoReq emptypb.Empty 57 var metadata runtime.ServerMetadata 58 59 msg, err := client.GetSymbol(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 60 return msg, metadata, err 61 62 } 63 64 func local_request_ConfigERC20Service_GetSymbol_0(ctx context.Context, marshaler runtime.Marshaler, server ConfigERC20ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 65 var protoReq emptypb.Empty 66 var metadata runtime.ServerMetadata 67 68 msg, err := server.GetSymbol(ctx, &protoReq) 69 return msg, metadata, err 70 71 } 72 73 func request_ConfigERC20Service_GetDecimals_0(ctx context.Context, marshaler runtime.Marshaler, client ConfigERC20ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 74 var protoReq emptypb.Empty 75 var metadata runtime.ServerMetadata 76 77 msg, err := client.GetDecimals(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 78 return msg, metadata, err 79 80 } 81 82 func local_request_ConfigERC20Service_GetDecimals_0(ctx context.Context, marshaler runtime.Marshaler, server ConfigERC20ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 83 var protoReq emptypb.Empty 84 var metadata runtime.ServerMetadata 85 86 msg, err := server.GetDecimals(ctx, &protoReq) 87 return msg, metadata, err 88 89 } 90 91 func request_ConfigERC20Service_GetTotalSupply_0(ctx context.Context, marshaler runtime.Marshaler, client ConfigERC20ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 92 var protoReq emptypb.Empty 93 var metadata runtime.ServerMetadata 94 95 msg, err := client.GetTotalSupply(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 96 return msg, metadata, err 97 98 } 99 100 func local_request_ConfigERC20Service_GetTotalSupply_0(ctx context.Context, marshaler runtime.Marshaler, server ConfigERC20ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 101 var protoReq emptypb.Empty 102 var metadata runtime.ServerMetadata 103 104 msg, err := server.GetTotalSupply(ctx, &protoReq) 105 return msg, metadata, err 106 107 } 108 109 // RegisterConfigERC20ServiceHandlerServer registers the http handlers for service ConfigERC20Service to "mux". 110 // UnaryRPC :call ConfigERC20ServiceServer directly. 111 // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. 112 // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterConfigERC20ServiceHandlerFromEndpoint instead. 113 func RegisterConfigERC20ServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ConfigERC20ServiceServer) error { 114 115 mux.Handle("GET", pattern_ConfigERC20Service_GetName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 116 ctx, cancel := context.WithCancel(req.Context()) 117 defer cancel() 118 var stream runtime.ServerTransportStream 119 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 120 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 121 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 122 if err != nil { 123 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 124 return 125 } 126 resp, md, err := local_request_ConfigERC20Service_GetName_0(rctx, inboundMarshaler, server, req, pathParams) 127 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 128 ctx = runtime.NewServerMetadataContext(ctx, md) 129 if err != nil { 130 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 131 return 132 } 133 134 forward_ConfigERC20Service_GetName_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 135 136 }) 137 138 mux.Handle("GET", pattern_ConfigERC20Service_GetSymbol_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 139 ctx, cancel := context.WithCancel(req.Context()) 140 defer cancel() 141 var stream runtime.ServerTransportStream 142 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 143 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 144 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 145 if err != nil { 146 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 147 return 148 } 149 resp, md, err := local_request_ConfigERC20Service_GetSymbol_0(rctx, inboundMarshaler, server, req, pathParams) 150 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 151 ctx = runtime.NewServerMetadataContext(ctx, md) 152 if err != nil { 153 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 154 return 155 } 156 157 forward_ConfigERC20Service_GetSymbol_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 158 159 }) 160 161 mux.Handle("GET", pattern_ConfigERC20Service_GetDecimals_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 162 ctx, cancel := context.WithCancel(req.Context()) 163 defer cancel() 164 var stream runtime.ServerTransportStream 165 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 166 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 167 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 168 if err != nil { 169 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 170 return 171 } 172 resp, md, err := local_request_ConfigERC20Service_GetDecimals_0(rctx, inboundMarshaler, server, req, pathParams) 173 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 174 ctx = runtime.NewServerMetadataContext(ctx, md) 175 if err != nil { 176 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 177 return 178 } 179 180 forward_ConfigERC20Service_GetDecimals_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 181 182 }) 183 184 mux.Handle("GET", pattern_ConfigERC20Service_GetTotalSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 185 ctx, cancel := context.WithCancel(req.Context()) 186 defer cancel() 187 var stream runtime.ServerTransportStream 188 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 189 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 190 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 191 if err != nil { 192 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 193 return 194 } 195 resp, md, err := local_request_ConfigERC20Service_GetTotalSupply_0(rctx, inboundMarshaler, server, req, pathParams) 196 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 197 ctx = runtime.NewServerMetadataContext(ctx, md) 198 if err != nil { 199 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 200 return 201 } 202 203 forward_ConfigERC20Service_GetTotalSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 204 205 }) 206 207 return nil 208 } 209 210 // RegisterConfigERC20ServiceHandlerFromEndpoint is same as RegisterConfigERC20ServiceHandler but 211 // automatically dials to "endpoint" and closes the connection when "ctx" gets done. 212 func RegisterConfigERC20ServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { 213 conn, err := grpc.Dial(endpoint, opts...) 214 if err != nil { 215 return err 216 } 217 defer func() { 218 if err != nil { 219 if cerr := conn.Close(); cerr != nil { 220 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 221 } 222 return 223 } 224 go func() { 225 <-ctx.Done() 226 if cerr := conn.Close(); cerr != nil { 227 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 228 } 229 }() 230 }() 231 232 return RegisterConfigERC20ServiceHandler(ctx, mux, conn) 233 } 234 235 // RegisterConfigERC20ServiceHandler registers the http handlers for service ConfigERC20Service to "mux". 236 // The handlers forward requests to the grpc endpoint over "conn". 237 func RegisterConfigERC20ServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { 238 return RegisterConfigERC20ServiceHandlerClient(ctx, mux, NewConfigERC20ServiceClient(conn)) 239 } 240 241 // RegisterConfigERC20ServiceHandlerClient registers the http handlers for service ConfigERC20Service 242 // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ConfigERC20ServiceClient". 243 // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ConfigERC20ServiceClient" 244 // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in 245 // "ConfigERC20ServiceClient" to call the correct interceptors. 246 func RegisterConfigERC20ServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ConfigERC20ServiceClient) error { 247 248 mux.Handle("GET", pattern_ConfigERC20Service_GetName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 249 ctx, cancel := context.WithCancel(req.Context()) 250 defer cancel() 251 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 252 rctx, err := runtime.AnnotateContext(ctx, mux, req) 253 if err != nil { 254 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 255 return 256 } 257 resp, md, err := request_ConfigERC20Service_GetName_0(rctx, inboundMarshaler, client, req, pathParams) 258 ctx = runtime.NewServerMetadataContext(ctx, md) 259 if err != nil { 260 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 261 return 262 } 263 264 forward_ConfigERC20Service_GetName_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 265 266 }) 267 268 mux.Handle("GET", pattern_ConfigERC20Service_GetSymbol_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 269 ctx, cancel := context.WithCancel(req.Context()) 270 defer cancel() 271 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 272 rctx, err := runtime.AnnotateContext(ctx, mux, req) 273 if err != nil { 274 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 275 return 276 } 277 resp, md, err := request_ConfigERC20Service_GetSymbol_0(rctx, inboundMarshaler, client, req, pathParams) 278 ctx = runtime.NewServerMetadataContext(ctx, md) 279 if err != nil { 280 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 281 return 282 } 283 284 forward_ConfigERC20Service_GetSymbol_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 285 286 }) 287 288 mux.Handle("GET", pattern_ConfigERC20Service_GetDecimals_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 289 ctx, cancel := context.WithCancel(req.Context()) 290 defer cancel() 291 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 292 rctx, err := runtime.AnnotateContext(ctx, mux, req) 293 if err != nil { 294 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 295 return 296 } 297 resp, md, err := request_ConfigERC20Service_GetDecimals_0(rctx, inboundMarshaler, client, req, pathParams) 298 ctx = runtime.NewServerMetadataContext(ctx, md) 299 if err != nil { 300 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 301 return 302 } 303 304 forward_ConfigERC20Service_GetDecimals_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 305 306 }) 307 308 mux.Handle("GET", pattern_ConfigERC20Service_GetTotalSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 309 ctx, cancel := context.WithCancel(req.Context()) 310 defer cancel() 311 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 312 rctx, err := runtime.AnnotateContext(ctx, mux, req) 313 if err != nil { 314 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 315 return 316 } 317 resp, md, err := request_ConfigERC20Service_GetTotalSupply_0(rctx, inboundMarshaler, client, req, pathParams) 318 ctx = runtime.NewServerMetadataContext(ctx, md) 319 if err != nil { 320 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 321 return 322 } 323 324 forward_ConfigERC20Service_GetTotalSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 325 326 }) 327 328 return nil 329 } 330 331 var ( 332 pattern_ConfigERC20Service_GetName_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"name"}, "", runtime.AssumeColonVerbOpt(true))) 333 334 pattern_ConfigERC20Service_GetSymbol_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"symbol"}, "", runtime.AssumeColonVerbOpt(true))) 335 336 pattern_ConfigERC20Service_GetDecimals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"decimals"}, "", runtime.AssumeColonVerbOpt(true))) 337 338 pattern_ConfigERC20Service_GetTotalSupply_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"total-supply"}, "", runtime.AssumeColonVerbOpt(true))) 339 ) 340 341 var ( 342 forward_ConfigERC20Service_GetName_0 = runtime.ForwardResponseMessage 343 344 forward_ConfigERC20Service_GetSymbol_0 = runtime.ForwardResponseMessage 345 346 forward_ConfigERC20Service_GetDecimals_0 = runtime.ForwardResponseMessage 347 348 forward_ConfigERC20Service_GetTotalSupply_0 = runtime.ForwardResponseMessage 349 )