diff options
Diffstat (limited to 'lib/csapi/definitions/auth_data.cpp')
-rw-r--r-- | lib/csapi/definitions/auth_data.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/csapi/definitions/auth_data.cpp b/lib/csapi/definitions/auth_data.cpp index f8639432..006b8c7e 100644 --- a/lib/csapi/definitions/auth_data.cpp +++ b/lib/csapi/definitions/auth_data.cpp @@ -6,23 +6,20 @@ using namespace QMatrixClient; -QJsonObject QMatrixClient::toJson(const AuthenticationData& pod) +void JsonObjectConverter<AuthenticationData>::dumpTo( + QJsonObject& jo, const AuthenticationData& pod) { - QJsonObject jo = toJson(pod.authInfo); + fillJson(jo, pod.authInfo); addParam<>(jo, QStringLiteral("type"), pod.type); addParam<IfNotEmpty>(jo, QStringLiteral("session"), pod.session); - return jo; } -AuthenticationData FromJsonObject<AuthenticationData>::operator()(QJsonObject jo) const +void JsonObjectConverter<AuthenticationData>::fillFrom( + QJsonObject jo, AuthenticationData& result) { - AuthenticationData result; - result.type = - fromJson<QString>(jo.take("type"_ls)); - result.session = - fromJson<QString>(jo.take("session"_ls)); + fromJson(jo.take("type"_ls), result.type); + fromJson(jo.take("session"_ls), result.session); - result.authInfo = fromJson<QHash<QString, QJsonObject>>(jo); - return result; + fromJson(jo, result.authInfo); } |