From 64e9e812e90781c57f7dbce878afffaace7fac10 Mon Sep 17 00:00:00 2001 From: Changhua Date: Fri, 20 Jan 2023 11:33:47 +0800 Subject: [PATCH] Add Node.js client --- nodejs/TEQuant.jpeg | Bin 0 -> 40316 bytes nodejs/package.json | 45 + nodejs/prettier.config.js | 7 + nodejs/proto/index.js | 8 + nodejs/proto/index.ts | 5 + nodejs/proto/wcf.proto | 88 + nodejs/proto/wcf_grpc_pb.d.ts | 226 ++ nodejs/proto/wcf_grpc_pb.js | 286 ++ nodejs/proto/wcf_pb.d.ts | 421 +++ nodejs/proto/wcf_pb.js | 3376 ++++++++++++++++++++ nodejs/src/commands/base-command.ts | 20 + nodejs/src/commands/index.ts | 29 + nodejs/src/commands/rock-scissors-paper.ts | 38 + nodejs/src/commands/stock.ts | 28 + nodejs/src/index.ts | 57 + nodejs/src/utils/log.ts | 11 + nodejs/src/utils/misic.ts | 20 + nodejs/src/wcf/index.ts | 55 + nodejs/src/wcf/win32.ts | 18 + nodejs/tsconfig.json | 103 + 20 files changed, 4841 insertions(+) create mode 100755 nodejs/TEQuant.jpeg create mode 100755 nodejs/package.json create mode 100755 nodejs/prettier.config.js create mode 100755 nodejs/proto/index.js create mode 100755 nodejs/proto/index.ts create mode 100755 nodejs/proto/wcf.proto create mode 100755 nodejs/proto/wcf_grpc_pb.d.ts create mode 100755 nodejs/proto/wcf_grpc_pb.js create mode 100755 nodejs/proto/wcf_pb.d.ts create mode 100755 nodejs/proto/wcf_pb.js create mode 100755 nodejs/src/commands/base-command.ts create mode 100755 nodejs/src/commands/index.ts create mode 100755 nodejs/src/commands/rock-scissors-paper.ts create mode 100755 nodejs/src/commands/stock.ts create mode 100755 nodejs/src/index.ts create mode 100755 nodejs/src/utils/log.ts create mode 100755 nodejs/src/utils/misic.ts create mode 100755 nodejs/src/wcf/index.ts create mode 100755 nodejs/src/wcf/win32.ts create mode 100755 nodejs/tsconfig.json diff --git a/nodejs/TEQuant.jpeg b/nodejs/TEQuant.jpeg new file m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3BLH#p zP&PQ;P7N#?oQ*uiXmFsr%DrpnpZxft1y%*I6X7aSVLUmm&3x5Bt^lGGyjAj8mp6@L zkb;EcCd1uRcK(Fr44m#Eae2V0|I*@E zIQi4E^3IvIR^qQP9iRqjW!?KHwCJZi5WsWICVTRQ8*`OnrjJcyifMZdgL6!!T?Wq@ zA`cpJgif%5XJSW>`Nr$VDB!^MCXG zV(fS4M|S^Vq43htDG301J2Il_3(ZE7wng~kt*`C{#7q^LggT=4A{O7L)310aC{%@v zDtQzNN~8)&fg{FIc7+ra#A9+> { +}; +exports.protoIndex = protoIndex; diff --git a/nodejs/proto/index.ts b/nodejs/proto/index.ts new file mode 100755 index 0000000..f9e4e18 --- /dev/null +++ b/nodejs/proto/index.ts @@ -0,0 +1,5 @@ +import './wcf_grpc_pb'; +import './wcf_pb'; + +export const protoIndex:any = ():void => { +}; diff --git a/nodejs/proto/wcf.proto b/nodejs/proto/wcf.proto new file mode 100755 index 0000000..68431d0 --- /dev/null +++ b/nodejs/proto/wcf.proto @@ -0,0 +1,88 @@ +syntax = "proto3"; + +package wcf; +option java_package = "com.iamteer.wcf"; + +service Wcf { + rpc RpcIsLogin(Empty) returns (Response) {} + rpc RpcGetSelfWxid(Empty) returns (String) {} + rpc RpcEnableRecvMsg(Empty) returns (stream WxMsg) {} + rpc RpcDisableRecvMsg(Empty) returns (Response) {} + rpc RpcSendTextMsg(TextMsg) returns (Response) {} + rpc RpcSendImageMsg(ImageMsg) returns (Response) {} + rpc RpcGetMsgTypes(Empty) returns (MsgTypes) {} + rpc RpcGetContacts(Empty) returns (Contacts) {} + rpc RpcGetDbNames(Empty) returns (DbNames) {} + rpc RpcGetDbTables(String) returns (DbTables) {} + rpc RpcExecDbQuery(DbQuery) returns (DbRows) {} + rpc RpcAcceptNewFriend(Verification) returns (Response) {} +} + +message Empty {} + +message WxMsg { + bool is_self = 1; // 是否自己发送的 + bool is_group = 2; // 是否群消息 + int32 type = 3; // 消息类型 + string id = 4; // 消息 id + string xml = 5; // 消息 xml + string sender = 6; // 消息发送者 + string roomid = 7; // 群 id(如果是群消息的话) + string content = 8; // 消息内容 +} + +message Response { + int32 status = 1; // 状态码 +} + +message TextMsg { + string msg = 1; // 要发送的消息内容 + string receiver = 2; // 消息接收人,当为群时可@ + string aters = 3; // 要@的人列表,逗号分隔 +} + +message ImageMsg { + string path = 1; // 要发送的图片的路径 + string receiver = 2; // 消息接收人 +} + +message MsgTypes { map types = 1; } + +message Contact { + string wxid = 1; // 微信 id + string code = 2; // 微信号 + string name = 3; // 微信昵称 + string country = 4; // 国家 + string province = 5; // 省/州 + string city = 6; // 城市 + int32 gender = 7; // 性别 +} +message Contacts { repeated Contact contacts = 1; } + +message DbNames { repeated string names = 1; } + +message String { string str = 1; } + +message DbTable { + string name = 1; // 表名 + string sql = 2; // 建表 SQL +} +message DbTables { repeated DbTable tables = 1; } + +message DbQuery { + string db = 1; // 目标数据库 + string sql = 2; // 查询 SQL +} + +message DbField { + int32 type = 1; // 字段类型 + string column = 2; // 字段名称 + bytes content = 3; // 字段内容 +} +message DbRow { repeated DbField fields = 1; } +message DbRows { repeated DbRow rows = 1; } + +message Verification { + string v3 = 1; + string v4 = 2; +} diff --git a/nodejs/proto/wcf_grpc_pb.d.ts b/nodejs/proto/wcf_grpc_pb.d.ts new file mode 100755 index 0000000..1fc60fe --- /dev/null +++ b/nodejs/proto/wcf_grpc_pb.d.ts @@ -0,0 +1,226 @@ +// package: wcf +// file: wcf.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as grpc from "grpc"; +import * as wcf_pb from "./wcf_pb"; + +interface IWcfService extends grpc.ServiceDefinition { + rpcIsLogin: IWcfService_IRpcIsLogin; + rpcGetSelfWxid: IWcfService_IRpcGetSelfWxid; + rpcEnableRecvMsg: IWcfService_IRpcEnableRecvMsg; + rpcDisableRecvMsg: IWcfService_IRpcDisableRecvMsg; + rpcSendTextMsg: IWcfService_IRpcSendTextMsg; + rpcSendImageMsg: IWcfService_IRpcSendImageMsg; + rpcGetMsgTypes: IWcfService_IRpcGetMsgTypes; + rpcGetContacts: IWcfService_IRpcGetContacts; + rpcGetDbNames: IWcfService_IRpcGetDbNames; + rpcGetDbTables: IWcfService_IRpcGetDbTables; + rpcExecDbQuery: IWcfService_IRpcExecDbQuery; + rpcAcceptNewFriend: IWcfService_IRpcAcceptNewFriend; +} + +interface IWcfService_IRpcIsLogin extends grpc.MethodDefinition { + path: "/wcf.Wcf/RpcIsLogin"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IWcfService_IRpcGetSelfWxid extends grpc.MethodDefinition { + path: "/wcf.Wcf/RpcGetSelfWxid"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IWcfService_IRpcEnableRecvMsg extends grpc.MethodDefinition { + path: "/wcf.Wcf/RpcEnableRecvMsg"; + requestStream: false; + responseStream: true; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IWcfService_IRpcDisableRecvMsg extends grpc.MethodDefinition { + path: "/wcf.Wcf/RpcDisableRecvMsg"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IWcfService_IRpcSendTextMsg extends grpc.MethodDefinition { + path: "/wcf.Wcf/RpcSendTextMsg"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IWcfService_IRpcSendImageMsg extends grpc.MethodDefinition { + path: "/wcf.Wcf/RpcSendImageMsg"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IWcfService_IRpcGetMsgTypes extends grpc.MethodDefinition { + path: "/wcf.Wcf/RpcGetMsgTypes"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IWcfService_IRpcGetContacts extends grpc.MethodDefinition { + path: "/wcf.Wcf/RpcGetContacts"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IWcfService_IRpcGetDbNames extends grpc.MethodDefinition { + path: "/wcf.Wcf/RpcGetDbNames"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IWcfService_IRpcGetDbTables extends grpc.MethodDefinition { + path: "/wcf.Wcf/RpcGetDbTables"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IWcfService_IRpcExecDbQuery extends grpc.MethodDefinition { + path: "/wcf.Wcf/RpcExecDbQuery"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IWcfService_IRpcAcceptNewFriend extends grpc.MethodDefinition { + path: "/wcf.Wcf/RpcAcceptNewFriend"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} + +export const WcfService: IWcfService; + +export interface IWcfServer { + rpcIsLogin: grpc.handleUnaryCall; + rpcGetSelfWxid: grpc.handleUnaryCall; + rpcEnableRecvMsg: grpc.handleServerStreamingCall; + rpcDisableRecvMsg: grpc.handleUnaryCall; + rpcSendTextMsg: grpc.handleUnaryCall; + rpcSendImageMsg: grpc.handleUnaryCall; + rpcGetMsgTypes: grpc.handleUnaryCall; + rpcGetContacts: grpc.handleUnaryCall; + rpcGetDbNames: grpc.handleUnaryCall; + rpcGetDbTables: grpc.handleUnaryCall; + rpcExecDbQuery: grpc.handleUnaryCall; + rpcAcceptNewFriend: grpc.handleUnaryCall; +} + +export interface IWcfClient { + rpcIsLogin(request: wcf_pb.Empty, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcIsLogin(request: wcf_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcIsLogin(request: wcf_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcGetSelfWxid(request: wcf_pb.Empty, callback: (error: grpc.ServiceError | null, response: wcf_pb.String) => void): grpc.ClientUnaryCall; + rpcGetSelfWxid(request: wcf_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.String) => void): grpc.ClientUnaryCall; + rpcGetSelfWxid(request: wcf_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.String) => void): grpc.ClientUnaryCall; + rpcEnableRecvMsg(request: wcf_pb.Empty, options?: Partial): grpc.ClientReadableStream; + rpcEnableRecvMsg(request: wcf_pb.Empty, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + rpcDisableRecvMsg(request: wcf_pb.Empty, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcDisableRecvMsg(request: wcf_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcDisableRecvMsg(request: wcf_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcSendTextMsg(request: wcf_pb.TextMsg, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcSendTextMsg(request: wcf_pb.TextMsg, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcSendTextMsg(request: wcf_pb.TextMsg, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcSendImageMsg(request: wcf_pb.ImageMsg, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcSendImageMsg(request: wcf_pb.ImageMsg, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcSendImageMsg(request: wcf_pb.ImageMsg, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcGetMsgTypes(request: wcf_pb.Empty, callback: (error: grpc.ServiceError | null, response: wcf_pb.MsgTypes) => void): grpc.ClientUnaryCall; + rpcGetMsgTypes(request: wcf_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.MsgTypes) => void): grpc.ClientUnaryCall; + rpcGetMsgTypes(request: wcf_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.MsgTypes) => void): grpc.ClientUnaryCall; + rpcGetContacts(request: wcf_pb.Empty, callback: (error: grpc.ServiceError | null, response: wcf_pb.Contacts) => void): grpc.ClientUnaryCall; + rpcGetContacts(request: wcf_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.Contacts) => void): grpc.ClientUnaryCall; + rpcGetContacts(request: wcf_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.Contacts) => void): grpc.ClientUnaryCall; + rpcGetDbNames(request: wcf_pb.Empty, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbNames) => void): grpc.ClientUnaryCall; + rpcGetDbNames(request: wcf_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbNames) => void): grpc.ClientUnaryCall; + rpcGetDbNames(request: wcf_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbNames) => void): grpc.ClientUnaryCall; + rpcGetDbTables(request: wcf_pb.String, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbTables) => void): grpc.ClientUnaryCall; + rpcGetDbTables(request: wcf_pb.String, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbTables) => void): grpc.ClientUnaryCall; + rpcGetDbTables(request: wcf_pb.String, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbTables) => void): grpc.ClientUnaryCall; + rpcExecDbQuery(request: wcf_pb.DbQuery, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbRows) => void): grpc.ClientUnaryCall; + rpcExecDbQuery(request: wcf_pb.DbQuery, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbRows) => void): grpc.ClientUnaryCall; + rpcExecDbQuery(request: wcf_pb.DbQuery, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbRows) => void): grpc.ClientUnaryCall; + rpcAcceptNewFriend(request: wcf_pb.Verification, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcAcceptNewFriend(request: wcf_pb.Verification, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + rpcAcceptNewFriend(request: wcf_pb.Verification, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; +} + +export class WcfClient extends grpc.Client implements IWcfClient { + constructor(address: string, credentials: grpc.ChannelCredentials, options?: object); + public rpcIsLogin(request: wcf_pb.Empty, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcIsLogin(request: wcf_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcIsLogin(request: wcf_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcGetSelfWxid(request: wcf_pb.Empty, callback: (error: grpc.ServiceError | null, response: wcf_pb.String) => void): grpc.ClientUnaryCall; + public rpcGetSelfWxid(request: wcf_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.String) => void): grpc.ClientUnaryCall; + public rpcGetSelfWxid(request: wcf_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.String) => void): grpc.ClientUnaryCall; + public rpcEnableRecvMsg(request: wcf_pb.Empty, options?: Partial): grpc.ClientReadableStream; + public rpcEnableRecvMsg(request: wcf_pb.Empty, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; + public rpcDisableRecvMsg(request: wcf_pb.Empty, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcDisableRecvMsg(request: wcf_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcDisableRecvMsg(request: wcf_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcSendTextMsg(request: wcf_pb.TextMsg, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcSendTextMsg(request: wcf_pb.TextMsg, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcSendTextMsg(request: wcf_pb.TextMsg, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcSendImageMsg(request: wcf_pb.ImageMsg, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcSendImageMsg(request: wcf_pb.ImageMsg, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcSendImageMsg(request: wcf_pb.ImageMsg, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcGetMsgTypes(request: wcf_pb.Empty, callback: (error: grpc.ServiceError | null, response: wcf_pb.MsgTypes) => void): grpc.ClientUnaryCall; + public rpcGetMsgTypes(request: wcf_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.MsgTypes) => void): grpc.ClientUnaryCall; + public rpcGetMsgTypes(request: wcf_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.MsgTypes) => void): grpc.ClientUnaryCall; + public rpcGetContacts(request: wcf_pb.Empty, callback: (error: grpc.ServiceError | null, response: wcf_pb.Contacts) => void): grpc.ClientUnaryCall; + public rpcGetContacts(request: wcf_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.Contacts) => void): grpc.ClientUnaryCall; + public rpcGetContacts(request: wcf_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.Contacts) => void): grpc.ClientUnaryCall; + public rpcGetDbNames(request: wcf_pb.Empty, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbNames) => void): grpc.ClientUnaryCall; + public rpcGetDbNames(request: wcf_pb.Empty, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbNames) => void): grpc.ClientUnaryCall; + public rpcGetDbNames(request: wcf_pb.Empty, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbNames) => void): grpc.ClientUnaryCall; + public rpcGetDbTables(request: wcf_pb.String, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbTables) => void): grpc.ClientUnaryCall; + public rpcGetDbTables(request: wcf_pb.String, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbTables) => void): grpc.ClientUnaryCall; + public rpcGetDbTables(request: wcf_pb.String, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbTables) => void): grpc.ClientUnaryCall; + public rpcExecDbQuery(request: wcf_pb.DbQuery, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbRows) => void): grpc.ClientUnaryCall; + public rpcExecDbQuery(request: wcf_pb.DbQuery, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbRows) => void): grpc.ClientUnaryCall; + public rpcExecDbQuery(request: wcf_pb.DbQuery, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.DbRows) => void): grpc.ClientUnaryCall; + public rpcAcceptNewFriend(request: wcf_pb.Verification, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcAcceptNewFriend(request: wcf_pb.Verification, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; + public rpcAcceptNewFriend(request: wcf_pb.Verification, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: wcf_pb.Response) => void): grpc.ClientUnaryCall; +} diff --git a/nodejs/proto/wcf_grpc_pb.js b/nodejs/proto/wcf_grpc_pb.js new file mode 100755 index 0000000..f46e0f4 --- /dev/null +++ b/nodejs/proto/wcf_grpc_pb.js @@ -0,0 +1,286 @@ +// GENERATED CODE -- DO NOT EDIT! + +'use strict'; +var grpc = require('grpc'); +var wcf_pb = require('./wcf_pb.js'); + +function serialize_wcf_Contacts(arg) { + if (!(arg instanceof wcf_pb.Contacts)) { + throw new Error('Expected argument of type wcf.Contacts'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_wcf_Contacts(buffer_arg) { + return wcf_pb.Contacts.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_wcf_DbNames(arg) { + if (!(arg instanceof wcf_pb.DbNames)) { + throw new Error('Expected argument of type wcf.DbNames'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_wcf_DbNames(buffer_arg) { + return wcf_pb.DbNames.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_wcf_DbQuery(arg) { + if (!(arg instanceof wcf_pb.DbQuery)) { + throw new Error('Expected argument of type wcf.DbQuery'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_wcf_DbQuery(buffer_arg) { + return wcf_pb.DbQuery.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_wcf_DbRows(arg) { + if (!(arg instanceof wcf_pb.DbRows)) { + throw new Error('Expected argument of type wcf.DbRows'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_wcf_DbRows(buffer_arg) { + return wcf_pb.DbRows.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_wcf_DbTables(arg) { + if (!(arg instanceof wcf_pb.DbTables)) { + throw new Error('Expected argument of type wcf.DbTables'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_wcf_DbTables(buffer_arg) { + return wcf_pb.DbTables.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_wcf_Empty(arg) { + if (!(arg instanceof wcf_pb.Empty)) { + throw new Error('Expected argument of type wcf.Empty'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_wcf_Empty(buffer_arg) { + return wcf_pb.Empty.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_wcf_ImageMsg(arg) { + if (!(arg instanceof wcf_pb.ImageMsg)) { + throw new Error('Expected argument of type wcf.ImageMsg'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_wcf_ImageMsg(buffer_arg) { + return wcf_pb.ImageMsg.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_wcf_MsgTypes(arg) { + if (!(arg instanceof wcf_pb.MsgTypes)) { + throw new Error('Expected argument of type wcf.MsgTypes'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_wcf_MsgTypes(buffer_arg) { + return wcf_pb.MsgTypes.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_wcf_Response(arg) { + if (!(arg instanceof wcf_pb.Response)) { + throw new Error('Expected argument of type wcf.Response'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_wcf_Response(buffer_arg) { + return wcf_pb.Response.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_wcf_String(arg) { + if (!(arg instanceof wcf_pb.String)) { + throw new Error('Expected argument of type wcf.String'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_wcf_String(buffer_arg) { + return wcf_pb.String.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_wcf_TextMsg(arg) { + if (!(arg instanceof wcf_pb.TextMsg)) { + throw new Error('Expected argument of type wcf.TextMsg'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_wcf_TextMsg(buffer_arg) { + return wcf_pb.TextMsg.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_wcf_Verification(arg) { + if (!(arg instanceof wcf_pb.Verification)) { + throw new Error('Expected argument of type wcf.Verification'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_wcf_Verification(buffer_arg) { + return wcf_pb.Verification.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_wcf_WxMsg(arg) { + if (!(arg instanceof wcf_pb.WxMsg)) { + throw new Error('Expected argument of type wcf.WxMsg'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_wcf_WxMsg(buffer_arg) { + return wcf_pb.WxMsg.deserializeBinary(new Uint8Array(buffer_arg)); +} + + +var WcfService = exports.WcfService = { + rpcIsLogin: { + path: '/wcf.Wcf/RpcIsLogin', + requestStream: false, + responseStream: false, + requestType: wcf_pb.Empty, + responseType: wcf_pb.Response, + requestSerialize: serialize_wcf_Empty, + requestDeserialize: deserialize_wcf_Empty, + responseSerialize: serialize_wcf_Response, + responseDeserialize: deserialize_wcf_Response, + }, + rpcGetSelfWxid: { + path: '/wcf.Wcf/RpcGetSelfWxid', + requestStream: false, + responseStream: false, + requestType: wcf_pb.Empty, + responseType: wcf_pb.String, + requestSerialize: serialize_wcf_Empty, + requestDeserialize: deserialize_wcf_Empty, + responseSerialize: serialize_wcf_String, + responseDeserialize: deserialize_wcf_String, + }, + rpcEnableRecvMsg: { + path: '/wcf.Wcf/RpcEnableRecvMsg', + requestStream: false, + responseStream: true, + requestType: wcf_pb.Empty, + responseType: wcf_pb.WxMsg, + requestSerialize: serialize_wcf_Empty, + requestDeserialize: deserialize_wcf_Empty, + responseSerialize: serialize_wcf_WxMsg, + responseDeserialize: deserialize_wcf_WxMsg, + }, + rpcDisableRecvMsg: { + path: '/wcf.Wcf/RpcDisableRecvMsg', + requestStream: false, + responseStream: false, + requestType: wcf_pb.Empty, + responseType: wcf_pb.Response, + requestSerialize: serialize_wcf_Empty, + requestDeserialize: deserialize_wcf_Empty, + responseSerialize: serialize_wcf_Response, + responseDeserialize: deserialize_wcf_Response, + }, + rpcSendTextMsg: { + path: '/wcf.Wcf/RpcSendTextMsg', + requestStream: false, + responseStream: false, + requestType: wcf_pb.TextMsg, + responseType: wcf_pb.Response, + requestSerialize: serialize_wcf_TextMsg, + requestDeserialize: deserialize_wcf_TextMsg, + responseSerialize: serialize_wcf_Response, + responseDeserialize: deserialize_wcf_Response, + }, + rpcSendImageMsg: { + path: '/wcf.Wcf/RpcSendImageMsg', + requestStream: false, + responseStream: false, + requestType: wcf_pb.ImageMsg, + responseType: wcf_pb.Response, + requestSerialize: serialize_wcf_ImageMsg, + requestDeserialize: deserialize_wcf_ImageMsg, + responseSerialize: serialize_wcf_Response, + responseDeserialize: deserialize_wcf_Response, + }, + rpcGetMsgTypes: { + path: '/wcf.Wcf/RpcGetMsgTypes', + requestStream: false, + responseStream: false, + requestType: wcf_pb.Empty, + responseType: wcf_pb.MsgTypes, + requestSerialize: serialize_wcf_Empty, + requestDeserialize: deserialize_wcf_Empty, + responseSerialize: serialize_wcf_MsgTypes, + responseDeserialize: deserialize_wcf_MsgTypes, + }, + rpcGetContacts: { + path: '/wcf.Wcf/RpcGetContacts', + requestStream: false, + responseStream: false, + requestType: wcf_pb.Empty, + responseType: wcf_pb.Contacts, + requestSerialize: serialize_wcf_Empty, + requestDeserialize: deserialize_wcf_Empty, + responseSerialize: serialize_wcf_Contacts, + responseDeserialize: deserialize_wcf_Contacts, + }, + rpcGetDbNames: { + path: '/wcf.Wcf/RpcGetDbNames', + requestStream: false, + responseStream: false, + requestType: wcf_pb.Empty, + responseType: wcf_pb.DbNames, + requestSerialize: serialize_wcf_Empty, + requestDeserialize: deserialize_wcf_Empty, + responseSerialize: serialize_wcf_DbNames, + responseDeserialize: deserialize_wcf_DbNames, + }, + rpcGetDbTables: { + path: '/wcf.Wcf/RpcGetDbTables', + requestStream: false, + responseStream: false, + requestType: wcf_pb.String, + responseType: wcf_pb.DbTables, + requestSerialize: serialize_wcf_String, + requestDeserialize: deserialize_wcf_String, + responseSerialize: serialize_wcf_DbTables, + responseDeserialize: deserialize_wcf_DbTables, + }, + rpcExecDbQuery: { + path: '/wcf.Wcf/RpcExecDbQuery', + requestStream: false, + responseStream: false, + requestType: wcf_pb.DbQuery, + responseType: wcf_pb.DbRows, + requestSerialize: serialize_wcf_DbQuery, + requestDeserialize: deserialize_wcf_DbQuery, + responseSerialize: serialize_wcf_DbRows, + responseDeserialize: deserialize_wcf_DbRows, + }, + rpcAcceptNewFriend: { + path: '/wcf.Wcf/RpcAcceptNewFriend', + requestStream: false, + responseStream: false, + requestType: wcf_pb.Verification, + responseType: wcf_pb.Response, + requestSerialize: serialize_wcf_Verification, + requestDeserialize: deserialize_wcf_Verification, + responseSerialize: serialize_wcf_Response, + responseDeserialize: deserialize_wcf_Response, + }, +}; + +exports.WcfClient = grpc.makeGenericClientConstructor(WcfService); diff --git a/nodejs/proto/wcf_pb.d.ts b/nodejs/proto/wcf_pb.d.ts new file mode 100755 index 0000000..f01fbbe --- /dev/null +++ b/nodejs/proto/wcf_pb.d.ts @@ -0,0 +1,421 @@ +// package: wcf +// file: wcf.proto + +/* tslint:disable */ +/* eslint-disable */ + +import * as jspb from "google-protobuf"; + +export class Empty extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Empty.AsObject; + static toObject(includeInstance: boolean, msg: Empty): Empty.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Empty, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Empty; + static deserializeBinaryFromReader(message: Empty, reader: jspb.BinaryReader): Empty; +} + +export namespace Empty { + export type AsObject = { + } +} + +export class WxMsg extends jspb.Message { + getIsSelf(): boolean; + setIsSelf(value: boolean): WxMsg; + getIsGroup(): boolean; + setIsGroup(value: boolean): WxMsg; + getType(): number; + setType(value: number): WxMsg; + getId(): string; + setId(value: string): WxMsg; + getXml(): string; + setXml(value: string): WxMsg; + getSender(): string; + setSender(value: string): WxMsg; + getRoomid(): string; + setRoomid(value: string): WxMsg; + getContent(): string; + setContent(value: string): WxMsg; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): WxMsg.AsObject; + static toObject(includeInstance: boolean, msg: WxMsg): WxMsg.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: WxMsg, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WxMsg; + static deserializeBinaryFromReader(message: WxMsg, reader: jspb.BinaryReader): WxMsg; +} + +export namespace WxMsg { + export type AsObject = { + isSelf: boolean, + isGroup: boolean, + type: number, + id: string, + xml: string, + sender: string, + roomid: string, + content: string, + } +} + +export class Response extends jspb.Message { + getStatus(): number; + setStatus(value: number): Response; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Response.AsObject; + static toObject(includeInstance: boolean, msg: Response): Response.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Response, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Response; + static deserializeBinaryFromReader(message: Response, reader: jspb.BinaryReader): Response; +} + +export namespace Response { + export type AsObject = { + status: number, + } +} + +export class TextMsg extends jspb.Message { + getMsg(): string; + setMsg(value: string): TextMsg; + getReceiver(): string; + setReceiver(value: string): TextMsg; + getAters(): string; + setAters(value: string): TextMsg; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): TextMsg.AsObject; + static toObject(includeInstance: boolean, msg: TextMsg): TextMsg.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: TextMsg, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): TextMsg; + static deserializeBinaryFromReader(message: TextMsg, reader: jspb.BinaryReader): TextMsg; +} + +export namespace TextMsg { + export type AsObject = { + msg: string, + receiver: string, + aters: string, + } +} + +export class ImageMsg extends jspb.Message { + getPath(): string; + setPath(value: string): ImageMsg; + getReceiver(): string; + setReceiver(value: string): ImageMsg; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ImageMsg.AsObject; + static toObject(includeInstance: boolean, msg: ImageMsg): ImageMsg.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ImageMsg, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ImageMsg; + static deserializeBinaryFromReader(message: ImageMsg, reader: jspb.BinaryReader): ImageMsg; +} + +export namespace ImageMsg { + export type AsObject = { + path: string, + receiver: string, + } +} + +export class MsgTypes extends jspb.Message { + + getTypesMap(): jspb.Map; + clearTypesMap(): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MsgTypes.AsObject; + static toObject(includeInstance: boolean, msg: MsgTypes): MsgTypes.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MsgTypes, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MsgTypes; + static deserializeBinaryFromReader(message: MsgTypes, reader: jspb.BinaryReader): MsgTypes; +} + +export namespace MsgTypes { + export type AsObject = { + + typesMap: Array<[number, string]>, + } +} + +export class Contact extends jspb.Message { + getWxid(): string; + setWxid(value: string): Contact; + getCode(): string; + setCode(value: string): Contact; + getName(): string; + setName(value: string): Contact; + getCountry(): string; + setCountry(value: string): Contact; + getProvince(): string; + setProvince(value: string): Contact; + getCity(): string; + setCity(value: string): Contact; + getGender(): number; + setGender(value: number): Contact; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Contact.AsObject; + static toObject(includeInstance: boolean, msg: Contact): Contact.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Contact, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Contact; + static deserializeBinaryFromReader(message: Contact, reader: jspb.BinaryReader): Contact; +} + +export namespace Contact { + export type AsObject = { + wxid: string, + code: string, + name: string, + country: string, + province: string, + city: string, + gender: number, + } +} + +export class Contacts extends jspb.Message { + clearContactsList(): void; + getContactsList(): Array; + setContactsList(value: Array): Contacts; + addContacts(value?: Contact, index?: number): Contact; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Contacts.AsObject; + static toObject(includeInstance: boolean, msg: Contacts): Contacts.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Contacts, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Contacts; + static deserializeBinaryFromReader(message: Contacts, reader: jspb.BinaryReader): Contacts; +} + +export namespace Contacts { + export type AsObject = { + contactsList: Array, + } +} + +export class DbNames extends jspb.Message { + clearNamesList(): void; + getNamesList(): Array; + setNamesList(value: Array): DbNames; + addNames(value: string, index?: number): string; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DbNames.AsObject; + static toObject(includeInstance: boolean, msg: DbNames): DbNames.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DbNames, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DbNames; + static deserializeBinaryFromReader(message: DbNames, reader: jspb.BinaryReader): DbNames; +} + +export namespace DbNames { + export type AsObject = { + namesList: Array, + } +} + +export class String extends jspb.Message { + getStr(): string; + setStr(value: string): String; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): String.AsObject; + static toObject(includeInstance: boolean, msg: String): String.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: String, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): String; + static deserializeBinaryFromReader(message: String, reader: jspb.BinaryReader): String; +} + +export namespace String { + export type AsObject = { + str: string, + } +} + +export class DbTable extends jspb.Message { + getName(): string; + setName(value: string): DbTable; + getSql(): string; + setSql(value: string): DbTable; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DbTable.AsObject; + static toObject(includeInstance: boolean, msg: DbTable): DbTable.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DbTable, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DbTable; + static deserializeBinaryFromReader(message: DbTable, reader: jspb.BinaryReader): DbTable; +} + +export namespace DbTable { + export type AsObject = { + name: string, + sql: string, + } +} + +export class DbTables extends jspb.Message { + clearTablesList(): void; + getTablesList(): Array; + setTablesList(value: Array): DbTables; + addTables(value?: DbTable, index?: number): DbTable; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DbTables.AsObject; + static toObject(includeInstance: boolean, msg: DbTables): DbTables.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DbTables, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DbTables; + static deserializeBinaryFromReader(message: DbTables, reader: jspb.BinaryReader): DbTables; +} + +export namespace DbTables { + export type AsObject = { + tablesList: Array, + } +} + +export class DbQuery extends jspb.Message { + getDb(): string; + setDb(value: string): DbQuery; + getSql(): string; + setSql(value: string): DbQuery; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DbQuery.AsObject; + static toObject(includeInstance: boolean, msg: DbQuery): DbQuery.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DbQuery, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DbQuery; + static deserializeBinaryFromReader(message: DbQuery, reader: jspb.BinaryReader): DbQuery; +} + +export namespace DbQuery { + export type AsObject = { + db: string, + sql: string, + } +} + +export class DbField extends jspb.Message { + getType(): number; + setType(value: number): DbField; + getColumn(): string; + setColumn(value: string): DbField; + getContent(): Uint8Array | string; + getContent_asU8(): Uint8Array; + getContent_asB64(): string; + setContent(value: Uint8Array | string): DbField; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DbField.AsObject; + static toObject(includeInstance: boolean, msg: DbField): DbField.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DbField, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DbField; + static deserializeBinaryFromReader(message: DbField, reader: jspb.BinaryReader): DbField; +} + +export namespace DbField { + export type AsObject = { + type: number, + column: string, + content: Uint8Array | string, + } +} + +export class DbRow extends jspb.Message { + clearFieldsList(): void; + getFieldsList(): Array; + setFieldsList(value: Array): DbRow; + addFields(value?: DbField, index?: number): DbField; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DbRow.AsObject; + static toObject(includeInstance: boolean, msg: DbRow): DbRow.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DbRow, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DbRow; + static deserializeBinaryFromReader(message: DbRow, reader: jspb.BinaryReader): DbRow; +} + +export namespace DbRow { + export type AsObject = { + fieldsList: Array, + } +} + +export class DbRows extends jspb.Message { + clearRowsList(): void; + getRowsList(): Array; + setRowsList(value: Array): DbRows; + addRows(value?: DbRow, index?: number): DbRow; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DbRows.AsObject; + static toObject(includeInstance: boolean, msg: DbRows): DbRows.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DbRows, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DbRows; + static deserializeBinaryFromReader(message: DbRows, reader: jspb.BinaryReader): DbRows; +} + +export namespace DbRows { + export type AsObject = { + rowsList: Array, + } +} + +export class Verification extends jspb.Message { + getV3(): string; + setV3(value: string): Verification; + getV4(): string; + setV4(value: string): Verification; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Verification.AsObject; + static toObject(includeInstance: boolean, msg: Verification): Verification.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Verification, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Verification; + static deserializeBinaryFromReader(message: Verification, reader: jspb.BinaryReader): Verification; +} + +export namespace Verification { + export type AsObject = { + v3: string, + v4: string, + } +} diff --git a/nodejs/proto/wcf_pb.js b/nodejs/proto/wcf_pb.js new file mode 100755 index 0000000..7f40abf --- /dev/null +++ b/nodejs/proto/wcf_pb.js @@ -0,0 +1,3376 @@ +// source: wcf.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.wcf.Contact', null, global); +goog.exportSymbol('proto.wcf.Contacts', null, global); +goog.exportSymbol('proto.wcf.DbField', null, global); +goog.exportSymbol('proto.wcf.DbNames', null, global); +goog.exportSymbol('proto.wcf.DbQuery', null, global); +goog.exportSymbol('proto.wcf.DbRow', null, global); +goog.exportSymbol('proto.wcf.DbRows', null, global); +goog.exportSymbol('proto.wcf.DbTable', null, global); +goog.exportSymbol('proto.wcf.DbTables', null, global); +goog.exportSymbol('proto.wcf.Empty', null, global); +goog.exportSymbol('proto.wcf.ImageMsg', null, global); +goog.exportSymbol('proto.wcf.MsgTypes', null, global); +goog.exportSymbol('proto.wcf.Response', null, global); +goog.exportSymbol('proto.wcf.String', null, global); +goog.exportSymbol('proto.wcf.TextMsg', null, global); +goog.exportSymbol('proto.wcf.Verification', null, global); +goog.exportSymbol('proto.wcf.WxMsg', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.Empty = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.wcf.Empty, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.Empty.displayName = 'proto.wcf.Empty'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.WxMsg = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.wcf.WxMsg, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.WxMsg.displayName = 'proto.wcf.WxMsg'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.Response = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.wcf.Response, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.Response.displayName = 'proto.wcf.Response'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.TextMsg = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.wcf.TextMsg, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.TextMsg.displayName = 'proto.wcf.TextMsg'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.ImageMsg = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.wcf.ImageMsg, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.ImageMsg.displayName = 'proto.wcf.ImageMsg'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.MsgTypes = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.wcf.MsgTypes, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.MsgTypes.displayName = 'proto.wcf.MsgTypes'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.Contact = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.wcf.Contact, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.Contact.displayName = 'proto.wcf.Contact'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.Contacts = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.wcf.Contacts.repeatedFields_, null); +}; +goog.inherits(proto.wcf.Contacts, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.Contacts.displayName = 'proto.wcf.Contacts'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.DbNames = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.wcf.DbNames.repeatedFields_, null); +}; +goog.inherits(proto.wcf.DbNames, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.DbNames.displayName = 'proto.wcf.DbNames'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.String = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.wcf.String, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.String.displayName = 'proto.wcf.String'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.DbTable = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.wcf.DbTable, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.DbTable.displayName = 'proto.wcf.DbTable'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.DbTables = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.wcf.DbTables.repeatedFields_, null); +}; +goog.inherits(proto.wcf.DbTables, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.DbTables.displayName = 'proto.wcf.DbTables'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.DbQuery = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.wcf.DbQuery, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.DbQuery.displayName = 'proto.wcf.DbQuery'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.DbField = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.wcf.DbField, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.DbField.displayName = 'proto.wcf.DbField'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.DbRow = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.wcf.DbRow.repeatedFields_, null); +}; +goog.inherits(proto.wcf.DbRow, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.DbRow.displayName = 'proto.wcf.DbRow'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.DbRows = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.wcf.DbRows.repeatedFields_, null); +}; +goog.inherits(proto.wcf.DbRows, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.DbRows.displayName = 'proto.wcf.DbRows'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.wcf.Verification = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.wcf.Verification, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.wcf.Verification.displayName = 'proto.wcf.Verification'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.Empty.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.Empty.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.Empty} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.Empty.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.Empty} + */ +proto.wcf.Empty.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.Empty; + return proto.wcf.Empty.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.Empty} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.Empty} + */ +proto.wcf.Empty.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.Empty.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.Empty.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.Empty} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.Empty.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.WxMsg.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.WxMsg.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.WxMsg} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.WxMsg.toObject = function(includeInstance, msg) { + var f, obj = { + isSelf: jspb.Message.getBooleanFieldWithDefault(msg, 1, false), + isGroup: jspb.Message.getBooleanFieldWithDefault(msg, 2, false), + type: jspb.Message.getFieldWithDefault(msg, 3, 0), + id: jspb.Message.getFieldWithDefault(msg, 4, ""), + xml: jspb.Message.getFieldWithDefault(msg, 5, ""), + sender: jspb.Message.getFieldWithDefault(msg, 6, ""), + roomid: jspb.Message.getFieldWithDefault(msg, 7, ""), + content: jspb.Message.getFieldWithDefault(msg, 8, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.WxMsg} + */ +proto.wcf.WxMsg.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.WxMsg; + return proto.wcf.WxMsg.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.WxMsg} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.WxMsg} + */ +proto.wcf.WxMsg.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsSelf(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsGroup(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt32()); + msg.setType(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setXml(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setSender(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setRoomid(value); + break; + case 8: + var value = /** @type {string} */ (reader.readString()); + msg.setContent(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.WxMsg.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.WxMsg.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.WxMsg} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.WxMsg.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIsSelf(); + if (f) { + writer.writeBool( + 1, + f + ); + } + f = message.getIsGroup(); + if (f) { + writer.writeBool( + 2, + f + ); + } + f = message.getType(); + if (f !== 0) { + writer.writeInt32( + 3, + f + ); + } + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getXml(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = message.getSender(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } + f = message.getRoomid(); + if (f.length > 0) { + writer.writeString( + 7, + f + ); + } + f = message.getContent(); + if (f.length > 0) { + writer.writeString( + 8, + f + ); + } +}; + + +/** + * optional bool is_self = 1; + * @return {boolean} + */ +proto.wcf.WxMsg.prototype.getIsSelf = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.wcf.WxMsg} returns this + */ +proto.wcf.WxMsg.prototype.setIsSelf = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); +}; + + +/** + * optional bool is_group = 2; + * @return {boolean} + */ +proto.wcf.WxMsg.prototype.getIsGroup = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.wcf.WxMsg} returns this + */ +proto.wcf.WxMsg.prototype.setIsGroup = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional int32 type = 3; + * @return {number} + */ +proto.wcf.WxMsg.prototype.getType = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.wcf.WxMsg} returns this + */ +proto.wcf.WxMsg.prototype.setType = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional string id = 4; + * @return {string} + */ +proto.wcf.WxMsg.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.WxMsg} returns this + */ +proto.wcf.WxMsg.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional string xml = 5; + * @return {string} + */ +proto.wcf.WxMsg.prototype.getXml = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.WxMsg} returns this + */ +proto.wcf.WxMsg.prototype.setXml = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + +/** + * optional string sender = 6; + * @return {string} + */ +proto.wcf.WxMsg.prototype.getSender = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.WxMsg} returns this + */ +proto.wcf.WxMsg.prototype.setSender = function(value) { + return jspb.Message.setProto3StringField(this, 6, value); +}; + + +/** + * optional string roomid = 7; + * @return {string} + */ +proto.wcf.WxMsg.prototype.getRoomid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.WxMsg} returns this + */ +proto.wcf.WxMsg.prototype.setRoomid = function(value) { + return jspb.Message.setProto3StringField(this, 7, value); +}; + + +/** + * optional string content = 8; + * @return {string} + */ +proto.wcf.WxMsg.prototype.getContent = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.WxMsg} returns this + */ +proto.wcf.WxMsg.prototype.setContent = function(value) { + return jspb.Message.setProto3StringField(this, 8, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.Response.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.Response.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.Response} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.Response.toObject = function(includeInstance, msg) { + var f, obj = { + status: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.Response} + */ +proto.wcf.Response.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.Response; + return proto.wcf.Response.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.Response} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.Response} + */ +proto.wcf.Response.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setStatus(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.Response.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.Response.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.Response} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.Response.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStatus(); + if (f !== 0) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 status = 1; + * @return {number} + */ +proto.wcf.Response.prototype.getStatus = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.wcf.Response} returns this + */ +proto.wcf.Response.prototype.setStatus = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.TextMsg.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.TextMsg.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.TextMsg} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.TextMsg.toObject = function(includeInstance, msg) { + var f, obj = { + msg: jspb.Message.getFieldWithDefault(msg, 1, ""), + receiver: jspb.Message.getFieldWithDefault(msg, 2, ""), + aters: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.TextMsg} + */ +proto.wcf.TextMsg.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.TextMsg; + return proto.wcf.TextMsg.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.TextMsg} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.TextMsg} + */ +proto.wcf.TextMsg.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMsg(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setReceiver(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setAters(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.TextMsg.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.TextMsg.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.TextMsg} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.TextMsg.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMsg(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getReceiver(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getAters(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string msg = 1; + * @return {string} + */ +proto.wcf.TextMsg.prototype.getMsg = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.TextMsg} returns this + */ +proto.wcf.TextMsg.prototype.setMsg = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string receiver = 2; + * @return {string} + */ +proto.wcf.TextMsg.prototype.getReceiver = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.TextMsg} returns this + */ +proto.wcf.TextMsg.prototype.setReceiver = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string aters = 3; + * @return {string} + */ +proto.wcf.TextMsg.prototype.getAters = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.TextMsg} returns this + */ +proto.wcf.TextMsg.prototype.setAters = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.ImageMsg.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.ImageMsg.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.ImageMsg} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.ImageMsg.toObject = function(includeInstance, msg) { + var f, obj = { + path: jspb.Message.getFieldWithDefault(msg, 1, ""), + receiver: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.ImageMsg} + */ +proto.wcf.ImageMsg.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.ImageMsg; + return proto.wcf.ImageMsg.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.ImageMsg} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.ImageMsg} + */ +proto.wcf.ImageMsg.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPath(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setReceiver(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.ImageMsg.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.ImageMsg.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.ImageMsg} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.ImageMsg.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPath(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getReceiver(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string path = 1; + * @return {string} + */ +proto.wcf.ImageMsg.prototype.getPath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.ImageMsg} returns this + */ +proto.wcf.ImageMsg.prototype.setPath = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string receiver = 2; + * @return {string} + */ +proto.wcf.ImageMsg.prototype.getReceiver = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.ImageMsg} returns this + */ +proto.wcf.ImageMsg.prototype.setReceiver = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.MsgTypes.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.MsgTypes.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.MsgTypes} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.MsgTypes.toObject = function(includeInstance, msg) { + var f, obj = { + typesMap: (f = msg.getTypesMap()) ? f.toObject(includeInstance, undefined) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.MsgTypes} + */ +proto.wcf.MsgTypes.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.MsgTypes; + return proto.wcf.MsgTypes.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.MsgTypes} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.MsgTypes} + */ +proto.wcf.MsgTypes.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getTypesMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt32, jspb.BinaryReader.prototype.readString, null, 0, ""); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.MsgTypes.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.MsgTypes.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.MsgTypes} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.MsgTypes.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTypesMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeInt32, jspb.BinaryWriter.prototype.writeString); + } +}; + + +/** + * map types = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.wcf.MsgTypes.prototype.getTypesMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.wcf.MsgTypes} returns this + */ +proto.wcf.MsgTypes.prototype.clearTypesMap = function() { + this.getTypesMap().clear(); + return this;}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.Contact.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.Contact.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.Contact} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.Contact.toObject = function(includeInstance, msg) { + var f, obj = { + wxid: jspb.Message.getFieldWithDefault(msg, 1, ""), + code: jspb.Message.getFieldWithDefault(msg, 2, ""), + name: jspb.Message.getFieldWithDefault(msg, 3, ""), + country: jspb.Message.getFieldWithDefault(msg, 4, ""), + province: jspb.Message.getFieldWithDefault(msg, 5, ""), + city: jspb.Message.getFieldWithDefault(msg, 6, ""), + gender: jspb.Message.getFieldWithDefault(msg, 7, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.Contact} + */ +proto.wcf.Contact.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.Contact; + return proto.wcf.Contact.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.Contact} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.Contact} + */ +proto.wcf.Contact.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setWxid(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setCode(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setCountry(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setProvince(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setCity(value); + break; + case 7: + var value = /** @type {number} */ (reader.readInt32()); + msg.setGender(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.Contact.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.Contact.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.Contact} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.Contact.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getWxid(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getCode(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getCountry(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getProvince(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = message.getCity(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } + f = message.getGender(); + if (f !== 0) { + writer.writeInt32( + 7, + f + ); + } +}; + + +/** + * optional string wxid = 1; + * @return {string} + */ +proto.wcf.Contact.prototype.getWxid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.Contact} returns this + */ +proto.wcf.Contact.prototype.setWxid = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string code = 2; + * @return {string} + */ +proto.wcf.Contact.prototype.getCode = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.Contact} returns this + */ +proto.wcf.Contact.prototype.setCode = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string name = 3; + * @return {string} + */ +proto.wcf.Contact.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.Contact} returns this + */ +proto.wcf.Contact.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string country = 4; + * @return {string} + */ +proto.wcf.Contact.prototype.getCountry = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.Contact} returns this + */ +proto.wcf.Contact.prototype.setCountry = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional string province = 5; + * @return {string} + */ +proto.wcf.Contact.prototype.getProvince = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.Contact} returns this + */ +proto.wcf.Contact.prototype.setProvince = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + +/** + * optional string city = 6; + * @return {string} + */ +proto.wcf.Contact.prototype.getCity = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.Contact} returns this + */ +proto.wcf.Contact.prototype.setCity = function(value) { + return jspb.Message.setProto3StringField(this, 6, value); +}; + + +/** + * optional int32 gender = 7; + * @return {number} + */ +proto.wcf.Contact.prototype.getGender = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.wcf.Contact} returns this + */ +proto.wcf.Contact.prototype.setGender = function(value) { + return jspb.Message.setProto3IntField(this, 7, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.wcf.Contacts.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.Contacts.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.Contacts.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.Contacts} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.Contacts.toObject = function(includeInstance, msg) { + var f, obj = { + contactsList: jspb.Message.toObjectList(msg.getContactsList(), + proto.wcf.Contact.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.Contacts} + */ +proto.wcf.Contacts.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.Contacts; + return proto.wcf.Contacts.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.Contacts} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.Contacts} + */ +proto.wcf.Contacts.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.wcf.Contact; + reader.readMessage(value,proto.wcf.Contact.deserializeBinaryFromReader); + msg.addContacts(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.Contacts.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.Contacts.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.Contacts} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.Contacts.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getContactsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.wcf.Contact.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated Contact contacts = 1; + * @return {!Array} + */ +proto.wcf.Contacts.prototype.getContactsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.wcf.Contact, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.wcf.Contacts} returns this +*/ +proto.wcf.Contacts.prototype.setContactsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.wcf.Contact=} opt_value + * @param {number=} opt_index + * @return {!proto.wcf.Contact} + */ +proto.wcf.Contacts.prototype.addContacts = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.wcf.Contact, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.wcf.Contacts} returns this + */ +proto.wcf.Contacts.prototype.clearContactsList = function() { + return this.setContactsList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.wcf.DbNames.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.DbNames.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.DbNames.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.DbNames} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbNames.toObject = function(includeInstance, msg) { + var f, obj = { + namesList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.DbNames} + */ +proto.wcf.DbNames.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.DbNames; + return proto.wcf.DbNames.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.DbNames} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.DbNames} + */ +proto.wcf.DbNames.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.addNames(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.DbNames.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.DbNames.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.DbNames} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbNames.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getNamesList(); + if (f.length > 0) { + writer.writeRepeatedString( + 1, + f + ); + } +}; + + +/** + * repeated string names = 1; + * @return {!Array} + */ +proto.wcf.DbNames.prototype.getNamesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.wcf.DbNames} returns this + */ +proto.wcf.DbNames.prototype.setNamesList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.wcf.DbNames} returns this + */ +proto.wcf.DbNames.prototype.addNames = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.wcf.DbNames} returns this + */ +proto.wcf.DbNames.prototype.clearNamesList = function() { + return this.setNamesList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.String.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.String.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.String} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.String.toObject = function(includeInstance, msg) { + var f, obj = { + str: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.String} + */ +proto.wcf.String.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.String; + return proto.wcf.String.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.String} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.String} + */ +proto.wcf.String.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setStr(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.String.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.String.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.String} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.String.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStr(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string str = 1; + * @return {string} + */ +proto.wcf.String.prototype.getStr = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.String} returns this + */ +proto.wcf.String.prototype.setStr = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.DbTable.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.DbTable.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.DbTable} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbTable.toObject = function(includeInstance, msg) { + var f, obj = { + name: jspb.Message.getFieldWithDefault(msg, 1, ""), + sql: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.DbTable} + */ +proto.wcf.DbTable.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.DbTable; + return proto.wcf.DbTable.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.DbTable} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.DbTable} + */ +proto.wcf.DbTable.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setSql(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.DbTable.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.DbTable.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.DbTable} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbTable.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getSql(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string name = 1; + * @return {string} + */ +proto.wcf.DbTable.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.DbTable} returns this + */ +proto.wcf.DbTable.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string sql = 2; + * @return {string} + */ +proto.wcf.DbTable.prototype.getSql = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.DbTable} returns this + */ +proto.wcf.DbTable.prototype.setSql = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.wcf.DbTables.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.DbTables.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.DbTables.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.DbTables} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbTables.toObject = function(includeInstance, msg) { + var f, obj = { + tablesList: jspb.Message.toObjectList(msg.getTablesList(), + proto.wcf.DbTable.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.DbTables} + */ +proto.wcf.DbTables.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.DbTables; + return proto.wcf.DbTables.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.DbTables} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.DbTables} + */ +proto.wcf.DbTables.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.wcf.DbTable; + reader.readMessage(value,proto.wcf.DbTable.deserializeBinaryFromReader); + msg.addTables(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.DbTables.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.DbTables.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.DbTables} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbTables.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTablesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.wcf.DbTable.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated DbTable tables = 1; + * @return {!Array} + */ +proto.wcf.DbTables.prototype.getTablesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.wcf.DbTable, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.wcf.DbTables} returns this +*/ +proto.wcf.DbTables.prototype.setTablesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.wcf.DbTable=} opt_value + * @param {number=} opt_index + * @return {!proto.wcf.DbTable} + */ +proto.wcf.DbTables.prototype.addTables = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.wcf.DbTable, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.wcf.DbTables} returns this + */ +proto.wcf.DbTables.prototype.clearTablesList = function() { + return this.setTablesList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.DbQuery.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.DbQuery.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.DbQuery} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbQuery.toObject = function(includeInstance, msg) { + var f, obj = { + db: jspb.Message.getFieldWithDefault(msg, 1, ""), + sql: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.DbQuery} + */ +proto.wcf.DbQuery.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.DbQuery; + return proto.wcf.DbQuery.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.DbQuery} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.DbQuery} + */ +proto.wcf.DbQuery.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setDb(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setSql(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.DbQuery.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.DbQuery.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.DbQuery} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbQuery.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDb(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getSql(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string db = 1; + * @return {string} + */ +proto.wcf.DbQuery.prototype.getDb = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.DbQuery} returns this + */ +proto.wcf.DbQuery.prototype.setDb = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string sql = 2; + * @return {string} + */ +proto.wcf.DbQuery.prototype.getSql = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.DbQuery} returns this + */ +proto.wcf.DbQuery.prototype.setSql = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.DbField.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.DbField.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.DbField} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbField.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + column: jspb.Message.getFieldWithDefault(msg, 2, ""), + content: msg.getContent_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.DbField} + */ +proto.wcf.DbField.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.DbField; + return proto.wcf.DbField.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.DbField} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.DbField} + */ +proto.wcf.DbField.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setType(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setColumn(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setContent(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.DbField.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.DbField.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.DbField} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbField.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0) { + writer.writeInt32( + 1, + f + ); + } + f = message.getColumn(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getContent_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * optional int32 type = 1; + * @return {number} + */ +proto.wcf.DbField.prototype.getType = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.wcf.DbField} returns this + */ +proto.wcf.DbField.prototype.setType = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional string column = 2; + * @return {string} + */ +proto.wcf.DbField.prototype.getColumn = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.DbField} returns this + */ +proto.wcf.DbField.prototype.setColumn = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional bytes content = 3; + * @return {!(string|Uint8Array)} + */ +proto.wcf.DbField.prototype.getContent = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes content = 3; + * This is a type-conversion wrapper around `getContent()` + * @return {string} + */ +proto.wcf.DbField.prototype.getContent_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getContent())); +}; + + +/** + * optional bytes content = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getContent()` + * @return {!Uint8Array} + */ +proto.wcf.DbField.prototype.getContent_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getContent())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.wcf.DbField} returns this + */ +proto.wcf.DbField.prototype.setContent = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.wcf.DbRow.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.DbRow.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.DbRow.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.DbRow} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbRow.toObject = function(includeInstance, msg) { + var f, obj = { + fieldsList: jspb.Message.toObjectList(msg.getFieldsList(), + proto.wcf.DbField.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.DbRow} + */ +proto.wcf.DbRow.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.DbRow; + return proto.wcf.DbRow.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.DbRow} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.DbRow} + */ +proto.wcf.DbRow.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.wcf.DbField; + reader.readMessage(value,proto.wcf.DbField.deserializeBinaryFromReader); + msg.addFields(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.DbRow.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.DbRow.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.DbRow} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbRow.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getFieldsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.wcf.DbField.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated DbField fields = 1; + * @return {!Array} + */ +proto.wcf.DbRow.prototype.getFieldsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.wcf.DbField, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.wcf.DbRow} returns this +*/ +proto.wcf.DbRow.prototype.setFieldsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.wcf.DbField=} opt_value + * @param {number=} opt_index + * @return {!proto.wcf.DbField} + */ +proto.wcf.DbRow.prototype.addFields = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.wcf.DbField, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.wcf.DbRow} returns this + */ +proto.wcf.DbRow.prototype.clearFieldsList = function() { + return this.setFieldsList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.wcf.DbRows.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.DbRows.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.DbRows.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.DbRows} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbRows.toObject = function(includeInstance, msg) { + var f, obj = { + rowsList: jspb.Message.toObjectList(msg.getRowsList(), + proto.wcf.DbRow.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.DbRows} + */ +proto.wcf.DbRows.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.DbRows; + return proto.wcf.DbRows.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.DbRows} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.DbRows} + */ +proto.wcf.DbRows.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.wcf.DbRow; + reader.readMessage(value,proto.wcf.DbRow.deserializeBinaryFromReader); + msg.addRows(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.DbRows.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.DbRows.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.DbRows} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.DbRows.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getRowsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.wcf.DbRow.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated DbRow rows = 1; + * @return {!Array} + */ +proto.wcf.DbRows.prototype.getRowsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.wcf.DbRow, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.wcf.DbRows} returns this +*/ +proto.wcf.DbRows.prototype.setRowsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.wcf.DbRow=} opt_value + * @param {number=} opt_index + * @return {!proto.wcf.DbRow} + */ +proto.wcf.DbRows.prototype.addRows = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.wcf.DbRow, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.wcf.DbRows} returns this + */ +proto.wcf.DbRows.prototype.clearRowsList = function() { + return this.setRowsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.wcf.Verification.prototype.toObject = function(opt_includeInstance) { + return proto.wcf.Verification.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.wcf.Verification} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.Verification.toObject = function(includeInstance, msg) { + var f, obj = { + v3: jspb.Message.getFieldWithDefault(msg, 1, ""), + v4: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.wcf.Verification} + */ +proto.wcf.Verification.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.wcf.Verification; + return proto.wcf.Verification.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.wcf.Verification} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.wcf.Verification} + */ +proto.wcf.Verification.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setV3(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setV4(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.wcf.Verification.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.wcf.Verification.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.wcf.Verification} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.wcf.Verification.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getV3(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getV4(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string v3 = 1; + * @return {string} + */ +proto.wcf.Verification.prototype.getV3 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.Verification} returns this + */ +proto.wcf.Verification.prototype.setV3 = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string v4 = 2; + * @return {string} + */ +proto.wcf.Verification.prototype.getV4 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.wcf.Verification} returns this + */ +proto.wcf.Verification.prototype.setV4 = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +goog.object.extend(exports, proto.wcf); diff --git a/nodejs/src/commands/base-command.ts b/nodejs/src/commands/base-command.ts new file mode 100755 index 0000000..7cc2e5e --- /dev/null +++ b/nodejs/src/commands/base-command.ts @@ -0,0 +1,20 @@ +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export class Context {} + +export class Interaction { + constructor(input: string) { + this.input = input; + this.options = {}; + } + input: string; + output?: string; + options: any; +} + +export interface Command { + name: string; + follow: (interaction: Interaction) => number; + run: (ctx: Context, interaction: Interaction) => string | Promise; +} diff --git a/nodejs/src/commands/index.ts b/nodejs/src/commands/index.ts new file mode 100755 index 0000000..894628f --- /dev/null +++ b/nodejs/src/commands/index.ts @@ -0,0 +1,29 @@ +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import { log } from '../utils/log'; +import { Interaction, Command, Context } from './base-command'; +import rsp from './rock-scissors-paper'; +import stock from './stock'; + +let commands: Command[] = [rsp, stock]; + +export const handleCommand = async (ctx: Context, input: string): Promise => { + const interaction = new Interaction(input); + const choice = commands + .map((c) => { + return { score: c.follow(interaction), command: c }; + }) + ?.sort((a, b) => { + return a.score - b.score; + }) + ?.filter((x) => x.score > 0) + ?.pop(); + + if (!choice) { + log.debug('no command found'); + return ''; + } + const reply = await choice.command.run(ctx, interaction); + return reply; +}; diff --git a/nodejs/src/commands/rock-scissors-paper.ts b/nodejs/src/commands/rock-scissors-paper.ts new file mode 100755 index 0000000..97d3be8 --- /dev/null +++ b/nodejs/src/commands/rock-scissors-paper.ts @@ -0,0 +1,38 @@ +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +import { log } from '../utils/log'; +import { Interaction, Command, Context } from './base-command'; + +function RandomNum(max: number): number { + return Math.floor(Math.random() * (max + 1)); +} + +const keywords = ['rock', 'paper', 'scissors']; + +export default { + name: 'rock-scissors-paper', + follow: (interaction: Interaction): number => { + const i = keywords.find((k) => { + return interaction.input.includes(k); + }); + log.debug(`rock-scissors-paper follow-up: ${i}`); + interaction.options.pick = i ?? undefined; + return i ? 1 : 0; + }, + run: (ctx: Context, interaction: Interaction): string => { + const pick: string = interaction.options.pick as string; + + const playerPick = keywords.findIndex((x) => x == pick); + const botPick = RandomNum(2); + + let result = 'tied'; + + if (playerPick == botPick) result = 'Tied'; + else if (playerPick == 0 && botPick == 2) result = 'Win'; + else if ((playerPick - botPick) % 3 == 1) result = 'Win'; + else result = 'Lose'; + + const content = `You picked **${pick}** and I picked **${keywords[botPick]}**, You **${result}**`; + return content; + } +} as Command; diff --git a/nodejs/src/commands/stock.ts b/nodejs/src/commands/stock.ts new file mode 100755 index 0000000..73d219a --- /dev/null +++ b/nodejs/src/commands/stock.ts @@ -0,0 +1,28 @@ +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +import { stocks } from 'stock-api'; +import { Interaction, Command, Context } from './base-command'; + +function getPrice(code: string): Promise { + return stocks.tencent.getStocks([code]).then((res) => { + return JSON.stringify(res[0]); + }); +} + +export default { + name: 'stock', + follow: (interaction: Interaction): number => { + let match = /(S[HZ]\d{6})/.exec(interaction.input); + if (match) { + let stock = match && match[0]; + interaction.options.stock = stock; + return 1; + } + return 0; + }, + run: async (ctx: Context, interaction: Interaction): Promise => { + const pick: string = interaction.options.stock as string; + const content = await getPrice(pick); + return content; + } +} as Command; diff --git a/nodejs/src/index.ts b/nodejs/src/index.ts new file mode 100755 index 0000000..9f70927 --- /dev/null +++ b/nodejs/src/index.ts @@ -0,0 +1,57 @@ +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import * as readline from 'readline'; +import { stdin as input } from 'node:process'; +import { WxMsg } from '../proto/wcf_pb'; +import { log } from './utils/log'; +import { handleCommand } from './commands'; +import { Context } from './commands/base-command'; +import { SDK } from './wcf/win32'; +import { WCF } from './wcf'; +import { portAvailable, sleep } from './utils/misic'; + +let ctx = new Context(); + +(async () => { + if (await portAvailable(10086)) { + log.debug(`Call SDK to inject.`); + const sdk = new SDK(); + sdk.WxInitSDK(); + } + + // wait util WCF is ready + while (!(await portAvailable(10086))) { + await sleep(1000); + } + + log.debug(`Connect to gRPC and wait for login.`); + const wcf = new WCF(); + while (!(await wcf.IsLogin())) { + await sleep(1000); + } + + wcf.on('message', async (msg: WxMsg) => { + const txt = msg.getContent(); + log.debug(txt, msg.getIsSelf()); + if (!msg.getIsSelf()) { + const reply = await handleCommand(ctx, txt); + if (msg.getIsGroup()) { + wcf.SendTextMsg(msg.getRoomid(), reply); + } else { + wcf.SendTextMsg(msg.getSender(), reply); + } + } + }); + + wcf.EnableReceiveMsg(); +})(); + +const std = readline.createInterface({ input }); +std.on('line', async (line) => { + const reply = await handleCommand(ctx, line); + log.debug(`reply: ${reply}`); + if (line === 'exit') { + std.close(); + } +}); diff --git a/nodejs/src/utils/log.ts b/nodejs/src/utils/log.ts new file mode 100755 index 0000000..e15ecfd --- /dev/null +++ b/nodejs/src/utils/log.ts @@ -0,0 +1,11 @@ +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import { Logger } from 'tslog'; + +export const log: Logger = new Logger({ + name: 'main', + displayLoggerName: false, + overwriteConsole: true, + dateTimePattern: 'monthday hour:minute:second' +}); diff --git a/nodejs/src/utils/misic.ts b/nodejs/src/utils/misic.ts new file mode 100755 index 0000000..df997e3 --- /dev/null +++ b/nodejs/src/utils/misic.ts @@ -0,0 +1,20 @@ +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export function portAvailable(port: number): Promise { + const net = require('net'); + return new Promise((resolve, _reject) => { + let server = net.createServer().listen(port); + server.on('listening', function () { + server.close(); + resolve(true); + }); + server.on('error', function (err: any) { + if (err.code == 'EADDRINUSE') { + resolve(false); + } + }); + }); +} + +export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)); diff --git a/nodejs/src/wcf/index.ts b/nodejs/src/wcf/index.ts new file mode 100755 index 0000000..c93d251 --- /dev/null +++ b/nodejs/src/wcf/index.ts @@ -0,0 +1,55 @@ +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import EventEmitter from 'events'; +import TypedEmitter from 'typed-emitter'; +import * as grpc from 'grpc'; +import { WcfClient, IWcfClient } from '../../proto/wcf_grpc_pb'; +import { Empty, TextMsg, WxMsg } from '../../proto/wcf_pb'; + +type MessageEvents = { + error: (error: Error) => void; + message: (msg: WxMsg) => void; +}; + +export class WCF extends (EventEmitter as new () => TypedEmitter) { + client: IWcfClient; + + constructor() { + super(); + this.client = new WcfClient(`localhost:10086`, grpc.credentials.createInsecure()); + } + + async IsLogin(): Promise { + return new Promise((resolve, reject) => { + const request = new Empty(); + this.client.rpcIsLogin(request, (err, ret) => { + if (err) reject(err); + else resolve(ret.getStatus() !== 0); + }); + }); + } + + async EnableReceiveMsg() { + let stream = this.client.rpcEnableRecvMsg(new Empty()); + stream.on('data', (d) => { + this.emit('message', d); + }); + stream.on('error', (err) => { + this.emit('error', err); + }); + } + + async SendTextMsg(to: string, msg: string): Promise { + return new Promise((resolve, reject) => { + const request = new TextMsg(); + request.setReceiver(to); + request.setMsg(msg); + + this.client.rpcSendTextMsg(request, (err, ret) => { + if (err) reject(err); + else resolve(ret.getStatus() !== 0); + }); + }); + } +} diff --git a/nodejs/src/wcf/win32.ts b/nodejs/src/wcf/win32.ts new file mode 100755 index 0000000..182581a --- /dev/null +++ b/nodejs/src/wcf/win32.ts @@ -0,0 +1,18 @@ +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +import { Library, Method, never } from 'ffi-decorators'; + +@Library({ libPath: './sdk.dll' }) +export class SDK { + @Method({ types: ['int', []] }) + WxInitSDK(): number { + return never(); + } + + @Method({ types: ['int', []] }) + WxDestroySDK(): number { + return never(); + } +} + +// Todo: inject spy.dll directly in ts code. diff --git a/nodejs/tsconfig.json b/nodejs/tsconfig.json new file mode 100755 index 0000000..0b9715a --- /dev/null +++ b/nodejs/tsconfig.json @@ -0,0 +1,103 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./dist", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +}