tgbotxx 1.2.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
RevenueWithdrawalState.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
5
13 virtual ~RevenueWithdrawalState() = default;
14
16 std::string type;
17
19 virtual nl::json toJson() const {
20 nl::json json = nl::json::object();
22 return json;
23 }
24
26 virtual void fromJson(const nl::json& json) {
27 OBJECT_DESERIALIZE_FIELD(json, "type", type, "", false);
28 }
29 };
30
34 type = "pending";
35 }
39
42 [[nodiscard]] nl::json toJson() const override {
44 return json;
45 }
46
48 void fromJson(const nl::json& json) override {
50 }
51 };
52
56 type = "succeeded";
57 }
61
63 std::time_t date{};
64
66 std::string url;
67
70 nl::json toJson() const override {
74 return json;
75 }
76
78 void fromJson(const nl::json& json) override {
80 OBJECT_DESERIALIZE_FIELD(json, "date", date, 0, false);
81 OBJECT_DESERIALIZE_FIELD(json, "url", url, "", false);
82 }
83 };
84
88 type = "failed";
89 }
93
96 [[nodiscard]] nl::json toJson() const override {
98 return json;
99 }
100
102 void fromJson(const nl::json& json) override {
104 }
105 };
106
107}
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Available objects: https://core.telegram.org/bots/api#available-types.
Definition Object.hpp:19
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
Definition Object.hpp:46
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
The withdrawal failed and the transaction was refunded.
nl::json toJson() const override
Serializes this object to JSON.
void fromJson(const nl::json &json) override
Deserializes this object from JSON.
Base class representing the state of a revenue withdrawal operation https://core.telegram....
virtual nl::json toJson() const
Serializes this object to JSON.
virtual ~RevenueWithdrawalState()=default
virtual void fromJson(const nl::json &json)
Deserializes this object from JSON.
std::string type
Type of the state.
nl::json toJson() const override
Serializes this object to JSON.
void fromJson(const nl::json &json) override
Deserializes this object from JSON.
void fromJson(const nl::json &json) override
Deserializes this object from JSON.
std::time_t date
Date the withdrawal was completed in Unix time.
std::string url
An HTTPS URL that can be used to see transaction details.
nl::json toJson() const override
Serializes this object to JSON.