1#ifndef TGBOT_TGTYPEPARSER_H
2#define TGBOT_TGTYPEPARSER_H
195#include <boost/property_tree/json_parser.hpp>
196#include <boost/property_tree/ptree.hpp>
206class TGBOT_API TgTypeParser {
210 using JsonToTgTypeFunc = std::shared_ptr<T> (TgTypeParser::*)(const boost::property_tree::ptree&) const;
213 using TgTypeToJsonFunc = std::string (TgTypeParser::*)(const std::shared_ptr<T>&) const;
215 Update::Ptr parseJsonAndGetUpdate(
const boost::property_tree::ptree& data)
const;
216 std::string parseUpdate(
const Update::Ptr&
object)
const;
218 WebhookInfo::Ptr parseJsonAndGetWebhookInfo(
const boost::property_tree::ptree& data)
const;
219 std::string parseWebhookInfo(
const WebhookInfo::Ptr&
object)
const;
221 User::Ptr parseJsonAndGetUser(
const boost::property_tree::ptree& data)
const;
222 std::string parseUser(
const User::Ptr&
object)
const;
224 Chat::Ptr parseJsonAndGetChat(
const boost::property_tree::ptree& data)
const;
225 std::string parseChat(
const Chat::Ptr&
object)
const;
227 Message::Ptr parseJsonAndGetMessage(
const boost::property_tree::ptree& data)
const;
228 std::string parseMessage(
const Message::Ptr&
object)
const;
230 MessageId::Ptr parseJsonAndGetMessageId(
const boost::property_tree::ptree& data)
const;
231 std::string parseMessageId(
const MessageId::Ptr&
object)
const;
233 InaccessibleMessage::Ptr parseJsonAndGetInaccessibleMessage(
const boost::property_tree::ptree& data)
const;
234 std::string parseInaccessibleMessage(
const InaccessibleMessage::Ptr&
object)
const;
236 MessageEntity::Ptr parseJsonAndGetMessageEntity(
const boost::property_tree::ptree& data)
const;
237 std::string parseMessageEntity(
const MessageEntity::Ptr&
object)
const;
239 TextQuote::Ptr parseJsonAndGetTextQuote(
const boost::property_tree::ptree& data)
const;
240 std::string parseTextQuote(
const TextQuote::Ptr&
object)
const;
242 ExternalReplyInfo::Ptr parseJsonAndGetExternalReplyInfo(
const boost::property_tree::ptree& data)
const;
243 std::string parseExternalReplyInfo(
const ExternalReplyInfo::Ptr&
object)
const;
245 ReplyParameters::Ptr parseJsonAndGetReplyParameters(
const boost::property_tree::ptree& data)
const;
246 std::string parseReplyParameters(
const ReplyParameters::Ptr&
object)
const;
248 MessageOrigin::Ptr parseJsonAndGetMessageOrigin(
const boost::property_tree::ptree& data)
const;
249 std::string parseMessageOrigin(
const MessageOrigin::Ptr&
object)
const;
251 MessageOriginUser::Ptr parseJsonAndGetMessageOriginUser(
const boost::property_tree::ptree& data)
const;
252 std::string parseMessageOriginUser(
const MessageOriginUser::Ptr&
object)
const;
254 MessageOriginHiddenUser::Ptr parseJsonAndGetMessageOriginHiddenUser(
const boost::property_tree::ptree& data)
const;
255 std::string parseMessageOriginHiddenUser(
const MessageOriginHiddenUser::Ptr&
object)
const;
257 MessageOriginChat::Ptr parseJsonAndGetMessageOriginChat(
const boost::property_tree::ptree& data)
const;
258 std::string parseMessageOriginChat(
const MessageOriginChat::Ptr&
object)
const;
260 MessageOriginChannel::Ptr parseJsonAndGetMessageOriginChannel(
const boost::property_tree::ptree& data)
const;
261 std::string parseMessageOriginChannel(
const MessageOriginChannel::Ptr&
object)
const;
263 PhotoSize::Ptr parseJsonAndGetPhotoSize(
const boost::property_tree::ptree& data)
const;
264 std::string parsePhotoSize(
const PhotoSize::Ptr&
object)
const;
266 Animation::Ptr parseJsonAndGetAnimation(
const boost::property_tree::ptree& data)
const;
267 std::string parseAnimation(
const Animation::Ptr&
object)
const;
269 Audio::Ptr parseJsonAndGetAudio(
const boost::property_tree::ptree& data)
const;
270 std::string parseAudio(
const Audio::Ptr&
object)
const;
272 Document::Ptr parseJsonAndGetDocument(
const boost::property_tree::ptree& data)
const;
273 std::string parseDocument(
const Document::Ptr&
object)
const;
275 Story::Ptr parseJsonAndGetStory(
const boost::property_tree::ptree& data)
const;
276 std::string parseStory(
const Story::Ptr&
object)
const;
278 Video::Ptr parseJsonAndGetVideo(
const boost::property_tree::ptree& data)
const;
279 std::string parseVideo(
const Video::Ptr&
object)
const;
281 VideoNote::Ptr parseJsonAndGetVideoNote(
const boost::property_tree::ptree& data)
const;
282 std::string parseVideoNote(
const VideoNote::Ptr&
object)
const;
284 Voice::Ptr parseJsonAndGetVoice(
const boost::property_tree::ptree& data)
const;
285 std::string parseVoice(
const Voice::Ptr&
object)
const;
287 Contact::Ptr parseJsonAndGetContact(
const boost::property_tree::ptree& data)
const;
288 std::string parseContact(
const Contact::Ptr&
object)
const;
290 Dice::Ptr parseJsonAndGetDice(
const boost::property_tree::ptree& data)
const;
291 std::string parseDice(
const Dice::Ptr&
object)
const;
293 PollOption::Ptr parseJsonAndGetPollOption(
const boost::property_tree::ptree& data)
const;
294 std::string parsePollOption(
const PollOption::Ptr&
object)
const;
296 PollAnswer::Ptr parseJsonAndGetPollAnswer(
const boost::property_tree::ptree& data)
const;
297 std::string parsePollAnswer(
const PollAnswer::Ptr&
object)
const;
299 Poll::Ptr parseJsonAndGetPoll(
const boost::property_tree::ptree& data)
const;
300 std::string parsePoll(
const Poll::Ptr&
object)
const;
302 Location::Ptr parseJsonAndGetLocation(
const boost::property_tree::ptree& data)
const;
303 std::string parseLocation(
const Location::Ptr&
object)
const;
305 Venue::Ptr parseJsonAndGetVenue(
const boost::property_tree::ptree& data)
const;
306 std::string parseVenue(
const Venue::Ptr&
object)
const;
308 WebAppData::Ptr parseJsonAndGetWebAppData(
const boost::property_tree::ptree& data)
const;
309 std::string parseWebAppData(
const WebAppData::Ptr&
object)
const;
311 ProximityAlertTriggered::Ptr parseJsonAndGetProximityAlertTriggered(
const boost::property_tree::ptree& data)
const;
312 std::string parseProximityAlertTriggered(
const ProximityAlertTriggered::Ptr&
object)
const;
314 MessageAutoDeleteTimerChanged::Ptr parseJsonAndGetMessageAutoDeleteTimerChanged(
const boost::property_tree::ptree& data)
const;
315 std::string parseMessageAutoDeleteTimerChanged(
const MessageAutoDeleteTimerChanged::Ptr&
object)
const;
317 ChatBoostAdded::Ptr parseJsonAndGetChatBoostAdded(
const boost::property_tree::ptree& data)
const;
318 std::string parseChatBoostAdded(
const ChatBoostAdded::Ptr&
object)
const;
320 ForumTopicCreated::Ptr parseJsonAndGetForumTopicCreated(
const boost::property_tree::ptree& data)
const;
321 std::string parseForumTopicCreated(
const ForumTopicCreated::Ptr&
object)
const;
323 ForumTopicClosed::Ptr parseJsonAndGetForumTopicClosed(
const boost::property_tree::ptree& data)
const;
324 std::string parseForumTopicClosed(
const ForumTopicClosed::Ptr&
object)
const;
326 ForumTopicEdited::Ptr parseJsonAndGetForumTopicEdited(
const boost::property_tree::ptree& data)
const;
327 std::string parseForumTopicEdited(
const ForumTopicEdited::Ptr&
object)
const;
329 ForumTopicReopened::Ptr parseJsonAndGetForumTopicReopened(
const boost::property_tree::ptree& data)
const;
330 std::string parseForumTopicReopened(
const ForumTopicReopened::Ptr&
object)
const;
332 GeneralForumTopicHidden::Ptr parseJsonAndGetGeneralForumTopicHidden(
const boost::property_tree::ptree& data)
const;
333 std::string parseGeneralForumTopicHidden(
const GeneralForumTopicHidden::Ptr&
object)
const;
335 GeneralForumTopicUnhidden::Ptr parseJsonAndGetGeneralForumTopicUnhidden(
const boost::property_tree::ptree& data)
const;
336 std::string parseGeneralForumTopicUnhidden(
const GeneralForumTopicUnhidden::Ptr&
object)
const;
338 SharedUser::Ptr parseJsonAndGetSharedUser(
const boost::property_tree::ptree& data)
const;
339 std::string parseSharedUser(
const SharedUser::Ptr&
object)
const;
341 UsersShared::Ptr parseJsonAndGetUsersShared(
const boost::property_tree::ptree& data)
const;
342 std::string parseUsersShared(
const UsersShared::Ptr&
object)
const;
344 ChatShared::Ptr parseJsonAndGetChatShared(
const boost::property_tree::ptree& data)
const;
345 std::string parseChatShared(
const ChatShared::Ptr&
object)
const;
347 WriteAccessAllowed::Ptr parseJsonAndGetWriteAccessAllowed(
const boost::property_tree::ptree& data)
const;
348 std::string parseWriteAccessAllowed(
const WriteAccessAllowed::Ptr&
object)
const;
350 VideoChatScheduled::Ptr parseJsonAndGetVideoChatScheduled(
const boost::property_tree::ptree& data)
const;
351 std::string parseVideoChatScheduled(
const VideoChatScheduled::Ptr&
object)
const;
353 VideoChatStarted::Ptr parseJsonAndGetVideoChatStarted(
const boost::property_tree::ptree& data)
const;
354 std::string parseVideoChatStarted(
const VideoChatStarted::Ptr&
object)
const;
356 VideoChatEnded::Ptr parseJsonAndGetVideoChatEnded(
const boost::property_tree::ptree& data)
const;
357 std::string parseVideoChatEnded(
const VideoChatEnded::Ptr&
object)
const;
359 VideoChatParticipantsInvited::Ptr parseJsonAndGetVideoChatParticipantsInvited(
const boost::property_tree::ptree& data)
const;
360 std::string parseVideoChatParticipantsInvited(
const VideoChatParticipantsInvited::Ptr&
object)
const;
362 GiveawayCreated::Ptr parseJsonAndGetGiveawayCreated(
const boost::property_tree::ptree& data)
const;
363 std::string parseGiveawayCreated(
const GiveawayCreated::Ptr&
object)
const;
365 Giveaway::Ptr parseJsonAndGetGiveaway(
const boost::property_tree::ptree& data)
const;
366 std::string parseGiveaway(
const Giveaway::Ptr&
object)
const;
368 GiveawayWinners::Ptr parseJsonAndGetGiveawayWinners(
const boost::property_tree::ptree& data)
const;
369 std::string parseGiveawayWinners(
const GiveawayWinners::Ptr&
object)
const;
371 GiveawayCompleted::Ptr parseJsonAndGetGiveawayCompleted(
const boost::property_tree::ptree& data)
const;
372 std::string parseGiveawayCompleted(
const GiveawayCompleted::Ptr&
object)
const;
374 LinkPreviewOptions::Ptr parseJsonAndGetLinkPreviewOptions(
const boost::property_tree::ptree& data)
const;
375 std::string parseLinkPreviewOptions(
const LinkPreviewOptions::Ptr&
object)
const;
377 UserProfilePhotos::Ptr parseJsonAndGetUserProfilePhotos(
const boost::property_tree::ptree& data)
const;
378 std::string parseUserProfilePhotos(
const UserProfilePhotos::Ptr&
object)
const;
380 File::Ptr parseJsonAndGetFile(
const boost::property_tree::ptree& data)
const;
381 std::string parseFile(
const File::Ptr&
object)
const;
383 WebAppInfo::Ptr parseJsonAndGetWebAppInfo(
const boost::property_tree::ptree& data)
const;
384 std::string parseWebAppInfo(
const WebAppInfo::Ptr&
object)
const;
386 ReplyKeyboardMarkup::Ptr parseJsonAndGetReplyKeyboardMarkup(
const boost::property_tree::ptree& data)
const;
387 std::string parseReplyKeyboardMarkup(
const ReplyKeyboardMarkup::Ptr&
object)
const;
389 KeyboardButton::Ptr parseJsonAndGetKeyboardButton(
const boost::property_tree::ptree& data)
const;
390 std::string parseKeyboardButton(
const KeyboardButton::Ptr&
object)
const;
392 KeyboardButtonRequestUsers::Ptr parseJsonAndGetKeyboardButtonRequestUsers(
const boost::property_tree::ptree& data)
const;
393 std::string parseKeyboardButtonRequestUsers(
const KeyboardButtonRequestUsers::Ptr&
object)
const;
395 KeyboardButtonRequestChat::Ptr parseJsonAndGetKeyboardButtonRequestChat(
const boost::property_tree::ptree& data)
const;
396 std::string parseKeyboardButtonRequestChat(
const KeyboardButtonRequestChat::Ptr&
object)
const;
398 KeyboardButtonPollType::Ptr parseJsonAndGetKeyboardButtonPollType(
const boost::property_tree::ptree& data)
const;
399 std::string parseKeyboardButtonPollType(
const KeyboardButtonPollType::Ptr&
object)
const;
401 ReplyKeyboardRemove::Ptr parseJsonAndGetReplyKeyboardRemove(
const boost::property_tree::ptree& data)
const;
402 std::string parseReplyKeyboardRemove(
const ReplyKeyboardRemove::Ptr&
object)
const;
404 InlineKeyboardMarkup::Ptr parseJsonAndGetInlineKeyboardMarkup(
const boost::property_tree::ptree& data)
const;
405 std::string parseInlineKeyboardMarkup(
const InlineKeyboardMarkup::Ptr&
object)
const;
407 InlineKeyboardButton::Ptr parseJsonAndGetInlineKeyboardButton(
const boost::property_tree::ptree& data)
const;
408 std::string parseInlineKeyboardButton(
const InlineKeyboardButton::Ptr&
object)
const;
410 LoginUrl::Ptr parseJsonAndGetLoginUrl(
const boost::property_tree::ptree& data)
const;
411 std::string parseLoginUrl(
const LoginUrl::Ptr&
object)
const;
413 SwitchInlineQueryChosenChat::Ptr parseJsonAndGetSwitchInlineQueryChosenChat(
const boost::property_tree::ptree& data)
const;
414 std::string parseSwitchInlineQueryChosenChat(
const SwitchInlineQueryChosenChat::Ptr&
object)
const;
416 CallbackQuery::Ptr parseJsonAndGetCallbackQuery(
const boost::property_tree::ptree& data)
const;
417 std::string parseCallbackQuery(
const CallbackQuery::Ptr&
object)
const;
419 ForceReply::Ptr parseJsonAndGetForceReply(
const boost::property_tree::ptree& data)
const;
420 std::string parseForceReply(
const ForceReply::Ptr&
object)
const;
422 ChatPhoto::Ptr parseJsonAndGetChatPhoto(
const boost::property_tree::ptree& data)
const;
423 std::string parseChatPhoto(
const ChatPhoto::Ptr&
object)
const;
425 ChatInviteLink::Ptr parseJsonAndGetChatInviteLink(
const boost::property_tree::ptree& data)
const;
426 std::string parseChatInviteLink(
const ChatInviteLink::Ptr&
object)
const;
428 ChatAdministratorRights::Ptr parseJsonAndGetChatAdministratorRights(
const boost::property_tree::ptree& data)
const;
429 std::string parseChatAdministratorRights(
const ChatAdministratorRights::Ptr&
object)
const;
431 ChatMemberUpdated::Ptr parseJsonAndGetChatMemberUpdated(
const boost::property_tree::ptree& data)
const;
432 std::string parseChatMemberUpdated(
const ChatMemberUpdated::Ptr&
object)
const;
434 ChatMember::Ptr parseJsonAndGetChatMember(
const boost::property_tree::ptree& data)
const;
435 std::string parseChatMember(
const ChatMember::Ptr&
object)
const;
437 ChatMemberOwner::Ptr parseJsonAndGetChatMemberOwner(
const boost::property_tree::ptree& data)
const;
438 std::string parseChatMemberOwner(
const ChatMemberOwner::Ptr&
object)
const;
440 ChatMemberAdministrator::Ptr parseJsonAndGetChatMemberAdministrator(
const boost::property_tree::ptree& data)
const;
441 std::string parseChatMemberAdministrator(
const ChatMemberAdministrator::Ptr&
object)
const;
443 ChatMemberMember::Ptr parseJsonAndGetChatMemberMember(
const boost::property_tree::ptree& data)
const;
444 std::string parseChatMemberMember(
const ChatMemberMember::Ptr&
object)
const;
446 ChatMemberRestricted::Ptr parseJsonAndGetChatMemberRestricted(
const boost::property_tree::ptree& data)
const;
447 std::string parseChatMemberRestricted(
const ChatMemberRestricted::Ptr&
object)
const;
449 ChatMemberLeft::Ptr parseJsonAndGetChatMemberLeft(
const boost::property_tree::ptree& data)
const;
450 std::string parseChatMemberLeft(
const ChatMemberLeft::Ptr&
object)
const;
452 ChatMemberBanned::Ptr parseJsonAndGetChatMemberBanned(
const boost::property_tree::ptree& data)
const;
453 std::string parseChatMemberBanned(
const ChatMemberBanned::Ptr&
object)
const;
455 ChatJoinRequest::Ptr parseJsonAndGetChatJoinRequest(
const boost::property_tree::ptree& data)
const;
456 std::string parseChatJoinRequest(
const ChatJoinRequest::Ptr&
object)
const;
458 ChatPermissions::Ptr parseJsonAndGetChatPermissions(
const boost::property_tree::ptree& data)
const;
459 std::string parseChatPermissions(
const ChatPermissions::Ptr&
object)
const;
461 Birthdate::Ptr parseJsonAndGetBirthdate(
const boost::property_tree::ptree& data)
const;
462 std::string parseBirthdate(
const Birthdate::Ptr&
object)
const;
464 BusinessIntro::Ptr parseJsonAndGetBusinessIntro(
const boost::property_tree::ptree& data)
const;
465 std::string parseBusinessIntro(
const BusinessIntro::Ptr&
object)
const;
467 BusinessLocation::Ptr parseJsonAndGetBusinessLocation(
const boost::property_tree::ptree& data)
const;
468 std::string parseBusinessLocation(
const BusinessLocation::Ptr&
object)
const;
470 BusinessOpeningHoursInterval::Ptr parseJsonAndGetBusinessOpeningHoursInterval(
const boost::property_tree::ptree& data)
const;
471 std::string parseBusinessOpeningHoursInterval(
const BusinessOpeningHoursInterval::Ptr&
object)
const;
473 BusinessOpeningHours::Ptr parseJsonAndGetBusinessOpeningHours(
const boost::property_tree::ptree& data)
const;
474 std::string parseBusinessOpeningHours(
const BusinessOpeningHours::Ptr&
object)
const;
476 ChatLocation::Ptr parseJsonAndGetChatLocation(
const boost::property_tree::ptree& data)
const;
477 std::string parseChatLocation(
const ChatLocation::Ptr&
object)
const;
479 ReactionType::Ptr parseJsonAndGetReactionType(
const boost::property_tree::ptree& data)
const;
480 std::string parseReactionType(
const ReactionType::Ptr&
object)
const;
482 ReactionTypeEmoji::Ptr parseJsonAndGetReactionTypeEmoji(
const boost::property_tree::ptree& data)
const;
483 std::string parseReactionTypeEmoji(
const ReactionTypeEmoji::Ptr&
object)
const;
485 ReactionTypeCustomEmoji::Ptr parseJsonAndGetReactionTypeCustomEmoji(
const boost::property_tree::ptree& data)
const;
486 std::string parseReactionTypeCustomEmoji(
const ReactionTypeCustomEmoji::Ptr&
object)
const;
488 ReactionCount::Ptr parseJsonAndGetReactionCount(
const boost::property_tree::ptree& data)
const;
489 std::string parseReactionCount(
const ReactionCount::Ptr&
object)
const;
491 MessageReactionUpdated::Ptr parseJsonAndGetMessageReactionUpdated(
const boost::property_tree::ptree& data)
const;
492 std::string parseMessageReactionUpdated(
const MessageReactionUpdated::Ptr&
object)
const;
494 MessageReactionCountUpdated::Ptr parseJsonAndGetMessageReactionCountUpdated(
const boost::property_tree::ptree& data)
const;
495 std::string parseMessageReactionCountUpdated(
const MessageReactionCountUpdated::Ptr&
object)
const;
497 ForumTopic::Ptr parseJsonAndGetForumTopic(
const boost::property_tree::ptree& data)
const;
498 std::string parseForumTopic(
const ForumTopic::Ptr&
object)
const;
500 BotCommand::Ptr parseJsonAndGetBotCommand(
const boost::property_tree::ptree& data)
const;
501 std::string parseBotCommand(
const BotCommand::Ptr&
object)
const;
503 BotCommandScope::Ptr parseJsonAndGetBotCommandScope(
const boost::property_tree::ptree& data)
const;
504 std::string parseBotCommandScope(
const BotCommandScope::Ptr&
object)
const;
506 BotCommandScopeDefault::Ptr parseJsonAndGetBotCommandScopeDefault(
const boost::property_tree::ptree& data)
const;
507 std::string parseBotCommandScopeDefault(
const BotCommandScopeDefault::Ptr&
object)
const;
509 BotCommandScopeAllPrivateChats::Ptr parseJsonAndGetBotCommandScopeAllPrivateChats(
const boost::property_tree::ptree& data)
const;
510 std::string parseBotCommandScopeAllPrivateChats(
const BotCommandScopeAllPrivateChats::Ptr&
object)
const;
512 BotCommandScopeAllGroupChats::Ptr parseJsonAndGetBotCommandScopeAllGroupChats(
const boost::property_tree::ptree& data)
const;
513 std::string parseBotCommandScopeAllGroupChats(
const BotCommandScopeAllGroupChats::Ptr&
object)
const;
515 BotCommandScopeAllChatAdministrators::Ptr parseJsonAndGetBotCommandScopeAllChatAdministrators(
const boost::property_tree::ptree& data)
const;
516 std::string parseBotCommandScopeAllChatAdministrators(
const BotCommandScopeAllChatAdministrators::Ptr&
object)
const;
518 BotCommandScopeChat::Ptr parseJsonAndGetBotCommandScopeChat(
const boost::property_tree::ptree& data)
const;
519 std::string parseBotCommandScopeChat(
const BotCommandScopeChat::Ptr&
object)
const;
521 BotCommandScopeChatAdministrators::Ptr parseJsonAndGetBotCommandScopeChatAdministrators(
const boost::property_tree::ptree& data)
const;
522 std::string parseBotCommandScopeChatAdministrators(
const BotCommandScopeChatAdministrators::Ptr&
object)
const;
524 BotCommandScopeChatMember::Ptr parseJsonAndGetBotCommandScopeChatMember(
const boost::property_tree::ptree& data)
const;
525 std::string parseBotCommandScopeChatMember(
const BotCommandScopeChatMember::Ptr&
object)
const;
527 BotName::Ptr parseJsonAndGetBotName(
const boost::property_tree::ptree& data)
const;
528 std::string parseBotName(
const BotName::Ptr&
object)
const;
530 BotDescription::Ptr parseJsonAndGetBotDescription(
const boost::property_tree::ptree& data)
const;
531 std::string parseBotDescription(
const BotDescription::Ptr&
object)
const;
533 BotShortDescription::Ptr parseJsonAndGetBotShortDescription(
const boost::property_tree::ptree& data)
const;
534 std::string parseBotShortDescription(
const BotShortDescription::Ptr&
object)
const;
536 MenuButton::Ptr parseJsonAndGetMenuButton(
const boost::property_tree::ptree& data)
const;
537 std::string parseMenuButton(
const MenuButton::Ptr&
object)
const;
539 MenuButtonCommands::Ptr parseJsonAndGetMenuButtonCommands(
const boost::property_tree::ptree& data)
const;
540 std::string parseMenuButtonCommands(
const MenuButtonCommands::Ptr&
object)
const;
542 MenuButtonWebApp::Ptr parseJsonAndGetMenuButtonWebApp(
const boost::property_tree::ptree& data)
const;
543 std::string parseMenuButtonWebApp(
const MenuButtonWebApp::Ptr&
object)
const;
545 MenuButtonDefault::Ptr parseJsonAndGetMenuButtonDefault(
const boost::property_tree::ptree& data)
const;
546 std::string parseMenuButtonDefault(
const MenuButtonDefault::Ptr&
object)
const;
548 ChatBoostSource::Ptr parseJsonAndGetChatBoostSource(
const boost::property_tree::ptree& data)
const;
549 std::string parseChatBoostSource(
const ChatBoostSource::Ptr&
object)
const;
551 ChatBoostSourcePremium::Ptr parseJsonAndGetChatBoostSourcePremium(
const boost::property_tree::ptree& data)
const;
552 std::string parseChatBoostSourcePremium(
const ChatBoostSourcePremium::Ptr&
object)
const;
554 ChatBoostSourceGiftCode::Ptr parseJsonAndGetChatBoostSourceGiftCode(
const boost::property_tree::ptree& data)
const;
555 std::string parseChatBoostSourceGiftCode(
const ChatBoostSourceGiftCode::Ptr&
object)
const;
557 ChatBoostSourceGiveaway::Ptr parseJsonAndGetChatBoostSourceGiveaway(
const boost::property_tree::ptree& data)
const;
558 std::string parseChatBoostSourceGiveaway(
const ChatBoostSourceGiveaway::Ptr&
object)
const;
560 ChatBoost::Ptr parseJsonAndGetChatBoost(
const boost::property_tree::ptree& data)
const;
561 std::string parseChatBoost(
const ChatBoost::Ptr&
object)
const;
563 ChatBoostUpdated::Ptr parseJsonAndGetChatBoostUpdated(
const boost::property_tree::ptree& data)
const;
564 std::string parseChatBoostUpdated(
const ChatBoostUpdated::Ptr&
object)
const;
566 ChatBoostRemoved::Ptr parseJsonAndGetChatBoostRemoved(
const boost::property_tree::ptree& data)
const;
567 std::string parseChatBoostRemoved(
const ChatBoostRemoved::Ptr&
object)
const;
569 UserChatBoosts::Ptr parseJsonAndGetUserChatBoosts(
const boost::property_tree::ptree& data)
const;
570 std::string parseUserChatBoosts(
const UserChatBoosts::Ptr&
object)
const;
572 BusinessConnection::Ptr parseJsonAndGetBusinessConnection(
const boost::property_tree::ptree& data)
const;
573 std::string parseBusinessConnection(
const BusinessConnection::Ptr&
object)
const;
575 BusinessMessagesDeleted::Ptr parseJsonAndGetBusinessMessagesDeleted(
const boost::property_tree::ptree& data)
const;
576 std::string parseBusinessMessagesDeleted(
const BusinessMessagesDeleted::Ptr&
object)
const;
578 ResponseParameters::Ptr parseJsonAndGetResponseParameters(
const boost::property_tree::ptree& data)
const;
579 std::string parseResponseParameters(
const ResponseParameters::Ptr&
object)
const;
581 InputMedia::Ptr parseJsonAndGetInputMedia(
const boost::property_tree::ptree& data)
const;
582 std::string parseInputMedia(
const InputMedia::Ptr&
object)
const;
584 InputMediaPhoto::Ptr parseJsonAndGetInputMediaPhoto(
const boost::property_tree::ptree& data)
const;
585 std::string parseInputMediaPhoto(
const InputMediaPhoto::Ptr&
object)
const;
587 InputMediaVideo::Ptr parseJsonAndGetInputMediaVideo(
const boost::property_tree::ptree& data)
const;
588 std::string parseInputMediaVideo(
const InputMediaVideo::Ptr&
object)
const;
590 InputMediaAnimation::Ptr parseJsonAndGetInputMediaAnimation(
const boost::property_tree::ptree& data)
const;
591 std::string parseInputMediaAnimation(
const InputMediaAnimation::Ptr&
object)
const;
593 InputMediaAudio::Ptr parseJsonAndGetInputMediaAudio(
const boost::property_tree::ptree& data)
const;
594 std::string parseInputMediaAudio(
const InputMediaAudio::Ptr&
object)
const;
596 InputMediaDocument::Ptr parseJsonAndGetInputMediaDocument(
const boost::property_tree::ptree& data)
const;
597 std::string parseInputMediaDocument(
const InputMediaDocument::Ptr&
object)
const;
599 Sticker::Ptr parseJsonAndGetSticker(
const boost::property_tree::ptree& data)
const;
600 std::string parseSticker(
const Sticker::Ptr&
object)
const;
602 StickerSet::Ptr parseJsonAndGetStickerSet(
const boost::property_tree::ptree& data)
const;
603 std::string parseStickerSet(
const StickerSet::Ptr&
object)
const;
605 MaskPosition::Ptr parseJsonAndGetMaskPosition(
const boost::property_tree::ptree& data)
const;
606 std::string parseMaskPosition(
const MaskPosition::Ptr&
object)
const;
608 InputSticker::Ptr parseJsonAndGetInputSticker(
const boost::property_tree::ptree& data)
const;
609 std::string parseInputSticker(
const InputSticker::Ptr&
object)
const;
611 InlineQuery::Ptr parseJsonAndGetInlineQuery(
const boost::property_tree::ptree& data)
const;
612 std::string parseInlineQuery(
const InlineQuery::Ptr&
object)
const;
614 InlineQueryResultsButton::Ptr parseJsonAndGetInlineQueryResultsButton(
const boost::property_tree::ptree& data)
const;
615 std::string parseInlineQueryResultsButton(
const InlineQueryResultsButton::Ptr&
object)
const;
617 InlineQueryResult::Ptr parseJsonAndGetInlineQueryResult(
const boost::property_tree::ptree& data)
const;
618 std::string parseInlineQueryResult(
const InlineQueryResult::Ptr&
object)
const;
620 InlineQueryResultArticle::Ptr parseJsonAndGetInlineQueryResultArticle(
const boost::property_tree::ptree& data)
const;
621 std::string parseInlineQueryResultArticle(
const InlineQueryResultArticle::Ptr&
object)
const;
623 InlineQueryResultPhoto::Ptr parseJsonAndGetInlineQueryResultPhoto(
const boost::property_tree::ptree& data)
const;
624 std::string parseInlineQueryResultPhoto(
const InlineQueryResultPhoto::Ptr&
object)
const;
626 InlineQueryResultGif::Ptr parseJsonAndGetInlineQueryResultGif(
const boost::property_tree::ptree& data)
const;
627 std::string parseInlineQueryResultGif(
const InlineQueryResultGif::Ptr&
object)
const;
629 InlineQueryResultMpeg4Gif::Ptr parseJsonAndGetInlineQueryResultMpeg4Gif(
const boost::property_tree::ptree& data)
const;
630 std::string parseInlineQueryResultMpeg4Gif(
const InlineQueryResultMpeg4Gif::Ptr&
object)
const;
632 InlineQueryResultVideo::Ptr parseJsonAndGetInlineQueryResultVideo(
const boost::property_tree::ptree& data)
const;
633 std::string parseInlineQueryResultVideo(
const InlineQueryResultVideo::Ptr&
object)
const;
635 InlineQueryResultAudio::Ptr parseJsonAndGetInlineQueryResultAudio(
const boost::property_tree::ptree& data)
const;
636 std::string parseInlineQueryResultAudio(
const InlineQueryResultAudio::Ptr&
object)
const;
638 InlineQueryResultVoice::Ptr parseJsonAndGetInlineQueryResultVoice(
const boost::property_tree::ptree& data)
const;
639 std::string parseInlineQueryResultVoice(
const InlineQueryResultVoice::Ptr&
object)
const;
641 InlineQueryResultDocument::Ptr parseJsonAndGetInlineQueryResultDocument(
const boost::property_tree::ptree& data)
const;
642 std::string parseInlineQueryResultDocument(
const InlineQueryResultDocument::Ptr&
object)
const;
644 InlineQueryResultLocation::Ptr parseJsonAndGetInlineQueryResultLocation(
const boost::property_tree::ptree& data)
const;
645 std::string parseInlineQueryResultLocation(
const InlineQueryResultLocation::Ptr&
object)
const;
647 InlineQueryResultVenue::Ptr parseJsonAndGetInlineQueryResultVenue(
const boost::property_tree::ptree& data)
const;
648 std::string parseInlineQueryResultVenue(
const InlineQueryResultVenue::Ptr&
object)
const;
650 InlineQueryResultContact::Ptr parseJsonAndGetInlineQueryResultContact(
const boost::property_tree::ptree& data)
const;
651 std::string parseInlineQueryResultContact(
const InlineQueryResultContact::Ptr&
object)
const;
653 InlineQueryResultGame::Ptr parseJsonAndGetInlineQueryResultGame(
const boost::property_tree::ptree& data)
const;
654 std::string parseInlineQueryResultGame(
const InlineQueryResultGame::Ptr&
object)
const;
656 InlineQueryResultCachedPhoto::Ptr parseJsonAndGetInlineQueryResultCachedPhoto(
const boost::property_tree::ptree& data)
const;
657 std::string parseInlineQueryResultCachedPhoto(
const InlineQueryResultCachedPhoto::Ptr&
object)
const;
659 InlineQueryResultCachedGif::Ptr parseJsonAndGetInlineQueryResultCachedGif(
const boost::property_tree::ptree& data)
const;
660 std::string parseInlineQueryResultCachedGif(
const InlineQueryResultCachedGif::Ptr&
object)
const;
662 InlineQueryResultCachedMpeg4Gif::Ptr parseJsonAndGetInlineQueryResultCachedMpeg4Gif(
const boost::property_tree::ptree& data)
const;
663 std::string parseInlineQueryResultCachedMpeg4Gif(
const InlineQueryResultCachedMpeg4Gif::Ptr&
object)
const;
665 InlineQueryResultCachedSticker::Ptr parseJsonAndGetInlineQueryResultCachedSticker(
const boost::property_tree::ptree& data)
const;
666 std::string parseInlineQueryResultCachedSticker(
const InlineQueryResultCachedSticker::Ptr&
object)
const;
668 InlineQueryResultCachedDocument::Ptr parseJsonAndGetInlineQueryResultCachedDocument(
const boost::property_tree::ptree& data)
const;
669 std::string parseInlineQueryResultCachedDocument(
const InlineQueryResultCachedDocument::Ptr&
object)
const;
671 InlineQueryResultCachedVideo::Ptr parseJsonAndGetInlineQueryResultCachedVideo(
const boost::property_tree::ptree& data)
const;
672 std::string parseInlineQueryResultCachedVideo(
const InlineQueryResultCachedVideo::Ptr&
object)
const;
674 InlineQueryResultCachedVoice::Ptr parseJsonAndGetInlineQueryResultCachedVoice(
const boost::property_tree::ptree& data)
const;
675 std::string parseInlineQueryResultCachedVoice(
const InlineQueryResultCachedVoice::Ptr&
object)
const;
677 InlineQueryResultCachedAudio::Ptr parseJsonAndGetInlineQueryResultCachedAudio(
const boost::property_tree::ptree& data)
const;
678 std::string parseInlineQueryResultCachedAudio(
const InlineQueryResultCachedAudio::Ptr&
object)
const;
680 InputMessageContent::Ptr parseJsonAndGetInputMessageContent(
const boost::property_tree::ptree& data)
const;
681 std::string parseInputMessageContent(
const InputMessageContent::Ptr&
object)
const;
683 InputTextMessageContent::Ptr parseJsonAndGetInputTextMessageContent(
const boost::property_tree::ptree& data)
const;
684 std::string parseInputTextMessageContent(
const InputTextMessageContent::Ptr&
object)
const;
686 InputLocationMessageContent::Ptr parseJsonAndGetInputLocationMessageContent(
const boost::property_tree::ptree& data)
const;
687 std::string parseInputLocationMessageContent(
const InputLocationMessageContent::Ptr&
object)
const;
689 InputVenueMessageContent::Ptr parseJsonAndGetInputVenueMessageContent(
const boost::property_tree::ptree& data)
const;
690 std::string parseInputVenueMessageContent(
const InputVenueMessageContent::Ptr&
object)
const;
692 InputContactMessageContent::Ptr parseJsonAndGetInputContactMessageContent(
const boost::property_tree::ptree& data)
const;
693 std::string parseInputContactMessageContent(
const InputContactMessageContent::Ptr&
object)
const;
695 InputInvoiceMessageContent::Ptr parseJsonAndGetInputInvoiceMessageContent(
const boost::property_tree::ptree& data)
const;
696 std::string parseInputInvoiceMessageContent(
const InputInvoiceMessageContent::Ptr&
object)
const;
698 ChosenInlineResult::Ptr parseJsonAndGetChosenInlineResult(
const boost::property_tree::ptree& data)
const;
699 std::string parseChosenInlineResult(
const ChosenInlineResult::Ptr&
object)
const;
701 SentWebAppMessage::Ptr parseJsonAndGetSentWebAppMessage(
const boost::property_tree::ptree& data)
const;
702 std::string parseSentWebAppMessage(
const SentWebAppMessage::Ptr&
object)
const;
704 LabeledPrice::Ptr parseJsonAndGetLabeledPrice(
const boost::property_tree::ptree& data)
const;
705 std::string parseLabeledPrice(
const LabeledPrice::Ptr&
object)
const;
707 Invoice::Ptr parseJsonAndGetInvoice(
const boost::property_tree::ptree& data)
const;
708 std::string parseInvoice(
const Invoice::Ptr&
object)
const;
710 ShippingAddress::Ptr parseJsonAndGetShippingAddress(
const boost::property_tree::ptree& data)
const;
711 std::string parseShippingAddress(
const ShippingAddress::Ptr&
object)
const;
713 OrderInfo::Ptr parseJsonAndGetOrderInfo(
const boost::property_tree::ptree& data)
const;
714 std::string parseOrderInfo(
const OrderInfo::Ptr&
object)
const;
716 ShippingOption::Ptr parseJsonAndGetShippingOption(
const boost::property_tree::ptree& data)
const;
717 std::string parseShippingOption(
const ShippingOption::Ptr&
object)
const;
719 SuccessfulPayment::Ptr parseJsonAndGetSuccessfulPayment(
const boost::property_tree::ptree& data)
const;
720 std::string parseSuccessfulPayment(
const SuccessfulPayment::Ptr&
object)
const;
722 ShippingQuery::Ptr parseJsonAndGetShippingQuery(
const boost::property_tree::ptree& data)
const;
723 std::string parseShippingQuery(
const ShippingQuery::Ptr&
object)
const;
725 PreCheckoutQuery::Ptr parseJsonAndGetPreCheckoutQuery(
const boost::property_tree::ptree& data)
const;
726 std::string parsePreCheckoutQuery(
const PreCheckoutQuery::Ptr&
object)
const;
728 PassportData::Ptr parseJsonAndGetPassportData(
const boost::property_tree::ptree& data)
const;
729 std::string parsePassportData(
const PassportData::Ptr&
object)
const;
731 PassportFile::Ptr parseJsonAndGetPassportFile(
const boost::property_tree::ptree& data)
const;
732 std::string parsePassportFile(
const PassportFile::Ptr&
object)
const;
734 EncryptedPassportElement::Ptr parseJsonAndGetEncryptedPassportElement(
const boost::property_tree::ptree& data)
const;
735 std::string parseEncryptedPassportElement(
const EncryptedPassportElement::Ptr&
object)
const;
737 EncryptedCredentials::Ptr parseJsonAndGetEncryptedCredentials(
const boost::property_tree::ptree& data)
const;
738 std::string parseEncryptedCredentials(
const EncryptedCredentials::Ptr&
object)
const;
740 PassportElementError::Ptr parseJsonAndGetPassportElementError(
const boost::property_tree::ptree& data)
const;
741 std::string parsePassportElementError(
const PassportElementError::Ptr&
object)
const;
743 PassportElementErrorDataField::Ptr parseJsonAndGetPassportElementErrorDataField(
const boost::property_tree::ptree& data)
const;
744 std::string parsePassportElementErrorDataField(
const PassportElementErrorDataField::Ptr&
object)
const;
746 PassportElementErrorFrontSide::Ptr parseJsonAndGetPassportElementErrorFrontSide(
const boost::property_tree::ptree& data)
const;
747 std::string parsePassportElementErrorFrontSide(
const PassportElementErrorFrontSide::Ptr&
object)
const;
749 PassportElementErrorReverseSide::Ptr parseJsonAndGetPassportElementErrorReverseSide(
const boost::property_tree::ptree& data)
const;
750 std::string parsePassportElementErrorReverseSide(
const PassportElementErrorReverseSide::Ptr&
object)
const;
752 PassportElementErrorSelfie::Ptr parseJsonAndGetPassportElementErrorSelfie(
const boost::property_tree::ptree& data)
const;
753 std::string parsePassportElementErrorSelfie(
const PassportElementErrorSelfie::Ptr&
object)
const;
755 PassportElementErrorFile::Ptr parseJsonAndGetPassportElementErrorFile(
const boost::property_tree::ptree& data)
const;
756 std::string parsePassportElementErrorFile(
const PassportElementErrorFile::Ptr&
object)
const;
758 PassportElementErrorFiles::Ptr parseJsonAndGetPassportElementErrorFiles(
const boost::property_tree::ptree& data)
const;
759 std::string parsePassportElementErrorFiles(
const PassportElementErrorFiles::Ptr&
object)
const;
761 PassportElementErrorTranslationFile::Ptr parseJsonAndGetPassportElementErrorTranslationFile(
const boost::property_tree::ptree& data)
const;
762 std::string parsePassportElementErrorTranslationFile(
const PassportElementErrorTranslationFile::Ptr&
object)
const;
764 PassportElementErrorTranslationFiles::Ptr parseJsonAndGetPassportElementErrorTranslationFiles(
const boost::property_tree::ptree& data)
const;
765 std::string parsePassportElementErrorTranslationFiles(
const PassportElementErrorTranslationFiles::Ptr&
object)
const;
767 PassportElementErrorUnspecified::Ptr parseJsonAndGetPassportElementErrorUnspecified(
const boost::property_tree::ptree& data)
const;
768 std::string parsePassportElementErrorUnspecified(
const PassportElementErrorUnspecified::Ptr&
object)
const;
770 Game::Ptr parseJsonAndGetGame(
const boost::property_tree::ptree& data)
const;
771 std::string parseGame(
const Game::Ptr&
object)
const;
773 CallbackGame::Ptr parseJsonAndGetCallbackGame(
const boost::property_tree::ptree& data)
const;
774 std::string parseCallbackGame(
const CallbackGame::Ptr&
object)
const;
776 GameHighScore::Ptr parseJsonAndGetGameHighScore(
const boost::property_tree::ptree& data)
const;
777 std::string parseGameHighScore(
const GameHighScore::Ptr&
object)
const;
779 GenericReply::Ptr parseJsonAndGetGenericReply(
const boost::property_tree::ptree& data)
const;
780 std::string parseGenericReply(
const GenericReply::Ptr&
object)
const;
782 inline boost::property_tree::ptree parseJson(
const std::string& json)
const {
783 boost::property_tree::ptree tree;
784 std::istringstream input(json);
785 boost::property_tree::read_json(input, tree);
790 std::shared_ptr<T> tryParseJson(JsonToTgTypeFunc<T> parseFunc,
const boost::property_tree::ptree& data,
const std::string& keyName)
const {
791 auto treeItem = data.find(keyName);
792 if (treeItem == data.not_found()) {
793 return std::shared_ptr<T>();
795 return (this->*parseFunc)(treeItem->second);
799 std::vector<std::shared_ptr<T>> parseJsonAndGetArray(JsonToTgTypeFunc<T> parseFunc,
const boost::property_tree::ptree& data)
const {
800 std::vector<std::shared_ptr<T>> result;
801 result.reserve(data.size());
802 for (
const std::pair<const std::string, boost::property_tree::ptree>& innerTreeItem : data) {
803 result.push_back((this->*parseFunc)(innerTreeItem.second));
809 std::vector<T> parseJsonAndGetArray(std::function<T(
const boost::property_tree::ptree&)> parseFunc,
const boost::property_tree::ptree& data,
const std::string& keyName)
const {
810 std::vector<T> result;
811 auto treeItem = data.find(keyName);
812 if (treeItem == data.not_found()) {
815 result.reserve(treeItem->second.size());
816 for (
const std::pair<const std::string, boost::property_tree::ptree>& innerTreeItem : treeItem->second) {
817 result.push_back(parseFunc(innerTreeItem.second));
823 std::vector<std::shared_ptr<T>> parseJsonAndGetArray(JsonToTgTypeFunc<T> parseFunc,
const boost::property_tree::ptree& data,
const std::string& keyName)
const {
824 std::vector<std::shared_ptr<T>> result;
825 auto treeItem = data.find(keyName);
826 if (treeItem == data.not_found()) {
829 result.reserve(treeItem->second.size());
830 for (
const std::pair<const std::string, boost::property_tree::ptree>& innerTreeItem : treeItem->second) {
831 result.push_back((this->*parseFunc)(innerTreeItem.second));
837 std::vector<std::vector<std::shared_ptr<T>>> parseJsonAndGet2DArray(JsonToTgTypeFunc<T> parseFunc,
const boost::property_tree::ptree& data,
const std::string& keyName)
const {
838 std::vector<std::vector<std::shared_ptr<T>>> result;
839 auto treeItem = data.find(keyName);
840 if (treeItem == data.not_found()) {
843 result.reserve(treeItem->second.size());
844 for (
const std::pair<const std::string, boost::property_tree::ptree>& innerTreeItem : treeItem->second) {
845 std::vector<std::shared_ptr<T>> innerResult;
846 for (
const std::pair<const std::string, boost::property_tree::ptree>& innerInnerTreeItem : innerTreeItem.second) {
847 innerResult.push_back((this->*parseFunc)(innerInnerTreeItem.second));
849 result.push_back(innerResult);
855 std::string parseArray(TgTypeToJsonFunc<T> parseFunc,
const std::vector<std::shared_ptr<T>>& objects)
const {
860 for (
const std::shared_ptr<T>& item : objects) {
861 result += (this->*parseFunc)(item);
864 result.erase(result.length() - 1);
870 std::string parseArray(std::function<T(
const T&)> parseFunc,
const std::vector<T>& objects)
const {
875 for (
const T& item : objects) {
876 result += parseFunc(item);
879 result.erase(result.length() - 1);
885 std::string parse2DArray(TgTypeToJsonFunc<T> parseFunc,
const std::vector<std::vector<std::shared_ptr<T>>>& objects)
const {
890 for (
const std::vector<std::shared_ptr<T>>& item : objects) {
891 result += parseArray(parseFunc, item);
894 result.erase(result.length() - 1);
900 inline void removeLastComma(std::string& input)
const {
901 input.erase(input.length() - 1);
905 inline void appendToJson(std::string& json,
const std::string& varName,
const std::shared_ptr<T>& value)
const {
906 if (value ==
nullptr) {
917 inline void appendToJson(std::string& json,
const std::string& varName,
const T& value)
const {
926 inline void appendToJsonNumber(std::string& json,
const std::string& varName,
const T& value)
const {
930 json += std::to_string(value);
934 inline void appendToJson(std::string &json,
const std::string &varName,
const int &value)
const { appendToJsonNumber(json, varName, value); }
935 inline void appendToJson(std::string &json,
const std::string &varName,
const long &value)
const { appendToJsonNumber(json, varName, value); }
936 inline void appendToJson(std::string &json,
const std::string &varName,
const long long &value)
const { appendToJsonNumber(json, varName, value); }
937 inline void appendToJson(std::string &json,
const std::string &varName,
const unsigned &value)
const { appendToJsonNumber(json, varName, value); }
938 inline void appendToJson(std::string &json,
const std::string &varName,
const unsigned long &value)
const { appendToJsonNumber(json, varName, value); }
939 inline void appendToJson(std::string &json,
const std::string &varName,
const unsigned long long &value)
const { appendToJsonNumber(json, varName, value); }
940 inline void appendToJson(std::string &json,
const std::string &varName,
const float &value)
const { appendToJsonNumber(json, varName, value); }
941 inline void appendToJson(std::string &json,
const std::string &varName,
const double &value)
const { appendToJsonNumber(json, varName, value); }
942 inline void appendToJson(std::string &json,
const std::string &varName,
const long double &value)
const { appendToJsonNumber(json, varName, value); }
944 inline void appendToJson(std::string& json,
const std::string& varName,
const bool& value)
const {
948 json += (value ? "true" :
"false");
952 inline void appendToJson(std::string& json,
const std::string& varName,
const char* value)
const {
953 if (value !=
nullptr){
954 std::string strValue(value);
955 appendToJson(json, varName, strValue);
959 void appendToJson(std::string& json,
const std::string& varName,
const std::string& value)
const;