1#include "mtx/events/nheko_extensions/hidden_events.hpp"
2
3#include <nlohmann/json.hpp>
4
5namespace mtx {
6namespace events {
7namespace account_data {
8namespace nheko_extensions {
9
10void
11from_json(const nlohmann::json &obj, HiddenEvents &content)
12{
13 if (obj.contains(key: "hidden_event_types")) {
14 content.hidden_event_types = std::vector<EventType>{};
15 for (const auto &typeStr : obj.at(key: "hidden_event_types")) {
16 auto type = getEventType(type: typeStr.get<std::string>());
17 content.hidden_event_types->push_back(x: type);
18 }
19 }
20}
21
22void
23to_json(nlohmann::json &obj, const HiddenEvents &content)
24{
25 if (content.hidden_event_types) {
26 for (auto type : content.hidden_event_types.value()) {
27 obj["hidden_event_types"].push_back(val: to_string(type));
28 }
29 }
30}
31}
32} // namespace account_data
33} // namespace events
34} // namespace mtx
35