api.bm.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 PathRoomGetMultiple = "/live.xroom.v1.Room/getMultiple"
  20. var PathRoomGetMultipleByUids = "/live.xroom.v1.Room/getMultipleByUids"
  21. var PathRoomIsAnchor = "/live.xroom.v1.Room/isAnchor"
  22. // ==============
  23. // Room Interface
  24. // ==============
  25. type RoomBMServer interface {
  26. // 批量根据room_ids获取房间信息
  27. GetMultiple(ctx context.Context, req *RoomIDsReq) (resp *RoomIDsInfosResp, err error)
  28. // 批量根据uids获取房间信息
  29. GetMultipleByUids(ctx context.Context, req *UIDsReq) (resp *UIDsInfosResp, err error)
  30. // 批量根据uids判断是否是主播,如果是返回主播的room_id,否则返回0
  31. IsAnchor(ctx context.Context, req *IsAnchorUIDsReq) (resp *IsAnchorUIDsResp, err error)
  32. }
  33. var RoomSvc RoomBMServer
  34. func roomGetMultiple(c *bm.Context) {
  35. p := new(RoomIDsReq)
  36. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  37. return
  38. }
  39. resp, err := RoomSvc.GetMultiple(c, p)
  40. c.JSON(resp, err)
  41. }
  42. func roomGetMultipleByUids(c *bm.Context) {
  43. p := new(UIDsReq)
  44. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  45. return
  46. }
  47. resp, err := RoomSvc.GetMultipleByUids(c, p)
  48. c.JSON(resp, err)
  49. }
  50. func roomIsAnchor(c *bm.Context) {
  51. p := new(IsAnchorUIDsReq)
  52. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  53. return
  54. }
  55. resp, err := RoomSvc.IsAnchor(c, p)
  56. c.JSON(resp, err)
  57. }
  58. // RegisterRoomBMServer Register the blademaster route
  59. func RegisterRoomBMServer(e *bm.Engine, server RoomBMServer) {
  60. RoomSvc = server
  61. e.GET("/live.xroom.v1.Room/getMultiple", roomGetMultiple)
  62. e.GET("/live.xroom.v1.Room/getMultipleByUids", roomGetMultipleByUids)
  63. e.GET("/live.xroom.v1.Room/isAnchor", roomIsAnchor)
  64. }