diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-07-18 18:42:02 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-07-18 18:42:02 +0900 |
commit | f3a251404c00787b650e618fb5c257162507c18b (patch) | |
tree | a801eb5f444a8b2b3f8d93d2b64e22785bbf3f97 /lib/application-service/definitions/protocol.cpp | |
parent | 5e6b4bb975fa9697a6aca001629c65db506a437f (diff) | |
download | libquotient-f3a251404c00787b650e618fb5c257162507c18b.tar.gz libquotient-f3a251404c00787b650e618fb5c257162507c18b.zip |
csapi: third_party_lookup.* and its dependencies in application-service/
As per the latest API definitions.
Diffstat (limited to 'lib/application-service/definitions/protocol.cpp')
-rw-r--r-- | lib/application-service/definitions/protocol.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/lib/application-service/definitions/protocol.cpp b/lib/application-service/definitions/protocol.cpp new file mode 100644 index 00000000..65cbc20e --- /dev/null +++ b/lib/application-service/definitions/protocol.cpp @@ -0,0 +1,74 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "protocol.h" + +using namespace QMatrixClient; + +QJsonObject QMatrixClient::toJson(const FieldType& pod) +{ + QJsonObject _json; + addParam<IfNotEmpty>(_json, QStringLiteral("regexp"), pod.regexp); + addParam<IfNotEmpty>(_json, QStringLiteral("placeholder"), pod.placeholder); + return _json; +} + +FieldType FromJson<FieldType>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + FieldType result; + result.regexp = + fromJson<QString>(_json.value("regexp"_ls)); + result.placeholder = + fromJson<QString>(_json.value("placeholder"_ls)); + + return result; +} + +QJsonObject QMatrixClient::toJson(const FieldTypes& pod) +{ + QJsonObject _json; + addParam<IfNotEmpty>(_json, QStringLiteral("fieldname"), pod.fieldname); + return _json; +} + +FieldTypes FromJson<FieldTypes>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + FieldTypes result; + result.fieldname = + fromJson<FieldType>(_json.value("fieldname"_ls)); + + return result; +} + +QJsonObject QMatrixClient::toJson(const Protocol& pod) +{ + QJsonObject _json; + addParam<IfNotEmpty>(_json, QStringLiteral("user_fields"), pod.userFields); + addParam<IfNotEmpty>(_json, QStringLiteral("location_fields"), pod.locationFields); + addParam<IfNotEmpty>(_json, QStringLiteral("icon"), pod.icon); + addParam<IfNotEmpty>(_json, QStringLiteral("field_types"), pod.fieldTypes); + addParam<IfNotEmpty>(_json, QStringLiteral("instances"), pod.instances); + return _json; +} + +Protocol FromJson<Protocol>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + Protocol result; + result.userFields = + fromJson<QStringList>(_json.value("user_fields"_ls)); + result.locationFields = + fromJson<QStringList>(_json.value("location_fields"_ls)); + result.icon = + fromJson<QString>(_json.value("icon"_ls)); + result.fieldTypes = + fromJson<FieldTypes>(_json.value("field_types"_ls)); + result.instances = + fromJson<QVector<QJsonObject>>(_json.value("instances"_ls)); + + return result; +} + |