Refactor RestService interfaces.

This commit is contained in:
Adam Gu
2018-08-24 16:51:08 +08:00
parent e9096d4e53
commit a863b379d0
10 changed files with 227 additions and 265 deletions
+2 -20
View File
@@ -5,26 +5,8 @@
#include "webcc/logger.h"
#include "webcc/rest_async_client.h"
// -----------------------------------------------------------------------------
// Write a JSON object to string.
static std::string JsonToString(const Json::Value& json) {
Json::StreamWriterBuilder builder;
return Json::writeString(builder, json);
}
static Json::Value StringToJson(const std::string& str) {
Json::Value json;
Json::CharReaderBuilder builder;
std::stringstream stream(str);
std::string errs;
if (!Json::parseFromStream(builder, stream, &json, &errs)) {
std::cerr << errs << std::endl;
}
return json;
}
#include "example/common/book.h"
#include "example/common/book_json.h"
// -----------------------------------------------------------------------------