| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- // Code generated by protoc-gen-go-http. DO NOT EDIT.
- // versions:
- // protoc-gen-go-http v2.0.0
- package online
- import (
- context "context"
- base "git.ikuban.com/server/base-protobuf/kuban/api/base"
- reply "git.ikuban.com/server/kratos-utils/http/reply"
- http "github.com/go-kratos/kratos/v2/transport/http"
- binding "github.com/go-kratos/kratos/v2/transport/http/binding"
- ioutil "io/ioutil"
- time "time"
- )
- // 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
- var _ = ioutil.Discard
- var _ = new(time.Time)
- var _ = new(reply.SuccessReply)
- var _ = new(base.Html)
- const _ = http.SupportPackageIsVersion1
- type OnlineHTTPServer interface {
- Receive(context.Context, *ReceiveRequest) (*ReceiveReply, error)
- }
- func RegisterOnlineHTTPServer(s *http.Server, srv OnlineHTTPServer) {
- r := s.Route("/")
- r.POST("/api/online/receive", _Online_Receive0_HTTP_Handler(srv))
- }
- func _Online_Receive0_HTTP_Handler(srv OnlineHTTPServer) func(ctx http.Context) error {
- return func(ctx http.Context) error {
- var in ReceiveRequest
- if err := ctx.Bind(&in); err != nil {
- return err
- }
- if err := ctx.BindQuery(&in); err != nil {
- return err
- }
- http.SetOperation(ctx, "/api.online.Online/Receive")
- h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.Receive(ctx, req.(*ReceiveRequest))
- })
- out, err := h(ctx, &in)
- if err != nil {
- return err
- }
- success := &reply.SuccessReply{
- Code: 0,
- }
- if out != nil {
- success.Data = out
- }
- return ctx.Result(200, success)
- }
- }
- type OnlineHTTPClient interface {
- Receive(ctx context.Context, req *ReceiveRequest, opts ...http.CallOption) (rsp *ReceiveReply, err error)
- }
- type OnlineHTTPClientImpl struct {
- cc *http.Client
- }
- func NewOnlineHTTPClient(client *http.Client) OnlineHTTPClient {
- return &OnlineHTTPClientImpl{client}
- }
- func (c *OnlineHTTPClientImpl) Receive(ctx context.Context, in *ReceiveRequest, opts ...http.CallOption) (*ReceiveReply, error) {
- var out ReceiveReply
- pattern := "/api/online/receive"
- path := binding.EncodeURL(pattern, in, false)
- opts = append(opts, http.Operation("/api.online.Online/Receive"))
- 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
- }
|