account_http.pb.go 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. // Code generated by protoc-gen-go-http. DO NOT EDIT.
  2. // versions:
  3. // protoc-gen-go-http v2.0.0
  4. package account
  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 AccountHTTPServer interface {
  25. Authorization(context.Context, *AuthorizationRequest) (*TokenReply, error)
  26. CheckPhoneCode(context.Context, *CheckPhoneCodeRequest) (*emptypb.Empty, error)
  27. DebugLogin(context.Context, *DebugLoginRequest) (*TokenReply, error)
  28. SendPhoneCode(context.Context, *SendPhoneCodeRequest) (*emptypb.Empty, error)
  29. }
  30. func RegisterAccountHTTPServer(s *http.Server, srv AccountHTTPServer) {
  31. r := s.Route("/")
  32. r.POST("/api/login/debug", _Account_DebugLogin0_HTTP_Handler(srv))
  33. r.POST("/api/login/authorization", _Account_Authorization0_HTTP_Handler(srv))
  34. r.POST("/api/user/code/send", _Account_SendPhoneCode0_HTTP_Handler(srv))
  35. r.POST("/api/user/code/check", _Account_CheckPhoneCode0_HTTP_Handler(srv))
  36. }
  37. func _Account_DebugLogin0_HTTP_Handler(srv AccountHTTPServer) func(ctx http.Context) error {
  38. return func(ctx http.Context) error {
  39. var in DebugLoginRequest
  40. if err := ctx.Bind(&in); err != nil {
  41. return err
  42. }
  43. if err := ctx.BindQuery(&in); err != nil {
  44. return err
  45. }
  46. http.SetOperation(ctx, "/api.account.Account/DebugLogin")
  47. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  48. return srv.DebugLogin(ctx, req.(*DebugLoginRequest))
  49. })
  50. out, err := h(ctx, &in)
  51. if err != nil {
  52. return err
  53. }
  54. success := &reply.SuccessReply{
  55. Code: 0,
  56. }
  57. if out != nil {
  58. success.Data = out
  59. }
  60. return ctx.Result(200, success)
  61. }
  62. }
  63. func _Account_Authorization0_HTTP_Handler(srv AccountHTTPServer) func(ctx http.Context) error {
  64. return func(ctx http.Context) error {
  65. var in AuthorizationRequest
  66. if err := ctx.Bind(&in); err != nil {
  67. return err
  68. }
  69. if err := ctx.BindQuery(&in); err != nil {
  70. return err
  71. }
  72. http.SetOperation(ctx, "/api.account.Account/Authorization")
  73. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  74. return srv.Authorization(ctx, req.(*AuthorizationRequest))
  75. })
  76. out, err := h(ctx, &in)
  77. if err != nil {
  78. return err
  79. }
  80. success := &reply.SuccessReply{
  81. Code: 0,
  82. }
  83. if out != nil {
  84. success.Data = out
  85. }
  86. return ctx.Result(200, success)
  87. }
  88. }
  89. func _Account_SendPhoneCode0_HTTP_Handler(srv AccountHTTPServer) func(ctx http.Context) error {
  90. return func(ctx http.Context) error {
  91. var in SendPhoneCodeRequest
  92. if err := ctx.Bind(&in); err != nil {
  93. return err
  94. }
  95. if err := ctx.BindQuery(&in); err != nil {
  96. return err
  97. }
  98. http.SetOperation(ctx, "/api.account.Account/SendPhoneCode")
  99. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  100. return srv.SendPhoneCode(ctx, req.(*SendPhoneCodeRequest))
  101. })
  102. out, err := h(ctx, &in)
  103. if err != nil {
  104. return err
  105. }
  106. success := &reply.SuccessReply{
  107. Code: 0,
  108. }
  109. if out != nil {
  110. success.Data = out
  111. }
  112. return ctx.Result(200, success)
  113. }
  114. }
  115. func _Account_CheckPhoneCode0_HTTP_Handler(srv AccountHTTPServer) func(ctx http.Context) error {
  116. return func(ctx http.Context) error {
  117. var in CheckPhoneCodeRequest
  118. if err := ctx.Bind(&in); err != nil {
  119. return err
  120. }
  121. if err := ctx.BindQuery(&in); err != nil {
  122. return err
  123. }
  124. http.SetOperation(ctx, "/api.account.Account/CheckPhoneCode")
  125. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  126. return srv.CheckPhoneCode(ctx, req.(*CheckPhoneCodeRequest))
  127. })
  128. out, err := h(ctx, &in)
  129. if err != nil {
  130. return err
  131. }
  132. success := &reply.SuccessReply{
  133. Code: 0,
  134. }
  135. if out != nil {
  136. success.Data = out
  137. }
  138. return ctx.Result(200, success)
  139. }
  140. }
  141. type AccountHTTPClient interface {
  142. Authorization(ctx context.Context, req *AuthorizationRequest, opts ...http.CallOption) (rsp *TokenReply, err error)
  143. CheckPhoneCode(ctx context.Context, req *CheckPhoneCodeRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
  144. DebugLogin(ctx context.Context, req *DebugLoginRequest, opts ...http.CallOption) (rsp *TokenReply, err error)
  145. SendPhoneCode(ctx context.Context, req *SendPhoneCodeRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
  146. }
  147. type AccountHTTPClientImpl struct {
  148. cc *http.Client
  149. }
  150. func NewAccountHTTPClient(client *http.Client) AccountHTTPClient {
  151. return &AccountHTTPClientImpl{client}
  152. }
  153. func (c *AccountHTTPClientImpl) Authorization(ctx context.Context, in *AuthorizationRequest, opts ...http.CallOption) (*TokenReply, error) {
  154. var out TokenReply
  155. pattern := "/api/login/authorization"
  156. path := binding.EncodeURL(pattern, in, false)
  157. opts = append(opts, http.Operation("/api.account.Account/Authorization"))
  158. opts = append(opts, http.PathTemplate(pattern))
  159. err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
  160. if err != nil {
  161. return nil, err
  162. }
  163. return &out, err
  164. }
  165. func (c *AccountHTTPClientImpl) CheckPhoneCode(ctx context.Context, in *CheckPhoneCodeRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
  166. var out emptypb.Empty
  167. pattern := "/api/user/code/check"
  168. path := binding.EncodeURL(pattern, in, false)
  169. opts = append(opts, http.Operation("/api.account.Account/CheckPhoneCode"))
  170. opts = append(opts, http.PathTemplate(pattern))
  171. err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
  172. if err != nil {
  173. return nil, err
  174. }
  175. return &out, err
  176. }
  177. func (c *AccountHTTPClientImpl) DebugLogin(ctx context.Context, in *DebugLoginRequest, opts ...http.CallOption) (*TokenReply, error) {
  178. var out TokenReply
  179. pattern := "/api/login/debug"
  180. path := binding.EncodeURL(pattern, in, false)
  181. opts = append(opts, http.Operation("/api.account.Account/DebugLogin"))
  182. opts = append(opts, http.PathTemplate(pattern))
  183. err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
  184. if err != nil {
  185. return nil, err
  186. }
  187. return &out, err
  188. }
  189. func (c *AccountHTTPClientImpl) SendPhoneCode(ctx context.Context, in *SendPhoneCodeRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
  190. var out emptypb.Empty
  191. pattern := "/api/user/code/send"
  192. path := binding.EncodeURL(pattern, in, false)
  193. opts = append(opts, http.Operation("/api.account.Account/SendPhoneCode"))
  194. opts = append(opts, http.PathTemplate(pattern))
  195. err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
  196. if err != nil {
  197. return nil, err
  198. }
  199. return &out, err
  200. }