dm.bm.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
  2. // source: dm.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. dm.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 PathDMSendMsg = "/live.approom.v1.DM/SendMsg"
  20. var PathDMGetHistory = "/live.approom.v1.DM/GetHistory"
  21. // ============
  22. // DM Interface
  23. // ============
  24. type DMBMServer interface {
  25. // `method:"POST"`
  26. SendMsg(ctx context.Context, req *SendDMReq) (resp *SendMsgResp, err error)
  27. // `method:"POST"`
  28. GetHistory(ctx context.Context, req *HistoryReq) (resp *HistoryResp, err error)
  29. }
  30. var v1DMSvc DMBMServer
  31. func dMSendMsg(c *bm.Context) {
  32. p := new(SendDMReq)
  33. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  34. return
  35. }
  36. resp, err := v1DMSvc.SendMsg(c, p)
  37. c.JSON(resp, err)
  38. }
  39. func dMGetHistory(c *bm.Context) {
  40. p := new(HistoryReq)
  41. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  42. return
  43. }
  44. resp, err := v1DMSvc.GetHistory(c, p)
  45. c.JSON(resp, err)
  46. }
  47. // RegisterV1DMService Register the blademaster route with middleware map
  48. // midMap is the middleware map, the key is defined in proto
  49. func RegisterV1DMService(e *bm.Engine, svc DMBMServer, midMap map[string]bm.HandlerFunc) {
  50. v1DMSvc = svc
  51. e.POST("/xlive/app-room/v1/dM/SendMsg", dMSendMsg)
  52. e.POST("/xlive/app-room/v1/dM/GetHistory", dMGetHistory)
  53. }
  54. // RegisterDMBMServer Register the blademaster route
  55. func RegisterDMBMServer(e *bm.Engine, server DMBMServer) {
  56. v1DMSvc = server
  57. e.POST("/live.approom.v1.DM/SendMsg", dMSendMsg)
  58. e.POST("/live.approom.v1.DM/GetHistory", dMGetHistory)
  59. }