| 1 | #pragma once |
| 2 | |
| 3 | /// @file |
| 4 | /// @brief Response for the endpoint to search users |
| 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 | struct User |
| 16 | { |
| 17 | //! The avatar url, as an MXC, if one exists. |
| 18 | std::string avatar_url; |
| 19 | //! The display name of the user, if one exists. |
| 20 | std::string display_name; |
| 21 | //! The user’s matrix user ID. |
| 22 | std::string user_id; |
| 23 | |
| 24 | friend void from_json(const nlohmann::json &obj, User &res); |
| 25 | }; |
| 26 | //! User directory search results. |
| 27 | struct Users |
| 28 | { |
| 29 | //! If the search was limited by the search limit. |
| 30 | bool limited; |
| 31 | |
| 32 | //! A chunk of user events. |
| 33 | std::vector<User> results; |
| 34 | |
| 35 | friend void from_json(const nlohmann::json &obj, Users &res); |
| 36 | }; |
| 37 | } |
| 38 | } |
| 39 | |