| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- // 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
- }
|