diff options
author | JellyBrick <shlee1503@naver.com> | 2018-05-27 02:27:44 +0900 |
---|---|---|
committer | JellyBrick <shlee1503@naver.com> | 2018-05-27 02:27:44 +0900 |
commit | 66cbca3b206567ce62af42cab950696ef6f80adb (patch) | |
tree | 9a69b16523de4c083540e4d092942a15cf12ef42 /include | |
parent | b538f1fb43c790c9043630e6bfad42f037dbe03a (diff) |
Bot API 3.0 (Maks Mazurov (fox.cpp))
Diffstat (limited to 'include')
-rw-r--r-- | include/tgbot/Api.h | 29 | ||||
-rw-r--r-- | include/tgbot/TgTypeParser.h | 35 | ||||
-rw-r--r-- | include/tgbot/tgbot.h | 1 | ||||
-rw-r--r-- | include/tgbot/types/InlineQueryResultGif.h | 5 | ||||
-rw-r--r-- | include/tgbot/types/InlineQueryResultMpeg4Gif.h | 5 | ||||
-rw-r--r-- | include/tgbot/types/Invoice.h | 78 | ||||
-rw-r--r-- | include/tgbot/types/LabeledPrice.h | 42 | ||||
-rw-r--r-- | include/tgbot/types/Message.h | 5 | ||||
-rw-r--r-- | include/tgbot/types/OrderInfo.h | 66 | ||||
-rw-r--r-- | include/tgbot/types/PreCheckoutQuery.h | 91 | ||||
-rw-r--r-- | include/tgbot/types/ShippingAddress.h | 75 | ||||
-rw-r--r-- | include/tgbot/types/ShippingOption.h | 43 | ||||
-rw-r--r-- | include/tgbot/types/ShippingQuery.h | 68 | ||||
-rw-r--r-- | include/tgbot/types/SuccessfulPayment.h | 90 | ||||
-rw-r--r-- | include/tgbot/types/User.h | 5 | ||||
-rw-r--r-- | include/tgbot/types/VideoNote.h | 70 |
16 files changed, 708 insertions, 0 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index 4eb63c7..10cc91e 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -230,6 +230,35 @@ public: int32_t replyToMessageId = 0, const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), bool disableNotification = false) const; /** + * Use this method to send video messages. On success, the sent Message is returned. + * @param chatId Unique identifier for the target chat. + * @param videoNote Video note to send. + * @param replyToMessageId If the message is a reply, ID of the original message. + * @param disableNotification Sends the message silently. Users will receive a notification with no sound. + * @param duration Duration of sent video in seconds. + * @param length Video width and height. + * @param replyMarkup Additional interface options. A object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + * @return On success, the sent Message is returned. + */ + Message::Ptr sendVideoNote(int64_t chatId, const InputFile::Ptr videoNote, int64_t replyToMessageId = 0, bool disableNotification = false, + int32_t duration = 0, int32_t length = 0, const GenericReply::Ptr replyMarkup = GenericReply::Ptr()); + + /** + * Use this method to send video messages. On success, the sent Message is returned. + * @param chatId Unique identifier for the target chat. + * @param videoNote Id of the video note that exists on the Telegram servers. + * @param replyToMessageId If the message is a reply, ID of the original message. + * @param disableNotification Sends the message silently. Users will receive a notification with no sound. + * @param duration Duration of sent video in seconds. + * @param length Video width and height. + * @param replyMarkup Additional interface options. A object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + * @return On success, the sent Message is returned. + */ + Message::Ptr sendVideoNote(int64_t chatId, const std::string &videoNote, int64_t replyToMessageId = 0, bool disableNotification = false, + int32_t duration = 0, int32_t length = 0, const GenericReply::Ptr replyMarkup = GenericReply::Ptr()); + + + /** * Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. * @param chatId Unique identifier for the target chat. * @param voice Audio file to send. diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h index 2faaf45..bfae9aa 100644 --- a/include/tgbot/TgTypeParser.h +++ b/include/tgbot/TgTypeParser.h @@ -36,6 +36,7 @@ #include "tgbot/types/Document.h" #include "tgbot/types/Sticker.h" #include "tgbot/types/Video.h" +#include "tgbot/types/VideoNote.h" #include "tgbot/types/Contact.h" #include "tgbot/types/Location.h" #include "tgbot/types/Update.h" @@ -80,6 +81,14 @@ #include "tgbot/types/InputLocationMessageContent.h" #include "tgbot/types/InputVenueMessageContent.h" #include "tgbot/types/InputContactMessageContent.h" +#include "tgbot/types/Invoice.h" +#include "tgbot/types/OrderInfo.h" +#include "tgbot/types/PreCheckoutQuery.h" +#include "tgbot/types/ShippingAddress.h" +#include "tgbot/types/ShippingQuery.h" +#include "tgbot/types/ShippingOption.h" +#include "tgbot/types/SuccessfulPayment.h" +#include "tgbot/types/LabeledPrice.h" namespace TgBot { @@ -111,6 +120,8 @@ public: std::string parseSticker(const Sticker::Ptr& object) const; Video::Ptr parseJsonAndGetVideo(const boost::property_tree::ptree& data) const; std::string parseVideo(const Video::Ptr& object) const; + VideoNote::Ptr parseJsonAndGetVideoNote(const boost::property_tree::ptree& data) const; + std::string parseVideoNote(const VideoNote::Ptr& object) const; Contact::Ptr parseJsonAndGetContact(const boost::property_tree::ptree& data) const; std::string parseContact(const Contact::Ptr& object) const; Location::Ptr parseJsonAndGetLocation(const boost::property_tree::ptree& data) const; @@ -234,6 +245,30 @@ public: InputContactMessageContent::Ptr parseJsonAndGetInputContactMessageContent(const boost::property_tree::ptree& data) const; std::string parseInputContactMessageContent(const InputContactMessageContent::Ptr& object) const; + Invoice::Ptr parseJsonAndGetInvoice(const boost::property_tree::ptree& data) const; + std::string parseInvoice(const Invoice::Ptr& object) const; + + LabeledPrice::Ptr parseJsonAndGetLabeledPrice(const boost::property_tree::ptree& data) const; + std::string parseLabeledPrice(const LabeledPrice::Ptr& object) const; + + OrderInfo::Ptr parseJsonAndGetOrderInfo(const boost::property_tree::ptree& data) const; + std::string parseOrderInfo(const OrderInfo::Ptr& object) const; + + PreCheckoutQuery::Ptr parseJsonAndGetPreCheckoutQuery(const boost::property_tree::ptree& data) const; + std::string parsePreCheckoutQuery(const PreCheckoutQuery::Ptr& object) const; + + ShippingAddress::Ptr parseJsonAndGetShippingAddress(const boost::property_tree::ptree& data) const; + std::string parseShippingAddress(const ShippingAddress::Ptr& object) const; + + ShippingOption::Ptr parseJsonAndGetShippingOption(const boost::property_tree::ptree& data) const; + std::string parseShippingOption(const ShippingOption::Ptr& object) const; + + ShippingQuery::Ptr parseJsonAndGetShippingQuery(const boost::property_tree::ptree& data) const; + std::string parseShippingQuery(const ShippingQuery::Ptr& object) const; + + SuccessfulPayment::Ptr parseJsonAndGetSucessfulPayment(const boost::property_tree::ptree& data) const; + std::string parseSucessfulPayment(const SuccessfulPayment::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/tgbot.h b/include/tgbot/tgbot.h index 39de85e..687783b 100644 --- a/include/tgbot/tgbot.h +++ b/include/tgbot/tgbot.h @@ -45,6 +45,7 @@ #include "tgbot/types/User.h" #include "tgbot/types/UserProfilePhotos.h" #include "tgbot/types/Video.h" +#include "tgbot/types/VideoNote.h" #include "tgbot/types/InlineQuery.h" #include "tgbot/types/InlineQueryResult.h" #include "tgbot/types/InlineQueryResultArticle.h" diff --git a/include/tgbot/types/InlineQueryResultGif.h b/include/tgbot/types/InlineQueryResultGif.h index 6159886..1b6f9a3 100644 --- a/include/tgbot/types/InlineQueryResultGif.h +++ b/include/tgbot/types/InlineQueryResultGif.h @@ -44,6 +44,11 @@ public: int32_t gifHeight; /** + * Optional. Duration of the GIF + */ + int32_t gifDuration; + + /** * URL of the static thumbnail for the result (jpeg or gif) */ std::string thumbUrl; diff --git a/include/tgbot/types/InlineQueryResultMpeg4Gif.h b/include/tgbot/types/InlineQueryResultMpeg4Gif.h index c1dbb9e..9727281 100644 --- a/include/tgbot/types/InlineQueryResultMpeg4Gif.h +++ b/include/tgbot/types/InlineQueryResultMpeg4Gif.h @@ -39,6 +39,11 @@ public: int32_t mpeg4Height; /** + * Optional. Video duration. + */ + int32_t mpeg4Duration; + + /** * URL of the static thumbnail (jpeg or gif) for the result */ std::string thumbUrl; diff --git a/include/tgbot/types/Invoice.h b/include/tgbot/types/Invoice.h new file mode 100644 index 0000000..7836e14 --- /dev/null +++ b/include/tgbot/types/Invoice.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015 Oleg Morozenkov + * Copyright (c) 2017 Maks Mazurov (fox.cpp) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef TGBOT_INVOICE_H +#define TGBOT_INVOICE_H + +#include <string> +#include <memory> + +namespace TgBot { + +/** + * @brief This object contains basic information about an invoice. + * + * https://core.telegram.org/bots/api#invoice + * + * @ingroup types + */ +class Invoice { +public: + typedef std::shared_ptr<Invoice> Ptr; + + /** + * @brief Product name. + */ + std::string title; + + /** + * @brief Product description. + */ + std::string description; + + /** + * @brief Unique bot deep-linking parameter that can be used to generate this invoice. + */ + std::string startParameter; + + /** + * @brief Three-letter ISO 4217 currency code. + */ + std::string currency; + + /** + * @brief Total price in the smallest units of the currency (integer, + * not float/double). + * + * For example, for a price of US$ 1.45 pass + * amount = 145. See the exp parameter in currencies.json, it shows + * the number of digits past the decimal point for each currency (2 + * for the majority of currencies). + * + * https://core.telegram.org/bots/payments/currencies.json + */ + int32_t totalAmount; +}; +} + +#endif //TGBOT_INVOICE_H diff --git a/include/tgbot/types/LabeledPrice.h b/include/tgbot/types/LabeledPrice.h new file mode 100644 index 0000000..64b9aeb --- /dev/null +++ b/include/tgbot/types/LabeledPrice.h @@ -0,0 +1,42 @@ +// +// Created by Maks Mazurov (fox.cpp) on 21.05.17. +// + +#ifndef TGBOT_LABELEDPRICE_H +#define TGBOT_LABELEDPRICE_H + +#include <string> +#include <memory> + +namespace TgBot { + +/** + * @brief This object represents a portion of the price for goods or services. + * + * https://core.telegram.org/bots/api#labeledprice + * @ingroup types + */ +class LabeledPrice { +public: + typedef std::shared_ptr<LabeledPrice> Ptr; + + /** + * @brief Portion label. + */ + std::string label; + + /** + * @brief Price of the product in the smallest units of the currency (integer, + * not float/double). + * + * For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter + * in currencies.json, it shows the number of digits past the decimal point + * for each currency (2 for the majority of currencies). + * + * https://core.telegram.org/bots/payments/currencies.json + */ + int32_t amount; +}; +} + +#endif //TGBOT_LABELEDPRICE_H diff --git a/include/tgbot/types/Message.h b/include/tgbot/types/Message.h index 415f616..ee293b9 100644 --- a/include/tgbot/types/Message.h +++ b/include/tgbot/types/Message.h @@ -176,6 +176,11 @@ public: User::Ptr newChatMember; /** + * Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) + */ + std::vector<User::Ptr> newChatMembers; + + /** * Optional. A member was removed from the group, information about them (this member may be bot itself). */ User::Ptr leftChatMember; diff --git a/include/tgbot/types/OrderInfo.h b/include/tgbot/types/OrderInfo.h new file mode 100644 index 0000000..45c3d75 --- /dev/null +++ b/include/tgbot/types/OrderInfo.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2015 Oleg Morozenkov + * Copyright (c) 2017 Maks Mazurov (fox.cpp) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef TGBOT_ORDERINFO_H +#define TGBOT_ORDERINFO_H + +#include <string> +#include <memory> +#include "tgbot/types/ShippingAddress.h" + +namespace TgBot { + +/** + * @brief This object represents information about an order. + * + * https://core.telegram.org/bots/api#orderinfo + * + * @ingroup types + */ +class OrderInfo { +public: + typedef std::shared_ptr<OrderInfo> Ptr; + + /** + * @brief Optional. User name. + */ + std::string name; + + /** + * @brief Optional. User's phone number. + */ + std::string phoneNumber; + + /** + * @brief Optional. User email. + */ + std::string email; + + /** + * @brief Optional. User shipping address. + */ + ShippingAddress::Ptr shippingAddress; +}; +} + +#endif //TGBOT_ORDERINFO_H diff --git a/include/tgbot/types/PreCheckoutQuery.h b/include/tgbot/types/PreCheckoutQuery.h new file mode 100644 index 0000000..7282b3b --- /dev/null +++ b/include/tgbot/types/PreCheckoutQuery.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2015 Oleg Morozenkov + * Copyright (c) 2017 Maks Mazurov (fox.cpp) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef TGBOT_PRECHECKOUTQUERY_H +#define TGBOT_PRECHECKOUTQUERY_H + +#include <string> +#include <memory> +#include <vector> +#include "tgbot/types/User.h" +#include "tgbot/types/OrderInfo.h" + +namespace TgBot { + +/** + * @brief This object contains information about an incoming pre-checkout query. + * + * https://core.telegram.org/bots/api#precheckoutquery + * + * @ingroup types + */ +class PreCheckoutQuery { +public: + typedef std::shared_ptr<PreCheckoutQuery> Ptr; + + /** + * @brief Unique query identifier. + */ + std::string id; + + /** + * @brief User who sent the query. + */ + User::Ptr from; + + /** + * @brief Three-letter ISO 4217 currency code. + */ + std::string currency; + + /** + * @brief Total price in the smallest units of the currency (integer, + * not float/double). + * + * For example, for a price of US$ 1.45 pass + * amount = 145. See the exp parameter in currencies.json, it shows + * the number of digits past the decimal point for each currency (2 + * for the majority of currencies). + * + * https://core.telegram.org/bots/payments/currencies.json + */ + int32_t totalAmount; + + /** + * @brief Bot specified invoice payload. + */ + std::string invoicePayload; + + /** + * @brief Optional. Identifier of the shipping option chosen by the user. + */ + std::string shippingOptionId; + + /** + * @brief Optional. Order info provided by the user. + */ + OrderInfo::Ptr orderInfo; +}; +} + +#endif //TGBOT_PRECHECKOUTQUERY_H diff --git a/include/tgbot/types/ShippingAddress.h b/include/tgbot/types/ShippingAddress.h new file mode 100644 index 0000000..97ac33f --- /dev/null +++ b/include/tgbot/types/ShippingAddress.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2015 Oleg Morozenkov + * Copyright (c) 2017 Maks Mazurov (fox.cpp) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef TGBOT_SHIPPINGADDRESS_H +#define TGBOT_SHIPPINGADDRESS_H + +#include <string> +#include <memory> + +namespace TgBot { + +/** + * @brief This object represents a shipping address. + * + * https://core.telegram.org/bots/api#shippingaddress + * + * @ingroup types + */ +class ShippingAddress { +public: + typedef std::shared_ptr<ShippingAddress> Ptr; + + /** + * @brief ISO 3166-1 alpha-2 country code. + */ + std::string countryCode; + + /** + * @brief State, if applicable. + */ + std::string state; + + /** + * @brief City. + */ + std::string city; + + /** + * @brief First line for the address. + */ + std::string streetLine1; + + /** + * @brief Second line for the address. + */ + std::string streetLine2; + + /** + * Address post code. + */ + std::string postCode; +}; +} + +#endif //TGBOT_SHIPPINGADDRESS_H diff --git a/include/tgbot/types/ShippingOption.h b/include/tgbot/types/ShippingOption.h new file mode 100644 index 0000000..a946681 --- /dev/null +++ b/include/tgbot/types/ShippingOption.h @@ -0,0 +1,43 @@ +// +// Created by Maks Mazurov (fox.cpp) on 21.05.17. +// + +#ifndef TGBOT_SHIPPINGOPTION_H +#define TGBOT_SHIPPINGOPTION_H + +#include <string> +#include <memory> +#include <vector> +#include "tgbot/types/LabeledPrice.h" + +namespace TgBot { + +/** + * @brief This object represents one shipping option. + * + * https://core.telegram.org/bots/api#shippingoption + * + * @ingroup types + */ +class ShippingOption { +public: + typedef std::shared_ptr<ShippingOption> Ptr; + + /** + * @brief Shipping option identifier. + */ + std::string id; + + /** + * @brief Option title. + */ + std::string title; + + /** + * @brief List of price options. + */ + std::vector<LabeledPrice::Ptr> prices; +}; +} + +#endif //TGBOT_SHIPPINGOPTION_H diff --git a/include/tgbot/types/ShippingQuery.h b/include/tgbot/types/ShippingQuery.h new file mode 100644 index 0000000..47c20d8 --- /dev/null +++ b/include/tgbot/types/ShippingQuery.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2015 Oleg Morozenkov + * Copyright (c) 2017 Maks Mazurov (fox.cpp) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef TGBOT_SHIPPINGQUERY_H +#define TGBOT_SHIPPINGQUERY_H + +#include <string> +#include <memory> +#include <vector> +#include "tgbot/types/User.h" +#include "tgbot/types/ShippingAddress.h" + +namespace TgBot { + +/** + * @brief This object contains information about an incoming shipping query. + * + * https://core.telegram.org/bots/api#shippingquery + * + * @ingroup types + */ +class ShippingQuery { +public: + typedef std::shared_ptr<ShippingQuery> Ptr; + + /** + * @brief Unique query identifier. + */ + std::string id; + + /** + * @brief User who sent the query. + */ + User::Ptr from; + + /** + * @brief Bot specified invoice payload. + */ + std::string invoicePayload; + + /** + * @brief User specified shipping address. + */ + ShippingAddress::Ptr shippingAddress; +}; +} + +#endif //TGBOT_SHIPPINGQUERY_H diff --git a/include/tgbot/types/SuccessfulPayment.h b/include/tgbot/types/SuccessfulPayment.h new file mode 100644 index 0000000..ed96e8b --- /dev/null +++ b/include/tgbot/types/SuccessfulPayment.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2015 Oleg Morozenkov + * Copyright (c) 2017 Maks Mazurov (fox.cpp) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef TGBOT_SUCCESSFULPAYMENT_H +#define TGBOT_SUCCESSFULPAYMENT_H + +#include <string> +#include <memory> +#include <vector> +#include "tgbot/types/OrderInfo.h" + +namespace TgBot { + +/** + * @brief This object contains basic information about a successful payment. + * + * https://core.telegram.org/bots/api#successfulpayment + * + * @ingroup types + */ +class SuccessfulPayment { +public: + typedef std::shared_ptr<SuccessfulPayment> Ptr; + + /** + * @brief Three-letter ISO 4217 currency code + */ + std::string currency; + + /** + * @brief Total price in the smallest units of the currency (integer, + * not float/double). + * + * For example, for a price of US$ 1.45 pass + * amount = 145. See the exp parameter in currencies.json, it shows + * the number of digits past the decimal point for each currency (2 + * for the majority of currencies). + * + * https://core.telegram.org/bots/payments/currencies.json + */ + int32_t totalAmount; + + /** + * @brief Bot specified invoice payload. + */ + std::string invoicePayload; + + /** + * @brief Optional. Identifier of the shipping option chosen by the user. + */ + std::string shippingOptionId; + + /** + * @brief Optional. Order info provided by the user. + */ + OrderInfo::Ptr orderInfo; + + /** + * @brief Telegram payment identifier. + */ + std::string telegramPaymentChargeId; + + /** + * @brief Provider payment identifier. + */ + std::string providerPaymentChargeId; +}; +} + +#endif //TGBOT_SUCCESSFULPAYMENT_H diff --git a/include/tgbot/types/User.h b/include/tgbot/types/User.h index 420d355..f3a6960 100644 --- a/include/tgbot/types/User.h +++ b/include/tgbot/types/User.h @@ -56,6 +56,11 @@ public: * Optional. User‘s or bot’s username. */ std::string username; + + /** + * Optional. IETF language tag of the user's language. + */ + std::string languageCode; }; } diff --git a/include/tgbot/types/VideoNote.h b/include/tgbot/types/VideoNote.h new file mode 100644 index 0000000..bff452e --- /dev/null +++ b/include/tgbot/types/VideoNote.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2015 Oleg Morozenkov + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef TGBOT_CPP_VIDEONOTE_H +#define TGBOT_CPP_VIDEONOTE_H + +#include <string> +#include <memory> + +#include "tgbot/types/PhotoSize.h" + +namespace TgBot { + +/** + * This object represents a video message (available in Telegram apps as of v.4.0). + * @ingroup types + */ +class VideoNote { + +public: + typedef std::shared_ptr<VideoNote> Ptr; + + /** + * Unique identifier for this file. + */ + std::string fileId; + + /** + * Video width and height as defined by sender. + */ + int32_t length; + + /** + * Duration of the video in seconds as defined by sender. + */ + int32_t duration; + + /** + * Optional. Video thumbnail. + */ + PhotoSize::Ptr thumb; + + /** + * Optional. File size. + */ + int32_t fileSize; +}; + +} + +#endif //TGBOT_CPP_VIDEONOTE_H |