| 1 | #pragma once |
| 2 | |
| 3 | /// @file |
| 4 | /// @brief Responses from the registration API. |
| 5 | |
| 6 | #include <string> |
| 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 | #include "mtx/identifiers.hpp" |
| 15 | |
| 16 | namespace mtx { |
| 17 | namespace responses { |
| 18 | |
| 19 | //! Response from the `POST /_matrix/client/r0/register` endpoint. |
| 20 | struct Register |
| 21 | { |
| 22 | //! The fully-qualified Matrix user ID that has been registered. |
| 23 | mtx::identifiers::User user_id; |
| 24 | //! An access token for the account. This access token can then be used to |
| 25 | //! authorize other requests. |
| 26 | std::string access_token; |
| 27 | //! ID of the registered device. Will be the same as the corresponding |
| 28 | //! parameter in the request, if one was specified. |
| 29 | std::string device_id; |
| 30 | |
| 31 | friend void from_json(const nlohmann::json &obj, Register &response); |
| 32 | }; |
| 33 | |
| 34 | //! Response from the `GET |
| 35 | //! /_matrix/client/v1/register/m.login.registration_token/validity` |
| 36 | //! endpoint. |
| 37 | struct RegistrationTokenValidity |
| 38 | { |
| 39 | //! Whether the registration token is valid or not |
| 40 | bool valid; |
| 41 | |
| 42 | friend void from_json(const nlohmann::json &obj, RegistrationTokenValidity &response); |
| 43 | }; |
| 44 | } |
| 45 | } |
| 46 | |