| 1 | #include "mtx/responses/register.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, Register &response) |
| 12 | { |
| 13 | using namespace mtx::identifiers; |
| 14 | response.user_id = obj.at(key: "user_id").get<User>(); |
| 15 | response.access_token = obj.at(key: "access_token").get<std::string>(); |
| 16 | response.device_id = obj.at(key: "device_id").get<std::string>(); |
| 17 | } |
| 18 | |
| 19 | void |
| 20 | from_json(const nlohmann::json &obj, RegistrationTokenValidity &response) |
| 21 | { |
| 22 | response.valid = obj.at(key: "valid").get<bool>(); |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 |