aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions/push_rule.cpp
blob: 98f5d7882849594afb8daee93800e43a68768fbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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;
    addParam<>(_json, "actions", pod.actions);
    addParam<>(_json, "default", pod.isDefault);
    addParam<>(_json, "enabled", pod.enabled);
    addParam<>(_json, "rule_id", pod.ruleId);
    addParam<IfNotEmpty>(_json, "conditions", pod.conditions);
    addParam<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;
}