user_http.pb.go 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. // Code generated by protoc-gen-go-http. DO NOT EDIT.
  2. // versions:
  3. // protoc-gen-go-http v2.0.0
  4. package user
  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 UserHTTPServer interface {
  25. DebugLogin(context.Context, *DebugLoginRequest) (*LoginReply, error)
  26. GetUserInfo(context.Context, *emptypb.Empty) (*UserInfo, error)
  27. Login(context.Context, *LoginRequest) (*LoginReply, error)
  28. UpdateUserInformation(context.Context, *UpdateUserInformationRequest) (*emptypb.Empty, error)
  29. UpdateUserPhone(context.Context, *UpdatePhoneRequest) (*emptypb.Empty, error)
  30. }
  31. func RegisterUserHTTPServer(s *http.Server, srv UserHTTPServer) {
  32. r := s.Route("/")
  33. r.POST("/api/login/debug", _User_DebugLogin0_HTTP_Handler(srv))
  34. r.POST("/api/login", _User_Login0_HTTP_Handler(srv))
  35. r.POST("/api/user/update/information", _User_UpdateUserInformation0_HTTP_Handler(srv))
  36. r.POST("/api/user/update/phone", _User_UpdateUserPhone0_HTTP_Handler(srv))
  37. r.POST("/api/user/info", _User_GetUserInfo0_HTTP_Handler(srv))
  38. }
  39. func _User_DebugLogin0_HTTP_Handler(srv UserHTTPServer) func(ctx http.Context) error {
  40. return func(ctx http.Context) error {
  41. var in DebugLoginRequest
  42. if err := ctx.Bind(&in); err != nil {
  43. return err
  44. }
  45. if err := ctx.BindQuery(&in); err != nil {
  46. return err
  47. }
  48. http.SetOperation(ctx, "/api.user.User/DebugLogin")
  49. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  50. return srv.DebugLogin(ctx, req.(*DebugLoginRequest))
  51. })
  52. out, err := h(ctx, &in)
  53. if err != nil {
  54. return err
  55. }
  56. success := &reply.SuccessReply{
  57. Code: 0,
  58. }
  59. if out != nil {
  60. success.Data = out
  61. }
  62. return ctx.Result(200, success)
  63. }
  64. }
  65. func _User_Login0_HTTP_Handler(srv UserHTTPServer) func(ctx http.Context) error {
  66. return func(ctx http.Context) error {
  67. var in LoginRequest
  68. if err := ctx.Bind(&in); err != nil {
  69. return err
  70. }
  71. if err := ctx.BindQuery(&in); err != nil {
  72. return err
  73. }
  74. http.SetOperation(ctx, "/api.user.User/Login")
  75. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  76. return srv.Login(ctx, req.(*LoginRequest))
  77. })
  78. out, err := h(ctx, &in)
  79. if err != nil {
  80. return err
  81. }
  82. success := &reply.SuccessReply{
  83. Code: 0,
  84. }
  85. if out != nil {
  86. success.Data = out
  87. }
  88. return ctx.Result(200, success)
  89. }
  90. }
  91. func _User_UpdateUserInformation0_HTTP_Handler(srv UserHTTPServer) func(ctx http.Context) error {
  92. return func(ctx http.Context) error {
  93. var in UpdateUserInformationRequest
  94. if err := ctx.Bind(&in); err != nil {
  95. return err
  96. }
  97. if err := ctx.BindQuery(&in); err != nil {
  98. return err
  99. }
  100. http.SetOperation(ctx, "/api.user.User/UpdateUserInformation")
  101. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  102. return srv.UpdateUserInformation(ctx, req.(*UpdateUserInformationRequest))
  103. })
  104. out, err := h(ctx, &in)
  105. if err != nil {
  106. return err
  107. }
  108. success := &reply.SuccessReply{
  109. Code: 0,
  110. }
  111. if out != nil {
  112. success.Data = out
  113. }
  114. return ctx.Result(200, success)
  115. }
  116. }
  117. func _User_UpdateUserPhone0_HTTP_Handler(srv UserHTTPServer) func(ctx http.Context) error {
  118. return func(ctx http.Context) error {
  119. var in UpdatePhoneRequest
  120. if err := ctx.Bind(&in); err != nil {
  121. return err
  122. }
  123. if err := ctx.BindQuery(&in); err != nil {
  124. return err
  125. }
  126. http.SetOperation(ctx, "/api.user.User/UpdateUserPhone")
  127. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  128. return srv.UpdateUserPhone(ctx, req.(*UpdatePhoneRequest))
  129. })
  130. out, err := h(ctx, &in)
  131. if err != nil {
  132. return err
  133. }
  134. success := &reply.SuccessReply{
  135. Code: 0,
  136. }
  137. if out != nil {
  138. success.Data = out
  139. }
  140. return ctx.Result(200, success)
  141. }
  142. }
  143. func _User_GetUserInfo0_HTTP_Handler(srv UserHTTPServer) func(ctx http.Context) error {
  144. return func(ctx http.Context) error {
  145. var in emptypb.Empty
  146. if err := ctx.Bind(&in); err != nil {
  147. return err
  148. }
  149. if err := ctx.BindQuery(&in); err != nil {
  150. return err
  151. }
  152. http.SetOperation(ctx, "/api.user.User/GetUserInfo")
  153. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  154. return srv.GetUserInfo(ctx, req.(*emptypb.Empty))
  155. })
  156. out, err := h(ctx, &in)
  157. if err != nil {
  158. return err
  159. }
  160. success := &reply.SuccessReply{
  161. Code: 0,
  162. }
  163. if out != nil {
  164. success.Data = out
  165. }
  166. return ctx.Result(200, success)
  167. }
  168. }
  169. type UserHTTPClient interface {
  170. DebugLogin(ctx context.Context, req *DebugLoginRequest, opts ...http.CallOption) (rsp *LoginReply, err error)
  171. GetUserInfo(ctx context.Context, req *emptypb.Empty, opts ...http.CallOption) (rsp *UserInfo, err error)
  172. Login(ctx context.Context, req *LoginRequest, opts ...http.CallOption) (rsp *LoginReply, err error)
  173. UpdateUserInformation(ctx context.Context, req *UpdateUserInformationRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
  174. UpdateUserPhone(ctx context.Context, req *UpdatePhoneRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error)
  175. }
  176. type UserHTTPClientImpl struct {
  177. cc *http.Client
  178. }
  179. func NewUserHTTPClient(client *http.Client) UserHTTPClient {
  180. return &UserHTTPClientImpl{client}
  181. }
  182. func (c *UserHTTPClientImpl) DebugLogin(ctx context.Context, in *DebugLoginRequest, opts ...http.CallOption) (*LoginReply, error) {
  183. var out LoginReply
  184. pattern := "/api/login/debug"
  185. path := binding.EncodeURL(pattern, in, false)
  186. opts = append(opts, http.Operation("/api.user.User/DebugLogin"))
  187. opts = append(opts, http.PathTemplate(pattern))
  188. err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
  189. if err != nil {
  190. return nil, err
  191. }
  192. return &out, err
  193. }
  194. func (c *UserHTTPClientImpl) GetUserInfo(ctx context.Context, in *emptypb.Empty, opts ...http.CallOption) (*UserInfo, error) {
  195. var out UserInfo
  196. pattern := "/api/user/info"
  197. path := binding.EncodeURL(pattern, in, false)
  198. opts = append(opts, http.Operation("/api.user.User/GetUserInfo"))
  199. opts = append(opts, http.PathTemplate(pattern))
  200. err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
  201. if err != nil {
  202. return nil, err
  203. }
  204. return &out, err
  205. }
  206. func (c *UserHTTPClientImpl) Login(ctx context.Context, in *LoginRequest, opts ...http.CallOption) (*LoginReply, error) {
  207. var out LoginReply
  208. pattern := "/api/login"
  209. path := binding.EncodeURL(pattern, in, false)
  210. opts = append(opts, http.Operation("/api.user.User/Login"))
  211. opts = append(opts, http.PathTemplate(pattern))
  212. err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
  213. if err != nil {
  214. return nil, err
  215. }
  216. return &out, err
  217. }
  218. func (c *UserHTTPClientImpl) UpdateUserInformation(ctx context.Context, in *UpdateUserInformationRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
  219. var out emptypb.Empty
  220. pattern := "/api/user/update/information"
  221. path := binding.EncodeURL(pattern, in, false)
  222. opts = append(opts, http.Operation("/api.user.User/UpdateUserInformation"))
  223. opts = append(opts, http.PathTemplate(pattern))
  224. err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
  225. if err != nil {
  226. return nil, err
  227. }
  228. return &out, err
  229. }
  230. func (c *UserHTTPClientImpl) UpdateUserPhone(ctx context.Context, in *UpdatePhoneRequest, opts ...http.CallOption) (*emptypb.Empty, error) {
  231. var out emptypb.Empty
  232. pattern := "/api/user/update/phone"
  233. path := binding.EncodeURL(pattern, in, false)
  234. opts = append(opts, http.Operation("/api.user.User/UpdateUserPhone"))
  235. opts = append(opts, http.PathTemplate(pattern))
  236. err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
  237. if err != nil {
  238. return nil, err
  239. }
  240. return &out, err
  241. }