// Code generated by protoc-gen-go-http. DO NOT EDIT. // versions: // protoc-gen-go-http v2.0.0 package chat import ( context "context" base "git.ikuban.com/server/base-protobuf/kuban/api/base" reply "git.ikuban.com/server/kratos-utils/http/reply" common "git.ikuban.com/server/pw-protobuf/api/common" 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" 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 ChatHTTPServer interface { GetIsRead(context.Context, *common.ChatIsReadInfo) (*emptypb.Empty, error) GotoRoom(context.Context, *common.GoToRoom) (*emptypb.Empty, error) Send(context.Context, *common.SendMessageRequest) (*common.SendMessageReply, error) } func RegisterChatHTTPServer(s *http.Server, srv ChatHTTPServer) { r := s.Route("/") r.POST("/api/chat/send", _Chat_Send0_HTTP_Handler(srv)) r.POST("/api/chat/read", _Chat_GetIsRead0_HTTP_Handler(srv)) r.POST("/api/chat/room/goto", _Chat_GotoRoom0_HTTP_Handler(srv)) } func _Chat_Send0_HTTP_Handler(srv ChatHTTPServer) func(ctx http.Context) error { return func(ctx http.Context) error { var in common.SendMessageRequest if err := ctx.Bind(&in); err != nil { return err } if err := ctx.BindQuery(&in); err != nil { return err } http.SetOperation(ctx, "/api.chat.Chat/Send") h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { return srv.Send(ctx, req.(*common.SendMessageRequest)) }) 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) } } func _Chat_GetIsRead0_HTTP_Handler(srv ChatHTTPServer) func(ctx http.Context) error { return func(ctx http.Context) error { var in common.ChatIsReadInfo if err := ctx.Bind(&in); err != nil { return err } if err := ctx.BindQuery(&in); err != nil { return err } http.SetOperation(ctx, "/api.chat.Chat/GetIsRead") h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { return srv.GetIsRead(ctx, req.(*common.ChatIsReadInfo)) }) 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) } } func _Chat_GotoRoom0_HTTP_Handler(srv ChatHTTPServer) func(ctx http.Context) error { return func(ctx http.Context) error { var in common.GoToRoom if err := ctx.Bind(&in); err != nil { return err } if err := ctx.BindQuery(&in); err != nil { return err } http.SetOperation(ctx, "/api.chat.Chat/GotoRoom") h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { return srv.GotoRoom(ctx, req.(*common.GoToRoom)) }) 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 ChatHTTPClient interface { GetIsRead(ctx context.Context, req *common.ChatIsReadInfo, opts ...http.CallOption) (rsp *emptypb.Empty, err error) GotoRoom(ctx context.Context, req *common.GoToRoom, opts ...http.CallOption) (rsp *emptypb.Empty, err error) Send(ctx context.Context, req *common.SendMessageRequest, opts ...http.CallOption) (rsp *common.SendMessageReply, err error) } type ChatHTTPClientImpl struct { cc *http.Client } func NewChatHTTPClient(client *http.Client) ChatHTTPClient { return &ChatHTTPClientImpl{client} } func (c *ChatHTTPClientImpl) GetIsRead(ctx context.Context, in *common.ChatIsReadInfo, opts ...http.CallOption) (*emptypb.Empty, error) { var out emptypb.Empty pattern := "/api/chat/read" path := binding.EncodeURL(pattern, in, false) opts = append(opts, http.Operation("/api.chat.Chat/GetIsRead")) 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 *ChatHTTPClientImpl) GotoRoom(ctx context.Context, in *common.GoToRoom, opts ...http.CallOption) (*emptypb.Empty, error) { var out emptypb.Empty pattern := "/api/chat/room/goto" path := binding.EncodeURL(pattern, in, false) opts = append(opts, http.Operation("/api.chat.Chat/GotoRoom")) 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 *ChatHTTPClientImpl) Send(ctx context.Context, in *common.SendMessageRequest, opts ...http.CallOption) (*common.SendMessageReply, error) { var out common.SendMessageReply pattern := "/api/chat/send" path := binding.EncodeURL(pattern, in, false) opts = append(opts, http.Operation("/api.chat.Chat/Send")) 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 }