relation.bm.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
  2. // source: api/http/v1/relation.pb
  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/relation.pb
  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. // Relation Interface
  21. // ==================
  22. // Index 相关服务
  23. type Relation interface {
  24. // [app端关注二级页][全量]正在直播接口
  25. // `midware:"guest"`
  26. LiveAnchor(ctx context.Context, req *LiveAnchorReq) (resp *LiveAnchorResp, err error)
  27. // [app端关注二级页][分页]暂未开播接口
  28. // `midware:"guest"`
  29. UnliveAnchor(ctx context.Context, req *UnLiveAnchorReq) (resp *UnLiveAnchorResp, err error)
  30. }
  31. var v1RelationSvc Relation
  32. // @params LiveAnchorReq
  33. // @router GET /xlive/app-interface/v1/relation/liveAnchor
  34. // @response LiveAnchorResp
  35. func relationLiveAnchor(c *bm.Context) {
  36. p := new(LiveAnchorReq)
  37. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  38. return
  39. }
  40. resp, err := v1RelationSvc.LiveAnchor(c, p)
  41. c.JSON(resp, err)
  42. }
  43. // @params UnLiveAnchorReq
  44. // @router GET /xlive/app-interface/v1/relation/unliveAnchor
  45. // @response UnLiveAnchorResp
  46. func relationUnliveAnchor(c *bm.Context) {
  47. p := new(UnLiveAnchorReq)
  48. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  49. return
  50. }
  51. resp, err := v1RelationSvc.UnliveAnchor(c, p)
  52. c.JSON(resp, err)
  53. }
  54. // RegisterV1RelationService Register the blademaster route with middleware map
  55. // midMap is the middleware map, the key is defined in proto
  56. func RegisterV1RelationService(e *bm.Engine, svc Relation, midMap map[string]bm.HandlerFunc) {
  57. guest := midMap["guest"]
  58. v1RelationSvc = svc
  59. e.GET("/xlive/app-interface/v1/relation/liveAnchor", guest, relationLiveAnchor)
  60. e.GET("/xlive/app-interface/v1/relation/unliveAnchor", guest, relationUnliveAnchor)
  61. }