summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Kukin <kukin.konstantin@gmail.com>2016-12-27 19:52:26 +0300
committerKonstantin Kukin <kukin.konstantin@gmail.com>2016-12-27 19:52:26 +0300
commit9c60e1f40132b2cf2190de55e057c442a2934440 (patch)
tree132dac4c0be66ab775a0a39d269ae154b9d8a676
parentc912fac6016ec582ac3bfeec642a9b758562c994 (diff)
add parse types to JSON part1
-rw-r--r--include/tgbot/TgTypeParser.h101
-rw-r--r--include/tgbot/types/InlineQueryResult.h2
-rw-r--r--src/TgTypeParser.cpp168
3 files changed, 269 insertions, 2 deletions
diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h
index 9e5a1d7..214480a 100644
--- a/include/tgbot/TgTypeParser.h
+++ b/include/tgbot/TgTypeParser.h
@@ -40,21 +40,42 @@
#include "tgbot/types/Location.h"
#include "tgbot/types/Update.h"
#include "tgbot/types/UserProfilePhotos.h"
+#include "tgbot/types/File.h"
#include "tgbot/types/ReplyKeyboardMarkup.h"
+#include "tgbot/types/KeyboardButton.h"
+#include "tgbot/types/ReplyKeyboardRemove.h"
#include "tgbot/types/ReplyKeyboardHide.h"
#include "tgbot/types/ForceReply.h"
+#include "tgbot/types/ChatMember.h"
+#include "tgbot/types/ResponseParameters.h"
#include "tgbot/types/GenericReply.h"
#include "tgbot/types/InlineQuery.h"
#include "tgbot/types/InlineQueryResult.h"
+#include "tgbot/types/InlineQueryResultCachedAudio.h"
+#include "tgbot/types/InlineQueryResultCachedDocument.h"
+#include "tgbot/types/InlineQueryResultCachedGif.h"
+#include "tgbot/types/InlineQueryResultCachedMpeg4Gif.h"
+#include "tgbot/types/InlineQueryResultCachedPhoto.h"
+#include "tgbot/types/InlineQueryResultCachedSticker.h"
+#include "tgbot/types/InlineQueryResultCachedVideo.h"
+#include "tgbot/types/InlineQueryResultCachedVoice.h"
#include "tgbot/types/InlineQueryResultArticle.h"
-#include "tgbot/types/InlineQueryResultPhoto.h"
+#include "tgbot/types/InlineQueryResultAudio.h"
+#include "tgbot/types/InlineQueryResultContact.h"
+#include "tgbot/types/InlineQueryResultGame.h"
+#include "tgbot/types/InlineQueryResultDocument.h"
#include "tgbot/types/InlineQueryResultGif.h"
+#include "tgbot/types/InlineQueryResultLocation.h"
#include "tgbot/types/InlineQueryResultMpeg4Gif.h"
+#include "tgbot/types/InlineQueryResultPhoto.h"
+#include "tgbot/types/InlineQueryResultVenue.h"
#include "tgbot/types/InlineQueryResultVideo.h"
+#include "tgbot/types/InlineQueryResultVoice.h"
#include "tgbot/types/ChosenInlineResult.h"
#include "tgbot/types/CallbackQuery.h"
#include "tgbot/types/InlineKeyboardMarkup.h"
#include "tgbot/types/InlineKeyboardButton.h"
+#include "tgbot/types/WebhookInfo.h"
namespace TgBot {
@@ -94,20 +115,72 @@ public:
std::string parseUpdate(const Update::Ptr& object) const;
UserProfilePhotos::Ptr parseJsonAndGetUserProfilePhotos(const boost::property_tree::ptree& data) const;
std::string parseUserProfilePhotos(const UserProfilePhotos::Ptr& object) const;
+
+ File::Ptr parseJsonAndGetFile(const boost::property_tree::ptree& data) const;
+ std::string parseFile(const File::Ptr& object) const;
+
ReplyKeyboardMarkup::Ptr parseJsonAndGetReplyKeyboardMarkup(const boost::property_tree::ptree& data) const;
std::string parseReplyKeyboardMarkup(const ReplyKeyboardMarkup::Ptr& object) const;
+
+ KeyboardButton::Ptr parseJsonAndGetKeyboardButton(const boost::property_tree::ptree& data) const;
+ std::string parseKeyboardButton(const KeyboardButton::Ptr& object) const;
+
+ ReplyKeyboardRemove::Ptr parseJsonAndGetReplyKeyboardRemove(const boost::property_tree::ptree& data) const;
+ std::string parseReplyKeyboardRemove(const ReplyKeyboardRemove::Ptr& object) const;
+
ReplyKeyboardHide::Ptr parseJsonAndGetReplyKeyboardHide(const boost::property_tree::ptree& data) const;
std::string parseReplyKeyboardHide(const ReplyKeyboardHide::Ptr& object) const;
ForceReply::Ptr parseJsonAndGetForceReply(const boost::property_tree::ptree& data) const;
std::string parseForceReply(const ForceReply::Ptr& object) const;
+
+ ChatMember::Ptr parseJsonAndGetChatMember(const boost::property_tree::ptree& data) const;
+ std::string parseChatMember(const ChatMember::Ptr& object) const;
+
+ ResponseParameters::Ptr parseJsonAndGetResponseParameters(const boost::property_tree::ptree& data) const;
+ std::string parseResponseParameters(const ResponseParameters::Ptr& object) const;
+
GenericReply::Ptr parseJsonAndGetGenericReply(const boost::property_tree::ptree& data) const;
std::string parseGenericReply(const GenericReply::Ptr& object) const;
+
InlineQuery::Ptr parseJsonAndGetInlineQuery(const boost::property_tree::ptree& data) const;
std::string parseInlineQuery(const InlineQuery::Ptr& object) const;
+
InlineQueryResult::Ptr parseJsonAndGetInlineQueryResult(const boost::property_tree::ptree& data) const;
std::string parseInlineQueryResult(const InlineQueryResult::Ptr& object) const;
+
+ InlineQueryResultCachedAudio::Ptr parseJsonAndGetInlineQueryResultCachedAudio(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultCachedAudio(const InlineQueryResultCachedAudio::Ptr& object) const;
+
+ InlineQueryResultCachedDocument::Ptr parseJsonAndGetInlineQueryResultCachedDocument(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultCachedDocument(const InlineQueryResultCachedDocument::Ptr& object) const;
+
+ InlineQueryResultCachedGif::Ptr parseJsonAndGetInlineQueryResultCachedGif(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultCachedGif(const InlineQueryResultCachedGif::Ptr& object) const;
+
+ InlineQueryResultCachedMpeg4Gif::Ptr parseJsonAndGetInlineQueryResultCachedMpeg4Gif(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultCachedMpeg4Gif(const InlineQueryResultCachedMpeg4Gif::Ptr& object) const;
+
+ InlineQueryResultCachedPhoto::Ptr parseJsonAndGetInlineQueryResultCachedPhoto(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultCachedPhoto(const InlineQueryResultCachedPhoto::Ptr& object) const;
+
+ InlineQueryResultCachedSticker::Ptr parseJsonAndGetInlineQueryResultCachedSticker(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultCachedSticker(const InlineQueryResultCachedSticker::Ptr& object) const;
+
+ InlineQueryResultCachedVideo::Ptr parseJsonAndGetInlineQueryResultCachedVideo(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultCachedVideo(const InlineQueryResultCachedVideo::Ptr& object) const;
+
+ InlineQueryResultCachedVoice::Ptr parseJsonAndGetInlineQueryResultCachedVoice(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultCachedVoice(const InlineQueryResultCachedVoice::Ptr& object) const;
+
InlineQueryResultArticle::Ptr parseJsonAndGetInlineQueryResultArticle(const boost::property_tree::ptree& data) const;
std::string parseInlineQueryResultArticle(const InlineQueryResultArticle::Ptr& object) const;
+
+ InlineQueryResultAudio::Ptr parseJsonAndGetInlineQueryResultAudio(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultAudio(const InlineQueryResultAudio::Ptr& object) const;
+
+ InlineQueryResultContact::Ptr parseJsonAndGetInlineQueryResultContact(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultContact(const InlineQueryResultContact::Ptr& object) const;
+
InlineQueryResultPhoto::Ptr parseJsonAndGetInlineQueryResultPhoto(const boost::property_tree::ptree& data) const;
std::string parseInlineQueryResultPhoto(const InlineQueryResultPhoto::Ptr& object) const;
InlineQueryResultGif::Ptr parseJsonAndGetInlineQueryResultGif(const boost::property_tree::ptree& data) const;
@@ -118,6 +191,7 @@ public:
std::string parseInlineQueryResultVideo(const InlineQueryResultVideo::Ptr& object) const;
ChosenInlineResult::Ptr parseJsonAndGetChosenInlineResult(const boost::property_tree::ptree& data) const;
std::string parseChosenInlineResult(const ChosenInlineResult::Ptr& object) const;
+
CallbackQuery::Ptr parseJsonAndGetCallbackQuery(const boost::property_tree::ptree& data) const;
std::string parseCallbackQuery(const CallbackQuery::Ptr& object) const;
InlineKeyboardMarkup::Ptr parseJsonAndGetInlineKeyboardMarkup(const boost::property_tree::ptree& data) const;
@@ -125,6 +199,9 @@ public:
InlineKeyboardButton::Ptr parseJsonAndGetInlineKeyboardButton(const boost::property_tree::ptree& data) const;
std::string parseInlineKeyboardButton(const InlineKeyboardButton::Ptr& object) const;
+ WebhookInfo::Ptr parseJsonAndGetWebhookInfo(const boost::property_tree::ptree& data) const;
+ std::string parseWebhookInfo(const WebhookInfo::Ptr& object) const;
+
inline boost::property_tree::ptree parseJson(const std::string& json) const {
boost::property_tree::ptree tree;
std::istringstream input(json);
@@ -151,6 +228,15 @@ public:
}
template<typename T>
+ std::vector<T> parseJsonAndGetArray(std::function<T(const boost::property_tree::ptree&)> parseFunc, const boost::property_tree::ptree& data) const {
+ std::vector<T> result;
+ for (const std::pair<const std::string, boost::property_tree::ptree>& innerTreeItem : data) {
+ result.push_back(parseFunc(innerTreeItem.second));
+ }
+ return result;
+ }
+
+ template<typename T>
std::vector<std::shared_ptr<T>> parseJsonAndGetArray(JsonToTgTypeFunc<T> parseFunc, const boost::property_tree::ptree& data, const std::string& keyName) const {
std::vector<std::shared_ptr<T>> result;
auto treeItem = data.find(keyName);
@@ -194,6 +280,19 @@ public:
}
template<typename T>
+ std::string parseArray(std::function<T(const T&)> parseFunc, const std::vector<T>& objects) const {
+ std::string result;
+ result += '[';
+ for (const T& item : objects) {
+ result += parseFunc(item);
+ result += ',';
+ }
+ result.erase(result.length() - 1);
+ result += ']';
+ return result;
+ }
+
+ template<typename T>
std::string parse2DArray(TgTypeToJsonFunc<T> parseFunc, const std::vector<std::vector<std::shared_ptr<T>>>& objects) const {
std::string result;
result += '[';
diff --git a/include/tgbot/types/InlineQueryResult.h b/include/tgbot/types/InlineQueryResult.h
index 6dad81b..29e6f7a 100644
--- a/include/tgbot/types/InlineQueryResult.h
+++ b/include/tgbot/types/InlineQueryResult.h
@@ -22,7 +22,7 @@ public:
typedef std::shared_ptr<InlineQueryResult> Ptr;
InlineQueryResult() {
- //this->disableWebPagePreview = false;
+
}
virtual ~InlineQueryResult() { }
diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp
index 6bd77a7..ea176b0 100644
--- a/src/TgTypeParser.cpp
+++ b/src/TgTypeParser.cpp
@@ -49,6 +49,7 @@ Chat::Ptr TgTypeParser::parseJsonAndGetChat(const ptree& data) const {
result->username = data.get("username", "");
result->firstName = data.get<string>("first_name", "");
result->lastName = data.get("last_name", "");
+ result->allMembersAreAdministrators = data.get<bool>("all_members_are_administrators", false);
return result;
}
@@ -108,6 +109,7 @@ MessageEntity::Ptr TgTypeParser::parseJsonAndGetEntity(const ptree& data) const{
result->offset=data.get<int32_t>("offset");
result->length=data.get<int32_t>("length");
result->url=data.get<string>("url", "");
+ result->user = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "user");
return result;
}
@@ -208,6 +210,8 @@ Audio::Ptr TgTypeParser::parseJsonAndGetAudio(const ptree& data) const {
Audio::Ptr result(new Audio);
result->fileId = data.get<string>("file_id");
result->duration = data.get<int32_t>("duration");
+ result->performer = data.get<string>("performer", "");
+ result->title = data.get<string>("title", "");
result->mimeType = data.get("mime_type", "");
result->fileSize = data.get("file_size", 0);
return result;
@@ -260,6 +264,7 @@ Sticker::Ptr TgTypeParser::parseJsonAndGetSticker(const ptree& data) const {
result->width = data.get<int32_t>("width");
result->height = data.get<int32_t>("height");
result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->emoji = data.get<string>("emoji");
result->fileSize = data.get("file_size", 0);
return result;
}
@@ -274,6 +279,7 @@ string TgTypeParser::parseSticker(const Sticker::Ptr& object) const {
appendToJson(result, "width", object->width);
appendToJson(result, "height", object->height);
appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "emoji", object->emoji);
appendToJson(result, "file_size", object->fileSize);
result.erase(result.length() - 1);
result += '}';
@@ -400,6 +406,28 @@ string TgTypeParser::parseUserProfilePhotos(const UserProfilePhotos::Ptr& object
return result;
}
+File::Ptr TgTypeParser::parseJsonAndGetFile(const boost::property_tree::ptree& data) const {
+ File::Ptr result(new File);
+ result->fileId = data.get<string>("file_id");
+ result->filePath = data.get<int32_t>("file_size", 0);
+ result->filePath = data.get<string>("file_path", "");
+ return result;
+}
+
+string TgTypeParser::parseFile(const File::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ string result;
+ result += '{';
+ appendToJson(result, "file_id", object->fileId);
+ appendToJson(result, "file_size", object->fileSize);
+ appendToJson(result, "file_path", object->filePath);
+ result.erase(result.length() - 1);
+ result += '}';
+ return result;
+}
+
ReplyKeyboardMarkup::Ptr TgTypeParser::parseJsonAndGetReplyKeyboardMarkup(const boost::property_tree::ptree& data) const {
ReplyKeyboardMarkup::Ptr result(new ReplyKeyboardMarkup);
for (const pair<const string, ptree>& item : data.find("keyboard")->second) {
@@ -442,6 +470,47 @@ std::string TgTypeParser::parseReplyKeyboardMarkup(const ReplyKeyboardMarkup::Pt
return result;
}
+KeyboardButton::Ptr TgTypeParser::parseJsonAndGetKeyboardButton(const boost::property_tree::ptree& data) const {
+ KeyboardButton::Ptr result(new KeyboardButton);
+ result->text = data.get<string>("text");
+ result->requestContact = data.get<bool>("request_contact", false);
+ result->requestLocation = data.get<bool>("request_location", false);
+ return result;
+}
+
+std::string TgTypeParser::parseKeyboardButton(const KeyboardButton::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ string result;
+ result += '{';
+ appendToJson(result, "text", object->text);
+ appendToJson(result, "request_contact", object->requestContact);
+ appendToJson(result, "request_location", object->requestLocation);
+ result.erase(result.length() - 1);
+ result += '}';
+ return result;
+}
+
+ReplyKeyboardRemove::Ptr TgTypeParser::parseJsonAndGetReplyKeyboardRemove(const boost::property_tree::ptree& data) const {
+ ReplyKeyboardRemove::Ptr result(new ReplyKeyboardRemove);
+ result->selective = data.get<bool>("selective", false);
+ return result;
+}
+
+std::string TgTypeParser::parseReplyKeyboardRemove(const ReplyKeyboardRemove::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ string result;
+ result += '{';
+ appendToJson(result, "remove_keyboard", object->removeKeyboard);
+ appendToJson(result, "selective", object->selective);
+ result.erase(result.length() - 1);
+ result += '}';
+ return result;
+}
+
ReplyKeyboardHide::Ptr TgTypeParser::parseJsonAndGetReplyKeyboardHide(const boost::property_tree::ptree& data) const {
ReplyKeyboardHide::Ptr result(new ReplyKeyboardHide);
result->selective = data.get<bool>("selective");
@@ -480,6 +549,46 @@ std::string TgTypeParser::parseForceReply(const ForceReply::Ptr& object) const {
return result;
}
+ChatMember::Ptr TgTypeParser::parseJsonAndGetChatMember(const boost::property_tree::ptree& data) const {
+ ChatMember::Ptr result(new ChatMember);
+ result->user = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "user");
+ result->status = data.get<string>("status");
+ return result;
+}
+
+std::string TgTypeParser::parseChatMember(const ChatMember::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ string result;
+ result += '{';
+ appendToJson(result, "user", parseUser(object->user));
+ appendToJson(result, "status", object->status);
+ result.erase(result.length() - 1);
+ result += '}';
+ return result;
+}
+
+ResponseParameters::Ptr TgTypeParser::parseJsonAndGetResponseParameters(const boost::property_tree::ptree& data) const {
+ ResponseParameters::Ptr result(new ResponseParameters);
+ result->migrateToChatId = data.get<int32_t>("migrate_to_chat_id", 0);
+ result->retryAfter = data.get<int32_t>("retry_after", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseResponseParameters(const ResponseParameters::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ string result;
+ result += '{';
+ appendToJson(result, "migrate_to_chat_id", object->migrateToChatId);
+ appendToJson(result, "retry_after", object->retryAfter);
+ result.erase(result.length() - 1);
+ result += '}';
+ return result;
+}
+
GenericReply::Ptr TgTypeParser::parseJsonAndGetGenericReply(const boost::property_tree::ptree& data) const {
if (data.find("force_reply") != data.not_found()) {
return static_pointer_cast<GenericReply>(parseJsonAndGetForceReply(data));
@@ -511,6 +620,7 @@ InlineQuery::Ptr TgTypeParser::parseJsonAndGetInlineQuery(const boost::property_
InlineQuery::Ptr result(new InlineQuery);
result->id = data.get<string>("id");
result->from = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "from");
+ result->location = tryParseJson<Location>(&TgTypeParser::parseJsonAndGetLocation, data, "location");
result->query = data.get<string>("query");
result->offset = data.get<string>("offset");
@@ -525,6 +635,7 @@ std::string TgTypeParser::parseInlineQuery(const InlineQuery::Ptr& object) const
result += '{';
appendToJson(result, "id", object->id);
appendToJson(result, "from", parseUser(object->from));
+ appendToJson(result, "location", parseLocation(object->location));
appendToJson(result, "query", object->query);
appendToJson(result, "offset", object->offset);
result.erase(result.length() - 1);
@@ -536,6 +647,19 @@ InlineQueryResult::Ptr TgTypeParser::parseJsonAndGetInlineQueryResult(const boos
string type = data.get<string>("type");
InlineQueryResult::Ptr result;
+ /*if (type == InlineQueryResultCachedAudio::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultArticle(data));
+ } else if (type == InlineQueryResultCachedDocument::TYPE) {
+
+ } else if (type == InlineQueryResultCachedDocument::TYPE) {
+
+ } else if (type == InlineQueryResultCachedDocument::TYPE) {
+
+ } else if (type == InlineQueryResultCachedDocument::TYPE) {
+
+ } else if (type == InlineQueryResultCachedDocument::TYPE) {
+
+ }*/
if (type == InlineQueryResultArticle::TYPE) {
result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultArticle(data));
} else if (type == InlineQueryResultPhoto::TYPE) {
@@ -753,6 +877,8 @@ CallbackQuery::Ptr TgTypeParser::parseJsonAndGetCallbackQuery(const boost::prope
result->from = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "from");
result->message = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "message");
result->inlineMessageId = data.get<string>("inline_message_id", "");
+ result->chatInstance = data.get<string>("chat_instance");
+ result->gameShortName = data.get<string>("game_short_name", "");
result->data = data.get<string>("data", "");
return result;
}
@@ -768,6 +894,8 @@ std::string TgTypeParser::parseCallbackQuery(const CallbackQuery::Ptr& object) c
appendToJson(result, "from", parseUser(object->from));
appendToJson(result, "message", parseMessage(object->message));
appendToJson(result, "inline_message_id", object->inlineMessageId);
+ appendToJson(result, "chat_instance", object->chatInstance);
+ appendToJson(result, "game_short_name", object->gameShortName);
appendToJson(result, "data", object->data);
result.erase(result.length() - 1);
result += '}';
@@ -809,6 +937,7 @@ InlineKeyboardButton::Ptr TgTypeParser::parseJsonAndGetInlineKeyboardButton(cons
result->url = data.get<string>("url", "");
result->callbackData = data.get<string>("callback_data", "");
result->switchInlineQuery = data.get<string>("switch_inline_query", "");
+ result->switchInlineQueryCurrentChat = data.get<string>("switch_inline_query_current_chat", "");
return result;
}
std::string TgTypeParser::parseInlineKeyboardButton(const InlineKeyboardButton::Ptr& object) const {
@@ -821,6 +950,45 @@ std::string TgTypeParser::parseInlineKeyboardButton(const InlineKeyboardButton::
appendToJson(result, "url", object->url);
appendToJson(result, "callback_data", object->callbackData);
appendToJson(result, "switch_inline_query", object->switchInlineQuery);
+ appendToJson(result, "switch_inline_query_current_chat", object->switchInlineQueryCurrentChat);
+ result.erase(result.length() - 1);
+ result += '}';
+ return result;
+}
+
+WebhookInfo::Ptr TgTypeParser::parseJsonAndGetWebhookInfo(const boost::property_tree::ptree& data) const {
+ WebhookInfo::Ptr result(new WebhookInfo);
+ result->url = data.get<string>("url");
+ result->hasCustomCertificate = data.get<bool>("has_custom_certificate");
+ result->pendingUpdateCount = data.get<int32_t>("pending_update_count");
+ result->lastErrorDate = data.get<int32_t>("last_error_date", 0);
+ result->lastErrorMessage = data.get<string>("last_error_message", "");
+ result->maxConnections = data.get<int32_t>("max_connections", 0);
+ result->allowedUpdates = parseJsonAndGetArray<std::string>(
+ [](const boost::property_tree::ptree& innerData)->std::string {
+ return innerData.get<std::string>("");
+ }
+ , data);
+ return result;
+}
+
+std::string TgTypeParser::parseWebhookInfo(const WebhookInfo::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ string result;
+ result += '{';
+ appendToJson(result, "url", object->url);
+ appendToJson(result, "has_custom_certificate", object->hasCustomCertificate);
+ appendToJson(result, "pending_update_count", object->pendingUpdateCount);
+ appendToJson(result, "last_error_date", object->lastErrorDate);
+ appendToJson(result, "last_error_message", object->lastErrorMessage);
+ appendToJson(result, "max_connections", object->maxConnections);
+ appendToJson(result, "allowed_updates",
+ parseArray<std::string>([](const std::string &s)->std::string {
+ return s;
+ }
+ , object->allowedUpdates));
result.erase(result.length() - 1);
result += '}';
return result;