diff options
Diffstat (limited to 'lib/csapi/definitions')
-rw-r--r-- | lib/csapi/definitions/push_condition.cpp | 34 | ||||
-rw-r--r-- | lib/csapi/definitions/push_condition.h | 30 | ||||
-rw-r--r-- | lib/csapi/definitions/push_rule.cpp | 40 | ||||
-rw-r--r-- | lib/csapi/definitions/push_rule.h | 37 | ||||
-rw-r--r-- | lib/csapi/definitions/push_ruleset.cpp | 37 | ||||
-rw-r--r-- | lib/csapi/definitions/push_ruleset.h | 34 |
6 files changed, 212 insertions, 0 deletions
diff --git a/lib/csapi/definitions/push_condition.cpp b/lib/csapi/definitions/push_condition.cpp new file mode 100644 index 00000000..149419f4 --- /dev/null +++ b/lib/csapi/definitions/push_condition.cpp @@ -0,0 +1,34 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "push_condition.h" + +using namespace QMatrixClient; + +QJsonObject QMatrixClient::toJson(const PushCondition& pod) +{ + QJsonObject _json; + addToJson<>(_json, "kind", pod.kind); + addToJson<IfNotEmpty>(_json, "key", pod.key); + addToJson<IfNotEmpty>(_json, "pattern", pod.pattern); + addToJson<IfNotEmpty>(_json, "is", pod.is); + return _json; +} + +PushCondition FromJson<PushCondition>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + PushCondition result; + result.kind = + fromJson<QString>(_json.value("kind")); + result.key = + fromJson<QString>(_json.value("key")); + result.pattern = + fromJson<QString>(_json.value("pattern")); + result.is = + fromJson<QString>(_json.value("is")); + + return result; +} + diff --git a/lib/csapi/definitions/push_condition.h b/lib/csapi/definitions/push_condition.h new file mode 100644 index 00000000..5744b9b8 --- /dev/null +++ b/lib/csapi/definitions/push_condition.h @@ -0,0 +1,30 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + + + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + struct PushCondition + { + QString kind; + QString key; + QString pattern; + QString is; + }; + + QJsonObject toJson(const PushCondition& pod); + + template <> struct FromJson<PushCondition> + { + PushCondition operator()(const QJsonValue& jv); + }; + +} // namespace QMatrixClient diff --git a/lib/csapi/definitions/push_rule.cpp b/lib/csapi/definitions/push_rule.cpp new file mode 100644 index 00000000..3a44a385 --- /dev/null +++ b/lib/csapi/definitions/push_rule.cpp @@ -0,0 +1,40 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "push_rule.h" + +using namespace QMatrixClient; + +QJsonObject QMatrixClient::toJson(const PushRule& pod) +{ + QJsonObject _json; + addToJson<>(_json, "actions", pod.actions); + addToJson<>(_json, "default", pod.isDefault); + addToJson<>(_json, "enabled", pod.enabled); + addToJson<>(_json, "rule_id", pod.ruleId); + addToJson<IfNotEmpty>(_json, "conditions", pod.conditions); + addToJson<IfNotEmpty>(_json, "pattern", pod.pattern); + return _json; +} + +PushRule FromJson<PushRule>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + PushRule result; + result.actions = + fromJson<QVector<QVariant>>(_json.value("actions")); + result.isDefault = + fromJson<bool>(_json.value("default")); + result.enabled = + fromJson<bool>(_json.value("enabled")); + result.ruleId = + fromJson<QString>(_json.value("rule_id")); + result.conditions = + fromJson<QVector<PushCondition>>(_json.value("conditions")); + result.pattern = + fromJson<QString>(_json.value("pattern")); + + return result; +} + diff --git a/lib/csapi/definitions/push_rule.h b/lib/csapi/definitions/push_rule.h new file mode 100644 index 00000000..853210d0 --- /dev/null +++ b/lib/csapi/definitions/push_rule.h @@ -0,0 +1,37 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + + +#include "lib/csapi/definitions/push_condition.h" +#include "converters.h" +#include <QtCore/QVector> +#include <QtCore/QVariant> +#include <QtCore/QJsonObject> + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + struct PushRule + { + QVector<QVariant> actions; + bool isDefault; + bool enabled; + QString ruleId; + QVector<PushCondition> conditions; + QString pattern; + }; + + QJsonObject toJson(const PushRule& pod); + + template <> struct FromJson<PushRule> + { + PushRule operator()(const QJsonValue& jv); + }; + +} // namespace QMatrixClient diff --git a/lib/csapi/definitions/push_ruleset.cpp b/lib/csapi/definitions/push_ruleset.cpp new file mode 100644 index 00000000..98d79248 --- /dev/null +++ b/lib/csapi/definitions/push_ruleset.cpp @@ -0,0 +1,37 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "push_ruleset.h" + +using namespace QMatrixClient; + +QJsonObject QMatrixClient::toJson(const PushRuleset& pod) +{ + QJsonObject _json; + addToJson<IfNotEmpty>(_json, "content", pod.content); + addToJson<IfNotEmpty>(_json, "override", pod.override); + addToJson<IfNotEmpty>(_json, "room", pod.room); + addToJson<IfNotEmpty>(_json, "sender", pod.sender); + addToJson<IfNotEmpty>(_json, "underride", pod.underride); + return _json; +} + +PushRuleset FromJson<PushRuleset>::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + PushRuleset result; + result.content = + fromJson<QVector<PushRule>>(_json.value("content")); + result.override = + fromJson<QVector<PushRule>>(_json.value("override")); + result.room = + fromJson<QVector<PushRule>>(_json.value("room")); + result.sender = + fromJson<QVector<PushRule>>(_json.value("sender")); + result.underride = + fromJson<QVector<PushRule>>(_json.value("underride")); + + return result; +} + diff --git a/lib/csapi/definitions/push_ruleset.h b/lib/csapi/definitions/push_ruleset.h new file mode 100644 index 00000000..96199a11 --- /dev/null +++ b/lib/csapi/definitions/push_ruleset.h @@ -0,0 +1,34 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + + +#include <QtCore/QVector> +#include "converters.h" +#include "lib/csapi/definitions/push_rule.h" + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + struct PushRuleset + { + QVector<PushRule> content; + QVector<PushRule> override; + QVector<PushRule> room; + QVector<PushRule> sender; + QVector<PushRule> underride; + }; + + QJsonObject toJson(const PushRuleset& pod); + + template <> struct FromJson<PushRuleset> + { + PushRuleset operator()(const QJsonValue& jv); + }; + +} // namespace QMatrixClient |