api.pb.bm.go 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // Package v1 Code generated by go-common/app/tool/protoc-gen-bm. DO NOT EDIT.
  2. package v1
  3. import (
  4. "bytes"
  5. "context"
  6. "encoding/json"
  7. "go-common/app/tool/protoc-gen-bm/jsonpb"
  8. bm "go-common/library/net/http/blademaster"
  9. )
  10. // BMUpServer interface as same as gGRPC server define
  11. type BMUpServer interface {
  12. UpArcs(context.Context, *UpArcsReq) (*UpArcsReply, error)
  13. UpsArcs(context.Context, *UpsArcsReq) (*UpsArcsReply, error)
  14. UpCount(context.Context, *UpCountReq) (*UpCountReply, error)
  15. UpsCount(context.Context, *UpsCountReq) (*UpsCountReply, error)
  16. }
  17. // _BMServerUpserver
  18. type _BMServerUp struct {
  19. BMUpServer
  20. }
  21. func (b *_BMServerUp) bmUpUpArcsHandler(c *bm.Context) {
  22. req := new(UpArcsReq)
  23. if err := c.Bind(req); err != nil {
  24. return
  25. }
  26. reply, err := b.UpArcs(c.Context, req)
  27. if err != nil {
  28. c.JSON(nil, err)
  29. return
  30. }
  31. body := &bytes.Buffer{}
  32. marshaler := jsonpb.Marshaler{EmitDefaults: true, OrigName: true}
  33. err = marshaler.Marshal(body, reply)
  34. c.JSON(json.RawMessage(body.Bytes()), err)
  35. }
  36. func (b *_BMServerUp) bmUpUpsArcsHandler(c *bm.Context) {
  37. req := new(UpsArcsReq)
  38. if err := c.Bind(req); err != nil {
  39. return
  40. }
  41. reply, err := b.UpsArcs(c.Context, req)
  42. if err != nil {
  43. c.JSON(nil, err)
  44. return
  45. }
  46. body := &bytes.Buffer{}
  47. marshaler := jsonpb.Marshaler{EmitDefaults: true, OrigName: true}
  48. err = marshaler.Marshal(body, reply)
  49. c.JSON(json.RawMessage(body.Bytes()), err)
  50. }
  51. func (b *_BMServerUp) bmUpUpCountHandler(c *bm.Context) {
  52. req := new(UpCountReq)
  53. if err := c.Bind(req); err != nil {
  54. return
  55. }
  56. reply, err := b.UpCount(c.Context, req)
  57. if err != nil {
  58. c.JSON(nil, err)
  59. return
  60. }
  61. body := &bytes.Buffer{}
  62. marshaler := jsonpb.Marshaler{EmitDefaults: true, OrigName: true}
  63. err = marshaler.Marshal(body, reply)
  64. c.JSON(json.RawMessage(body.Bytes()), err)
  65. }
  66. func (b *_BMServerUp) bmUpUpsCountHandler(c *bm.Context) {
  67. req := new(UpsCountReq)
  68. if err := c.Bind(req); err != nil {
  69. return
  70. }
  71. reply, err := b.UpsCount(c.Context, req)
  72. if err != nil {
  73. c.JSON(nil, err)
  74. return
  75. }
  76. body := &bytes.Buffer{}
  77. marshaler := jsonpb.Marshaler{EmitDefaults: true, OrigName: true}
  78. err = marshaler.Marshal(body, reply)
  79. c.JSON(json.RawMessage(body.Bytes()), err)
  80. }
  81. // RegisterUpBMServer register bm server
  82. func RegisterUpBMServer(e *bm.Engine, s BMUpServer) {
  83. bs := &_BMServerUp{s}
  84. e.GET("/x/internal/uper/archive/up/passed", bs.bmUpUpArcsHandler)
  85. e.GET("/x/internal/uper/archive/ups/passed", bs.bmUpUpsArcsHandler)
  86. e.GET("/x/internal/uper/archive/up/count", bs.bmUpUpCountHandler)
  87. e.GET("/x/internal/uper/archive/ups/count", bs.bmUpUpsCountHandler)
  88. }