summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/tgbot/TgTypeParser.h35
-rw-r--r--include/tgbot/types/InputContactMessageContent.h4
-rw-r--r--include/tgbot/types/InputLocationMessageContent.h4
-rw-r--r--include/tgbot/types/InputMessageContent.h13
-rw-r--r--include/tgbot/types/InputTextMessageContent.h4
-rw-r--r--include/tgbot/types/InputVenueMessageContent.h6
-rw-r--r--include/tgbot/types/Update.h15
-rw-r--r--src/TgTypeParser.cpp631
-rw-r--r--src/types/InlineQueryResult.cpp32
9 files changed, 707 insertions, 37 deletions
diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h
index 214480a..66e2c41 100644
--- a/include/tgbot/TgTypeParser.h
+++ b/include/tgbot/TgTypeParser.h
@@ -76,6 +76,11 @@
#include "tgbot/types/InlineKeyboardMarkup.h"
#include "tgbot/types/InlineKeyboardButton.h"
#include "tgbot/types/WebhookInfo.h"
+#include "tgbot/types/InputMessageContent.h"
+#include "tgbot/types/InputTextMessageContent.h"
+#include "tgbot/types/InputLocationMessageContent.h"
+#include "tgbot/types/InputVenueMessageContent.h"
+#include "tgbot/types/InputContactMessageContent.h"
namespace TgBot {
@@ -181,6 +186,21 @@ public:
InlineQueryResultContact::Ptr parseJsonAndGetInlineQueryResultContact(const boost::property_tree::ptree& data) const;
std::string parseInlineQueryResultContact(const InlineQueryResultContact::Ptr& object) const;
+ InlineQueryResultGame::Ptr parseJsonAndGetInlineQueryResultGame(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultGame(const InlineQueryResultGame::Ptr& object) const;
+
+ InlineQueryResultDocument::Ptr parseJsonAndGetInlineQueryResultDocument(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultDocument(const InlineQueryResultDocument::Ptr& object) const;
+
+ InlineQueryResultLocation::Ptr parseJsonAndGetInlineQueryResultLocation(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultLocation(const InlineQueryResultLocation::Ptr& object) const;
+
+ InlineQueryResultVenue::Ptr parseJsonAndGetInlineQueryResultVenue(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultVenue(const InlineQueryResultVenue::Ptr& object) const;
+
+ InlineQueryResultVoice::Ptr parseJsonAndGetInlineQueryResultVoice(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultVoice(const InlineQueryResultVoice::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;
@@ -202,6 +222,21 @@ public:
WebhookInfo::Ptr parseJsonAndGetWebhookInfo(const boost::property_tree::ptree& data) const;
std::string parseWebhookInfo(const WebhookInfo::Ptr& object) const;
+ InputMessageContent::Ptr parseJsonAndGetInputMessageContent(const boost::property_tree::ptree& data) const;
+ std::string parseInputMessageContent(const InputMessageContent::Ptr& object) const;
+
+ InputTextMessageContent::Ptr parseJsonAndGetInputTextMessageContent(const boost::property_tree::ptree& data) const;
+ std::string parseInputTextMessageContent(const InputTextMessageContent::Ptr& object) const;
+
+ InputLocationMessageContent::Ptr parseJsonAndGetInputLocationMessageContent(const boost::property_tree::ptree& data) const;
+ std::string parseInputLocationMessageContent(const InputLocationMessageContent::Ptr& object) const;
+
+ InputVenueMessageContent::Ptr parseJsonAndGetInputVenueMessageContent(const boost::property_tree::ptree& data) const;
+ std::string parseInputVenueMessageContent(const InputVenueMessageContent::Ptr& object) const;
+
+ InputContactMessageContent::Ptr parseJsonAndGetInputContactMessageContent(const boost::property_tree::ptree& data) const;
+ std::string parseInputContactMessageContent(const InputContactMessageContent::Ptr& object) const;
+
inline boost::property_tree::ptree parseJson(const std::string& json) const {
boost::property_tree::ptree tree;
std::istringstream input(json);
diff --git a/include/tgbot/types/InputContactMessageContent.h b/include/tgbot/types/InputContactMessageContent.h
index 84ba907..421093c 100644
--- a/include/tgbot/types/InputContactMessageContent.h
+++ b/include/tgbot/types/InputContactMessageContent.h
@@ -18,6 +18,10 @@ class InputContactMessageContent : public InputMessageContent {
public:
typedef std::shared_ptr<InputContactMessageContent> Ptr;
+ InputContactMessageContent() :
+ InputMessageContent("InputContactMessageContent")
+ {}
+
/**
* Contact's phone number
*/
diff --git a/include/tgbot/types/InputLocationMessageContent.h b/include/tgbot/types/InputLocationMessageContent.h
index 737ca9f..3405353 100644
--- a/include/tgbot/types/InputLocationMessageContent.h
+++ b/include/tgbot/types/InputLocationMessageContent.h
@@ -17,6 +17,10 @@ class InputLocationMessageContent : public InputMessageContent {
public:
typedef std::shared_ptr<InputLocationMessageContent> Ptr;
+ InputLocationMessageContent() :
+ InputMessageContent("InputLocationMessageContent")
+ {}
+
/**
* Latitude of the location in degrees
*/
diff --git a/include/tgbot/types/InputMessageContent.h b/include/tgbot/types/InputMessageContent.h
index 2063c08..587dcf8 100644
--- a/include/tgbot/types/InputMessageContent.h
+++ b/include/tgbot/types/InputMessageContent.h
@@ -17,6 +17,19 @@ class InputMessageContent {
public:
typedef std::shared_ptr<InputMessageContent> Ptr;
+ InputMessageContent(const std::string &tType):
+ type(tType)
+ {}
+
+ /**
+ * May be
+ * InputTextMessageContent
+ * InputLocationMessageContent
+ * InputVenueMessageContent
+ * InputContactMessageContent
+ */
+ std::string type;
+
virtual ~InputMessageContent() { }
};
}
diff --git a/include/tgbot/types/InputTextMessageContent.h b/include/tgbot/types/InputTextMessageContent.h
index 4960164..4c33069 100644
--- a/include/tgbot/types/InputTextMessageContent.h
+++ b/include/tgbot/types/InputTextMessageContent.h
@@ -18,6 +18,10 @@ class InputTextMessageContent : public InputMessageContent {
public:
typedef std::shared_ptr<InputTextMessageContent> Ptr;
+ InputTextMessageContent():
+ InputMessageContent("InputTextMessageContent")
+ {}
+
/**
* Text of the message to be sent, 1-4096 characters
*/
diff --git a/include/tgbot/types/InputVenueMessageContent.h b/include/tgbot/types/InputVenueMessageContent.h
index 0b5eab7..3ffc998 100644
--- a/include/tgbot/types/InputVenueMessageContent.h
+++ b/include/tgbot/types/InputVenueMessageContent.h
@@ -19,6 +19,10 @@ class InputVenueMessageContent : public InputMessageContent {
public:
typedef std::shared_ptr<InputVenueMessageContent> Ptr;
+ InputVenueMessageContent() :
+ InputMessageContent("InputVenueMessageContent")
+ {}
+
/**
* Latitude of the location in degrees
*/
@@ -42,7 +46,7 @@ public:
/**
* Optional. Foursquare identifier of the venue, if known
*/
- std::string foursquare_id;
+ std::string foursquareId;
virtual ~InputVenueMessageContent() { }
};
diff --git a/include/tgbot/types/Update.h b/include/tgbot/types/Update.h
index 7a3c106..53fe697 100644
--- a/include/tgbot/types/Update.h
+++ b/include/tgbot/types/Update.h
@@ -52,6 +52,21 @@ public:
Message::Ptr message;
/**
+ * Optional. New version of a message that is known to the bot and was edited
+ */
+ Message::Ptr editedMessage;
+
+ /**
+ * Optional. New incoming channel post of any kind — text, photo, sticker, etc.
+ */
+ Message::Ptr channelPost;
+
+ /**
+ * Optional. New version of a channel post that is known to the bot and was edited
+ */
+ Message::Ptr editedChannelPost;
+
+ /**
* Optional. New incoming inline query
*/
InlineQuery::Ptr inlineQuery;
diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp
index ea176b0..939d339 100644
--- a/src/TgTypeParser.cpp
+++ b/src/TgTypeParser.cpp
@@ -342,8 +342,8 @@ string TgTypeParser::parseContact(const Contact::Ptr& object) const {
Location::Ptr TgTypeParser::parseJsonAndGetLocation(const ptree& data) const {
Location::Ptr result(new Location);
- result->longitude = data.get<float>("longitude");
- result->latitude = data.get<float>("latitude");
+ result->longitude = data.get<float>("longitude", 0);
+ result->latitude = data.get<float>("latitude", 0);
return result;
}
@@ -364,6 +364,9 @@ Update::Ptr TgTypeParser::parseJsonAndGetUpdate(const ptree& data) const {
Update::Ptr result(new Update);
result->updateId = data.get<int32_t>("update_id");
result->message = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "message");
+ result->editedMessage = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "edited_message");
+ result->channelPost = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "channel_post");
+ result->editedChannelPost = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "edited_channel_post");
result->inlineQuery = tryParseJson<InlineQuery>(&TgTypeParser::parseJsonAndGetInlineQuery, data, "inline_query");
result->chosenInlineResult = tryParseJson<ChosenInlineResult>(&TgTypeParser::parseJsonAndGetChosenInlineResult, data, "chosen_inline_result");
result->callbackQuery = tryParseJson<CallbackQuery>(&TgTypeParser::parseJsonAndGetCallbackQuery, data, "callback_query");
@@ -378,6 +381,9 @@ string TgTypeParser::parseUpdate(const Update::Ptr& object) const {
result += '{';
appendToJson(result, "update_id", object->updateId);
appendToJson(result, "message", parseMessage(object->message));
+ appendToJson(result, "edited_message", parseMessage(object->editedMessage));
+ appendToJson(result, "channel_post", parseMessage(object->channelPost));
+ appendToJson(result, "edited_channel_post", parseMessage(object->editedChannelPost));
appendToJson(result, "inline_query", parseInlineQuery(object->inlineQuery));
appendToJson(result, "chosen_inline_result", parseChosenInlineResult(object->chosenInlineResult));
appendToJson(result, "callback_query", parseCallbackQuery(object->callbackQuery));
@@ -647,21 +653,38 @@ 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) {
-
+ if (type == InlineQueryResultCachedAudio::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultCachedAudio(data));
} else if (type == InlineQueryResultCachedDocument::TYPE) {
-
- } else if (type == InlineQueryResultCachedDocument::TYPE) {
-
- }*/
- if (type == InlineQueryResultArticle::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultCachedDocument(data));
+ } else if (type == InlineQueryResultCachedGif::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultCachedGif(data));
+ } else if (type == InlineQueryResultCachedMpeg4Gif::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultCachedMpeg4Gif(data));
+ } else if (type == InlineQueryResultCachedPhoto::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultCachedPhoto(data));
+ } else if (type == InlineQueryResultCachedSticker::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultCachedSticker(data));
+ } else if (type == InlineQueryResultCachedVideo::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultCachedVideo(data));
+ } else if (type == InlineQueryResultCachedVoice::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultCachedVoice(data));
+ } else if (type == InlineQueryResultArticle::TYPE) {
result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultArticle(data));
+ } else if (type == InlineQueryResultAudio::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultAudio(data));
+ } else if (type == InlineQueryResultContact::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultContact(data));
+ } else if (type == InlineQueryResultGame::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultGame(data));
+ } else if (type == InlineQueryResultDocument::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultDocument(data));
+ } else if (type == InlineQueryResultLocation::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultLocation(data));
+ } else if (type == InlineQueryResultVenue::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultVenue(data));
+ } else if (type == InlineQueryResultVoice::TYPE) {
+ result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultVoice(data));
} else if (type == InlineQueryResultPhoto::TYPE) {
result = static_pointer_cast<InlineQueryResult>(parseJsonAndGetInlineQueryResultPhoto(data));
} else if (type == InlineQueryResultGif::TYPE) {
@@ -676,10 +699,9 @@ InlineQueryResult::Ptr TgTypeParser::parseJsonAndGetInlineQueryResult(const boos
result->id = data.get<string>("id");
result->title = data.get<string>("title", "");
- //result->messageText = data.get<string>("message_text", "");
- //result->parseMode = data.get<string>("parse_mode", "");
- //result->disableWebPagePreview = data.get("disable_web_page_preview", false);
- //result->thumbUrl = data.get<string>("thumb_url", "");
+ result->caption = data.get<string>("caption", "");
+ result->replyMarkup = tryParseJson<InlineKeyboardMarkup>(&TgTypeParser::parseJsonAndGetInlineKeyboardMarkup, data, "reply_markup");
+ result->inputMessageContent = tryParseJson<InputMessageContent>(&TgTypeParser::parseJsonAndGetInputMessageContent, data, "input_message_content");
return result;
}
@@ -694,34 +716,246 @@ std::string TgTypeParser::parseInlineQueryResult(const InlineQueryResult::Ptr& o
appendToJson(result, "id", object->id);
appendToJson(result, "type", object->type);
appendToJson(result, "title", object->title);
- //appendToJson(result, "message_text", object->messageText);
- //appendToJson(result, "parse_mode", object->parseMode);
- //appendToJson(result, "disable_web_page_preview", object->disableWebPagePreview);
- //appendToJson(result, "thumb_url", object->thumbUrl);
+ appendToJson(result, "caption", object->caption);
+ appendToJson(result, "reply_markup", parseInlineKeyboardMarkup(object->replyMarkup));
+ appendToJson(result, "input_message_content", parseInputMessageContent(object->inputMessageContent));
- if (object->type == InlineQueryResultArticle::TYPE){
+ if (object->type == InlineQueryResultCachedAudio::TYPE) {
+ result += parseInlineQueryResultCachedAudio(static_pointer_cast<InlineQueryResultCachedAudio>(object));
+ }
+ else if (object->type == InlineQueryResultCachedDocument::TYPE) {
+ result += parseInlineQueryResultCachedDocument(static_pointer_cast<InlineQueryResultCachedDocument>(object));
+ }
+ else if (object->type == InlineQueryResultCachedGif::TYPE) {
+ result += parseInlineQueryResultCachedGif(static_pointer_cast<InlineQueryResultCachedGif>(object));
+ }
+ else if (object->type == InlineQueryResultCachedMpeg4Gif::TYPE) {
+ result += parseInlineQueryResultCachedMpeg4Gif(static_pointer_cast<InlineQueryResultCachedMpeg4Gif>(object));
+ }
+ else if (object->type == InlineQueryResultCachedPhoto::TYPE) {
+ result += parseInlineQueryResultCachedPhoto(static_pointer_cast<InlineQueryResultCachedPhoto>(object));
+ }
+ else if (object->type == InlineQueryResultCachedSticker::TYPE) {
+ result += parseInlineQueryResultCachedSticker(static_pointer_cast<InlineQueryResultCachedSticker>(object));
+ }
+ else if (object->type == InlineQueryResultCachedVideo::TYPE) {
+ result += parseInlineQueryResultCachedVideo(static_pointer_cast<InlineQueryResultCachedVideo>(object));
+ }
+ else if (object->type == InlineQueryResultCachedVoice::TYPE) {
+ result += parseInlineQueryResultCachedVoice(static_pointer_cast<InlineQueryResultCachedVoice>(object));
+ }
+ else if (object->type == InlineQueryResultArticle::TYPE) {
result += parseInlineQueryResultArticle(static_pointer_cast<InlineQueryResultArticle>(object));
- } else if (object->type == InlineQueryResultPhoto::TYPE){
+ }
+ else if (object->type == InlineQueryResultAudio::TYPE) {
+ result += parseInlineQueryResultAudio(static_pointer_cast<InlineQueryResultAudio>(object));
+ }
+ else if (object->type == InlineQueryResultContact::TYPE) {
+ result += parseInlineQueryResultContact(static_pointer_cast<InlineQueryResultContact>(object));
+ }
+ else if (object->type == InlineQueryResultGame::TYPE) {
+ result += parseInlineQueryResultGame(static_pointer_cast<InlineQueryResultGame>(object));
+ }
+ else if (object->type == InlineQueryResultDocument::TYPE) {
+ result += parseInlineQueryResultDocument(static_pointer_cast<InlineQueryResultDocument>(object));
+ }
+ else if (object->type == InlineQueryResultLocation::TYPE) {
+ result += parseInlineQueryResultLocation(static_pointer_cast<InlineQueryResultLocation>(object));
+ }
+ else if (object->type == InlineQueryResultVenue::TYPE) {
+ result += parseInlineQueryResultVenue(static_pointer_cast<InlineQueryResultVenue>(object));
+ }
+ else if (object->type == InlineQueryResultVoice::TYPE) {
+ result += parseInlineQueryResultVoice(static_pointer_cast<InlineQueryResultVoice>(object));
+ }
+ else if (object->type == InlineQueryResultPhoto::TYPE) {
result += parseInlineQueryResultPhoto(static_pointer_cast<InlineQueryResultPhoto>(object));
- } else if (object->type == InlineQueryResultGif::TYPE){
+ }
+ else if (object->type == InlineQueryResultGif::TYPE) {
result += parseInlineQueryResultGif(static_pointer_cast<InlineQueryResultGif>(object));
- } else if (object->type == InlineQueryResultMpeg4Gif::TYPE){
+ }
+ else if (object->type == InlineQueryResultMpeg4Gif::TYPE) {
result += parseInlineQueryResultMpeg4Gif(static_pointer_cast<InlineQueryResultMpeg4Gif>(object));
- } else if (object->type == InlineQueryResultVideo::TYPE){
+ }
+ else if (object->type == InlineQueryResultVideo::TYPE) {
result += parseInlineQueryResultVideo(static_pointer_cast<InlineQueryResultVideo>(object));
}
-
+
result.erase(result.length() - 1);
result += '}';
return result;
}
+InlineQueryResultCachedAudio::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedAudio(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultCachedAudio::Ptr result(new InlineQueryResultCachedAudio);
+ result->audioFileId = data.get<string>("audio_file_id");
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultCachedAudio(const InlineQueryResultCachedAudio::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "audio_file_id", object->audioFileId);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
+InlineQueryResultCachedDocument::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedDocument(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultCachedDocument::Ptr result(new InlineQueryResultCachedDocument);
+ result->documentFileId = data.get<string>("document_file_id");
+ result->description = data.get<string>("description", "");
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultCachedDocument(const InlineQueryResultCachedDocument::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "document_file_id", object->documentFileId);
+ appendToJson(result, "description", object->description);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
+
+InlineQueryResultCachedGif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedGif(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultCachedGif::Ptr result(new InlineQueryResultCachedGif);
+ result->gifFileId = data.get<string>("gif_file_id");
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultCachedGif(const InlineQueryResultCachedGif::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "gif_file_id", object->gifFileId);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
+
+InlineQueryResultCachedMpeg4Gif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedMpeg4Gif(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultCachedMpeg4Gif::Ptr result(new InlineQueryResultCachedMpeg4Gif);
+ result->mpeg4FileId = data.get<string>("mpeg4_file_id");
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultCachedMpeg4Gif(const InlineQueryResultCachedMpeg4Gif::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "mpeg4_file_id", object->mpeg4FileId);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
+
+InlineQueryResultCachedPhoto::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedPhoto(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultCachedPhoto::Ptr result(new InlineQueryResultCachedPhoto);
+ result->photoFileId = data.get<string>("photo_file_id");
+ result->description = data.get<string>("description", "");
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultCachedPhoto(const InlineQueryResultCachedPhoto::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "photo_file_id", object->photoFileId);
+ appendToJson(result, "description", object->description);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
+
+InlineQueryResultCachedSticker::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedSticker(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultCachedSticker::Ptr result(new InlineQueryResultCachedSticker);
+ result->stickerFileId = data.get<string>("sticker_file_id");
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultCachedSticker(const InlineQueryResultCachedSticker::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "sticker_file_id", object->stickerFileId);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
+InlineQueryResultCachedVideo::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedVideo(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultCachedVideo::Ptr result(new InlineQueryResultCachedVideo);
+ result->videoFileId = data.get<string>("video_file_id");
+ result->description = data.get<string>("description", "");
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultCachedVideo(const InlineQueryResultCachedVideo::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "video_file_id", object->videoFileId);
+ appendToJson(result, "description", object->description);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
+
+InlineQueryResultCachedVoice::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCachedVoice(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultCachedVoice::Ptr result(new InlineQueryResultCachedVoice);
+ result->voiceFileId = data.get<string>("voice_file_id");
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultCachedVoice(const InlineQueryResultCachedVoice::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "voice_file_id", object->voiceFileId);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
InlineQueryResultArticle::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultArticle(const boost::property_tree::ptree& data) const {
// NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
InlineQueryResultArticle::Ptr result(new InlineQueryResultArticle);
result->url = data.get<string>("url", "");
result->hideUrl = data.get("hide_url", false);
result->description = data.get<string>("description", "");
+ result->thumbUrl = data.get<string>("thumb_url", "");
result->thumbWidth = data.get("thumb_width", 0);
result->thumbHeight = data.get("thumb_height", 0);
return result;
@@ -737,20 +971,203 @@ std::string TgTypeParser::parseInlineQueryResultArticle(const InlineQueryResultA
appendToJson(result, "url", object->url);
appendToJson(result, "hide_url", object->hideUrl);
appendToJson(result, "description", object->description);
+ appendToJson(result, "thumb_url", object->thumbUrl);
+ appendToJson(result, "thumb_width", object->thumbWidth);
+ appendToJson(result, "thumb_height", object->thumbHeight);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
+InlineQueryResultAudio::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultAudio(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultAudio::Ptr result(new InlineQueryResultAudio);
+ result->audioUrl = data.get<string>("audio_url");
+ result->performer = data.get<string>("performer", "");
+ result->audioDuration = data.get<int32_t>("audio_duration", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultAudio(const InlineQueryResultAudio::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "audio_url", object->audioUrl);
+ appendToJson(result, "performer", object->performer);
+ appendToJson(result, "audio_duration", object->audioDuration);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
+
+InlineQueryResultContact::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultContact(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultContact::Ptr result(new InlineQueryResultContact);
+ result->phoneNumber = data.get<string>("phone_number");
+ result->firstName = data.get<string>("first_name");
+ result->lastName = data.get<string>("last_name", "");
+ result->thumbUrl = data.get<string>("thumb_url", "");
+ result->thumbWidth = data.get<int32_t>("thumb_width", 0);
+ result->thumbHeight = data.get<int32_t>("thumb_height", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultContact(const InlineQueryResultContact::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "phone_number", object->phoneNumber);
+ appendToJson(result, "first_name", object->firstName);
+ appendToJson(result, "last_name", object->lastName);
+ appendToJson(result, "thumb_url", object->thumbUrl);
+ appendToJson(result, "thumb_width", object->thumbWidth);
+ appendToJson(result, "thumb_height", object->thumbHeight);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
+
+InlineQueryResultGame::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultGame(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultGame::Ptr result(new InlineQueryResultGame);
+ result->gameShortName = data.get<string>("game_short_name");
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultGame(const InlineQueryResultGame::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "game_short_name", object->gameShortName);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
+InlineQueryResultDocument::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultDocument(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultDocument::Ptr result(new InlineQueryResultDocument);
+ result->documentUrl = data.get<string>("document_url");
+ result->mimeType = data.get<string>("mime_type");
+ result->description = data.get<string>("description", "");
+ result->thumbUrl = data.get<string>("thumb_url", "");
+ result->thumbWidth = data.get<int32_t>("thumb_width", 0);
+ result->thumbHeight = data.get<int32_t>("thumb_height", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultDocument(const InlineQueryResultDocument::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "document_url", object->documentUrl);
+ appendToJson(result, "mime_type", object->mimeType);
+ appendToJson(result, "description", object->description);
+ appendToJson(result, "thumb_url", object->thumbUrl);
appendToJson(result, "thumb_width", object->thumbWidth);
appendToJson(result, "thumb_height", object->thumbHeight);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
+InlineQueryResultLocation::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultLocation(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultLocation::Ptr result(new InlineQueryResultLocation);
+ result->latitude = data.get<float>("latitude");
+ result->longitude = data.get<float>("longitude");
+ result->thumbUrl = data.get<string>("thumb_url", "");
+ result->thumbWidth = data.get<int32_t>("thumb_width", 0);
+ result->thumbHeight = data.get<int32_t>("thumb_height", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultLocation(const InlineQueryResultLocation::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "latitude", object->latitude);
+ appendToJson(result, "longitude", object->longitude);
+ appendToJson(result, "thumb_url", object->thumbUrl);
+ appendToJson(result, "thumb_width", object->thumbWidth);
+ appendToJson(result, "thumb_height", object->thumbHeight);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
+
+InlineQueryResultVenue::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultVenue(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultVenue::Ptr result(new InlineQueryResultVenue);
+ result->latitude = data.get<float>("latitude");
+ result->longitude = data.get<float>("longitude");
+ result->address = data.get<string>("address");
+ result->foursquareId = data.get<string>("foursquare_id", "");
+ result->thumbUrl = data.get<string>("thumb_url", "");
+ result->thumbWidth = data.get<int32_t>("thumb_width", 0);
+ result->thumbHeight = data.get<int32_t>("thumb_height", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultVenue(const InlineQueryResultVenue::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "latitude", object->latitude);
+ appendToJson(result, "longitude", object->longitude);
+ appendToJson(result, "address", object->address);
+ appendToJson(result, "foursquare_id", object->foursquareId);
+ appendToJson(result, "thumb_url", object->thumbUrl);
+ appendToJson(result, "thumb_width", object->thumbWidth);
+ appendToJson(result, "thumb_height", object->thumbHeight);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
+InlineQueryResultVoice::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultVoice(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
+ InlineQueryResultVoice::Ptr result(new InlineQueryResultVoice);
+ result->voiceUrl = data.get<string>("voice_url");
+ result->voiceDuration = data.get<int32_t>("voice_duration", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultVoice(const InlineQueryResultVoice::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInlineQueryResult(), so I don't add
+ // curly brackets to the result string.
+ string result;
+ appendToJson(result, "voice_url", object->voiceUrl);
+ appendToJson(result, "voice_duration", object->voiceDuration);
+ // The last comma will be erased by parseInlineQueryResult().
+ return result;
+}
+
InlineQueryResultPhoto::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultPhoto(const boost::property_tree::ptree& data) const {
// NOTE: This function will be called by parseJsonAndGgetInlineQueryResult().
InlineQueryResultPhoto::Ptr result(new InlineQueryResultPhoto);
result->photoUrl = data.get<string>("photo_url", "");
+ result->thumbUrl = data.get<string>("thumb_url");
result->photoWidth = data.get("photo_width", 0);
result->photoHeight = data.get("photo_height", 0);
result->description = data.get<string>("description", "");
- result->caption = data.get<string>("caption", "");
return result;
}
@@ -762,10 +1179,10 @@ std::string TgTypeParser::parseInlineQueryResultPhoto(const InlineQueryResultPho
// curly brackets to the result string.
string result;
appendToJson(result, "photo_url", object->photoUrl);
+ appendToJson(result, "thumb_url", object->thumbUrl);
appendToJson(result, "photo_width", object->photoWidth);
appendToJson(result, "photo_height", object->photoHeight);
appendToJson(result, "description", object->description);
- appendToJson(result, "caption", object->caption);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
@@ -776,7 +1193,7 @@ InlineQueryResultGif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultGif(cons
result->gifUrl = data.get<string>("gif_url", "");
result->gifWidth = data.get("gif_width", 0);
result->gifHeight = data.get("gif_height", 0);
- result->caption = data.get<string>("caption", "");
+ result->thumbUrl = data.get<string>("thumb_url");
return result;
}
std::string TgTypeParser::parseInlineQueryResultGif(const InlineQueryResultGif::Ptr& object) const {
@@ -789,7 +1206,7 @@ std::string TgTypeParser::parseInlineQueryResultGif(const InlineQueryResultGif::
appendToJson(result, "gif_url", object->gifUrl);
appendToJson(result, "gif_width", object->gifWidth);
appendToJson(result, "gif_height", object->gifHeight);
- appendToJson(result, "caption", object->caption);
+ appendToJson(result, "thumb_url", object->thumbUrl);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
@@ -800,7 +1217,7 @@ InlineQueryResultMpeg4Gif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultMpe
result->mpeg4Url = data.get<string>("mpeg4_url");
result->mpeg4Width = data.get("mpeg4_width", 0);
result->mpeg4Height = data.get("mpeg4_height", 0);
- result->caption = data.get("caption", "");
+ result->thumbUrl = data.get<string>("thumb_url");
return result;
}
@@ -814,7 +1231,7 @@ std::string TgTypeParser::parseInlineQueryResultMpeg4Gif(const InlineQueryResult
appendToJson(result, "mpeg4_url", object->mpeg4Url);
appendToJson(result, "mpeg4_width", object->mpeg4Width);
appendToJson(result, "mpeg4_height", object->mpeg4Height);
- appendToJson(result, "caption", object->caption);
+ appendToJson(result, "thumb_url", object->thumbUrl);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
@@ -824,7 +1241,8 @@ InlineQueryResultVideo::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultVideo(
InlineQueryResultVideo::Ptr result(new InlineQueryResultVideo);
result->videoUrl = data.get<string>("video_url");
result->mimeType = data.get<string>("mime_type");
- result->videoWidth = data.get("video_height", 0);
+ result->thumbUrl = data.get<string>("thumb_url");
+ result->videoWidth = data.get("video_width", 0);
result->videoHeight = data.get("video_height", 0);
result->videoDuration = data.get("video_duration", 0);
result->description = data.get<string>("description", "");
@@ -840,6 +1258,7 @@ std::string TgTypeParser::parseInlineQueryResultVideo(const InlineQueryResultVid
string result;
appendToJson(result, "video_url", object->videoUrl);
appendToJson(result, "mime_type", object->mimeType);
+ appendToJson(result, "thumb_url", object->thumbUrl);
appendToJson(result, "video_width", object->videoWidth);
appendToJson(result, "video_height", object->videoHeight);
appendToJson(result, "video_duration", object->videoDuration);
@@ -852,6 +1271,8 @@ ChosenInlineResult::Ptr TgTypeParser::parseJsonAndGetChosenInlineResult(const bo
ChosenInlineResult::Ptr result(new ChosenInlineResult);
result->resultId = data.get<string>("result_id");
result->from = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "from");
+ result->location = tryParseJson<Location>(&TgTypeParser::parseJsonAndGetLocation, data, "location");
+ result->inlineMessageId = data.get<string>("inline_message_id", "");
result->query = data.get<string>("query");
return result;
}
@@ -994,6 +1415,144 @@ std::string TgTypeParser::parseWebhookInfo(const WebhookInfo::Ptr& object) const
return result;
}
+InputMessageContent::Ptr TgTypeParser::parseJsonAndGetInputMessageContent(const boost::property_tree::ptree& data) const {
+ InputMessageContent::Ptr result;
+ // define InputMessageContent type
+
+ string tMessageText = data.get<string>("message_text", "");
+ float tLatitude = data.get<float>("latitude", 1000); // latitude belong (-90,90)
+ string tTitle = data.get<string>("title", "");
+ string tPnoneNumber = data.get<string>("phone_number", "");
+
+ if (tMessageText != std::string("")) {
+ result = static_pointer_cast<InputMessageContent>(parseJsonAndGetInputTextMessageContent(data));
+ } else if (tTitle !=std::string("")) {
+ result = static_pointer_cast<InputMessageContent>(parseJsonAndGetInputVenueMessageContent(data));
+ } else if (tLatitude != 1000) {
+ result = static_pointer_cast<InputMessageContent>(parseJsonAndGetInputLocationMessageContent(data));
+ } else if (tPnoneNumber!= std::string("")) {
+ result = static_pointer_cast<InputMessageContent>(parseJsonAndGetInputContactMessageContent(data));
+ }
+
+ return result;
+}
+
+std::string TgTypeParser::parseInputMessageContent(const InputMessageContent::Ptr& object) const {
+ if (!object){
+ return "";
+ }
+
+ string result;
+ result += '{';
+
+ if (object->type == std::string("InputTextMessageContent")) {
+ result += parseInputTextMessageContent(static_pointer_cast<InputTextMessageContent>(object));
+ }
+ else if (object->type == std::string("InputLocationMessageContent")) {
+ result += parseInputLocationMessageContent(static_pointer_cast<InputLocationMessageContent>(object));
+ }
+ else if (object->type == std::string("InputVenueMessageContent")) {
+ result += parseInputVenueMessageContent(static_pointer_cast<InputVenueMessageContent>(object));
+ }
+ else if (object->type == std::string("InputContactMessageContent")) {
+ result += parseInputContactMessageContent(static_pointer_cast<InputContactMessageContent>(object));
+ }
+
+ result.erase(result.length() - 1);
+ result += '}';
+ return result;
+}
+
+InputTextMessageContent::Ptr TgTypeParser::parseJsonAndGetInputTextMessageContent(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGetInputMessageContent().
+ InputTextMessageContent::Ptr result(new InputTextMessageContent);
+ result->messageText = data.get<string>("message_text");
+ result->parseMode = data.get<string>("parse_mode", "");
+ result->disableWebPagePreview = data.get<bool>("disable_web_page_preview", false);
+ return result;
+}
+
+std::string TgTypeParser::parseInputTextMessageContent(const InputTextMessageContent::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInputMessageContent()
+ string result;
+ appendToJson(result, "message_text", object->messageText);
+ appendToJson(result, "parse_mode", object->parseMode);
+ appendToJson(result, "disable_web_page_preview", object->disableWebPagePreview);
+ // The last comma will be erased by parseInputMessageContent().
+ return result;
+}
+
+InputLocationMessageContent::Ptr TgTypeParser::parseJsonAndGetInputLocationMessageContent(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGetInputMessageContent().
+ InputLocationMessageContent::Ptr result(new InputLocationMessageContent);
+ result->latitude = data.get<float>("latitude");
+ result->longitude = data.get<float>("longitude");
+ return result;
+}
+
+std::string TgTypeParser::parseInputLocationMessageContent(const InputLocationMessageContent::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInputMessageContent()
+ string result;
+ appendToJson(result, "latitude", object->latitude);
+ appendToJson(result, "longitude", object->longitude);
+ // The last comma will be erased by parseInputMessageContent().
+ return result;
+}
+
+InputVenueMessageContent::Ptr TgTypeParser::parseJsonAndGetInputVenueMessageContent(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGetInputMessageContent().
+ InputVenueMessageContent::Ptr result(new InputVenueMessageContent);
+ result->latitude = data.get<float>("latitude");
+ result->longitude = data.get<float>("longitude");
+ result->title = data.get<string>("title");
+ result->address = data.get<string>("address");
+ result->foursquareId = data.get<string>("foursquare_id", "");
+ return result;
+}
+
+std::string TgTypeParser::parseInputVenueMessageContent(const InputVenueMessageContent::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInputMessageContent()
+ string result;
+ appendToJson(result, "latitude", object->latitude);
+ appendToJson(result, "longitude", object->longitude);
+ appendToJson(result, "title", object->title);
+ appendToJson(result, "address", object->address);
+ appendToJson(result, "foursquare_id", object->foursquareId);
+ // The last comma will be erased by parseInputMessageContent().
+ return result;
+}
+
+InputContactMessageContent::Ptr TgTypeParser::parseJsonAndGetInputContactMessageContent(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGetInputMessageContent().
+ InputContactMessageContent::Ptr result(new InputContactMessageContent);
+ result->phoneNumber = data.get<string>("phone_number");
+ result->firstName = data.get<string>("first_name");
+ result->lastName = data.get<string>("last_name", "");
+ return result;
+}
+
+std::string TgTypeParser::parseInputContactMessageContent(const InputContactMessageContent::Ptr& object) const {
+ if (!object){
+ return " ";
+ }
+ // This function will be called by parseInputMessageContent()
+ string result;
+ appendToJson(result, "phone_number", object->phoneNumber);
+ appendToJson(result, "first_name", object->firstName);
+ appendToJson(result, "last_name", object->lastName);
+ // The last comma will be erased by parseInputMessageContent().
+ return result;
+}
+
void TgTypeParser::appendToJson(string& json, const string& varName, const string& value) const {
if (value.empty()) {
return;
diff --git a/src/types/InlineQueryResult.cpp b/src/types/InlineQueryResult.cpp
index be1f14a..9f90e19 100644
--- a/src/types/InlineQueryResult.cpp
+++ b/src/types/InlineQueryResult.cpp
@@ -1,6 +1,22 @@
//
// Created by Andrea Giove on 27/03/16.
//
+
+#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/InlineQueryResultAudio.h"
+#include "tgbot/types/InlineQueryResultContact.h"
+#include "tgbot/types/InlineQueryResultGame.h"
+#include "tgbot/types/InlineQueryResultDocument.h"
+#include "tgbot/types/InlineQueryResultLocation.h"
+#include "tgbot/types/InlineQueryResultVenue.h"
+#include "tgbot/types/InlineQueryResultVoice.h"
#include "tgbot/types/InlineQueryResultArticle.h"
#include "tgbot/types/InlineQueryResultGif.h"
#include "tgbot/types/InlineQueryResultMpeg4Gif.h"
@@ -9,8 +25,24 @@
using namespace TgBot;
+const std::string InlineQueryResultCachedAudio::TYPE = "cached_audio";
+const std::string InlineQueryResultCachedDocument::TYPE = "cached_document";
+const std::string InlineQueryResultCachedGif::TYPE = "cached_gif";
+const std::string InlineQueryResultCachedMpeg4Gif::TYPE = "cached_mpeg4gif";
+const std::string InlineQueryResultCachedPhoto::TYPE = "cached_photo";
+const std::string InlineQueryResultCachedSticker::TYPE = "cached_sticker";
+const std::string InlineQueryResultCachedVideo::TYPE = "cached_video";
+const std::string InlineQueryResultCachedVoice::TYPE = "cached_voice";
+
const std::string InlineQueryResultArticle::TYPE = "article";
+const std::string InlineQueryResultAudio::TYPE = "audio";
+const std::string InlineQueryResultContact::TYPE = "contact";
+const std::string InlineQueryResultGame::TYPE = "game";
+const std::string InlineQueryResultDocument::TYPE = "document";
const std::string InlineQueryResultGif::TYPE = "gif";
+const std::string InlineQueryResultLocation::TYPE = "location";
const std::string InlineQueryResultMpeg4Gif::TYPE = "mpeg4_gif";
const std::string InlineQueryResultPhoto::TYPE = "photo";
+const std::string InlineQueryResultVenue::TYPE = "venue";
const std::string InlineQueryResultVideo::TYPE = "video";
+const std::string InlineQueryResultVoice::TYPE = "voice";