go-common/app/admin/live/live-admin/api/http/v1/resource.bm.go
2019-04-22 18:49:16 +08:00

244 lines
8.0 KiB
Go

// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
// source: resource.proto
/*
Package v1 is a generated blademaster stub package.
This code was generated with go-common/app/tool/bmgen/protoc-gen-bm v0.1.
It is generated from these files:
resource.proto
*/
package v1
import (
"context"
bm "go-common/library/net/http/blademaster"
"go-common/library/net/http/blademaster/binding"
)
// to suppressed 'imported but not used warning'
var _ *bm.Context
var _ context.Context
var _ binding.StructValidator
var PathResourceAdd = "/live.liveadmin.v1.Resource/add"
var PathResourceAddEx = "/live.liveadmin.v1.Resource/addEx"
var PathResourceEdit = "/live.liveadmin.v1.Resource/edit"
var PathResourceOffline = "/live.liveadmin.v1.Resource/offline"
var PathResourceGetList = "/live.liveadmin.v1.Resource/getList"
var PathResourceGetPlatformList = "/live.liveadmin.v1.Resource/getPlatformList"
var PathResourceGetListEx = "/live.liveadmin.v1.Resource/getListEx"
var PathSplashGetInfo = "/live.liveadmin.v1.Splash/getInfo"
var PathBannerGetBlinkBanner = "/live.liveadmin.v1.Banner/getBlinkBanner"
var PathBannerGetBanner = "/live.liveadmin.v1.Banner/getBanner"
// ==================
// Resource Interface
// ==================
type ResourceBMServer interface {
// Add 添加资源接口
// `method:"POST" internal:"true" `
Add(ctx context.Context, req *AddReq) (resp *AddResp, err error)
// AddEx 添加资源接口(不限制位置和平台)
// `method:"POST" internal:"true" `
AddEx(ctx context.Context, req *AddReq) (resp *AddResp, err error)
// Edit 编辑资源接口
// `method:"POST" internal:"true" `
Edit(ctx context.Context, req *EditReq) (resp *EditResp, err error)
// Offline 下线资源接口
// `method:"POST" internal:"true" `
Offline(ctx context.Context, req *OfflineReq) (resp *OfflineResp, err error)
// GetList 获取资源列表
// `method:"GET" internal:"true" `
GetList(ctx context.Context, req *GetListReq) (resp *GetListResp, err error)
// 获取平台列表
// `method:"GET" internal:"true" `
GetPlatformList(ctx context.Context, req *GetPlatformListReq) (resp *GetPlatformListResp, err error)
// GetListEx 获取资源列表
// `method:"GET" internal:"true" `
GetListEx(ctx context.Context, req *GetListExReq) (resp *GetListExResp, err error)
}
var v1ResourceSvc ResourceBMServer
func resourceAdd(c *bm.Context) {
p := new(AddReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1ResourceSvc.Add(c, p)
c.JSON(resp, err)
}
func resourceAddEx(c *bm.Context) {
p := new(AddReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1ResourceSvc.AddEx(c, p)
c.JSON(resp, err)
}
func resourceEdit(c *bm.Context) {
p := new(EditReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1ResourceSvc.Edit(c, p)
c.JSON(resp, err)
}
func resourceOffline(c *bm.Context) {
p := new(OfflineReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1ResourceSvc.Offline(c, p)
c.JSON(resp, err)
}
func resourceGetList(c *bm.Context) {
p := new(GetListReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1ResourceSvc.GetList(c, p)
c.JSON(resp, err)
}
func resourceGetPlatformList(c *bm.Context) {
p := new(GetPlatformListReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1ResourceSvc.GetPlatformList(c, p)
c.JSON(resp, err)
}
func resourceGetListEx(c *bm.Context) {
p := new(GetListExReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1ResourceSvc.GetListEx(c, p)
c.JSON(resp, err)
}
// RegisterV1ResourceService Register the blademaster route with middleware map
// midMap is the middleware map, the key is defined in proto
func RegisterV1ResourceService(e *bm.Engine, svc ResourceBMServer, midMap map[string]bm.HandlerFunc) {
v1ResourceSvc = svc
e.POST("/xlive/internal/live-admin/v1/resource/add", resourceAdd)
e.POST("/xlive/internal/live-admin/v1/resource/addEx", resourceAddEx)
e.POST("/xlive/internal/live-admin/v1/resource/edit", resourceEdit)
e.POST("/xlive/internal/live-admin/v1/resource/offline", resourceOffline)
e.GET("/xlive/internal/live-admin/v1/resource/getList", resourceGetList)
e.GET("/xlive/internal/live-admin/v1/resource/getPlatformList", resourceGetPlatformList)
e.GET("/xlive/internal/live-admin/v1/resource/getListEx", resourceGetListEx)
}
// RegisterResourceBMServer Register the blademaster route
func RegisterResourceBMServer(e *bm.Engine, server ResourceBMServer) {
v1ResourceSvc = server
e.POST("/live.liveadmin.v1.Resource/add", resourceAdd)
e.POST("/live.liveadmin.v1.Resource/addEx", resourceAddEx)
e.POST("/live.liveadmin.v1.Resource/edit", resourceEdit)
e.POST("/live.liveadmin.v1.Resource/offline", resourceOffline)
e.GET("/live.liveadmin.v1.Resource/getList", resourceGetList)
e.GET("/live.liveadmin.v1.Resource/getPlatformList", resourceGetPlatformList)
e.GET("/live.liveadmin.v1.Resource/getListEx", resourceGetListEx)
}
// ================
// Splash Interface
// ================
type SplashBMServer interface {
// 获取有效闪屏配置
// `method:"GET" internal:"true" `
GetInfo(ctx context.Context, req *GetInfoReq) (resp *GetInfoResp, err error)
}
var v1SplashSvc SplashBMServer
func splashGetInfo(c *bm.Context) {
p := new(GetInfoReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1SplashSvc.GetInfo(c, p)
c.JSON(resp, err)
}
// RegisterV1SplashService Register the blademaster route with middleware map
// midMap is the middleware map, the key is defined in proto
func RegisterV1SplashService(e *bm.Engine, svc SplashBMServer, midMap map[string]bm.HandlerFunc) {
v1SplashSvc = svc
e.GET("/xlive/internal/live-admin/v1/splash/getInfo", splashGetInfo)
}
// RegisterSplashBMServer Register the blademaster route
func RegisterSplashBMServer(e *bm.Engine, server SplashBMServer) {
v1SplashSvc = server
e.GET("/live.liveadmin.v1.Splash/getInfo", splashGetInfo)
}
// ================
// Banner Interface
// ================
type BannerBMServer interface {
// 获取有效banner配置
// `method:"GET" internal:"true" `
GetBlinkBanner(ctx context.Context, req *GetInfoReq) (resp *GetInfoResp, err error)
// 获取有效banner配置
// `method:"GET" internal:"true" `
GetBanner(ctx context.Context, req *GetBannerReq) (resp *GetBannerResp, err error)
}
var v1BannerSvc BannerBMServer
func bannerGetBlinkBanner(c *bm.Context) {
p := new(GetInfoReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1BannerSvc.GetBlinkBanner(c, p)
c.JSON(resp, err)
}
func bannerGetBanner(c *bm.Context) {
p := new(GetBannerReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1BannerSvc.GetBanner(c, p)
c.JSON(resp, err)
}
// RegisterV1BannerService Register the blademaster route with middleware map
// midMap is the middleware map, the key is defined in proto
func RegisterV1BannerService(e *bm.Engine, svc BannerBMServer, midMap map[string]bm.HandlerFunc) {
v1BannerSvc = svc
e.GET("/xlive/internal/live-admin/v1/banner/getBlinkBanner", bannerGetBlinkBanner)
e.GET("/xlive/internal/live-admin/v1/banner/getBanner", bannerGetBanner)
}
// RegisterBannerBMServer Register the blademaster route
func RegisterBannerBMServer(e *bm.Engine, server BannerBMServer) {
v1BannerSvc = server
e.GET("/live.liveadmin.v1.Banner/getBlinkBanner", bannerGetBlinkBanner)
e.GET("/live.liveadmin.v1.Banner/getBanner", bannerGetBanner)
}