124 lines
4.3 KiB
Go
124 lines
4.3 KiB
Go
|
// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
|
||
|
// source: user_resource.proto
|
||
|
|
||
|
/*
|
||
|
Package v2 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:
|
||
|
user_resource.proto
|
||
|
*/
|
||
|
package v2
|
||
|
|
||
|
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 PathUserResourceAdd = "/live.liveadmin.v2.UserResource/add"
|
||
|
var PathUserResourceEdit = "/live.liveadmin.v2.UserResource/edit"
|
||
|
var PathUserResourceGet = "/live.liveadmin.v2.UserResource/get"
|
||
|
var PathUserResourceSetStatus = "/live.liveadmin.v2.UserResource/setStatus"
|
||
|
var PathUserResourceGetSingle = "/live.liveadmin.v2.UserResource/getSingle"
|
||
|
|
||
|
// ======================
|
||
|
// UserResource Interface
|
||
|
// ======================
|
||
|
|
||
|
type UserResourceBMServer interface {
|
||
|
// Add 添加资源接口
|
||
|
// `method:"POST" internal:"true" `
|
||
|
Add(ctx context.Context, req *UserResourceAddReq) (resp *UserResourceAddResp, err error)
|
||
|
|
||
|
// Edit 编辑现有资源
|
||
|
// `method:"POST" internal:"true" `
|
||
|
Edit(ctx context.Context, req *UserResourceEditReq) (resp *UserResourceEditResp, err error)
|
||
|
|
||
|
// List 获取资源列表
|
||
|
// `method:"GET" internal:"true" `
|
||
|
Get(ctx context.Context, req *UserResourceListReq) (resp *UserResourceListResp, err error)
|
||
|
|
||
|
// SetStatus 更改资源状态
|
||
|
// `method:"POST" internal:"true" `
|
||
|
SetStatus(ctx context.Context, req *UserResourceSetStatusReq) (resp *UserResourceSetStatusResp, err error)
|
||
|
|
||
|
// Query 请求单个资源
|
||
|
// `method:"GET" internal:"true" `
|
||
|
GetSingle(ctx context.Context, req *UserResourceGetSingleReq) (resp *UserResourceGetSingleResp, err error)
|
||
|
}
|
||
|
|
||
|
var v2UserResourceSvc UserResourceBMServer
|
||
|
|
||
|
func userResourceAdd(c *bm.Context) {
|
||
|
p := new(UserResourceAddReq)
|
||
|
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
|
||
|
return
|
||
|
}
|
||
|
resp, err := v2UserResourceSvc.Add(c, p)
|
||
|
c.JSON(resp, err)
|
||
|
}
|
||
|
|
||
|
func userResourceEdit(c *bm.Context) {
|
||
|
p := new(UserResourceEditReq)
|
||
|
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
|
||
|
return
|
||
|
}
|
||
|
resp, err := v2UserResourceSvc.Edit(c, p)
|
||
|
c.JSON(resp, err)
|
||
|
}
|
||
|
|
||
|
func userResourceGet(c *bm.Context) {
|
||
|
p := new(UserResourceListReq)
|
||
|
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
|
||
|
return
|
||
|
}
|
||
|
resp, err := v2UserResourceSvc.Get(c, p)
|
||
|
c.JSON(resp, err)
|
||
|
}
|
||
|
|
||
|
func userResourceSetStatus(c *bm.Context) {
|
||
|
p := new(UserResourceSetStatusReq)
|
||
|
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
|
||
|
return
|
||
|
}
|
||
|
resp, err := v2UserResourceSvc.SetStatus(c, p)
|
||
|
c.JSON(resp, err)
|
||
|
}
|
||
|
|
||
|
func userResourceGetSingle(c *bm.Context) {
|
||
|
p := new(UserResourceGetSingleReq)
|
||
|
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
|
||
|
return
|
||
|
}
|
||
|
resp, err := v2UserResourceSvc.GetSingle(c, p)
|
||
|
c.JSON(resp, err)
|
||
|
}
|
||
|
|
||
|
// RegisterV2UserResourceService Register the blademaster route with middleware map
|
||
|
// midMap is the middleware map, the key is defined in proto
|
||
|
func RegisterV2UserResourceService(e *bm.Engine, svc UserResourceBMServer, midMap map[string]bm.HandlerFunc) {
|
||
|
v2UserResourceSvc = svc
|
||
|
e.POST("/xlive/internal/live-admin/v2/userResource/add", userResourceAdd)
|
||
|
e.POST("/xlive/internal/live-admin/v2/userResource/edit", userResourceEdit)
|
||
|
e.GET("/xlive/internal/live-admin/v2/userResource/get", userResourceGet)
|
||
|
e.POST("/xlive/internal/live-admin/v2/userResource/setStatus", userResourceSetStatus)
|
||
|
e.GET("/xlive/internal/live-admin/v2/userResource/getSingle", userResourceGetSingle)
|
||
|
}
|
||
|
|
||
|
// RegisterUserResourceBMServer Register the blademaster route
|
||
|
func RegisterUserResourceBMServer(e *bm.Engine, server UserResourceBMServer) {
|
||
|
v2UserResourceSvc = server
|
||
|
e.POST("/live.liveadmin.v2.UserResource/add", userResourceAdd)
|
||
|
e.POST("/live.liveadmin.v2.UserResource/edit", userResourceEdit)
|
||
|
e.GET("/live.liveadmin.v2.UserResource/get", userResourceGet)
|
||
|
e.POST("/live.liveadmin.v2.UserResource/setStatus", userResourceSetStatus)
|
||
|
e.GET("/live.liveadmin.v2.UserResource/getSingle", userResourceGetSingle)
|
||
|
}
|