| 1 | #include "mtx/responses/messages.hpp" |
| 2 | #include "mtx/responses/common.hpp" |
| 3 | |
| 4 | #include <nlohmann/json.hpp> |
| 5 | |
| 6 | using json = nlohmann::json; |
| 7 | |
| 8 | namespace mtx { |
| 9 | namespace responses { |
| 10 | |
| 11 | void |
| 12 | from_json(const json &obj, Messages &messages) |
| 13 | { |
| 14 | messages.start = obj.value("start", ""); |
| 15 | messages.end = obj.value("end", ""); |
| 16 | |
| 17 | if (obj.contains("chunk")) |
| 18 | utils::parse_timeline_events(obj.at("chunk"), messages.chunk); |
| 19 | } |
| 20 | } |
| 21 | } |