80 lines
2.3 KiB
Go
80 lines
2.3 KiB
Go
// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
|
||
// source: api.proto
|
||
|
||
/*
|
||
Package api 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:
|
||
api.proto
|
||
*/
|
||
package api
|
||
|
||
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 PathRoomGetMultiple = "/live.xroom.v1.Room/getMultiple"
|
||
var PathRoomGetMultipleByUids = "/live.xroom.v1.Room/getMultipleByUids"
|
||
var PathRoomIsAnchor = "/live.xroom.v1.Room/isAnchor"
|
||
|
||
// ==============
|
||
// Room Interface
|
||
// ==============
|
||
|
||
type RoomBMServer interface {
|
||
// 批量根据room_ids获取房间信息
|
||
GetMultiple(ctx context.Context, req *RoomIDsReq) (resp *RoomIDsInfosResp, err error)
|
||
|
||
// 批量根据uids获取房间信息
|
||
GetMultipleByUids(ctx context.Context, req *UIDsReq) (resp *UIDsInfosResp, err error)
|
||
|
||
// 批量根据uids判断是否是主播,如果是返回主播的room_id,否则返回0
|
||
IsAnchor(ctx context.Context, req *IsAnchorUIDsReq) (resp *IsAnchorUIDsResp, err error)
|
||
}
|
||
|
||
var RoomSvc RoomBMServer
|
||
|
||
func roomGetMultiple(c *bm.Context) {
|
||
p := new(RoomIDsReq)
|
||
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
|
||
return
|
||
}
|
||
resp, err := RoomSvc.GetMultiple(c, p)
|
||
c.JSON(resp, err)
|
||
}
|
||
|
||
func roomGetMultipleByUids(c *bm.Context) {
|
||
p := new(UIDsReq)
|
||
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
|
||
return
|
||
}
|
||
resp, err := RoomSvc.GetMultipleByUids(c, p)
|
||
c.JSON(resp, err)
|
||
}
|
||
|
||
func roomIsAnchor(c *bm.Context) {
|
||
p := new(IsAnchorUIDsReq)
|
||
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
|
||
return
|
||
}
|
||
resp, err := RoomSvc.IsAnchor(c, p)
|
||
c.JSON(resp, err)
|
||
}
|
||
|
||
// RegisterRoomBMServer Register the blademaster route
|
||
func RegisterRoomBMServer(e *bm.Engine, server RoomBMServer) {
|
||
RoomSvc = server
|
||
e.GET("/live.xroom.v1.Room/getMultiple", roomGetMultiple)
|
||
e.GET("/live.xroom.v1.Room/getMultipleByUids", roomGetMultipleByUids)
|
||
e.GET("/live.xroom.v1.Room/isAnchor", roomIsAnchor)
|
||
}
|