go-common/app/interface/live/app-blink/api/http/v1/appBlink.bm.go

162 lines
4.5 KiB
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
// source: appBlink.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:
appBlink.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 PathSplashGetInfo = "/live.appblink.v1.Splash/GetInfo"
var PathBannerGetBlinkBanner = "/live.appblink.v1.Banner/GetBlinkBanner"
var PathRoomGetInfo = "/live.appblink.v1.Room/GetInfo"
var PathRoomCreate = "/live.appblink.v1.Room/Create"
var PathTopicGetTopicList = "/live.appblink.v1.Topic/GetTopicList"
var PathTopicCheckTopic = "/live.appblink.v1.Topic/CheckTopic"
// ================
// Splash Interface
// ================
type SplashBMServer interface {
}
var v1SplashSvc SplashBMServer
// RegisterSplashBMServer Register the blademaster route
func RegisterSplashBMServer(e *bm.Engine, server SplashBMServer) {
v1SplashSvc = server
}
// ================
// Banner Interface
// ================
type BannerBMServer interface {
}
var v1BannerSvc BannerBMServer
// RegisterBannerBMServer Register the blademaster route
func RegisterBannerBMServer(e *bm.Engine, server BannerBMServer) {
v1BannerSvc = server
}
// ==============
// Room Interface
// ==============
type RoomBMServer interface {
// 获取房间基本信息
// `method:"GET" midware:"auth"`
GetInfo(ctx context.Context, req *GetRoomInfoReq) (resp *GetRoomInfoResp, err error)
// 创建房间
// `method:"POST" midware:"auth"`
Create(ctx context.Context, req *CreateReq) (resp *CreateResp, err error)
}
var v1RoomSvc RoomBMServer
func roomGetInfo(c *bm.Context) {
p := new(GetRoomInfoReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1RoomSvc.GetInfo(c, p)
c.JSON(resp, err)
}
func roomCreate(c *bm.Context) {
p := new(CreateReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1RoomSvc.Create(c, p)
c.JSON(resp, err)
}
// RegisterV1RoomService Register the blademaster route with middleware map
// midMap is the middleware map, the key is defined in proto
func RegisterV1RoomService(e *bm.Engine, svc RoomBMServer, midMap map[string]bm.HandlerFunc) {
auth := midMap["auth"]
v1RoomSvc = svc
e.GET("/xlive/app-blink/v1/room/GetInfo", auth, roomGetInfo)
e.POST("/xlive/app-blink/v1/room/Create", auth, roomCreate)
}
// RegisterRoomBMServer Register the blademaster route
func RegisterRoomBMServer(e *bm.Engine, server RoomBMServer) {
v1RoomSvc = server
e.GET("/live.appblink.v1.Room/GetInfo", roomGetInfo)
e.POST("/live.appblink.v1.Room/Create", roomCreate)
}
// ===============
// Topic Interface
// ===============
type TopicBMServer interface {
// 获取话题列表
// `method:"GET" midware:"auth"`
GetTopicList(ctx context.Context, req *GetTopicListReq) (resp *GetTopicListResp, err error)
// 检验话题是否有效
// `method:"GET" midware:"auth"`
CheckTopic(ctx context.Context, req *CheckTopicReq) (resp *CheckTopicResp, err error)
}
var v1TopicSvc TopicBMServer
func topicGetTopicList(c *bm.Context) {
p := new(GetTopicListReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1TopicSvc.GetTopicList(c, p)
c.JSON(resp, err)
}
func topicCheckTopic(c *bm.Context) {
p := new(CheckTopicReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1TopicSvc.CheckTopic(c, p)
c.JSON(resp, err)
}
// RegisterV1TopicService Register the blademaster route with middleware map
// midMap is the middleware map, the key is defined in proto
func RegisterV1TopicService(e *bm.Engine, svc TopicBMServer, midMap map[string]bm.HandlerFunc) {
auth := midMap["auth"]
v1TopicSvc = svc
e.GET("/xlive/app-blink/v1/topic/GetTopicList", auth, topicGetTopicList)
e.GET("/xlive/app-blink/v1/topic/CheckTopic", auth, topicCheckTopic)
}
// RegisterTopicBMServer Register the blademaster route
func RegisterTopicBMServer(e *bm.Engine, server TopicBMServer) {
v1TopicSvc = server
e.GET("/live.appblink.v1.Topic/GetTopicList", topicGetTopicList)
e.GET("/live.appblink.v1.Topic/CheckTopic", topicCheckTopic)
}