api.bm.go 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
  2. // source: api.proto
  3. /*
  4. Package api is a generated blademaster stub package.
  5. This code was generated with go-common/app/tool/bmgen/protoc-gen-bm v0.1.
  6. It is generated from these files:
  7. api.proto
  8. */
  9. package api
  10. import (
  11. "context"
  12. bm "go-common/library/net/http/blademaster"
  13. "go-common/library/net/http/blademaster/binding"
  14. )
  15. // to suppressed 'imported but not used warning'
  16. var _ *bm.Context
  17. var _ context.Context
  18. var _ binding.StructValidator
  19. var PathPassportSNSGetAuthorizeURL = "/x/internal/passport-sns/authorize/url"
  20. var PathPassportSNSBind = "/x/internal/passport-sns/bind"
  21. var PathPassportSNSUnbind = "/x/internal/passport-sns/unbind"
  22. var PathPassportSNSGetInfo = "/x/internal/passport-sns/info"
  23. var PathPassportSNSGetInfoByCode = "/x/internal/passport-sns/info/code"
  24. var PathPassportSNSUpdateInfo = "/x/internal/passport-sns/info/update"
  25. // =====================
  26. // PassportSNS Interface
  27. // =====================
  28. type PassportSNSBMServer interface {
  29. // GetAuthorizeURL get authorize url
  30. GetAuthorizeURL(ctx context.Context, req *GetAuthorizeURLReq) (resp *GetAuthorizeURLReply, err error)
  31. // Bind bind sns account
  32. Bind(ctx context.Context, req *BindReq) (resp *EmptyReply, err error)
  33. // Unbind unbind sns account
  34. Unbind(ctx context.Context, req *UnbindReq) (resp *EmptyReply, err error)
  35. // GetInfo get info by mid
  36. GetInfo(ctx context.Context, req *GetInfoReq) (resp *GetInfoReply, err error)
  37. // GetInfoByCode get info by authorize code
  38. GetInfoByCode(ctx context.Context, req *GetInfoByCodeReq) (resp *GetInfoByCodeReply, err error)
  39. // UpdateInfo update info
  40. UpdateInfo(ctx context.Context, req *UpdateInfoReq) (resp *EmptyReply, err error)
  41. }
  42. var PassportSNSSvc PassportSNSBMServer
  43. func passportSNSGetAuthorizeURL(c *bm.Context) {
  44. p := new(GetAuthorizeURLReq)
  45. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  46. return
  47. }
  48. resp, err := PassportSNSSvc.GetAuthorizeURL(c, p)
  49. c.JSON(resp, err)
  50. }
  51. func passportSNSBind(c *bm.Context) {
  52. p := new(BindReq)
  53. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  54. return
  55. }
  56. resp, err := PassportSNSSvc.Bind(c, p)
  57. c.JSON(resp, err)
  58. }
  59. func passportSNSUnbind(c *bm.Context) {
  60. p := new(UnbindReq)
  61. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  62. return
  63. }
  64. resp, err := PassportSNSSvc.Unbind(c, p)
  65. c.JSON(resp, err)
  66. }
  67. func passportSNSGetInfo(c *bm.Context) {
  68. p := new(GetInfoReq)
  69. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  70. return
  71. }
  72. resp, err := PassportSNSSvc.GetInfo(c, p)
  73. c.JSON(resp, err)
  74. }
  75. func passportSNSGetInfoByCode(c *bm.Context) {
  76. p := new(GetInfoByCodeReq)
  77. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  78. return
  79. }
  80. resp, err := PassportSNSSvc.GetInfoByCode(c, p)
  81. c.JSON(resp, err)
  82. }
  83. func passportSNSUpdateInfo(c *bm.Context) {
  84. p := new(UpdateInfoReq)
  85. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  86. return
  87. }
  88. resp, err := PassportSNSSvc.UpdateInfo(c, p)
  89. c.JSON(resp, err)
  90. }
  91. // RegisterPassportSNSService Register the blademaster route with middleware map
  92. // midMap is the middleware map, the key is defined in proto
  93. func RegisterPassportSNSService(e *bm.Engine, svc PassportSNSBMServer, midMap map[string]bm.HandlerFunc) {
  94. PassportSNSSvc = svc
  95. e.GET("/x/internal/passport-sns/authorize/url", passportSNSGetAuthorizeURL)
  96. e.POST("/x/internal/passport-sns/bind", passportSNSBind)
  97. e.POST("/x/internal/passport-sns/unbind", passportSNSUnbind)
  98. e.GET("/x/internal/passport-sns/info", passportSNSGetInfo)
  99. e.GET("/x/internal/passport-sns/info/code", passportSNSGetInfoByCode)
  100. e.POST("/x/internal/passport-sns/info/update", passportSNSUpdateInfo)
  101. }
  102. // RegisterPassportSNSBMServer Register the blademaster route
  103. func RegisterPassportSNSBMServer(e *bm.Engine, server PassportSNSBMServer) {
  104. PassportSNSSvc = server
  105. e.GET("/x/internal/passport-sns/authorize/url", passportSNSGetAuthorizeURL)
  106. e.POST("/x/internal/passport-sns/bind", passportSNSBind)
  107. e.POST("/x/internal/passport-sns/unbind", passportSNSUnbind)
  108. e.GET("/x/internal/passport-sns/info", passportSNSGetInfo)
  109. e.GET("/x/internal/passport-sns/info/code", passportSNSGetInfoByCode)
  110. e.POST("/x/internal/passport-sns/info/update", passportSNSUpdateInfo)
  111. }