1 | #pragma once |
2 | |
3 | /// @file |
4 | /// @brief Responses from the profile API. |
5 | |
6 | #if __has_include(<nlohmann/json_fwd.hpp>) |
7 | #include <nlohmann/json_fwd.hpp> |
8 | #else |
9 | #include <nlohmann/json.hpp> |
10 | #endif |
11 | |
12 | namespace mtx { |
13 | namespace responses { |
14 | |
15 | //! Response from the `GET /_matrix/client/r0/profile/{userId}` endpoint. |
16 | // |
17 | //! Get the combined profile information for this user. |
18 | //! This API may be used to fetch the user's own profile |
19 | //! information or other users; either locally or on remote homeservers. |
20 | //! This API may return keys which are not limited to *displayname* or *avatar_url*. |
21 | struct Profile |
22 | { |
23 | //! The user's avatar URL if they have set one, otherwise not present. |
24 | std::string avatar_url; |
25 | //! The user's display name if they have set one, otherwise not present. |
26 | std::string display_name; |
27 | |
28 | friend void from_json(const nlohmann::json &obj, Profile &profile); |
29 | }; |
30 | |
31 | //! Response from the `GET /_matrix/client/r0/profile/{userId}/avatar_url` endpoint. |
32 | struct AvatarUrl |
33 | { |
34 | std::string avatar_url; |
35 | |
36 | friend void from_json(const nlohmann::json &obj, AvatarUrl &avatar); |
37 | }; |
38 | } |
39 | } |
40 | |