check_http.pb.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // Code generated by protoc-gen-go-http. DO NOT EDIT.
  2. // versions:
  3. // protoc-gen-go-http v2.0.0
  4. package check
  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. ioutil "io/ioutil"
  12. time "time"
  13. )
  14. // This is a compile-time assertion to ensure that this generated file
  15. // is compatible with the kratos package it is being compiled against.
  16. var _ = new(context.Context)
  17. var _ = binding.EncodeURL
  18. var _ = ioutil.Discard
  19. var _ = new(time.Time)
  20. var _ = new(reply.SuccessReply)
  21. var _ = new(base.Html)
  22. const _ = http.SupportPackageIsVersion1
  23. type CheckHTTPServer interface {
  24. CheckTextHttp(context.Context, *CheckTextHttpRequest) (*CheckReply, error)
  25. }
  26. func RegisterCheckHTTPServer(s *http.Server, srv CheckHTTPServer) {
  27. r := s.Route("/")
  28. r.POST("/api/check/text", _Check_CheckTextHttp0_HTTP_Handler(srv))
  29. }
  30. func _Check_CheckTextHttp0_HTTP_Handler(srv CheckHTTPServer) func(ctx http.Context) error {
  31. return func(ctx http.Context) error {
  32. var in CheckTextHttpRequest
  33. if err := ctx.Bind(&in); err != nil {
  34. return err
  35. }
  36. if err := ctx.BindQuery(&in); err != nil {
  37. return err
  38. }
  39. http.SetOperation(ctx, "/api.check.Check/CheckTextHttp")
  40. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  41. return srv.CheckTextHttp(ctx, req.(*CheckTextHttpRequest))
  42. })
  43. out, err := h(ctx, &in)
  44. if err != nil {
  45. return err
  46. }
  47. success := &reply.SuccessReply{
  48. Code: 0,
  49. }
  50. if out != nil {
  51. success.Data = out
  52. }
  53. return ctx.Result(200, success)
  54. }
  55. }
  56. type CheckHTTPClient interface {
  57. CheckTextHttp(ctx context.Context, req *CheckTextHttpRequest, opts ...http.CallOption) (rsp *CheckReply, err error)
  58. }
  59. type CheckHTTPClientImpl struct {
  60. cc *http.Client
  61. }
  62. func NewCheckHTTPClient(client *http.Client) CheckHTTPClient {
  63. return &CheckHTTPClientImpl{client}
  64. }
  65. func (c *CheckHTTPClientImpl) CheckTextHttp(ctx context.Context, in *CheckTextHttpRequest, opts ...http.CallOption) (*CheckReply, error) {
  66. var out CheckReply
  67. pattern := "/api/check/text"
  68. path := binding.EncodeURL(pattern, in, false)
  69. opts = append(opts, http.Operation("/api.check.Check/CheckTextHttp"))
  70. opts = append(opts, http.PathTemplate(pattern))
  71. err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
  72. if err != nil {
  73. return nil, err
  74. }
  75. return &out, err
  76. }