account_http.pb.go 8.3 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 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. common "git.ikuban.com/server/pw-protobuf/api/common"
  10. http "github.com/go-kratos/kratos/v2/transport/http"
  11. binding "github.com/go-kratos/kratos/v2/transport/http/binding"
  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. DebugLogin(context.Context, *DebugLoginRequest) (*TokenReply, error)
  27. RandomAvatar(context.Context, *RandomAvatarRequest) (*RandomAvatarReply, error)
  28. RandomIntroduce(context.Context, *common.SexReq) (*common.RandomIntroduceReply, error)
  29. RandomNickname(context.Context, *RandomNicknameRequest) (*RandomNicknameReply, error)
  30. }
  31. func RegisterAccountHTTPServer(s *http.Server, srv AccountHTTPServer) {
  32. r := s.Route("/")
  33. r.POST("/api/login/debug", _Account_DebugLogin0_HTTP_Handler(srv))
  34. r.POST("/api/login/authorization", _Account_Authorization0_HTTP_Handler(srv))
  35. r.POST("/api/common/random/nickname", _Account_RandomNickname0_HTTP_Handler(srv))
  36. r.POST("/api/common/random/avatar", _Account_RandomAvatar0_HTTP_Handler(srv))
  37. r.POST("/api/common/random/introduce", _Account_RandomIntroduce0_HTTP_Handler(srv))
  38. }
  39. func _Account_DebugLogin0_HTTP_Handler(srv AccountHTTPServer) 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.account.Account/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 _Account_Authorization0_HTTP_Handler(srv AccountHTTPServer) func(ctx http.Context) error {
  66. return func(ctx http.Context) error {
  67. var in AuthorizationRequest
  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.account.Account/Authorization")
  75. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  76. return srv.Authorization(ctx, req.(*AuthorizationRequest))
  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 _Account_RandomNickname0_HTTP_Handler(srv AccountHTTPServer) func(ctx http.Context) error {
  92. return func(ctx http.Context) error {
  93. var in RandomNicknameRequest
  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.account.Account/RandomNickname")
  101. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  102. return srv.RandomNickname(ctx, req.(*RandomNicknameRequest))
  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 _Account_RandomAvatar0_HTTP_Handler(srv AccountHTTPServer) func(ctx http.Context) error {
  118. return func(ctx http.Context) error {
  119. var in RandomAvatarRequest
  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.account.Account/RandomAvatar")
  127. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  128. return srv.RandomAvatar(ctx, req.(*RandomAvatarRequest))
  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 _Account_RandomIntroduce0_HTTP_Handler(srv AccountHTTPServer) func(ctx http.Context) error {
  144. return func(ctx http.Context) error {
  145. var in common.SexReq
  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.account.Account/RandomIntroduce")
  153. h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
  154. return srv.RandomIntroduce(ctx, req.(*common.SexReq))
  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 AccountHTTPClient interface {
  170. Authorization(ctx context.Context, req *AuthorizationRequest, opts ...http.CallOption) (rsp *TokenReply, err error)
  171. DebugLogin(ctx context.Context, req *DebugLoginRequest, opts ...http.CallOption) (rsp *TokenReply, err error)
  172. RandomAvatar(ctx context.Context, req *RandomAvatarRequest, opts ...http.CallOption) (rsp *RandomAvatarReply, err error)
  173. RandomIntroduce(ctx context.Context, req *common.SexReq, opts ...http.CallOption) (rsp *common.RandomIntroduceReply, err error)
  174. RandomNickname(ctx context.Context, req *RandomNicknameRequest, opts ...http.CallOption) (rsp *RandomNicknameReply, err error)
  175. }
  176. type AccountHTTPClientImpl struct {
  177. cc *http.Client
  178. }
  179. func NewAccountHTTPClient(client *http.Client) AccountHTTPClient {
  180. return &AccountHTTPClientImpl{client}
  181. }
  182. func (c *AccountHTTPClientImpl) Authorization(ctx context.Context, in *AuthorizationRequest, opts ...http.CallOption) (*TokenReply, error) {
  183. var out TokenReply
  184. pattern := "/api/login/authorization"
  185. path := binding.EncodeURL(pattern, in, false)
  186. opts = append(opts, http.Operation("/api.account.Account/Authorization"))
  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 *AccountHTTPClientImpl) DebugLogin(ctx context.Context, in *DebugLoginRequest, opts ...http.CallOption) (*TokenReply, error) {
  195. var out TokenReply
  196. pattern := "/api/login/debug"
  197. path := binding.EncodeURL(pattern, in, false)
  198. opts = append(opts, http.Operation("/api.account.Account/DebugLogin"))
  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 *AccountHTTPClientImpl) RandomAvatar(ctx context.Context, in *RandomAvatarRequest, opts ...http.CallOption) (*RandomAvatarReply, error) {
  207. var out RandomAvatarReply
  208. pattern := "/api/common/random/avatar"
  209. path := binding.EncodeURL(pattern, in, false)
  210. opts = append(opts, http.Operation("/api.account.Account/RandomAvatar"))
  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 *AccountHTTPClientImpl) RandomIntroduce(ctx context.Context, in *common.SexReq, opts ...http.CallOption) (*common.RandomIntroduceReply, error) {
  219. var out common.RandomIntroduceReply
  220. pattern := "/api/common/random/introduce"
  221. path := binding.EncodeURL(pattern, in, false)
  222. opts = append(opts, http.Operation("/api.account.Account/RandomIntroduce"))
  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 *AccountHTTPClientImpl) RandomNickname(ctx context.Context, in *RandomNicknameRequest, opts ...http.CallOption) (*RandomNicknameReply, error) {
  231. var out RandomNicknameReply
  232. pattern := "/api/common/random/nickname"
  233. path := binding.EncodeURL(pattern, in, false)
  234. opts = append(opts, http.Operation("/api.account.Account/RandomNickname"))
  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. }