Debian Codegraph @

mtxclient/lib/structs/responses/profile.cpp

raw symbols SCIP
1 #include "mtx/responses/profile.hpp"
2
3 #include <nlohmann/json.hpp>
4
5 using json = nlohmann::json;
6
7 namespace mtx {
8 namespace responses {
9
10 void
11 from_json(const json &obj, Profile &profile)
12 {
13 if (obj.count("avatar_url") != 0 && !obj.at("avatar_url").is_null())
14 profile.avatar_url = obj.at("avatar_url").get<std::string>();
15
16 if (obj.count("displayname") != 0 && !obj.at("displayname").is_null())
17 profile.display_name = obj.at("displayname").get<std::string>();
18 }
19
20 void
21 from_json(const json &obj, AvatarUrl &avatar)
22 {
23 if (obj.count("avatar_url") != 0 && !obj.at("avatar_url").is_null())
24 avatar.avatar_url = obj.at("avatar_url").get<std::string>();
25 }
26 }
27 }