From 79bb03513bb191cb570c3bde4283626e2e6e5b58 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Tue, 28 Oct 2014 11:39:55 +0100 Subject: [PATCH] ldb access from api --- webthreestubclient.h | 58 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/webthreestubclient.h b/webthreestubclient.h index 911d757e4..c25ea0d97 100644 --- a/webthreestubclient.h +++ b/webthreestubclient.h @@ -171,6 +171,20 @@ class WebThreeStubClient } + std::string get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); +p.append(param2); + + Json::Value result = this->client->CallMethod("get",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + + } + Json::Value getMessages(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; @@ -184,6 +198,20 @@ class WebThreeStubClient } + std::string getString(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); +p.append(param2); + + Json::Value result = this->client->CallMethod("getString",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + + } + bool listening() throw (jsonrpc::JsonRpcException) { Json::Value p; @@ -258,6 +286,36 @@ class WebThreeStubClient } + bool put(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); +p.append(param2); +p.append(param3); + + Json::Value result = this->client->CallMethod("put",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + + } + + bool putString(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); +p.append(param2); +p.append(param3); + + Json::Value result = this->client->CallMethod("putString",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + + } + bool setCoinbase(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p;