// Code generated by protoc-gen-go-http. DO NOT EDIT. // versions: // - protoc-gen-go-http v2.6.3 // - protoc v3.21.12 // source: greeter.proto package api import ( context "context" http "github.com/go-kratos/kratos/v2/transport/http" binding "github.com/go-kratos/kratos/v2/transport/http/binding" emptypb "google.golang.org/protobuf/types/known/emptypb" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the kratos package it is being compiled against. var _ = new(context.Context) var _ = binding.EncodeURL const _ = http.SupportPackageIsVersion1 const OperationGreeterPing = "/api.Greeter/Ping" type GreeterHTTPServer interface { // Ping Sends a greeting Ping(context.Context, *emptypb.Empty) (*PingReply, error) } func RegisterGreeterHTTPServer(s *http.Server, srv GreeterHTTPServer) { r := s.Route("/") r.GET("/ping", _Greeter_Ping0_HTTP_Handler(srv)) } func _Greeter_Ping0_HTTP_Handler(srv GreeterHTTPServer) func(ctx http.Context) error { return func(ctx http.Context) error { var in emptypb.Empty if err := ctx.BindQuery(&in); err != nil { return err } http.SetOperation(ctx, OperationGreeterPing) h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { return srv.Ping(ctx, req.(*emptypb.Empty)) }) out, err := h(ctx, &in) if err != nil { return err } reply := out.(*PingReply) return ctx.Result(200, reply) } } type GreeterHTTPClient interface { Ping(ctx context.Context, req *emptypb.Empty, opts ...http.CallOption) (rsp *PingReply, err error) } type GreeterHTTPClientImpl struct { cc *http.Client } func NewGreeterHTTPClient(client *http.Client) GreeterHTTPClient { return &GreeterHTTPClientImpl{client} } func (c *GreeterHTTPClientImpl) Ping(ctx context.Context, in *emptypb.Empty, opts ...http.CallOption) (*PingReply, error) { var out PingReply pattern := "/ping" path := binding.EncodeURL(pattern, in, true) opts = append(opts, http.Operation(OperationGreeterPing)) opts = append(opts, http.PathTemplate(pattern)) err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) if err != nil { return nil, err } return &out, err }