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

73 lines
1.9 KiB
Go

// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
// source: dm.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:
dm.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 PathDmSendmsg = "/xlive/open-interface/v1/dm/sendmsg"
var PathDmGetConf = "/xlive/open-interface/v1/dm/getConf"
// ============
// Dm Interface
// ============
type DmBMServer interface {
// `method:"POST"`
Sendmsg(ctx context.Context, req *SendMsgReq) (resp *SendMsgResp, err error)
GetConf(ctx context.Context, req *GetConfReq) (resp *GetConfResp, err error)
}
var v1DmSvc DmBMServer
func dmSendmsg(c *bm.Context) {
p := new(SendMsgReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1DmSvc.Sendmsg(c, p)
c.JSON(resp, err)
}
func dmGetConf(c *bm.Context) {
p := new(GetConfReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1DmSvc.GetConf(c, p)
c.JSON(resp, err)
}
// RegisterV1DmService Register the blademaster route with middleware map
// midMap is the middleware map, the key is defined in proto
func RegisterV1DmService(e *bm.Engine, svc DmBMServer, midMap map[string]bm.HandlerFunc) {
v1DmSvc = svc
e.POST("/xlive/open-interface/v1/dm/sendmsg", dmSendmsg)
e.GET("/xlive/open-interface/v1/dm/getConf", dmGetConf)
}
// RegisterDmBMServer Register the blademaster route
func RegisterDmBMServer(e *bm.Engine, server DmBMServer) {
v1DmSvc = server
e.POST("/xlive/open-interface/v1/dm/sendmsg", dmSendmsg)
e.GET("/xlive/open-interface/v1/dm/getConf", dmGetConf)
}