diff --git a/WeChatFerry.sln b/WeChatFerry.sln index edf529f..7c8422a 100644 --- a/WeChatFerry.sln +++ b/WeChatFerry.sln @@ -5,11 +5,6 @@ VisualStudioVersion = 16.0.32802.440 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spy", "spy\spy.vcxproj", "{4DE80B82-5F6A-4C4C-9D16-1574308110FA}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp", "cpp\cpp.vcxproj", "{2FC45612-A106-42D1-871F-1DE704095B2C}" - ProjectSection(ProjectDependencies) = postProject - {ABFCB647-137F-478B-A73E-F0B1E3ADC215} = {ABFCB647-137F-478B-A73E-F0B1E3ADC215} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdk", "sdk\sdk.vcxproj", "{ABFCB647-137F-478B-A73E-F0B1E3ADC215}" ProjectSection(ProjectDependencies) = postProject {4DE80B82-5F6A-4C4C-9D16-1574308110FA} = {4DE80B82-5F6A-4C4C-9D16-1574308110FA} @@ -27,8 +22,6 @@ Global GlobalSection(ProjectConfigurationPlatforms) = postSolution {4DE80B82-5F6A-4C4C-9D16-1574308110FA}.Release|x86.ActiveCfg = Release|Win32 {4DE80B82-5F6A-4C4C-9D16-1574308110FA}.Release|x86.Build.0 = Release|Win32 - {2FC45612-A106-42D1-871F-1DE704095B2C}.Release|x86.ActiveCfg = Release|Win32 - {2FC45612-A106-42D1-871F-1DE704095B2C}.Release|x86.Build.0 = Release|Win32 {ABFCB647-137F-478B-A73E-F0B1E3ADC215}.Release|x86.ActiveCfg = Release|Win32 {ABFCB647-137F-478B-A73E-F0B1E3ADC215}.Release|x86.Build.0 = Release|Win32 {B11ADC6F-20DA-4DEF-A8A0-60374427D4C6}.Release|x86.ActiveCfg = Release|Win32 diff --git a/cpp/cpp.vcxproj b/cpp/cpp.vcxproj deleted file mode 100644 index f7b0680..0000000 --- a/cpp/cpp.vcxproj +++ /dev/null @@ -1,177 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 16.0 - Win32Proj - {2fc45612-a106-42d1-871f-1de704095b2c} - cpp - 10.0 - - - - Application - true - v142 - Unicode - - - Application - false - v142 - true - Unicode - - - Application - true - v142 - Unicode - - - Application - false - v142 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - false - - - true - - - false - - - true - x86-windows-static - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(SolutionDir)/spy;$(SolutionDir)/rpc;C:\Tools\vcpkg\installed\x86-windows-static\include;%(AdditionalIncludeDirectories) - 4251 - stdcpp17 - MultiThreaded - - - Console - true - true - true - $(OutDir)sdk.lib;iphlpapi.lib;wsock32.lib;ws2_32.lib;crypt32.lib;%(AdditionalDependencies) - - - xcopy /y $(OutDir)cpp.exe $(OutDir)out\cpp - - - Copy files - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/cpp/cpp.vcxproj.filters b/cpp/cpp.vcxproj.filters deleted file mode 100644 index 6568b8d..0000000 --- a/cpp/cpp.vcxproj.filters +++ /dev/null @@ -1,62 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {985fabc8-364a-4c12-ac0a-b9386288565a} - - - - - 头文件 - - - nnrpc - - - nnrpc - - - nnrpc - - - nnrpc - - - nnrpc - - - - - 源文件 - - - nnrpc - - - nnrpc - - - nnrpc - - - nnrpc - - - - - nnrpc - - - \ No newline at end of file diff --git a/cpp/cpp.vcxproj.user b/cpp/cpp.vcxproj.user deleted file mode 100644 index 88a5509..0000000 --- a/cpp/cpp.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/cpp/main.cpp b/cpp/main.cpp deleted file mode 100644 index 77b89db..0000000 --- a/cpp/main.cpp +++ /dev/null @@ -1,527 +0,0 @@ -/* -RPC Client -*/ -#pragma warning(disable : 4251) -#pragma execution_character_set("utf-8") - -#include -#include -#include -#if 0 -#include - -#include "../proto/wcf.grpc.pb.h" -#include "../sdk/sdk.h" - -using namespace std; - -using grpc::Channel; -using grpc::ClientContext; -using grpc::Status; - -using wcf::Contact; -using wcf::Contacts; -using wcf::DbField; -using wcf::DbNames; -using wcf::DbQuery; -using wcf::DbRow; -using wcf::DbRows; -using wcf::DbTable; -using wcf::DbTables; -using wcf::Empty; -using wcf::ImageMsg; -using wcf::MsgTypes; -using wcf::Response; -using wcf::String; -using wcf::TextMsg; -using wcf::Verification; -using wcf::Wcf; -using wcf::WxMsg; - -class WcfClient -{ -public: - static WcfClient &Instance(string host_port) - { - static WcfClient instance(grpc::CreateChannel(host_port, grpc::InsecureChannelCredentials())); - return instance; - } - - ~WcfClient() - { - cout << "~WcfClient()" << endl; - this->DisableRecvMsg(); - WxDestroySDK(); - } - - int IsLogin() - { - Empty empty; - Response rsp; - ClientContext context; - std::mutex mu; - std::condition_variable cv; - bool done = false; - Status status; - - stub_->async()->RpcIsLogin(&context, &empty, &rsp, [&mu, &cv, &done, &status](Status s) { - status = std::move(s); - std::lock_guard lock(mu); - done = true; - cv.notify_one(); - }); - std::unique_lock lock(mu); - cv.wait(lock, [&done] { return done; }); - - if (!status.ok()) { - cout << "IsLogin rpc failed." << endl; - } - - return rsp.status(); - } - - string GetSelfWxid() - { - Empty empty; - String rsp; - ClientContext context; - std::mutex mu; - std::condition_variable cv; - bool done = false; - Status status; - - stub_->async()->RpcGetSelfWxid(&context, &empty, &rsp, [&mu, &cv, &done, &status](Status s) { - status = std::move(s); - std::lock_guard lock(mu); - done = true; - cv.notify_one(); - }); - std::unique_lock lock(mu); - cv.wait(lock, [&done] { return done; }); - - if (!status.ok()) { - cout << "GetSelfWxid rpc failed." << endl; - } - - return rsp.str(); - } - - void EnableRecvMsg(function msg_handle_cb) - { - class Reader : public grpc::ClientReadReactor - { - public: - Reader(Wcf::Stub *stub, function msg_handle_cb) - : msg_handle_cb_(msg_handle_cb) - { - stub->async()->RpcEnableRecvMsg(&context_, &empty_, this); - StartRead(&msg_); - StartCall(); - } - - void OnReadDone(bool ok) override - { - if (ok) { - try { - msg_handle_cb_(msg_); - } catch (...) { - cout << "OnMsg wrong..." << endl; - } - StartRead(&msg_); - } - } - - void OnDone(const Status &s) override - { - unique_lock l(mu_); - status_ = s; - done_ = true; - cv_.notify_one(); - } - - Status Await() - { - unique_lock l(mu_); - cv_.wait(l, [this] { return done_; }); - return move(status_); - } - - private: - Empty empty_; - WxMsg msg_; - ClientContext context_; - - mutex mu_; - Status status_; - bool done_ = false; - condition_variable cv_; - - function msg_handle_cb_; - }; - - Reader reader(stub_.get(), msg_handle_cb); - Status status = reader.Await(); - - if (!status.ok()) { - cout << "GetMessage rpc failed." << endl; - } - } - - int DisableRecvMsg() - { - Empty empty; - Response rsp; - ClientContext context; - std::mutex mu; - std::condition_variable cv; - bool done = false; - Status status; - - stub_->async()->RpcDisableRecvMsg(&context, &empty, &rsp, [&mu, &cv, &done, &status](Status s) { - status = std::move(s); - std::lock_guard lock(mu); - done = true; - cv.notify_one(); - }); - std::unique_lock lock(mu); - cv.wait(lock, [&done] { return done; }); - - if (!status.ok()) { - cout << "DisableRecvMsg rpc failed." << endl; - } - - return rsp.status(); - } - - int SendTextMsg(string msg, string receiver, string atusers) - { - Response rsp; - ClientContext context; - std::mutex mu; - std::condition_variable cv; - bool done = false; - Status status; - - TextMsg t_msg; - t_msg.set_msg(msg); - t_msg.set_receiver(receiver); - t_msg.set_aters(atusers); - - stub_->async()->RpcSendTextMsg(&context, &t_msg, &rsp, [&mu, &cv, &done, &status](Status s) { - status = std::move(s); - std::lock_guard lock(mu); - done = true; - cv.notify_one(); - }); - std::unique_lock lock(mu); - cv.wait(lock, [&done] { return done; }); - - if (!status.ok()) { - cout << "SendTextMsg rpc failed." << endl; - rsp.set_status(-999); // TODO: Unify error code - } - - return rsp.status(); - } - - int SendImageMsg(string path, string receiver) - { - Response rsp; - ClientContext context; - std::mutex mu; - std::condition_variable cv; - bool done = false; - Status status; - - ImageMsg i_msg; - i_msg.set_path(path); - i_msg.set_receiver(receiver); - - stub_->async()->RpcSendImageMsg(&context, &i_msg, &rsp, [&mu, &cv, &done, &status](Status s) { - status = std::move(s); - std::lock_guard lock(mu); - done = true; - cv.notify_one(); - }); - std::unique_lock lock(mu); - cv.wait(lock, [&done] { return done; }); - - if (!status.ok()) { - cout << "SendImageMsg rpc failed." << endl; - rsp.set_status(-999); // TODO: Unify error code - } - - return rsp.status(); - } - - MsgTypes GetMsgTypes(void) - { - Empty empty; - MsgTypes mt; - ClientContext context; - std::mutex mu; - std::condition_variable cv; - bool done = false; - Status status; - - stub_->async()->RpcGetMsgTypes(&context, &empty, &mt, [&mu, &cv, &done, &status](Status s) { - status = std::move(s); - std::lock_guard lock(mu); - done = true; - cv.notify_one(); - }); - std::unique_lock lock(mu); - cv.wait(lock, [&done] { return done; }); - - if (!status.ok()) { - cout << "GetMsgTypes rpc failed." << endl; - } - - return mt; - } - - Contacts GetContacts(void) - { - Empty empty; - Contacts contacts; - ClientContext context; - std::mutex mu; - std::condition_variable cv; - bool done = false; - Status status; - - stub_->async()->RpcGetContacts(&context, &empty, &contacts, [&mu, &cv, &done, &status](Status s) { - status = std::move(s); - std::lock_guard lock(mu); - done = true; - cv.notify_one(); - }); - std::unique_lock lock(mu); - cv.wait(lock, [&done] { return done; }); - - if (!status.ok()) { - cout << "GetContacts rpc failed." << endl; - } - - return contacts; - } - - DbNames GetDbNames(void) - { - Empty empty; - DbNames names; - ClientContext context; - std::mutex mu; - std::condition_variable cv; - bool done = false; - Status status; - - stub_->async()->RpcGetDbNames(&context, &empty, &names, [&mu, &cv, &done, &status](Status s) { - status = std::move(s); - std::lock_guard lock(mu); - done = true; - cv.notify_one(); - }); - std::unique_lock lock(mu); - cv.wait(lock, [&done] { return done; }); - - if (!status.ok()) { - cout << "GetDbNames rpc failed." << endl; - } - - return names; - } - - DbTables GetDbTables(string db) - { - DbTables tables; - ClientContext context; - std::mutex mu; - std::condition_variable cv; - bool done = false; - Status status; - - String s_db; - s_db.set_str(db); - - stub_->async()->RpcGetDbTables(&context, &s_db, &tables, [&mu, &cv, &done, &status](Status s) { - status = std::move(s); - std::lock_guard lock(mu); - done = true; - cv.notify_one(); - }); - std::unique_lock lock(mu); - cv.wait(lock, [&done] { return done; }); - - if (!status.ok()) { - cout << "GetDbTables rpc failed." << endl; - } - - return tables; - } - - DbRows ExecDbQuery(string db, string sql) - { - DbRows rows; - ClientContext context; - std::mutex mu; - std::condition_variable cv; - bool done = false; - Status status; - - DbQuery query; - query.set_db(db); - query.set_sql(sql); - - stub_->async()->RpcExecDbQuery(&context, &query, &rows, [&mu, &cv, &done, &status](Status s) { - status = std::move(s); - std::lock_guard lock(mu); - done = true; - cv.notify_one(); - }); - std::unique_lock lock(mu); - cv.wait(lock, [&done] { return done; }); - - if (!status.ok()) { - cout << "ExecDbQuery rpc failed." << endl; - } - - return rows; - } - - int AcceptNewFriend(string v3, string v4) - { - Response rsp; - ClientContext context; - std::mutex mu; - std::condition_variable cv; - bool done = false; - Status status; - - Verification v; - v.set_v3(v3); - v.set_v4(v4); - - stub_->async()->RpcAcceptNewFriend(&context, &v, &rsp, [&mu, &cv, &done, &status](Status s) { - status = std::move(s); - std::lock_guard lock(mu); - done = true; - cv.notify_one(); - }); - std::unique_lock lock(mu); - cv.wait(lock, [&done] { return done; }); - - if (!status.ok()) { - cout << "ExecDbQuery rpc failed." << endl; - rsp.set_status(-999); // TODO: Unify error code - } - - return rsp.status(); - } - -private: - unique_ptr stub_; - WcfClient(shared_ptr channel) - : stub_(Wcf::NewStub(channel)) - { - WxInitSDK(); - } -}; - -int OnMsg(WxMsg msg) -{ - cout << "Got Message: \n" - << msg.is_self() << ", " << msg.is_group() << ", " << msg.type() << ", " << msg.id() << ", " << msg.xml() - << ", " << msg.sender() << ", " << msg.roomid() << ", " << msg.content() << endl; - return 0; -} - -volatile sig_atomic_t gStop; -void handler(int s) -{ - cout << "Ctrl + C" << endl; - gStop = 1; -} - -int main(int argc, char **argv) -{ - int ret; - - signal(SIGINT, handler); - - WcfClient &client = WcfClient::Instance("localhost:10086"); - - cout << "IsLogin: " << client.IsLogin() << endl; - cout << "Self Wxid: " << client.GetSelfWxid() << endl; - - ret = client.SendTextMsg("来自CPP的消息!", "filehelper", ""); - cout << "SendTextMsg: " << ret << endl; - - ret = client.SendImageMsg("TEQuant.jpeg", "filehelper"); - cout << "SendImageMsg: " << ret << endl; - - MsgTypes mts = client.GetMsgTypes(); - cout << "GetMsgTypes: " << mts.types_size() << endl; - map m(mts.types().begin(), mts.types().end()); - for (auto &[k, v] : m) { - cout << k << ": " << v << endl; - } - - Contacts cnts = client.GetContacts(); - cout << "GetContacts: " << cnts.contacts().size() << endl; - vector vcnts(cnts.contacts().begin(), cnts.contacts().end()); - for (auto &c : vcnts) { - string gender = ""; - if (c.gender() == 1) { - gender = "男"; - } else if (c.gender() == 2) { - gender = "女"; - } - cout << c.wxid() << "\t" << c.code() << "\t" << c.name() << "\t" << c.country() << "\t" << c.province() << "\t" - << c.city() << "\t" << gender << endl; - } - - DbNames db = client.GetDbNames(); - cout << "GetDbNames: " << db.names().size() << endl; - vector dbs(db.names().begin(), db.names().end()); - for (auto &name : dbs) { - cout << name << endl; - } - - DbTables tbls = client.GetDbTables("db"); - cout << "GetDbTables: " << tbls.tables().size() << endl; - vector vtbls(tbls.tables().begin(), tbls.tables().end()); - for (auto &tbl : vtbls) { - cout << tbl.name() << "\n" << tbl.sql() << endl; - } - - DbRows r = client.ExecDbQuery("MicroMsg.db", "SELECT * FROM Contact LIMIT 1;"); - cout << "ExecDbQuery: " << r.rows().size() << endl; - vector vrows(r.rows().begin(), r.rows().end()); - for (auto &row : vrows) { - vector vfields(row.fields().begin(), row.fields().end()); - for (auto &field : vfields) - cout << field.column() << "[" << field.type() << "]: " << field.content() << endl; - } - - // 需要正确的 v3、v4 才能调用 - // ret = client.AcceptNewFriend("v3", "v4"); - // cout << "AcceptNewFriend: " << ret << endl; - - function cb = OnMsg; - thread t1 = thread([&]() { client.EnableRecvMsg(cb); }); - - while (!gStop) { - Sleep(1000); - } - - cout << "Cleanup" << endl; - client.DisableRecvMsg(); - - system("pause"); - client.~WcfClient(); - - return 0; -} -#endif -int main() { return 0; } diff --git a/java/README.MD b/java/README.MD deleted file mode 100644 index d94c924..0000000 --- a/java/README.MD +++ /dev/null @@ -1,13 +0,0 @@ -# WeChatFerry Java 客户端 -## 配置环境 -选择 32 位的 JDK [temurin](https://adoptium.net/zh-CN/temurin/releases)。 - -## 重新生成 gRPC 文件 -[gRPC 文件生成工具](https://repo.maven.apache.org/maven2/io/grpc/protoc-gen-grpc-java/)。 -```sh -cd java/src/main/java/ -protoc --java_out=. -I=../../../../proto wcf.proto -protoc --grpc-java_out=. --plugin=protoc-gen-grpc-java="C:/Tools/bin/protoc-gen-grpc-java-1.49.2-windows-x86_32.exe" -I=../../../../proto wcf.proto -``` - -`C:/Tools/bin` 为工具存放路径。 diff --git a/java/pom.xml b/java/pom.xml deleted file mode 100644 index c9aedd4..0000000 --- a/java/pom.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - 4.0.0 - - com.iamteer.wcf - WeChatFerry - 1.0-SNAPSHOT - - - - kr.motd.maven - os-maven-plugin - 1.6.2 - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 17 - 17 - - - - org.xolstice.maven.plugins - protobuf-maven-plugin - 0.6.1 - - com.google.protobuf:protoc:3.21.7:exe:${os.detected.classifier} - grpc-java - io.grpc:protoc-gen-grpc-java:1.50.0:exe:${os.detected.classifier} - - - - - compile - compile-custom - - - - - - - - - net.java.dev.jna - jna - 5.3.1 - - - io.grpc - grpc-netty-shaded - 1.50.0 - runtime - - - io.grpc - grpc-protobuf - 1.50.0 - - - io.grpc - grpc-stub - 1.50.0 - - - org.apache.tomcat - annotations-api - 6.0.53 - provided - - - - \ No newline at end of file diff --git a/java/src/main/java/com/iamteer/wcf/Client.java b/java/src/main/java/com/iamteer/wcf/Client.java deleted file mode 100644 index 666415e..0000000 --- a/java/src/main/java/com/iamteer/wcf/Client.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.iamteer.wcf; - -import java.util.List; -import java.util.Map; -import com.sun.jna.Library; -import com.sun.jna.Native; - -import io.grpc.ManagedChannel; -import io.grpc.stub.StreamObserver; -import io.grpc.ManagedChannelBuilder; - -public class Client { - private interface JnaLibrary extends Library { - JnaLibrary INSTANCE = Native.load("sdk", JnaLibrary.class); - - void WxInitSDK(); - - void WxDestroySDK(); - } - - public void InitClient(String hostPort) { - JnaLibrary.INSTANCE.WxInitSDK(); - this.connect(hostPort); - } - - public void CleanupClient() { - this.DisableRecvMsg(); - JnaLibrary.INSTANCE.WxDestroySDK(); - } - - private void connect(String hostPort) { - ManagedChannel managedChannel = ManagedChannelBuilder.forTarget(hostPort) - .usePlaintext() - .build(); - this.wcfBlokingStub = WcfGrpc.newBlockingStub(managedChannel); - this.wcfStub = WcfGrpc.newStub(managedChannel); - } - - public int IsLogin() { - WcfOuterClass.Empty empty = WcfOuterClass.Empty.newBuilder().build(); - WcfOuterClass.Response response = this.wcfBlokingStub.rpcIsLogin(empty); - return response.getStatus(); - } - - public String GetSelfWxid() { - WcfOuterClass.Empty empty = WcfOuterClass.Empty.newBuilder().build(); - WcfOuterClass.String rsp = this.wcfBlokingStub.rpcGetSelfWxid(empty); - return rsp.getStr(); - } - - public void EnableRecvMsg() { - if (isReceivingMsg) { - return; - } - - isReceivingMsg = true; - WcfOuterClass.Empty empty = WcfOuterClass.Empty.newBuilder().build(); - this.wcfStub.rpcEnableRecvMsg(empty, new StreamObserver() { - @Override - public void onNext(WcfOuterClass.WxMsg value) { - System.out.printf("New Message:\n%s", value); - } - - @Override - public void onError(Throwable t) { - System.err.println("EnableRecvMsg Error"); - } - - @Override - public void onCompleted() { - System.out.println("EnableRecvMsg Complete"); - } - }); - } - - public int DisableRecvMsg() { - if (!isReceivingMsg) { - return 0; - } - - WcfOuterClass.Empty empty = WcfOuterClass.Empty.newBuilder().build(); - WcfOuterClass.Response response = this.wcfBlokingStub.rpcDisableRecvMsg(empty); - if (response.getStatus() == 0) { - isReceivingMsg = false; - return 0; - } - - return -1; - } - - public int SendText(String msg, String receiver, String aters) { - WcfOuterClass.TextMsg textMsg = WcfOuterClass.TextMsg.newBuilder().setMsg(msg).setReceiver(receiver) - .setAters(aters).build(); - WcfOuterClass.Response response = this.wcfBlokingStub.rpcSendTextMsg(textMsg); - return response.getStatus(); - } - - public int SendImage(String path, String receiver) { - WcfOuterClass.ImageMsg imageMsg = WcfOuterClass.ImageMsg.newBuilder().setPath(path).setReceiver(receiver) - .build(); - WcfOuterClass.Response response = this.wcfBlokingStub.rpcSendImageMsg(imageMsg); - return response.getStatus(); - } - - public Map GetMsgTypes() { - WcfOuterClass.Empty empty = WcfOuterClass.Empty.newBuilder().build(); - WcfOuterClass.MsgTypes msgTypes = this.wcfBlokingStub.rpcGetMsgTypes(empty); - return msgTypes.getTypesMap(); - } - - public List GetContacts() { - WcfOuterClass.Empty empty = WcfOuterClass.Empty.newBuilder().build(); - WcfOuterClass.Contacts contacts = this.wcfBlokingStub.rpcGetContacts(empty); - return contacts.getContactsList(); - } - - public List GetDbs() { - WcfOuterClass.Empty empty = WcfOuterClass.Empty.newBuilder().build(); - WcfOuterClass.DbNames dbs = this.wcfBlokingStub.rpcGetDbNames(empty); - return dbs.getNamesList(); - } - - public List GetTables(String db) { - WcfOuterClass.String str = WcfOuterClass.String.newBuilder().setStr(db).build(); - WcfOuterClass.DbTables tables = this.wcfBlokingStub.rpcGetDbTables(str); - return tables.getTablesList(); - } - - public List QuerySql(String db, String sql) { - WcfOuterClass.DbQuery query = WcfOuterClass.DbQuery.newBuilder().setDb(db).setSql(sql).build(); - WcfOuterClass.DbRows rows = this.wcfBlokingStub.rpcExecDbQuery(query); - return rows.getRowsList(); - } - - public int AcceptNewFriend(String v3, String v4) { - WcfOuterClass.Verification v = WcfOuterClass.Verification.newBuilder().setV3(v3).setV4(v4).build(); - WcfOuterClass.Response response = this.wcfBlokingStub.rpcAcceptNewFriend(v); - return response.getStatus(); - } - - private boolean isReceivingMsg = false; - private WcfGrpc.WcfBlockingStub wcfBlokingStub; - private WcfGrpc.WcfStub wcfStub; -} diff --git a/java/src/main/java/com/iamteer/wcf/Main.java b/java/src/main/java/com/iamteer/wcf/Main.java deleted file mode 100644 index 4b939be..0000000 --- a/java/src/main/java/com/iamteer/wcf/Main.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.iamteer.wcf; - -import java.util.List; -import java.util.Map; -import java.util.Iterator; - -public class Main { - public static void main(String[] args) throws Exception { - String hostPort = "localhost:10086"; - Client client = new Client(); - client.InitClient(hostPort); - System.out.println("Connecting to " + hostPort); - - int status = client.IsLogin(); - System.out.println(status); - - String wxid = client.GetSelfWxid(); - System.out.println(wxid); - - client.EnableRecvMsg(); // Receive Message - - Map msgTypes = client.GetMsgTypes(); - Iterator> iterTypes = msgTypes.entrySet().iterator(); - while (iterTypes.hasNext()) { - Map.Entry entry = iterTypes.next(); - System.out.println(entry.getKey() + ": " + entry.getValue()); - } - - List contacts = client.GetContacts(); - Iterator iterContacts = contacts.iterator(); - while (iterContacts.hasNext()) { - WcfOuterClass.Contact contact = iterContacts.next(); - System.out.println(contact); - } - - List dbs = client.GetDbs(); - Iterator iterDbs = dbs.iterator(); - while (iterDbs.hasNext()) { - String db = iterDbs.next(); - System.out.println(db); - } - - List tables = client.GetTables("MicroMsg.db"); - Iterator iterTables = tables.iterator(); - while (iterTables.hasNext()) { - WcfOuterClass.DbTable table = iterTables.next(); - System.out.println(table); - } - - List rows = client.QuerySql("MicroMsg.db", "SELECT * FROM Contact LIMIT 1;"); - Iterator iterRows = rows.iterator(); - while (iterRows.hasNext()) { - WcfOuterClass.DbRow row = iterRows.next(); - System.out.println(row); - } - - // status = client.AcceptNewFriend("v3", "v4"); // 需要真实的数据 - // System.out.println(status); - - Thread.sleep(1000); - client.CleanupClient(); - } - -} diff --git a/nodejs/TEQuant.jpeg b/nodejs/TEQuant.jpeg deleted file mode 100755 index 47b86fe..0000000 Binary files a/nodejs/TEQuant.jpeg and /dev/null differ diff --git a/nodejs/package.json b/nodejs/package.json deleted file mode 100755 index bdeb59f..0000000 --- a/nodejs/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "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 deleted file mode 100755 index fec455d..0000000 --- a/nodejs/prettier.config.js +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100755 index dbae4a2..0000000 --- a/nodejs/proto/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"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 deleted file mode 100755 index f9e4e18..0000000 --- a/nodejs/proto/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import './wcf_grpc_pb'; -import './wcf_pb'; - -export const protoIndex:any = ():void => { -}; diff --git a/nodejs/proto/wcf.proto b/nodejs/proto/wcf.proto deleted file mode 100755 index 68431d0..0000000 --- a/nodejs/proto/wcf.proto +++ /dev/null @@ -1,88 +0,0 @@ -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 deleted file mode 100755 index 1fc60fe..0000000 --- a/nodejs/proto/wcf_grpc_pb.d.ts +++ /dev/null @@ -1,226 +0,0 @@ -// 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 deleted file mode 100755 index f46e0f4..0000000 --- a/nodejs/proto/wcf_grpc_pb.js +++ /dev/null @@ -1,286 +0,0 @@ -// 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 deleted file mode 100755 index f01fbbe..0000000 --- a/nodejs/proto/wcf_pb.d.ts +++ /dev/null @@ -1,421 +0,0 @@ -// 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 deleted file mode 100755 index 7f40abf..0000000 --- a/nodejs/proto/wcf_pb.js +++ /dev/null @@ -1,3376 +0,0 @@ -// 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 deleted file mode 100755 index 7cc2e5e..0000000 --- a/nodejs/src/commands/base-command.ts +++ /dev/null @@ -1,20 +0,0 @@ -// 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 deleted file mode 100755 index 894628f..0000000 --- a/nodejs/src/commands/index.ts +++ /dev/null @@ -1,29 +0,0 @@ -// 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 deleted file mode 100755 index 97d3be8..0000000 --- a/nodejs/src/commands/rock-scissors-paper.ts +++ /dev/null @@ -1,38 +0,0 @@ -// 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 deleted file mode 100755 index 73d219a..0000000 --- a/nodejs/src/commands/stock.ts +++ /dev/null @@ -1,28 +0,0 @@ -// 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 deleted file mode 100755 index 9f70927..0000000 --- a/nodejs/src/index.ts +++ /dev/null @@ -1,57 +0,0 @@ -// 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 deleted file mode 100755 index e15ecfd..0000000 --- a/nodejs/src/utils/log.ts +++ /dev/null @@ -1,11 +0,0 @@ -// 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 deleted file mode 100755 index df997e3..0000000 --- a/nodejs/src/utils/misic.ts +++ /dev/null @@ -1,20 +0,0 @@ -// 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 deleted file mode 100755 index c93d251..0000000 --- a/nodejs/src/wcf/index.ts +++ /dev/null @@ -1,55 +0,0 @@ -// 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 deleted file mode 100755 index 182581a..0000000 --- a/nodejs/src/wcf/win32.ts +++ /dev/null @@ -1,18 +0,0 @@ -// 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 deleted file mode 100755 index 0b9715a..0000000 --- a/nodejs/tsconfig.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "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. */ - } -}