resource.bm.go 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. // Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
  2. // source: resource.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. resource.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 PathResourceAdd = "/live.liveadmin.v1.Resource/add"
  20. var PathResourceAddEx = "/live.liveadmin.v1.Resource/addEx"
  21. var PathResourceEdit = "/live.liveadmin.v1.Resource/edit"
  22. var PathResourceOffline = "/live.liveadmin.v1.Resource/offline"
  23. var PathResourceGetList = "/live.liveadmin.v1.Resource/getList"
  24. var PathResourceGetPlatformList = "/live.liveadmin.v1.Resource/getPlatformList"
  25. var PathResourceGetListEx = "/live.liveadmin.v1.Resource/getListEx"
  26. var PathSplashGetInfo = "/live.liveadmin.v1.Splash/getInfo"
  27. var PathBannerGetBlinkBanner = "/live.liveadmin.v1.Banner/getBlinkBanner"
  28. var PathBannerGetBanner = "/live.liveadmin.v1.Banner/getBanner"
  29. // ==================
  30. // Resource Interface
  31. // ==================
  32. type ResourceBMServer interface {
  33. // Add 添加资源接口
  34. // `method:"POST" internal:"true" `
  35. Add(ctx context.Context, req *AddReq) (resp *AddResp, err error)
  36. // AddEx 添加资源接口(不限制位置和平台)
  37. // `method:"POST" internal:"true" `
  38. AddEx(ctx context.Context, req *AddReq) (resp *AddResp, err error)
  39. // Edit 编辑资源接口
  40. // `method:"POST" internal:"true" `
  41. Edit(ctx context.Context, req *EditReq) (resp *EditResp, err error)
  42. // Offline 下线资源接口
  43. // `method:"POST" internal:"true" `
  44. Offline(ctx context.Context, req *OfflineReq) (resp *OfflineResp, err error)
  45. // GetList 获取资源列表
  46. // `method:"GET" internal:"true" `
  47. GetList(ctx context.Context, req *GetListReq) (resp *GetListResp, err error)
  48. // 获取平台列表
  49. // `method:"GET" internal:"true" `
  50. GetPlatformList(ctx context.Context, req *GetPlatformListReq) (resp *GetPlatformListResp, err error)
  51. // GetListEx 获取资源列表
  52. // `method:"GET" internal:"true" `
  53. GetListEx(ctx context.Context, req *GetListExReq) (resp *GetListExResp, err error)
  54. }
  55. var v1ResourceSvc ResourceBMServer
  56. func resourceAdd(c *bm.Context) {
  57. p := new(AddReq)
  58. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  59. return
  60. }
  61. resp, err := v1ResourceSvc.Add(c, p)
  62. c.JSON(resp, err)
  63. }
  64. func resourceAddEx(c *bm.Context) {
  65. p := new(AddReq)
  66. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  67. return
  68. }
  69. resp, err := v1ResourceSvc.AddEx(c, p)
  70. c.JSON(resp, err)
  71. }
  72. func resourceEdit(c *bm.Context) {
  73. p := new(EditReq)
  74. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  75. return
  76. }
  77. resp, err := v1ResourceSvc.Edit(c, p)
  78. c.JSON(resp, err)
  79. }
  80. func resourceOffline(c *bm.Context) {
  81. p := new(OfflineReq)
  82. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  83. return
  84. }
  85. resp, err := v1ResourceSvc.Offline(c, p)
  86. c.JSON(resp, err)
  87. }
  88. func resourceGetList(c *bm.Context) {
  89. p := new(GetListReq)
  90. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  91. return
  92. }
  93. resp, err := v1ResourceSvc.GetList(c, p)
  94. c.JSON(resp, err)
  95. }
  96. func resourceGetPlatformList(c *bm.Context) {
  97. p := new(GetPlatformListReq)
  98. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  99. return
  100. }
  101. resp, err := v1ResourceSvc.GetPlatformList(c, p)
  102. c.JSON(resp, err)
  103. }
  104. func resourceGetListEx(c *bm.Context) {
  105. p := new(GetListExReq)
  106. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  107. return
  108. }
  109. resp, err := v1ResourceSvc.GetListEx(c, p)
  110. c.JSON(resp, err)
  111. }
  112. // RegisterV1ResourceService Register the blademaster route with middleware map
  113. // midMap is the middleware map, the key is defined in proto
  114. func RegisterV1ResourceService(e *bm.Engine, svc ResourceBMServer, midMap map[string]bm.HandlerFunc) {
  115. v1ResourceSvc = svc
  116. e.POST("/xlive/internal/live-admin/v1/resource/add", resourceAdd)
  117. e.POST("/xlive/internal/live-admin/v1/resource/addEx", resourceAddEx)
  118. e.POST("/xlive/internal/live-admin/v1/resource/edit", resourceEdit)
  119. e.POST("/xlive/internal/live-admin/v1/resource/offline", resourceOffline)
  120. e.GET("/xlive/internal/live-admin/v1/resource/getList", resourceGetList)
  121. e.GET("/xlive/internal/live-admin/v1/resource/getPlatformList", resourceGetPlatformList)
  122. e.GET("/xlive/internal/live-admin/v1/resource/getListEx", resourceGetListEx)
  123. }
  124. // RegisterResourceBMServer Register the blademaster route
  125. func RegisterResourceBMServer(e *bm.Engine, server ResourceBMServer) {
  126. v1ResourceSvc = server
  127. e.POST("/live.liveadmin.v1.Resource/add", resourceAdd)
  128. e.POST("/live.liveadmin.v1.Resource/addEx", resourceAddEx)
  129. e.POST("/live.liveadmin.v1.Resource/edit", resourceEdit)
  130. e.POST("/live.liveadmin.v1.Resource/offline", resourceOffline)
  131. e.GET("/live.liveadmin.v1.Resource/getList", resourceGetList)
  132. e.GET("/live.liveadmin.v1.Resource/getPlatformList", resourceGetPlatformList)
  133. e.GET("/live.liveadmin.v1.Resource/getListEx", resourceGetListEx)
  134. }
  135. // ================
  136. // Splash Interface
  137. // ================
  138. type SplashBMServer interface {
  139. // 获取有效闪屏配置
  140. // `method:"GET" internal:"true" `
  141. GetInfo(ctx context.Context, req *GetInfoReq) (resp *GetInfoResp, err error)
  142. }
  143. var v1SplashSvc SplashBMServer
  144. func splashGetInfo(c *bm.Context) {
  145. p := new(GetInfoReq)
  146. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  147. return
  148. }
  149. resp, err := v1SplashSvc.GetInfo(c, p)
  150. c.JSON(resp, err)
  151. }
  152. // RegisterV1SplashService Register the blademaster route with middleware map
  153. // midMap is the middleware map, the key is defined in proto
  154. func RegisterV1SplashService(e *bm.Engine, svc SplashBMServer, midMap map[string]bm.HandlerFunc) {
  155. v1SplashSvc = svc
  156. e.GET("/xlive/internal/live-admin/v1/splash/getInfo", splashGetInfo)
  157. }
  158. // RegisterSplashBMServer Register the blademaster route
  159. func RegisterSplashBMServer(e *bm.Engine, server SplashBMServer) {
  160. v1SplashSvc = server
  161. e.GET("/live.liveadmin.v1.Splash/getInfo", splashGetInfo)
  162. }
  163. // ================
  164. // Banner Interface
  165. // ================
  166. type BannerBMServer interface {
  167. // 获取有效banner配置
  168. // `method:"GET" internal:"true" `
  169. GetBlinkBanner(ctx context.Context, req *GetInfoReq) (resp *GetInfoResp, err error)
  170. // 获取有效banner配置
  171. // `method:"GET" internal:"true" `
  172. GetBanner(ctx context.Context, req *GetBannerReq) (resp *GetBannerResp, err error)
  173. }
  174. var v1BannerSvc BannerBMServer
  175. func bannerGetBlinkBanner(c *bm.Context) {
  176. p := new(GetInfoReq)
  177. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  178. return
  179. }
  180. resp, err := v1BannerSvc.GetBlinkBanner(c, p)
  181. c.JSON(resp, err)
  182. }
  183. func bannerGetBanner(c *bm.Context) {
  184. p := new(GetBannerReq)
  185. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  186. return
  187. }
  188. resp, err := v1BannerSvc.GetBanner(c, p)
  189. c.JSON(resp, err)
  190. }
  191. // RegisterV1BannerService Register the blademaster route with middleware map
  192. // midMap is the middleware map, the key is defined in proto
  193. func RegisterV1BannerService(e *bm.Engine, svc BannerBMServer, midMap map[string]bm.HandlerFunc) {
  194. v1BannerSvc = svc
  195. e.GET("/xlive/internal/live-admin/v1/banner/getBlinkBanner", bannerGetBlinkBanner)
  196. e.GET("/xlive/internal/live-admin/v1/banner/getBanner", bannerGetBanner)
  197. }
  198. // RegisterBannerBMServer Register the blademaster route
  199. func RegisterBannerBMServer(e *bm.Engine, server BannerBMServer) {
  200. v1BannerSvc = server
  201. e.GET("/live.liveadmin.v1.Banner/getBlinkBanner", bannerGetBlinkBanner)
  202. e.GET("/live.liveadmin.v1.Banner/getBanner", bannerGetBanner)
  203. }