| 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(key: "start", default_value: ""); |
| 15 | messages.end = obj.value(key: "end", default_value: ""); |
| 16 | |
| 17 | if (obj.contains(key: "chunk")) |
| 18 | utils::parse_timeline_events(events: obj.at(key: "chunk"), container&: messages.chunk); |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 |