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 | |
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')
-rw-r--r-- | lib/application-service/definitions/location.cpp | 31 | ||||
-rw-r--r-- | lib/application-service/definitions/location.h | 33 | ||||
-rw-r--r-- | lib/application-service/definitions/location_batch.cpp | 22 | ||||
-rw-r--r-- | lib/application-service/definitions/location_batch.h | 30 | ||||
-rw-r--r-- | lib/application-service/definitions/protocol.cpp | 74 | ||||
-rw-r--r-- | lib/application-service/definitions/protocol.h | 71 | ||||
-rw-r--r-- | lib/application-service/definitions/protocol_metadata.cpp | 22 | ||||
-rw-r--r-- | lib/application-service/definitions/protocol_metadata.h | 27 | ||||
-rw-r--r-- | lib/application-service/definitions/user.cpp | 31 | ||||
-rw-r--r-- | lib/application-service/definitions/user.h | 33 | ||||
-rw-r--r-- | lib/application-service/definitions/user_batch.cpp | 22 | ||||
-rw-r--r-- | lib/application-service/definitions/user_batch.h | 30 |
12 files changed, 426 insertions, 0 deletions
diff --git a/lib/application-service/definitions/location.cpp b/lib/application-service/definitions/location.cpp new file mode 100644 index 00000000..f70acd55 --- /dev/null +++ b/lib/application-service/definitions/location.cpp @@ -0,0 +1,31 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "location.h" + +using namespace QMatrixClient; + +QJsonObject QMatrixClient::toJson(const Location& pod) +{ + QJsonObject _json; + addParam<IfNotEmpty>(_json, QStringLiteral("alias"), pod.alias); + addParam<IfNotEmpty>(_json, QStringLiteral("protocol"), pod.protocol); + addParam<IfNotEmpty>(_json, QStringLiteral("fields"), pod.fields); + return _json; +} + +Location FromJson<Location>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + Location result; + result.alias = + fromJson<QString>(_json.value("alias"_ls)); + result.protocol = + fromJson<QString>(_json.value("protocol"_ls)); + result.fields = + fromJson<QJsonObject>(_json.value("fields"_ls)); + + return result; +} + diff --git a/lib/application-service/definitions/location.h b/lib/application-service/definitions/location.h new file mode 100644 index 00000000..af407a1a --- /dev/null +++ b/lib/application-service/definitions/location.h @@ -0,0 +1,33 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + + +#include <QtCore/QJsonObject> + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + struct Location + { + /// An alias for a matrix room. + QString alias; + /// The protocol ID that the third party location is a part of. + QString protocol; + /// Information used to identify this third party location. + QJsonObject fields; + }; + + QJsonObject toJson(const Location& pod); + + template <> struct FromJson<Location> + { + Location operator()(const QJsonValue& jv); + }; + +} // namespace QMatrixClient diff --git a/lib/application-service/definitions/location_batch.cpp b/lib/application-service/definitions/location_batch.cpp new file mode 100644 index 00000000..c9b9e95b --- /dev/null +++ b/lib/application-service/definitions/location_batch.cpp @@ -0,0 +1,22 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "location_batch.h" + +using namespace QMatrixClient; + +QJsonObject QMatrixClient::toJson(const LocationBatch& pod) +{ + QJsonObject _json; + return _json; +} + +LocationBatch FromJson<LocationBatch>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + LocationBatch result; + + return result; +} + diff --git a/lib/application-service/definitions/location_batch.h b/lib/application-service/definitions/location_batch.h new file mode 100644 index 00000000..59e0d14e --- /dev/null +++ b/lib/application-service/definitions/location_batch.h @@ -0,0 +1,30 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + + +#include "csapi/../application-service/definitions/location.h" +#include "converters.h" +#include <QtCore/QVector> + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + /// List of matched third party locations. + struct LocationBatch : QVector<Location> + { + }; + + QJsonObject toJson(const LocationBatch& pod); + + template <> struct FromJson<LocationBatch> + { + LocationBatch operator()(const QJsonValue& jv); + }; + +} // namespace QMatrixClient 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; +} + diff --git a/lib/application-service/definitions/protocol.h b/lib/application-service/definitions/protocol.h new file mode 100644 index 00000000..d4124779 --- /dev/null +++ b/lib/application-service/definitions/protocol.h @@ -0,0 +1,71 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + + +#include <QtCore/QJsonObject> +#include <QtCore/QVector> +#include "converters.h" + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + /// Definition of valid values for a field. + struct FieldType + { + /// A regular expression for validation of a field's value. + QString regexp; + /// An placeholder serving as a valid example of the field value. + QString placeholder; + }; + + QJsonObject toJson(const FieldType& pod); + + template <> struct FromJson<FieldType> + { + FieldType operator()(const QJsonValue& jv); + }; + + /// All location or user fields should have an entry here. + struct FieldTypes + { + /// Definition of valid values for a field. + Omittable<FieldType> fieldname; + }; + + QJsonObject toJson(const FieldTypes& pod); + + template <> struct FromJson<FieldTypes> + { + FieldTypes operator()(const QJsonValue& jv); + }; + + struct Protocol + { + /// Fields used to identify a third party user. + QStringList userFields; + /// Fields used to identify a third party location. + QStringList locationFields; + /// An icon representing the third party protocol. + QString icon; + /// All location or user fields should have an entry here. + Omittable<FieldTypes> fieldTypes; + /// A list of objects representing independent instances of configuration. + /// For instance multiple networks on IRC if multiple are bridged by the + /// same bridge. + QVector<QJsonObject> instances; + }; + + QJsonObject toJson(const Protocol& pod); + + template <> struct FromJson<Protocol> + { + Protocol operator()(const QJsonValue& jv); + }; + +} // namespace QMatrixClient diff --git a/lib/application-service/definitions/protocol_metadata.cpp b/lib/application-service/definitions/protocol_metadata.cpp new file mode 100644 index 00000000..eb740bb6 --- /dev/null +++ b/lib/application-service/definitions/protocol_metadata.cpp @@ -0,0 +1,22 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "protocol_metadata.h" + +using namespace QMatrixClient; + +QJsonObject QMatrixClient::toJson(const ProtocolMetadata& pod) +{ + QJsonObject _json; + return _json; +} + +ProtocolMetadata FromJson<ProtocolMetadata>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + ProtocolMetadata result; + + return result; +} + diff --git a/lib/application-service/definitions/protocol_metadata.h b/lib/application-service/definitions/protocol_metadata.h new file mode 100644 index 00000000..3c4bcd99 --- /dev/null +++ b/lib/application-service/definitions/protocol_metadata.h @@ -0,0 +1,27 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + + + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + /// Dictionary of supported third party protocols. + struct ProtocolMetadata + { + }; + + QJsonObject toJson(const ProtocolMetadata& pod); + + template <> struct FromJson<ProtocolMetadata> + { + ProtocolMetadata operator()(const QJsonValue& jv); + }; + +} // namespace QMatrixClient diff --git a/lib/application-service/definitions/user.cpp b/lib/application-service/definitions/user.cpp new file mode 100644 index 00000000..dfc12f29 --- /dev/null +++ b/lib/application-service/definitions/user.cpp @@ -0,0 +1,31 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "user.h" + +using namespace QMatrixClient; + +QJsonObject QMatrixClient::toJson(const User& pod) +{ + QJsonObject _json; + addParam<IfNotEmpty>(_json, QStringLiteral("userid"), pod.userid); + addParam<IfNotEmpty>(_json, QStringLiteral("protocol"), pod.protocol); + addParam<IfNotEmpty>(_json, QStringLiteral("fields"), pod.fields); + return _json; +} + +User FromJson<User>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + User result; + result.userid = + fromJson<QString>(_json.value("userid"_ls)); + result.protocol = + fromJson<QString>(_json.value("protocol"_ls)); + result.fields = + fromJson<QJsonObject>(_json.value("fields"_ls)); + + return result; +} + diff --git a/lib/application-service/definitions/user.h b/lib/application-service/definitions/user.h new file mode 100644 index 00000000..3f609dea --- /dev/null +++ b/lib/application-service/definitions/user.h @@ -0,0 +1,33 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + + +#include <QtCore/QJsonObject> + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + struct User + { + /// A Matrix User ID represting a third party user. + QString userid; + /// The protocol ID that the third party location is a part of. + QString protocol; + /// Information used to identify this third party location. + QJsonObject fields; + }; + + QJsonObject toJson(const User& pod); + + template <> struct FromJson<User> + { + User operator()(const QJsonValue& jv); + }; + +} // namespace QMatrixClient diff --git a/lib/application-service/definitions/user_batch.cpp b/lib/application-service/definitions/user_batch.cpp new file mode 100644 index 00000000..bbdf6835 --- /dev/null +++ b/lib/application-service/definitions/user_batch.cpp @@ -0,0 +1,22 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "user_batch.h" + +using namespace QMatrixClient; + +QJsonObject QMatrixClient::toJson(const UserBatch& pod) +{ + QJsonObject _json; + return _json; +} + +UserBatch FromJson<UserBatch>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + UserBatch result; + + return result; +} + diff --git a/lib/application-service/definitions/user_batch.h b/lib/application-service/definitions/user_batch.h new file mode 100644 index 00000000..e732eea1 --- /dev/null +++ b/lib/application-service/definitions/user_batch.h @@ -0,0 +1,30 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + + +#include "csapi/../application-service/definitions/user.h" +#include "converters.h" +#include <QtCore/QVector> + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + /// List of matched third party users. + struct UserBatch : QVector<User> + { + }; + + QJsonObject toJson(const UserBatch& pod); + + template <> struct FromJson<UserBatch> + { + UserBatch operator()(const QJsonValue& jv); + }; + +} // namespace QMatrixClient |