summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJellyBrick <shlee1503@naver.com>2018-06-22 20:51:07 +0900
committerJellyBrick <shlee1503@naver.com>2018-06-22 20:51:07 +0900
commite252f0aa25bb7087698ed94698a91f9309e61460 (patch)
tree31e56f044530d32760ba50a2162d6a32976512d3 /include
parent03cd6820af477475a196ab85971f4245057841e4 (diff)
Resolved #48, Bot API 3.0 implementation done.
Diffstat (limited to 'include')
-rw-r--r--include/tgbot/Api.h15
-rw-r--r--include/tgbot/TgTypeParser.h12
2 files changed, 14 insertions, 13 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h
index 75b01a5..efa2ad4 100644
--- a/include/tgbot/Api.h
+++ b/include/tgbot/Api.h
@@ -202,7 +202,7 @@ public:
* @param needName Optional. Pass True, if you require the user's full name to complete the order.
* @param needPhoneNumber Optional. Pass True, if you require the user's phone number to complete the order.
* @param needEmail Optional. Pass True, if you require the user's email address to complete the order.
- * @param needShippingAdress Optional. Pass True, if you require the user's shipping address to complete the order.
+ * @param needShippingAddress Optional. Pass True, if you require the user's shipping address to complete the order.
* @param sendPhoneNumberToProvider Optional. Pass True, if user's phone number should be sent to provider.
* @param sendEmailToProvider Optional. Pass True, if user's email address should be sent to provider
* @param isFlexible Optional. Pass True, if the final price depends on the shipping method.
@@ -212,17 +212,18 @@ public:
* @return On success, the sent Message is returned.
*/
Message::Ptr sendInvoice(int64_t chatId, const std::string& title, const std::string& description, const std::string& payload,
- const std::string& providerToken, const std::string& startParameter, const std::string& currency, const std::vector<LabeledPrice>& prices,
- const std::string& providerData, const std::string& photoUrl = "", int32_t photoSize = 0,
- int32_t photoWidth = 0, int32_t photoHeight = 0, bool needName = false,
- bool needPhoneNumber = false, bool needEmail = false, bool needShippingAdress = false,
- bool sendPhoneNumberToProvider = false, bool sendEmailToProvider = false, bool isFlexible = false,
- int32_t replyToMessageId = 0, const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), bool disableNotification = false) const;
+ const std::string& providerToken, const std::string& startParameter, const std::string& currency, const std::vector<LabeledPrice>& prices,
+ const std::string& providerData = "", const std::string& photoUrl = "", int32_t photoSize = 0,
+ int32_t photoWidth = 0, int32_t photoHeight = 0, bool needName = false,
+ bool needPhoneNumber = false, bool needEmail = false, bool needShippingAddress = false,
+ bool sendPhoneNumberToProvider = false, bool sendEmailToProvider = false, bool isFlexible = false,
+ int32_t replyToMessageId = 0, const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), bool disableNotification = false) const;
/**
* @brief Use this method to reply to shipping queries.
*
* If you sent an invoice requesting a shipping address and the parameter isFlexible was specified, the Bot API will send an Update with a shipping_query field to the bot.
+ *
* @param shippingQueryId Unique identifier for the query to be answered.
* @param ok Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)
* @param shippingOptions Optional. Required if ok is True. A JSON-serialized array of available shipping options.
diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h
index 1784383..dfb10a7 100644
--- a/include/tgbot/TgTypeParser.h
+++ b/include/tgbot/TgTypeParser.h
@@ -418,30 +418,30 @@ private:
}
template<typename T>
- void appendToJson(std::string& json, const std::string& varName, const std::shared_ptr<T>& value) const {
+ inline void appendToJson(std::string& json, const std::string& varName, const std::shared_ptr<T>& value) const {
if (value == nullptr) {
return;
}
json += '"';
json += varName;
- json += "\":";
+ json += R"(":)";
json += value;
json += ',';
}
template<typename T>
- void appendToJson(std::string& json, const std::string& varName, const T& value) const {
+ inline void appendToJson(std::string& json, const std::string& varName, const T& value) const {
json += '"';
json += varName;
- json += "\":";
+ json += R"(":)";
json += value;
json += ',';
}
- void appendToJson(std::string& json, const std::string& varName, const bool& value) const {
+ inline void appendToJson(std::string& json, const std::string& varName, const bool& value) const {
json += '"';
json += varName;
- json += "\":";
+ json += R"(":)";
json += (value ? "true" : "false");
json += ',';
}