| 1 | #include "mtx/responses/members.hpp" |
|---|---|
| 2 | |
| 3 | #include <nlohmann/json.hpp> |
| 4 | |
| 5 | #include "mtx/log.hpp" |
| 6 | |
| 7 | namespace mtx { |
| 8 | namespace responses { |
| 9 | |
| 10 | void |
| 11 | from_json(const nlohmann::json &obj, Members &res) |
| 12 | { |
| 13 | if (obj.contains(key: "chunk")) { |
| 14 | for (const auto &e : obj["chunk"]) { |
| 15 | try { |
| 16 | res.chunk.push_back(x: e.get<mtx::events::StateEvent<mtx::events::state::Member>>()); |
| 17 | } catch (const std::exception &e) { |
| 18 | utils::log::log()->warn(fmt: "Failed to parse member event in members chunk: {}", |
| 19 | args: e.what()); |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | } |
| 26 | } |
| 27 |