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.
329 lines
12 KiB
329 lines
12 KiB
// 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 OperationGreeterAlipayGCapture = "/api.Greeter/AlipayGCapture"
|
|
const OperationGreeterAlipayGPayback = "/api.Greeter/AlipayGPayback"
|
|
const OperationGreeterCountryList = "/api.Greeter/CountryList"
|
|
const OperationGreeterDistrictCascade = "/api.Greeter/DistrictCascade"
|
|
const OperationGreeterGetPayTransaction = "/api.Greeter/GetPayTransaction"
|
|
const OperationGreeterPayoutsWebUrl = "/api.Greeter/PayoutsWebUrl"
|
|
const OperationGreeterPaypalPayback = "/api.Greeter/PaypalPayback"
|
|
const OperationGreeterPing = "/api.Greeter/Ping"
|
|
|
|
type GreeterHTTPServer interface {
|
|
AlipayGCapture(context.Context, *AlipayGWebhook) (*AlipayGPaybackResp, error)
|
|
AlipayGPayback(context.Context, *AlipayGWebhook) (*AlipayGPaybackResp, error)
|
|
CountryList(context.Context, *emptypb.Empty) (*CountryReply, error)
|
|
DistrictCascade(context.Context, *DistrictRequest) (*DistrictReply, error)
|
|
GetPayTransaction(context.Context, *emptypb.Empty) (*GetPayTransactionResp, error)
|
|
PayoutsWebUrl(context.Context, *PayoutRequest) (*WebPayResponse, error)
|
|
PaypalPayback(context.Context, *PaypalWebhook) (*PaypalPaybackResp, error)
|
|
// 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))
|
|
r.GET("/country/list", _Greeter_CountryList0_HTTP_Handler(srv))
|
|
r.GET("/district/cascade", _Greeter_DistrictCascade0_HTTP_Handler(srv))
|
|
r.POST("/paypal/callback", _Greeter_PaypalPayback0_HTTP_Handler(srv))
|
|
r.POST("/alipay-g/callback", _Greeter_AlipayGPayback0_HTTP_Handler(srv))
|
|
r.POST("/alipay-g/capture", _Greeter_AlipayGCapture0_HTTP_Handler(srv))
|
|
r.POST("/pay/payouts", _Greeter_PayoutsWebUrl0_HTTP_Handler(srv))
|
|
r.GET("/pay/transaction/outTradeNo", _Greeter_GetPayTransaction0_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)
|
|
}
|
|
}
|
|
|
|
func _Greeter_CountryList0_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, OperationGreeterCountryList)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.CountryList(ctx, req.(*emptypb.Empty))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*CountryReply)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _Greeter_DistrictCascade0_HTTP_Handler(srv GreeterHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in DistrictRequest
|
|
if err := ctx.BindQuery(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationGreeterDistrictCascade)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.DistrictCascade(ctx, req.(*DistrictRequest))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*DistrictReply)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _Greeter_PaypalPayback0_HTTP_Handler(srv GreeterHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in PaypalWebhook
|
|
if err := ctx.Bind(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationGreeterPaypalPayback)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.PaypalPayback(ctx, req.(*PaypalWebhook))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*PaypalPaybackResp)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _Greeter_AlipayGPayback0_HTTP_Handler(srv GreeterHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in AlipayGWebhook
|
|
if err := ctx.Bind(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationGreeterAlipayGPayback)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.AlipayGPayback(ctx, req.(*AlipayGWebhook))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*AlipayGPaybackResp)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _Greeter_AlipayGCapture0_HTTP_Handler(srv GreeterHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in AlipayGWebhook
|
|
if err := ctx.Bind(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationGreeterAlipayGCapture)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.AlipayGCapture(ctx, req.(*AlipayGWebhook))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*AlipayGPaybackResp)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _Greeter_PayoutsWebUrl0_HTTP_Handler(srv GreeterHTTPServer) func(ctx http.Context) error {
|
|
return func(ctx http.Context) error {
|
|
var in PayoutRequest
|
|
if err := ctx.Bind(&in); err != nil {
|
|
return err
|
|
}
|
|
http.SetOperation(ctx, OperationGreeterPayoutsWebUrl)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.PayoutsWebUrl(ctx, req.(*PayoutRequest))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*WebPayResponse)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
func _Greeter_GetPayTransaction0_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, OperationGreeterGetPayTransaction)
|
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.GetPayTransaction(ctx, req.(*emptypb.Empty))
|
|
})
|
|
out, err := h(ctx, &in)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
reply := out.(*GetPayTransactionResp)
|
|
return ctx.Result(200, reply)
|
|
}
|
|
}
|
|
|
|
type GreeterHTTPClient interface {
|
|
AlipayGCapture(ctx context.Context, req *AlipayGWebhook, opts ...http.CallOption) (rsp *AlipayGPaybackResp, err error)
|
|
AlipayGPayback(ctx context.Context, req *AlipayGWebhook, opts ...http.CallOption) (rsp *AlipayGPaybackResp, err error)
|
|
CountryList(ctx context.Context, req *emptypb.Empty, opts ...http.CallOption) (rsp *CountryReply, err error)
|
|
DistrictCascade(ctx context.Context, req *DistrictRequest, opts ...http.CallOption) (rsp *DistrictReply, err error)
|
|
GetPayTransaction(ctx context.Context, req *emptypb.Empty, opts ...http.CallOption) (rsp *GetPayTransactionResp, err error)
|
|
PayoutsWebUrl(ctx context.Context, req *PayoutRequest, opts ...http.CallOption) (rsp *WebPayResponse, err error)
|
|
PaypalPayback(ctx context.Context, req *PaypalWebhook, opts ...http.CallOption) (rsp *PaypalPaybackResp, err error)
|
|
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) AlipayGCapture(ctx context.Context, in *AlipayGWebhook, opts ...http.CallOption) (*AlipayGPaybackResp, error) {
|
|
var out AlipayGPaybackResp
|
|
pattern := "/alipay-g/capture"
|
|
path := binding.EncodeURL(pattern, in, false)
|
|
opts = append(opts, http.Operation(OperationGreeterAlipayGCapture))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, err
|
|
}
|
|
|
|
func (c *GreeterHTTPClientImpl) AlipayGPayback(ctx context.Context, in *AlipayGWebhook, opts ...http.CallOption) (*AlipayGPaybackResp, error) {
|
|
var out AlipayGPaybackResp
|
|
pattern := "/alipay-g/callback"
|
|
path := binding.EncodeURL(pattern, in, false)
|
|
opts = append(opts, http.Operation(OperationGreeterAlipayGPayback))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, err
|
|
}
|
|
|
|
func (c *GreeterHTTPClientImpl) CountryList(ctx context.Context, in *emptypb.Empty, opts ...http.CallOption) (*CountryReply, error) {
|
|
var out CountryReply
|
|
pattern := "/country/list"
|
|
path := binding.EncodeURL(pattern, in, true)
|
|
opts = append(opts, http.Operation(OperationGreeterCountryList))
|
|
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
|
|
}
|
|
|
|
func (c *GreeterHTTPClientImpl) DistrictCascade(ctx context.Context, in *DistrictRequest, opts ...http.CallOption) (*DistrictReply, error) {
|
|
var out DistrictReply
|
|
pattern := "/district/cascade"
|
|
path := binding.EncodeURL(pattern, in, true)
|
|
opts = append(opts, http.Operation(OperationGreeterDistrictCascade))
|
|
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
|
|
}
|
|
|
|
func (c *GreeterHTTPClientImpl) GetPayTransaction(ctx context.Context, in *emptypb.Empty, opts ...http.CallOption) (*GetPayTransactionResp, error) {
|
|
var out GetPayTransactionResp
|
|
pattern := "/pay/transaction/outTradeNo"
|
|
path := binding.EncodeURL(pattern, in, true)
|
|
opts = append(opts, http.Operation(OperationGreeterGetPayTransaction))
|
|
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
|
|
}
|
|
|
|
func (c *GreeterHTTPClientImpl) PayoutsWebUrl(ctx context.Context, in *PayoutRequest, opts ...http.CallOption) (*WebPayResponse, error) {
|
|
var out WebPayResponse
|
|
pattern := "/pay/payouts"
|
|
path := binding.EncodeURL(pattern, in, false)
|
|
opts = append(opts, http.Operation(OperationGreeterPayoutsWebUrl))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, err
|
|
}
|
|
|
|
func (c *GreeterHTTPClientImpl) PaypalPayback(ctx context.Context, in *PaypalWebhook, opts ...http.CallOption) (*PaypalPaybackResp, error) {
|
|
var out PaypalPaybackResp
|
|
pattern := "/paypal/callback"
|
|
path := binding.EncodeURL(pattern, in, false)
|
|
opts = append(opts, http.Operation(OperationGreeterPaypalPayback))
|
|
opts = append(opts, http.PathTemplate(pattern))
|
|
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &out, err
|
|
}
|
|
|
|
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
|
|
}
|
|
|