| 1 | #pragma once |
| 2 | |
| 3 | /// @file |
| 4 | /// @brief Response for .well-known lookup. |
| 5 | |
| 6 | #include <optional> |
| 7 | |
| 8 | #if __has_include(<nlohmann/json_fwd.hpp>) |
| 9 | #include <nlohmann/json_fwd.hpp> |
| 10 | #else |
| 11 | #include <nlohmann/json.hpp> |
| 12 | #endif |
| 13 | |
| 14 | namespace mtx { |
| 15 | namespace responses { |
| 16 | //! The info about this server. |
| 17 | struct ServerInformation |
| 18 | { |
| 19 | //! Required. The base URL for client-server connections. |
| 20 | std::string base_url; |
| 21 | |
| 22 | friend void from_json(const nlohmann::json &obj, ServerInformation &response); |
| 23 | }; |
| 24 | |
| 25 | //! Response from the `GET /.well-known/matrix/client` endpoint. |
| 26 | //! May also be returned from `POST /_matrix/client/r0/login`. |
| 27 | // |
| 28 | //! Gets discovery information about the domain |
| 29 | struct WellKnown |
| 30 | { |
| 31 | //! Required. Used by clients to discover homeserver information. |
| 32 | ServerInformation homeserver; |
| 33 | //! Used by clients to discover identity server information. |
| 34 | std::optional<ServerInformation> identity_server; |
| 35 | |
| 36 | friend void from_json(const nlohmann::json &obj, WellKnown &response); |
| 37 | }; |
| 38 | } |
| 39 | } |
| 40 | |