go-common/app/service/live/resource/api/grpc/v2/user_resource.bm.go
2019-04-22 18:49:16 +08:00

116 lines
3.0 KiB
Go

// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
// source: api/grpc/v2/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:
api/grpc/v2/user_resource.proto
*/
package v2
import (
"context"
bm "go-common/library/net/http/blademaster"
)
// to suppressed 'imported but not used warning'
var _ *bm.Context
var _ context.Context
// ======================
// UserResource Interface
// ======================
type UserResource interface {
// Add 添加资源接口
Add(ctx context.Context, req *AddReq) (resp *AddResp, err error)
// Edit 编辑现有资源
Edit(ctx context.Context, req *EditReq) (resp *EditResp, err error)
// Query 请求单个资源
Query(ctx context.Context, req *QueryReq) (resp *QueryResp, err error)
// List 获取资源列表
List(ctx context.Context, req *ListReq) (resp *ListResp, err error)
// SetStatus 更改资源状态
SetStatus(ctx context.Context, req *SetStatusReq) (resp *SetStatusResp, err error)
}
var v2UserResourceSvc UserResource
// @params AddReq
// @router GET /xlive/resource/v2/userResource/Add
// @response AddResp
func userResourceAdd(c *bm.Context) {
p := new(AddReq)
if err := c.Bind(p); err != nil {
return
}
resp, err := v2UserResourceSvc.Add(c, p)
c.JSON(resp, err)
}
// @params EditReq
// @router GET /xlive/resource/v2/userResource/Edit
// @response EditResp
func userResourceEdit(c *bm.Context) {
p := new(EditReq)
if err := c.Bind(p); err != nil {
return
}
resp, err := v2UserResourceSvc.Edit(c, p)
c.JSON(resp, err)
}
// @params QueryReq
// @router GET /xlive/resource/v2/userResource/Query
// @response QueryResp
func userResourceQuery(c *bm.Context) {
p := new(QueryReq)
if err := c.Bind(p); err != nil {
return
}
resp, err := v2UserResourceSvc.Query(c, p)
c.JSON(resp, err)
}
// @params ListReq
// @router GET /xlive/resource/v2/userResource/List
// @response ListResp
func userResourceList(c *bm.Context) {
p := new(ListReq)
if err := c.Bind(p); err != nil {
return
}
resp, err := v2UserResourceSvc.List(c, p)
c.JSON(resp, err)
}
// @params SetStatusReq
// @router GET /xlive/resource/v2/userResource/SetStatus
// @response SetStatusResp
func userResourceSetStatus(c *bm.Context) {
p := new(SetStatusReq)
if err := c.Bind(p); err != nil {
return
}
resp, err := v2UserResourceSvc.SetStatus(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 UserResource, midMap map[string]bm.HandlerFunc) {
v2UserResourceSvc = svc
e.GET("/xlive/resource/v2/userResource/Add", userResourceAdd)
e.GET("/xlive/resource/v2/userResource/Edit", userResourceEdit)
e.GET("/xlive/resource/v2/userResource/Query", userResourceQuery)
e.GET("/xlive/resource/v2/userResource/List", userResourceList)
e.GET("/xlive/resource/v2/userResource/SetStatus", userResourceSetStatus)
}