dm.bm.go 1.8 KB

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