微信接口的RPC包
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

222 lines
6.4 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. // Code generated by protoc-gen-go.
  2. // source: weixin.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package weixinrpc is a generated protocol buffer package.
  6. It is generated from these files:
  7. weixin.proto
  8. It has these top-level messages:
  9. Request
  10. Response
  11. */
  12. package weixinrpc
  13. import proto "github.com/chai2010/protorpc/proto"
  14. import math "math"
  15. import "io"
  16. import "log"
  17. import "net"
  18. import "net/rpc"
  19. import "time"
  20. import protorpc "github.com/chai2010/protorpc"
  21. // Reference imports to suppress errors if they are not otherwise used.
  22. var _ = proto.Marshal
  23. var _ = math.Inf
  24. // 配置信息请求结构
  25. type Request struct {
  26. Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
  27. Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
  28. Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
  29. XXX_unrecognized []byte `json:"-"`
  30. }
  31. func (m *Request) Reset() { *m = Request{} }
  32. func (m *Request) String() string { return proto.CompactTextString(m) }
  33. func (*Request) ProtoMessage() {}
  34. func (m *Request) GetData() string {
  35. if m != nil && m.Data != nil {
  36. return *m.Data
  37. }
  38. return ""
  39. }
  40. func (m *Request) GetTime() string {
  41. if m != nil && m.Time != nil {
  42. return *m.Time
  43. }
  44. return ""
  45. }
  46. func (m *Request) GetSign() string {
  47. if m != nil && m.Sign != nil {
  48. return *m.Sign
  49. }
  50. return ""
  51. }
  52. // 配置信息响应结构
  53. type Response struct {
  54. Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
  55. Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
  56. Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
  57. XXX_unrecognized []byte `json:"-"`
  58. }
  59. func (m *Response) Reset() { *m = Response{} }
  60. func (m *Response) String() string { return proto.CompactTextString(m) }
  61. func (*Response) ProtoMessage() {}
  62. func (m *Response) GetData() string {
  63. if m != nil && m.Data != nil {
  64. return *m.Data
  65. }
  66. return ""
  67. }
  68. func (m *Response) GetTime() string {
  69. if m != nil && m.Time != nil {
  70. return *m.Time
  71. }
  72. return ""
  73. }
  74. func (m *Response) GetSign() string {
  75. if m != nil && m.Sign != nil {
  76. return *m.Sign
  77. }
  78. return ""
  79. }
  80. func init() {
  81. }
  82. type WeixinRpcService interface {
  83. GetAccessToken(in *Request, out *Response) error
  84. SendMiniappSubscribeMessage(in *Request, out *Response) error
  85. SendUniformMessage(in *Request, out *Response) error
  86. GetMiniAppOpenid(in *Request, out *Response) error
  87. GetMpOpenid(in *Request, out *Response) error
  88. GetAppOpenid(in *Request, out *Response) error
  89. GetMpUserInfo(in *Request, out *Response) error
  90. GetMiniappQrcode(in *Request, out *Response) error
  91. }
  92. // AcceptWeixinRpcServiceClient accepts connections on the listener and serves requests
  93. // for each incoming connection. Accept blocks; the caller typically
  94. // invokes it in a go statement.
  95. func AcceptWeixinRpcServiceClient(lis net.Listener, x WeixinRpcService) {
  96. srv := rpc.NewServer()
  97. if err := srv.RegisterName("WeixinRpcService", x); err != nil {
  98. log.Fatal(err)
  99. }
  100. for {
  101. conn, err := lis.Accept()
  102. if err != nil {
  103. log.Fatalf("lis.Accept(): %v\n", err)
  104. }
  105. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  106. }
  107. }
  108. // RegisterWeixinRpcService publish the given WeixinRpcService implementation on the server.
  109. func RegisterWeixinRpcService(srv *rpc.Server, x WeixinRpcService) error {
  110. if err := srv.RegisterName("WeixinRpcService", x); err != nil {
  111. return err
  112. }
  113. return nil
  114. }
  115. // NewWeixinRpcServiceServer returns a new WeixinRpcService Server.
  116. func NewWeixinRpcServiceServer(x WeixinRpcService) *rpc.Server {
  117. srv := rpc.NewServer()
  118. if err := srv.RegisterName("WeixinRpcService", x); err != nil {
  119. log.Fatal(err)
  120. }
  121. return srv
  122. }
  123. // ListenAndServeWeixinRpcService listen announces on the local network address laddr
  124. // and serves the given WeixinRpcService implementation.
  125. func ListenAndServeWeixinRpcService(network, addr string, x WeixinRpcService) error {
  126. lis, err := net.Listen(network, addr)
  127. if err != nil {
  128. return err
  129. }
  130. defer lis.Close()
  131. srv := rpc.NewServer()
  132. if err := srv.RegisterName("WeixinRpcService", x); err != nil {
  133. return err
  134. }
  135. for {
  136. conn, err := lis.Accept()
  137. if err != nil {
  138. log.Fatalf("lis.Accept(): %v\n", err)
  139. }
  140. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  141. }
  142. }
  143. type WeixinRpcServiceClient struct {
  144. *rpc.Client
  145. }
  146. // NewWeixinRpcServiceClient returns a WeixinRpcService rpc.Client and stub to handle
  147. // requests to the set of WeixinRpcService at the other end of the connection.
  148. func NewWeixinRpcServiceClient(conn io.ReadWriteCloser) (*WeixinRpcServiceClient, *rpc.Client) {
  149. c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
  150. return &WeixinRpcServiceClient{c}, c
  151. }
  152. func (c *WeixinRpcServiceClient) GetAccessToken(in *Request, out *Response) error {
  153. return c.Call("WeixinRpcService.GetAccessToken", in, out)
  154. }
  155. func (c *WeixinRpcServiceClient) SendMiniappSubscribeMessage(in *Request, out *Response) error {
  156. return c.Call("WeixinRpcService.SendMiniappSubscribeMessage", in, out)
  157. }
  158. func (c *WeixinRpcServiceClient) SendUniformMessage(in *Request, out *Response) error {
  159. return c.Call("WeixinRpcService.SendUniformMessage", in, out)
  160. }
  161. func (c *WeixinRpcServiceClient) GetMiniAppOpenid(in *Request, out *Response) error {
  162. return c.Call("WeixinRpcService.GetMiniAppOpenid", in, out)
  163. }
  164. func (c *WeixinRpcServiceClient) GetMpOpenid(in *Request, out *Response) error {
  165. return c.Call("WeixinRpcService.GetMpOpenid", in, out)
  166. }
  167. func (c *WeixinRpcServiceClient) GetAppOpenid(in *Request, out *Response) error {
  168. return c.Call("WeixinRpcService.GetAppOpenid", in, out)
  169. }
  170. func (c *WeixinRpcServiceClient) GetMpUserInfo(in *Request, out *Response) error {
  171. return c.Call("WeixinRpcService.GetMpUserInfo", in, out)
  172. }
  173. func (c *WeixinRpcServiceClient) GetMiniappQrcode(in *Request, out *Response) error {
  174. return c.Call("WeixinRpcService.GetMiniappQrcode", in, out)
  175. }
  176. // DialWeixinRpcService connects to an WeixinRpcService at the specified network address.
  177. func DialWeixinRpcService(network, addr string) (*WeixinRpcServiceClient, *rpc.Client, error) {
  178. c, err := protorpc.Dial(network, addr)
  179. if err != nil {
  180. return nil, nil, err
  181. }
  182. return &WeixinRpcServiceClient{c}, c, nil
  183. }
  184. // DialWeixinRpcServiceTimeout connects to an WeixinRpcService at the specified network address.
  185. func DialWeixinRpcServiceTimeout(network, addr string,
  186. timeout time.Duration) (*WeixinRpcServiceClient, *rpc.Client, error) {
  187. c, err := protorpc.DialTimeout(network, addr, timeout)
  188. if err != nil {
  189. return nil, nil, err
  190. }
  191. return &WeixinRpcServiceClient{c}, c, nil
  192. }