api.bm.go 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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. )
  14. // to suppressed 'imported but not used warning'
  15. var _ *bm.Context
  16. var _ context.Context
  17. // ==================
  18. // Resource Interface
  19. // ==================
  20. type Resource interface {
  21. // Add 添加资源接口
  22. Add(ctx context.Context, req *AddReq) (resp *AddResp, err error)
  23. // Add 添加资源接口(不限制位置和平台)
  24. AddEx(ctx context.Context, req *AddReq) (resp *AddResp, err error)
  25. // Edit 编辑资源接口
  26. Edit(ctx context.Context, req *EditReq) (resp *EditResp, err error)
  27. // Offline 下线资源接口
  28. Offline(ctx context.Context, req *OfflineReq) (resp *OfflineResp, err error)
  29. // GetList 获取资源列表
  30. GetList(ctx context.Context, req *GetListReq) (resp *GetListResp, err error)
  31. // 获取平台列表
  32. GetPlatformList(ctx context.Context, req *GetPlatformListReq) (resp *GetPlatformListResp, err error)
  33. // GetListEx 获取资源列表
  34. GetListEx(ctx context.Context, req *GetListExReq) (resp *GetListExResp, err error)
  35. }
  36. var v1ResourceSvc Resource
  37. // @params AddReq
  38. // @router GET /xlive/resource/v1/resource/Add
  39. // @response AddResp
  40. func resourceAdd(c *bm.Context) {
  41. p := new(AddReq)
  42. if err := c.Bind(p); err != nil {
  43. return
  44. }
  45. resp, err := v1ResourceSvc.Add(c, p)
  46. c.JSON(resp, err)
  47. }
  48. // @params AddReq
  49. // @router GET /xlive/resource/v1/resource/AddEx
  50. // @response AddResp
  51. func resourceAddEx(c *bm.Context) {
  52. p := new(AddReq)
  53. if err := c.Bind(p); err != nil {
  54. return
  55. }
  56. resp, err := v1ResourceSvc.AddEx(c, p)
  57. c.JSON(resp, err)
  58. }
  59. // @params EditReq
  60. // @router GET /xlive/resource/v1/resource/Edit
  61. // @response EditResp
  62. func resourceEdit(c *bm.Context) {
  63. p := new(EditReq)
  64. if err := c.Bind(p); err != nil {
  65. return
  66. }
  67. resp, err := v1ResourceSvc.Edit(c, p)
  68. c.JSON(resp, err)
  69. }
  70. // @params OfflineReq
  71. // @router GET /xlive/resource/v1/resource/Offline
  72. // @response OfflineResp
  73. func resourceOffline(c *bm.Context) {
  74. p := new(OfflineReq)
  75. if err := c.Bind(p); err != nil {
  76. return
  77. }
  78. resp, err := v1ResourceSvc.Offline(c, p)
  79. c.JSON(resp, err)
  80. }
  81. // @params GetListReq
  82. // @router GET /xlive/resource/v1/resource/GetList
  83. // @response GetListResp
  84. func resourceGetList(c *bm.Context) {
  85. p := new(GetListReq)
  86. if err := c.Bind(p); err != nil {
  87. return
  88. }
  89. resp, err := v1ResourceSvc.GetList(c, p)
  90. c.JSON(resp, err)
  91. }
  92. // @params GetPlatformListReq
  93. // @router GET /xlive/resource/v1/resource/GetPlatformList
  94. // @response GetPlatformListResp
  95. func resourceGetPlatformList(c *bm.Context) {
  96. p := new(GetPlatformListReq)
  97. if err := c.Bind(p); err != nil {
  98. return
  99. }
  100. resp, err := v1ResourceSvc.GetPlatformList(c, p)
  101. c.JSON(resp, err)
  102. }
  103. // @params GetListExReq
  104. // @router GET /xlive/resource/v1/resource/GetListEx
  105. // @response GetListExResp
  106. func resourceGetListEx(c *bm.Context) {
  107. p := new(GetListExReq)
  108. if err := c.Bind(p); err != nil {
  109. return
  110. }
  111. resp, err := v1ResourceSvc.GetListEx(c, p)
  112. c.JSON(resp, err)
  113. }
  114. // RegisterV1ResourceService Register the blademaster route with middleware map
  115. // midMap is the middleware map, the key is defined in proto
  116. func RegisterV1ResourceService(e *bm.Engine, svc Resource, midMap map[string]bm.HandlerFunc) {
  117. v1ResourceSvc = svc
  118. e.GET("/xlive/resource/v1/resource/Add", resourceAdd)
  119. e.GET("/xlive/resource/v1/resource/AddEx", resourceAddEx)
  120. e.GET("/xlive/resource/v1/resource/Edit", resourceEdit)
  121. e.GET("/xlive/resource/v1/resource/Offline", resourceOffline)
  122. e.GET("/xlive/resource/v1/resource/GetList", resourceGetList)
  123. e.GET("/xlive/resource/v1/resource/GetPlatformList", resourceGetPlatformList)
  124. e.GET("/xlive/resource/v1/resource/GetListEx", resourceGetListEx)
  125. }
  126. // ================
  127. // Splash Interface
  128. // ================
  129. type Splash interface {
  130. // 获取有效闪屏配置
  131. GetInfo(ctx context.Context, req *GetInfoReq) (resp *GetInfoResp, err error)
  132. }
  133. var v1SplashSvc Splash
  134. // @params GetInfoReq
  135. // @router GET /xlive/resource/v1/splash/GetInfo
  136. // @response GetInfoResp
  137. func splashGetInfo(c *bm.Context) {
  138. p := new(GetInfoReq)
  139. if err := c.Bind(p); err != nil {
  140. return
  141. }
  142. resp, err := v1SplashSvc.GetInfo(c, p)
  143. c.JSON(resp, err)
  144. }
  145. // RegisterV1SplashService Register the blademaster route with middleware map
  146. // midMap is the middleware map, the key is defined in proto
  147. func RegisterV1SplashService(e *bm.Engine, svc Splash, midMap map[string]bm.HandlerFunc) {
  148. v1SplashSvc = svc
  149. e.GET("/xlive/resource/v1/splash/GetInfo", splashGetInfo)
  150. }
  151. // ================
  152. // Banner Interface
  153. // ================
  154. type Banner interface {
  155. // 获取有效banner配置
  156. GetBlinkBanner(ctx context.Context, req *GetInfoReq) (resp *GetInfoResp, err error)
  157. // 获取有效banner配置
  158. GetBanner(ctx context.Context, req *GetBannerReq) (resp *GetBannerResp, err error)
  159. }
  160. var v1BannerSvc Banner
  161. // @params GetInfoReq
  162. // @router GET /xlive/resource/v1/banner/GetBlinkBanner
  163. // @response GetInfoResp
  164. func bannerGetBlinkBanner(c *bm.Context) {
  165. p := new(GetInfoReq)
  166. if err := c.Bind(p); err != nil {
  167. return
  168. }
  169. resp, err := v1BannerSvc.GetBlinkBanner(c, p)
  170. c.JSON(resp, err)
  171. }
  172. // @params GetBannerReq
  173. // @router GET /xlive/resource/v1/banner/GetBanner
  174. // @response GetBannerResp
  175. func bannerGetBanner(c *bm.Context) {
  176. p := new(GetBannerReq)
  177. if err := c.Bind(p); err != nil {
  178. return
  179. }
  180. resp, err := v1BannerSvc.GetBanner(c, p)
  181. c.JSON(resp, err)
  182. }
  183. // RegisterV1BannerService Register the blademaster route with middleware map
  184. // midMap is the middleware map, the key is defined in proto
  185. func RegisterV1BannerService(e *bm.Engine, svc Banner, midMap map[string]bm.HandlerFunc) {
  186. v1BannerSvc = svc
  187. e.GET("/xlive/resource/v1/banner/GetBlinkBanner", bannerGetBlinkBanner)
  188. e.GET("/xlive/resource/v1/banner/GetBanner", bannerGetBanner)
  189. }