Medal.liverpc.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
  2. // source: v1/Medal.proto
  3. package v1
  4. import context "context"
  5. import proto "github.com/golang/protobuf/proto"
  6. import "go-common/library/net/rpc/liverpc"
  7. var _ proto.Message // generate to suppress unused imports
  8. // ===============
  9. // Medal Interface
  10. // ===============
  11. type Medal interface {
  12. // * up主开启勋章
  13. //
  14. Create(context.Context, *MedalCreateReq) (*MedalCreateResp, error)
  15. // * 获取up主自己的勋章,更严格的类型
  16. //
  17. Query(context.Context, *MedalQueryReq) (*MedalQueryResp, error)
  18. // * 根据ID查询勋章详情,返回严格的类型
  19. //
  20. QueryId(context.Context, *MedalQueryIdReq) (*MedalQueryIdResp, error)
  21. }
  22. // =====================
  23. // Medal Live Rpc Client
  24. // =====================
  25. type medalRpcClient struct {
  26. client *liverpc.Client
  27. }
  28. // NewMedalRpcClient creates a Rpc client that implements the Medal interface.
  29. // It communicates using Rpc and can be configured with a custom HTTPClient.
  30. func NewMedalRpcClient(client *liverpc.Client) Medal {
  31. return &medalRpcClient{
  32. client: client,
  33. }
  34. }
  35. func (c *medalRpcClient) Create(ctx context.Context, in *MedalCreateReq) (*MedalCreateResp, error) {
  36. out := new(MedalCreateResp)
  37. err := doRpcRequest(ctx, c.client, 1, "Medal.create", in, out)
  38. if err != nil {
  39. return nil, err
  40. }
  41. return out, nil
  42. }
  43. func (c *medalRpcClient) Query(ctx context.Context, in *MedalQueryReq) (*MedalQueryResp, error) {
  44. out := new(MedalQueryResp)
  45. err := doRpcRequest(ctx, c.client, 1, "Medal.query", in, out)
  46. if err != nil {
  47. return nil, err
  48. }
  49. return out, nil
  50. }
  51. func (c *medalRpcClient) QueryId(ctx context.Context, in *MedalQueryIdReq) (*MedalQueryIdResp, error) {
  52. out := new(MedalQueryIdResp)
  53. err := doRpcRequest(ctx, c.client, 1, "Medal.query_id", in, out)
  54. if err != nil {
  55. return nil, err
  56. }
  57. return out, nil
  58. }