Gift.liverpc.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
  2. // source: v1/Gift.proto
  3. /*
  4. Package v1 is a generated liverpc stub package.
  5. This code was generated with go-common/app/tool/liverpc/protoc-gen-liverpc v0.1.
  6. It is generated from these files:
  7. v1/Gift.proto
  8. */
  9. package v1
  10. import context "context"
  11. import proto "github.com/golang/protobuf/proto"
  12. import "go-common/library/net/rpc/liverpc"
  13. var _ proto.Message // generate to suppress unused imports
  14. // Imports only used by utility functions:
  15. // ==============
  16. // Gift Interface
  17. // ==============
  18. type Gift interface {
  19. // * 增加包裹道具
  20. //
  21. AddFreeGift(context.Context, *GiftAddFreeGiftReq) (*GiftAddFreeGiftResp, error)
  22. }
  23. // ====================
  24. // Gift Live Rpc Client
  25. // ====================
  26. type giftRpcClient struct {
  27. client *liverpc.Client
  28. }
  29. // NewGiftRpcClient creates a Rpc client that implements the Gift interface.
  30. // It communicates using Rpc and can be configured with a custom HTTPClient.
  31. func NewGiftRpcClient(client *liverpc.Client) Gift {
  32. return &giftRpcClient{
  33. client: client,
  34. }
  35. }
  36. func (c *giftRpcClient) AddFreeGift(ctx context.Context, in *GiftAddFreeGiftReq) (*GiftAddFreeGiftResp, error) {
  37. out := new(GiftAddFreeGiftResp)
  38. err := doRpcRequest(ctx, c.client, 1, "Gift.addFreeGift", in, out)
  39. if err != nil {
  40. return nil, err
  41. }
  42. return out, nil
  43. }
  44. // =====
  45. // Utils
  46. // =====
  47. func doRpcRequest(ctx context.Context, client *liverpc.Client, version int, method string, in, out proto.Message) (err error) {
  48. err = client.Call(ctx, version, method, in, out)
  49. return
  50. }