From ddf10847d496dd65b00bc2026412958acd09790d Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 3 Jun 2018 19:50:54 +0900 Subject: csapi: jobs to setup push-rules --- lib/csapi/definitions/push_condition.cpp | 34 +++++++++++++++++++++++++++ lib/csapi/definitions/push_condition.h | 30 ++++++++++++++++++++++++ lib/csapi/definitions/push_rule.cpp | 40 ++++++++++++++++++++++++++++++++ lib/csapi/definitions/push_rule.h | 37 +++++++++++++++++++++++++++++ lib/csapi/definitions/push_ruleset.cpp | 37 +++++++++++++++++++++++++++++ lib/csapi/definitions/push_ruleset.h | 34 +++++++++++++++++++++++++++ 6 files changed, 212 insertions(+) create mode 100644 lib/csapi/definitions/push_condition.cpp create mode 100644 lib/csapi/definitions/push_condition.h create mode 100644 lib/csapi/definitions/push_rule.cpp create mode 100644 lib/csapi/definitions/push_rule.h create mode 100644 lib/csapi/definitions/push_ruleset.cpp create mode 100644 lib/csapi/definitions/push_ruleset.h (limited to 'lib/csapi/definitions') 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(_json, "key", pod.key); + addToJson(_json, "pattern", pod.pattern); + addToJson(_json, "is", pod.is); + return _json; +} + +PushCondition FromJson::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + PushCondition result; + result.kind = + fromJson(_json.value("kind")); + result.key = + fromJson(_json.value("key")); + result.pattern = + fromJson(_json.value("pattern")); + result.is = + fromJson(_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 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(_json, "conditions", pod.conditions); + addToJson(_json, "pattern", pod.pattern); + return _json; +} + +PushRule FromJson::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + PushRule result; + result.actions = + fromJson>(_json.value("actions")); + result.isDefault = + fromJson(_json.value("default")); + result.enabled = + fromJson(_json.value("enabled")); + result.ruleId = + fromJson(_json.value("rule_id")); + result.conditions = + fromJson>(_json.value("conditions")); + result.pattern = + fromJson(_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 +#include +#include + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + struct PushRule + { + QVector actions; + bool isDefault; + bool enabled; + QString ruleId; + QVector conditions; + QString pattern; + }; + + QJsonObject toJson(const PushRule& pod); + + template <> struct FromJson + { + 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(_json, "content", pod.content); + addToJson(_json, "override", pod.override); + addToJson(_json, "room", pod.room); + addToJson(_json, "sender", pod.sender); + addToJson(_json, "underride", pod.underride); + return _json; +} + +PushRuleset FromJson::operator()(const QJsonValue& jv) +{ + const auto& _json = jv.toObject(); + PushRuleset result; + result.content = + fromJson>(_json.value("content")); + result.override = + fromJson>(_json.value("override")); + result.room = + fromJson>(_json.value("room")); + result.sender = + fromJson>(_json.value("sender")); + result.underride = + fromJson>(_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 +#include "converters.h" +#include "lib/csapi/definitions/push_rule.h" + +#include "converters.h" + +namespace QMatrixClient +{ + // Data structures + + struct PushRuleset + { + QVector content; + QVector override; + QVector room; + QVector sender; + QVector underride; + }; + + QJsonObject toJson(const PushRuleset& pod); + + template <> struct FromJson + { + PushRuleset operator()(const QJsonValue& jv); + }; + +} // namespace QMatrixClient -- cgit v1.2.3