| 1 | #include <nlohmann/json.hpp> |
|---|---|
| 2 | #include <string> |
| 3 | |
| 4 | #include "mtx/events/redaction.hpp" |
| 5 | |
| 6 | using json = nlohmann::json; |
| 7 | |
| 8 | namespace mtx { |
| 9 | namespace events { |
| 10 | namespace msg { |
| 11 | |
| 12 | void |
| 13 | from_json(const json &obj, Redaction &event) |
| 14 | { |
| 15 | if (obj.count(key: "reason") != 0 && !obj.at(key: "reason").is_null()) |
| 16 | event.reason = obj.at(key: "reason").get<std::string>(); |
| 17 | } |
| 18 | |
| 19 | void |
| 20 | to_json(json &obj, const Redaction &event) |
| 21 | { |
| 22 | obj["reason"] = event.reason; |
| 23 | } |
| 24 | |
| 25 | } // namespace msg |
| 26 | } // namespace events |
| 27 | } // namespace mtx |
| 28 |