You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
2.1 KiB
77 lines
2.1 KiB
6 months ago
|
// 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"
|
||
|
)
|
||
|
|
||
|
// 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 OperationRecommenderPing = "/api.Recommender/Ping"
|
||
|
|
||
|
type RecommenderHTTPServer interface {
|
||
|
// Ping Sends a greeting
|
||
|
Ping(context.Context, *PingRequest) (*PingReply, error)
|
||
|
}
|
||
|
|
||
|
func RegisterRecommenderHTTPServer(s *http.Server, srv RecommenderHTTPServer) {
|
||
|
r := s.Route("/")
|
||
|
r.GET("/ping", _Recommender_Ping0_HTTP_Handler(srv))
|
||
|
}
|
||
|
|
||
|
func _Recommender_Ping0_HTTP_Handler(srv RecommenderHTTPServer) func(ctx http.Context) error {
|
||
|
return func(ctx http.Context) error {
|
||
|
var in PingRequest
|
||
|
if err := ctx.BindQuery(&in); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
http.SetOperation(ctx, OperationRecommenderPing)
|
||
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
return srv.Ping(ctx, req.(*PingRequest))
|
||
|
})
|
||
|
out, err := h(ctx, &in)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
reply := out.(*PingReply)
|
||
|
return ctx.Result(200, reply)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
type RecommenderHTTPClient interface {
|
||
|
Ping(ctx context.Context, req *PingRequest, opts ...http.CallOption) (rsp *PingReply, err error)
|
||
|
}
|
||
|
|
||
|
type RecommenderHTTPClientImpl struct {
|
||
|
cc *http.Client
|
||
|
}
|
||
|
|
||
|
func NewRecommenderHTTPClient(client *http.Client) RecommenderHTTPClient {
|
||
|
return &RecommenderHTTPClientImpl{client}
|
||
|
}
|
||
|
|
||
|
func (c *RecommenderHTTPClientImpl) Ping(ctx context.Context, in *PingRequest, opts ...http.CallOption) (*PingReply, error) {
|
||
|
var out PingReply
|
||
|
pattern := "/ping"
|
||
|
path := binding.EncodeURL(pattern, in, true)
|
||
|
opts = append(opts, http.Operation(OperationRecommenderPing))
|
||
|
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
|
||
|
}
|