tgbotxx 1.1.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
10 explicit RevenueWithdrawalState(const nl::json& json) {
11 _fromJson(json);
12 }
13 virtual ~RevenueWithdrawalState() = default;
14
16 std::string type;
17
19 virtual nl::json toJson() const {
20 nl::json json = nl::json::object();
21 OBJECT_SERIALIZE_FIELD(json, "type", type);
22 return json;
23 }
24
26 virtual void fromJson(const nl::json& json) {
27 OBJECT_DESERIALIZE_FIELD(json, "type", type, "", false);
28 }
29
30 private:
32 void _fromJson(const nl::json& json) {
33 fromJson(json);
34 }
35 };
36
46
52 explicit RevenueWithdrawalStateSucceeded(const nl::json& json) : RevenueWithdrawalState(json) {
53 RevenueWithdrawalState::type = "succeeded";
54 }
55
57 std::time_t date{};
58
60 std::string url;
61
62 nl::json toJson() const override {
63 nl::json json = RevenueWithdrawalState::toJson();
64 OBJECT_SERIALIZE_FIELD(json, "date", date);
65 OBJECT_SERIALIZE_FIELD(json, "url", url);
66 return json;
67 }
68
69 void fromJson(const nl::json& json) override {
71 OBJECT_DESERIALIZE_FIELD(json, "date", date, 0, false);
72 OBJECT_DESERIALIZE_FIELD(json, "url", url, "", false);
73 }
74 };
75
85
86}
#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
The withdrawal failed and the transaction was refunded.
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.
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.