diff --git a/nodejs/TEQuant.jpeg b/nodejs/TEQuant.jpeg new file mode 100755 index 0000000..47b86fe Binary files /dev/null and b/nodejs/TEQuant.jpeg differ diff --git a/nodejs/package.json b/nodejs/package.json new file mode 100755 index 0000000..bdeb59f --- /dev/null +++ b/nodejs/package.json @@ -0,0 +1,45 @@ +{ + "name": "WeChatFerryNodejs", + "version": "1.0.0", + "description": "WeChatFerry nodejs demo", + "main": "./src/index.ts", + "author": "radiocom@qq.com", + "license": "MIT", + "scripts": { + "prebuild": "eslint --fix src", + "start": "npx ts-node src/index.ts", + "proto:build": "npx grpc_tools_node_protoc --js_out=import_style=commonjs,binary:./proto/ --grpc_out=./proto/ --plugin=protoc-gen-grpc=\"node_modules/grpc-tools/bin/grpc_node_plugin.exe\" --proto_path=./proto wcf.proto", + "proto:types": ".\\node_modules\\grpc-tools\\bin\\protoc.exe --plugin=protoc-gen-ts=\".\\node_modules\\.bin\\protoc-gen-ts.cmd\" --ts_out=./proto/ -I ./proto wcf.proto" + }, + "dependencies": { + "@grpc/grpc-js": "^1.7.2", + "ffi-decorators": "^0.4.0", + "ffi-napi": "^4.0.3", + "grpc": "^1.24.11", + "net": "^1.0.2", + "readline": "^1.3.0", + "ref-napi": "^3.0.3", + "ref-struct-di": "^1.1.1", + "ref-union-di": "^1.0.1", + "stock-api": "^2.0.5", + "tslog": "^3.3.4", + "typed-emitter": "^2.1.0" + }, + "devDependencies": { + "@types/ffi-napi": "^4.0.6", + "@types/node": "^18.11.2", + "@typescript-eslint/eslint-plugin": "^5.40.1", + "@typescript-eslint/parser": "^5.40.1", + "eslint": "^8.25.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-header": "^3.1.1", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-unused-imports": "^2.0.0", + "grpc-tools": "^1.11.3", + "grpc_tools_node_protoc_ts": "^5.3.2", + "prettier": "^2.7.1", + "ts-node": "^10.9.1", + "tslib": "^2.4.0", + "typescript": "^4.8.4" + } +} diff --git a/nodejs/prettier.config.js b/nodejs/prettier.config.js new file mode 100755 index 0000000..fec455d --- /dev/null +++ b/nodejs/prettier.config.js @@ -0,0 +1,7 @@ +module.exports = { + tabWidth: 2, + singleQuote: true, + printWidth: 120, + endOfLine: 'lf', +}; + \ No newline at end of file diff --git a/nodejs/proto/index.js b/nodejs/proto/index.js new file mode 100755 index 0000000..dbae4a2 --- /dev/null +++ b/nodejs/proto/index.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.protoIndex = void 0; +require("./wcf_grpc_pb"); +require("./wcf_pb"); +const protoIndex = () => { +}; +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. */ + } +}