go-common/app/interface/live/web-ucenter/api/http/v1/service.bm.go
2019-04-22 18:49:16 +08:00

258 lines
9.3 KiB
Go

// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
// source: service.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:
service.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 PathHistoryGetHistoryByUid = "/live.webucenter.v1.history/get_history_by_uid"
var PathHistoryDelHistory = "/live.webucenter.v1.history/del_history"
var PathCapsuleGetDetail = "/live.webucenter.v1.Capsule/get_detail"
var PathCapsuleOpenCapsule = "/live.webucenter.v1.Capsule/open_capsule"
var PathCapsuleGetCapsuleInfo = "/live.webucenter.v1.Capsule/get_capsule_info"
var PathCapsuleOpenCapsuleByType = "/live.webucenter.v1.Capsule/open_capsule_by_type"
var PathAnchorTaskMyReward = "/live.webucenter.v1.AnchorTask/myReward"
var PathAnchorTaskUseRecord = "/live.webucenter.v1.AnchorTask/useRecord"
var PathAnchorTaskUseReward = "/live.webucenter.v1.AnchorTask/useReward"
var PathAnchorTaskIsViewed = "/live.webucenter.v1.AnchorTask/isViewed"
var PathAnchorTaskAddReward = "/live.webucenter.v1.AnchorTask/addReward"
// =================
// History Interface
// =================
// History 相关服务
type HistoryBMServer interface {
// 根据uid查询直播关键历史记录
// `midware:"auth"`
GetHistoryByUid(ctx context.Context, req *GetHistoryReq) (resp *GetHistoryResp, err error)
// 删除直播历史记录
// `method:"POST" midware:"auth"`
DelHistory(ctx context.Context, req *DelHistoryReq) (resp *DelHistoryResp, err error)
}
var v1HistorySvc HistoryBMServer
func historyGetHistoryByUid(c *bm.Context) {
p := new(GetHistoryReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1HistorySvc.GetHistoryByUid(c, p)
c.JSON(resp, err)
}
func historyDelHistory(c *bm.Context) {
p := new(DelHistoryReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1HistorySvc.DelHistory(c, p)
c.JSON(resp, err)
}
// RegisterV1HistoryService Register the blademaster route with middleware map
// midMap is the middleware map, the key is defined in proto
func RegisterV1HistoryService(e *bm.Engine, svc HistoryBMServer, midMap map[string]bm.HandlerFunc) {
auth := midMap["auth"]
v1HistorySvc = svc
e.GET("/xlive/web-ucenter/v1/history/get_history_by_uid", auth, historyGetHistoryByUid)
e.POST("/xlive/web-ucenter/v1/history/del_history", auth, historyDelHistory)
}
// RegisterHistoryBMServer Register the blademaster route
func RegisterHistoryBMServer(e *bm.Engine, server HistoryBMServer) {
e.GET("/live.webucenter.v1.history/get_history_by_uid", historyGetHistoryByUid)
e.POST("/live.webucenter.v1.history/del_history", historyDelHistory)
}
// =================
// Capsule Interface
// =================
type CapsuleBMServer interface {
// `midware:"auth"`
GetDetail(ctx context.Context, req *CapsuleGetDetailReq) (resp *CapsuleGetDetailResp, err error)
// `method:"POST" midware:"auth"`
OpenCapsule(ctx context.Context, req *CapsuleOpenCapsuleReq) (resp *CapsuleOpenCapsuleResp, err error)
// `midware:"guest"`
GetCapsuleInfo(ctx context.Context, req *CapsuleGetCapsuleInfoReq) (resp *CapsuleGetCapsuleInfoResp, err error)
// `method:"POST" midware:"auth"`
OpenCapsuleByType(ctx context.Context, req *CapsuleOpenCapsuleByTypeReq) (resp *CapsuleOpenCapsuleByTypeResp, err error)
}
var v1CapsuleSvc CapsuleBMServer
func capsuleGetDetail(c *bm.Context) {
p := new(CapsuleGetDetailReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1CapsuleSvc.GetDetail(c, p)
c.JSON(resp, err)
}
func capsuleOpenCapsule(c *bm.Context) {
p := new(CapsuleOpenCapsuleReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1CapsuleSvc.OpenCapsule(c, p)
c.JSON(resp, err)
}
func capsuleGetCapsuleInfo(c *bm.Context) {
p := new(CapsuleGetCapsuleInfoReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1CapsuleSvc.GetCapsuleInfo(c, p)
c.JSON(resp, err)
}
func capsuleOpenCapsuleByType(c *bm.Context) {
p := new(CapsuleOpenCapsuleByTypeReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1CapsuleSvc.OpenCapsuleByType(c, p)
c.JSON(resp, err)
}
// RegisterV1CapsuleService Register the blademaster route with middleware map
// midMap is the middleware map, the key is defined in proto
func RegisterV1CapsuleService(e *bm.Engine, svc CapsuleBMServer, midMap map[string]bm.HandlerFunc) {
auth := midMap["auth"]
guest := midMap["guest"]
v1CapsuleSvc = svc
e.GET("/xlive/web-ucenter/v1/capsule/get_detail", auth, capsuleGetDetail)
e.POST("/xlive/web-ucenter/v1/capsule/open_capsule", auth, capsuleOpenCapsule)
e.GET("/xlive/web-ucenter/v1/capsule/get_capsule_info", guest, capsuleGetCapsuleInfo)
e.POST("/xlive/web-ucenter/v1/capsule/open_capsule_by_type", auth, capsuleOpenCapsuleByType)
}
// RegisterCapsuleBMServer Register the blademaster route
func RegisterCapsuleBMServer(e *bm.Engine, server CapsuleBMServer) {
e.GET("/live.webucenter.v1.Capsule/get_detail", capsuleGetDetail)
e.POST("/live.webucenter.v1.Capsule/open_capsule", capsuleOpenCapsule)
e.GET("/live.webucenter.v1.Capsule/get_capsule_info", capsuleGetCapsuleInfo)
e.POST("/live.webucenter.v1.Capsule/open_capsule_by_type", capsuleOpenCapsuleByType)
}
// ====================
// AnchorTask Interface
// ====================
type AnchorTaskBMServer interface {
// (主播侧)-我的主播奖励(登录态)
// `midware:"auth"`
MyReward(ctx context.Context, req *AnchorTaskMyRewardReq) (resp *AnchorTaskMyRewardResp, err error)
// (主播侧)-奖励使用记录(登录态)
// `midware:"auth"`
UseRecord(ctx context.Context, req *AnchorTaskUseRecordReq) (resp *AnchorTaskUseRecordResp, err error)
// (主播侧)-使用奖励(登录态)
// `method:"POST" midware:"auth"`
UseReward(ctx context.Context, req *AnchorTaskUseRewardReq) (resp *AnchorTaskUseRewardResp, err error)
// (主播侧)-奖励和任务红点(登录态)
// `midware:"auth"`
IsViewed(ctx context.Context, req *AnchorTaskIsViewedReq) (resp *AnchorTaskIsViewedResp, err error)
// (主播侧)-添加主播奖励(内部接口)
// `method:"POST" internal:"true"`
AddReward(ctx context.Context, req *AnchorTaskAddRewardReq) (resp *AnchorTaskAddRewardResp, err error)
}
var v1AnchorTaskSvc AnchorTaskBMServer
func anchorTaskMyReward(c *bm.Context) {
p := new(AnchorTaskMyRewardReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1AnchorTaskSvc.MyReward(c, p)
c.JSON(resp, err)
}
func anchorTaskUseRecord(c *bm.Context) {
p := new(AnchorTaskUseRecordReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1AnchorTaskSvc.UseRecord(c, p)
c.JSON(resp, err)
}
func anchorTaskUseReward(c *bm.Context) {
p := new(AnchorTaskUseRewardReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1AnchorTaskSvc.UseReward(c, p)
c.JSON(resp, err)
}
func anchorTaskIsViewed(c *bm.Context) {
p := new(AnchorTaskIsViewedReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1AnchorTaskSvc.IsViewed(c, p)
c.JSON(resp, err)
}
func anchorTaskAddReward(c *bm.Context) {
p := new(AnchorTaskAddRewardReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1AnchorTaskSvc.AddReward(c, p)
c.JSON(resp, err)
}
// RegisterV1AnchorTaskService Register the blademaster route with middleware map
// midMap is the middleware map, the key is defined in proto
func RegisterV1AnchorTaskService(e *bm.Engine, svc AnchorTaskBMServer, midMap map[string]bm.HandlerFunc) {
auth := midMap["auth"]
v1AnchorTaskSvc = svc
e.GET("/xlive/web-ucenter/v1/anchorTask/myReward", auth, anchorTaskMyReward)
e.GET("/xlive/web-ucenter/v1/anchorTask/useRecord", auth, anchorTaskUseRecord)
e.POST("/xlive/web-ucenter/v1/anchorTask/useReward", auth, anchorTaskUseReward)
e.GET("/xlive/web-ucenter/v1/anchorTask/isViewed", auth, anchorTaskIsViewed)
e.POST("/xlive/internal/web-ucenter/v1/anchorTask/addReward", anchorTaskAddReward)
}
// RegisterAnchorTaskBMServer Register the blademaster route
func RegisterAnchorTaskBMServer(e *bm.Engine, server AnchorTaskBMServer) {
e.GET("/live.webucenter.v1.AnchorTask/myReward", anchorTaskMyReward)
e.GET("/live.webucenter.v1.AnchorTask/useRecord", anchorTaskUseRecord)
e.POST("/live.webucenter.v1.AnchorTask/useReward", anchorTaskUseReward)
e.GET("/live.webucenter.v1.AnchorTask/isViewed", anchorTaskIsViewed)
e.POST("/live.webucenter.v1.AnchorTask/addReward", anchorTaskAddReward)
}