api.bm.go 1.7 KB

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