tgbotxx 1.2.9.5
Telegram Bot C++ Library
Loading...
Searching...
No Matches
AcceptedGiftTypes.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
5
9 AcceptedGiftTypes() = default;
10 explicit AcceptedGiftTypes(const nl::json& json) {
12 }
13
16
19
22
25
28
29
32 nl::json toJson() const {
33 nl::json json = nl::json::object();
34 OBJECT_SERIALIZE_FIELD(json, "unlimited_gifts", unlimitedGifts);
35 OBJECT_SERIALIZE_FIELD(json, "limited_gifts", limitedGifts);
36 OBJECT_SERIALIZE_FIELD(json, "unique_gifts", uniqueGifts);
37 OBJECT_SERIALIZE_FIELD(json, "premium_subscription", premiumSubscription);
38 OBJECT_SERIALIZE_FIELD(json, "gifts_from_channels", giftsFromChannels);
39 return json;
40 }
41
43 void fromJson(const nl::json& json) {
44 OBJECT_DESERIALIZE_FIELD(json, "unlimited_gifts", unlimitedGifts, false, false);
45 OBJECT_DESERIALIZE_FIELD(json, "limited_gifts", limitedGifts, false, false);
46 OBJECT_DESERIALIZE_FIELD(json, "unique_gifts", uniqueGifts, false, false);
47 OBJECT_DESERIALIZE_FIELD(json, "premium_subscription", premiumSubscription, false, false);
48 OBJECT_DESERIALIZE_FIELD(json, "gifts_from_channels", giftsFromChannels, false, false);
49 }
50 };
51
52}
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Serialize.
Definition Object.hpp:27
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
Definition Object.hpp:64
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
This object describes the types of gifts that can be gifted to a user or a chat. https://core....
bool uniqueGifts
True, if unique gifts or gifts that can be upgraded to unique for free are accepted.
bool unlimitedGifts
True, if unlimited regular gifts are accepted.
nl::json toJson() const
Serializes this object to JSON.
bool giftsFromChannels
True, if transfers of unique gifts from channels are accepted.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
bool premiumSubscription
True, if a Telegram Premium subscription is accepted.
AcceptedGiftTypes(const nl::json &json)
bool limitedGifts
True, if limited regular gifts are accepted.