summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKonstantin Kukin <kukin.konstantin@gmail.com>2016-12-28 19:05:44 +0300
committerKonstantin Kukin <kukin.konstantin@gmail.com>2016-12-28 19:05:44 +0300
commit187311fc635c843f10c275c7e230543b5f67e703 (patch)
tree044a7bd68a338c7f78ec1103c7a3e8984b6ff2e2 /include
parent9c60e1f40132b2cf2190de55e057c442a2934440 (diff)
add parse types to JSON part2
Diffstat (limited to 'include')
-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
7 files changed, 80 insertions, 1 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;