aboutsummaryrefslogtreecommitdiff
path: root/event-schemas/schema/core-event-schema/stripped_state.h
blob: 742b0a5677672fda8ff7acd76a6a70fdf3728294 (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
41
42
43
44
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#pragma once

#include "converters.h"

namespace Quotient {
/// A stripped down state event, with only the `type`, `state_key`,
/// `sender`, and `content` keys.
struct StrippedStateEvent {
    /// The `content` for the event.
    QJsonObject content;

    /// The `state_key` for the event.
    QString stateKey;

    /// The `type` for the event.
    QString type;

    /// The `sender` for the event.
    QString sender;
};

template <>
struct JsonObjectConverter<StrippedStateEvent> {
    static void dumpTo(QJsonObject& jo, const StrippedStateEvent& pod)
    {
        addParam<>(jo, QStringLiteral("content"), pod.content);
        addParam<>(jo, QStringLiteral("state_key"), pod.stateKey);
        addParam<>(jo, QStringLiteral("type"), pod.type);
        addParam<>(jo, QStringLiteral("sender"), pod.sender);
    }
    static void fillFrom(const QJsonObject& jo, StrippedStateEvent& pod)
    {
        fromJson(jo.value("content"_ls), pod.content);
        fromJson(jo.value("state_key"_ls), pod.stateKey);
        fromJson(jo.value("type"_ls), pod.type);
        fromJson(jo.value("sender"_ls), pod.sender);
    }
};

} // namespace Quotient