appUcenter.bm.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. // Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
  2. // source: appUcenter.proto
  3. /*
  4. Package v1 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. appUcenter.proto
  8. */
  9. package v1
  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 PathRoomGetInfo = "/live.appucenter.v1.Room/GetInfo"
  20. var PathRoomCreate = "/live.appucenter.v1.Room/Create"
  21. var PathTopicGetTopicList = "/live.appucenter.v1.Topic/GetTopicList"
  22. var PathTopicCheckTopic = "/live.appucenter.v1.Topic/CheckTopic"
  23. // ==============
  24. // Room Interface
  25. // ==============
  26. type RoomBMServer interface {
  27. // 获取房间基本信息
  28. // `method:"GET" midware:"auth"`
  29. GetInfo(ctx context.Context, req *GetRoomInfoReq) (resp *GetRoomInfoResp, err error)
  30. // 创建房间
  31. // `method:"POST" midware:"auth"`
  32. Create(ctx context.Context, req *CreateReq) (resp *CreateResp, err error)
  33. }
  34. var v1RoomSvc RoomBMServer
  35. func roomGetInfo(c *bm.Context) {
  36. p := new(GetRoomInfoReq)
  37. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  38. return
  39. }
  40. resp, err := v1RoomSvc.GetInfo(c, p)
  41. c.JSON(resp, err)
  42. }
  43. func roomCreate(c *bm.Context) {
  44. p := new(CreateReq)
  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 := v1RoomSvc.Create(c, p)
  49. c.JSON(resp, err)
  50. }
  51. // RegisterV1RoomService Register the blademaster route with middleware map
  52. // midMap is the middleware map, the key is defined in proto
  53. func RegisterV1RoomService(e *bm.Engine, svc RoomBMServer, midMap map[string]bm.HandlerFunc) {
  54. auth := midMap["auth"]
  55. v1RoomSvc = svc
  56. e.GET("/xlive/app-ucenter/v1/room/GetInfo", auth, roomGetInfo)
  57. e.POST("/xlive/app-ucenter/v1/room/Create", auth, roomCreate)
  58. }
  59. // RegisterRoomBMServer Register the blademaster route
  60. func RegisterRoomBMServer(e *bm.Engine, server RoomBMServer) {
  61. v1RoomSvc = server
  62. e.GET("/live.appucenter.v1.Room/GetInfo", roomGetInfo)
  63. e.POST("/live.appucenter.v1.Room/Create", roomCreate)
  64. }
  65. // ===============
  66. // Topic Interface
  67. // ===============
  68. type TopicBMServer interface {
  69. // 获取话题列表
  70. // `method:"GET" midware:"auth"`
  71. GetTopicList(ctx context.Context, req *GetTopicListReq) (resp *GetTopicListResp, err error)
  72. // 检验话题是否有效
  73. // `method:"GET" midware:"auth"`
  74. CheckTopic(ctx context.Context, req *CheckTopicReq) (resp *CheckTopicResp, err error)
  75. }
  76. var v1TopicSvc TopicBMServer
  77. func topicGetTopicList(c *bm.Context) {
  78. p := new(GetTopicListReq)
  79. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  80. return
  81. }
  82. resp, err := v1TopicSvc.GetTopicList(c, p)
  83. c.JSON(resp, err)
  84. }
  85. func topicCheckTopic(c *bm.Context) {
  86. p := new(CheckTopicReq)
  87. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  88. return
  89. }
  90. resp, err := v1TopicSvc.CheckTopic(c, p)
  91. c.JSON(resp, err)
  92. }
  93. // RegisterV1TopicService Register the blademaster route with middleware map
  94. // midMap is the middleware map, the key is defined in proto
  95. func RegisterV1TopicService(e *bm.Engine, svc TopicBMServer, midMap map[string]bm.HandlerFunc) {
  96. auth := midMap["auth"]
  97. v1TopicSvc = svc
  98. e.GET("/xlive/app-ucenter/v1/topic/GetTopicList", auth, topicGetTopicList)
  99. e.GET("/xlive/app-ucenter/v1/topic/CheckTopic", auth, topicCheckTopic)
  100. }
  101. // RegisterTopicBMServer Register the blademaster route
  102. func RegisterTopicBMServer(e *bm.Engine, server TopicBMServer) {
  103. v1TopicSvc = server
  104. e.GET("/live.appucenter.v1.Topic/GetTopicList", topicGetTopicList)
  105. e.GET("/live.appucenter.v1.Topic/CheckTopic", topicCheckTopic)
  106. }