117 lines
3.0 KiB
Go
117 lines
3.0 KiB
Go
// Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
|
|
// source: v0/PayGoods.proto
|
|
|
|
/*
|
|
Package v0 is a generated liverpc stub package.
|
|
This code was generated with go-common/app/tool/liverpc/protoc-gen-liverpc v0.1.
|
|
|
|
It is generated from these files:
|
|
v0/PayGoods.proto
|
|
v0/PayLive.proto
|
|
*/
|
|
package v0
|
|
|
|
import context "context"
|
|
|
|
import proto "github.com/golang/protobuf/proto"
|
|
import "go-common/library/net/rpc/liverpc"
|
|
|
|
var _ proto.Message // generate to suppress unused imports
|
|
// Imports only used by utility functions:
|
|
|
|
// ==================
|
|
// PayGoods Interface
|
|
// ==================
|
|
|
|
type PayGoods interface {
|
|
// * 生成一张付费直播票
|
|
//
|
|
Add(context.Context, *PayGoodsAddReq) (*PayGoodsAddResp, error)
|
|
|
|
// * 更新一张付费直播票
|
|
//
|
|
Update(context.Context, *PayGoodsUpdateReq) (*PayGoodsUpdateResp, error)
|
|
|
|
// * 获取付费直播票列表
|
|
//
|
|
GetList(context.Context, *PayGoodsGetListReq) (*PayGoodsGetListResp, error)
|
|
|
|
// * 关闭购票
|
|
//
|
|
Close(context.Context, *PayGoodsCloseReq) (*PayGoodsCloseResp, error)
|
|
|
|
// * 开启购票
|
|
//
|
|
Open(context.Context, *PayGoodsOpenReq) (*PayGoodsOpenResp, error)
|
|
}
|
|
|
|
// ========================
|
|
// PayGoods Live Rpc Client
|
|
// ========================
|
|
|
|
type payGoodsRpcClient struct {
|
|
client *liverpc.Client
|
|
}
|
|
|
|
// NewPayGoodsRpcClient creates a Rpc client that implements the PayGoods interface.
|
|
// It communicates using Rpc and can be configured with a custom HTTPClient.
|
|
func NewPayGoodsRpcClient(client *liverpc.Client) PayGoods {
|
|
return &payGoodsRpcClient{
|
|
client: client,
|
|
}
|
|
}
|
|
|
|
func (c *payGoodsRpcClient) Add(ctx context.Context, in *PayGoodsAddReq) (*PayGoodsAddResp, error) {
|
|
out := new(PayGoodsAddResp)
|
|
err := doRpcRequest(ctx, c.client, 0, "PayGoods.add", in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *payGoodsRpcClient) Update(ctx context.Context, in *PayGoodsUpdateReq) (*PayGoodsUpdateResp, error) {
|
|
out := new(PayGoodsUpdateResp)
|
|
err := doRpcRequest(ctx, c.client, 0, "PayGoods.update", in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *payGoodsRpcClient) GetList(ctx context.Context, in *PayGoodsGetListReq) (*PayGoodsGetListResp, error) {
|
|
out := new(PayGoodsGetListResp)
|
|
err := doRpcRequest(ctx, c.client, 0, "PayGoods.getList", in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *payGoodsRpcClient) Close(ctx context.Context, in *PayGoodsCloseReq) (*PayGoodsCloseResp, error) {
|
|
out := new(PayGoodsCloseResp)
|
|
err := doRpcRequest(ctx, c.client, 0, "PayGoods.close", in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *payGoodsRpcClient) Open(ctx context.Context, in *PayGoodsOpenReq) (*PayGoodsOpenResp, error) {
|
|
out := new(PayGoodsOpenResp)
|
|
err := doRpcRequest(ctx, c.client, 0, "PayGoods.open", in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// =====
|
|
// Utils
|
|
// =====
|
|
|
|
func doRpcRequest(ctx context.Context, client *liverpc.Client, version int, method string, in, out proto.Message) (err error) {
|
|
err = client.Call(ctx, version, method, in, out)
|
|
return
|
|
}
|