online_http.pb.go 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // Code generated by protoc-gen-go-http. DO NOT EDIT.
  2. // versions:
  3. // protoc-gen-go-http v2.0.0
  4. package online
  5. import (
  6. context "context"
  7. base "git.ikuban.com/server/base-protobuf/kuban/api/base"
  8. reply "git.ikuban.com/server/kratos-utils/http/reply"
  9. http "github.com/go-kratos/kratos/v2/transport/http"
  10. binding "github.com/go-kratos/kratos/v2/transport/http/binding"
  11. emptypb "google.golang.org/protobuf/types/known/emptypb"
  12. ioutil "io/ioutil"
  13. time "time"
  14. )
  15. // This is a compile-time assertion to ensure that this generated file
  16. // is compatible with the kratos package it is being compiled against.
  17. var _ = new(context.Context)
  18. var _ = binding.EncodeURL
  19. var _ = ioutil.Discard
  20. var _ = new(time.Time)
  21. var _ = new(reply.SuccessReply)
  22. var _ = new(base.Html)
  23. const _ = http.SupportPackageIsVersion1
  24. type OnlineHTTPServer interface {
  25. UserOnline(context.Context, *UserOnlineRequest) (*emptypb.Empty, error)
  26. }
  27. func RegisterOnlineHTTPServer(s *http.Server, srv OnlineHTTPServer) {
  28. r := s.Route("/")
  29. r.POST("/api/online/user/", _Online_UserOnline0_HTTP_Handler(srv))
  30. }
  31. func _Online_UserOnline0_HTTP_Handler(srv OnlineHTTPServer) func(ctx http.Context) error {
  32. return func(ctx http.Context) error {
  33. var in UserOnlineRequest
  34. if err := ctx.Bind(&in); err != nil {
  35. return err
  36. }
  37. if err := ctx.BindQuery(&in); err != nil {
  38. return err
  39. }
  40. http.SetOperation(ctx, "/api.online.Online/UserOnline")
  41. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  42. return srv.UserOnline(ctx, req.(*UserOnlineRequest))
  43. })
  44. out, err := h(ctx, &in)
  45. if err != nil {
  46. return err
  47. }
  48. success := &reply.SuccessReply{
  49. Code: 0,
  50. }
  51. if out != nil {
  52. success.Data = out
  53. }
  54. return ctx.Result(200, success)
  55. }
  56. }
  57. type OnlineHTTPClient interface {
  58. UserOnline(ctx context.Context, req *UserOnlineRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
  59. }
  60. type OnlineHTTPClientImpl struct {
  61. cc *http.Client
  62. }
  63. func NewOnlineHTTPClient(client *http.Client) OnlineHTTPClient {
  64. return &OnlineHTTPClientImpl{client}
  65. }
  66. func (c *OnlineHTTPClientImpl) UserOnline(ctx context.Context, in *UserOnlineRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
  67. var out emptypb.Empty
  68. pattern := "/api/online/user/"
  69. path := binding.EncodeURL(pattern, in, false)
  70. opts = append(opts, http.Operation("/api.online.Online/UserOnline"))
  71. opts = append(opts, http.PathTemplate(pattern))
  72. err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
  73. if err != nil {
  74. return nil, err
  75. }
  76. return &out, err
  77. }