1 | // SPDX-FileCopyrightText: 2018 Kitsune Ral <Kitsune-Ral@users.sf.net> |
2 | // SPDX-License-Identifier: LGPL-2.1-or-later |
3 | |
4 | #pragma once |
5 | |
6 | #include "event.h" |
7 | |
8 | #include <QtCore/QDateTime> |
9 | #include <QtCore/QVector> |
10 | |
11 | namespace Quotient { |
12 | struct UserTimestamp { |
13 | QString userId; |
14 | QDateTime timestamp; |
15 | }; |
16 | struct ReceiptsForEvent { |
17 | QString evtId; |
18 | QVector<UserTimestamp> receipts; |
19 | }; |
20 | using EventsWithReceipts = QVector<ReceiptsForEvent>; |
21 | |
22 | template <> |
23 | QUOTIENT_API EventsWithReceipts fromJson(const QJsonObject& json); |
24 | QUOTIENT_API QJsonObject toJson(const EventsWithReceipts& ewrs); |
25 | |
26 | class QUOTIENT_API ReceiptEvent |
27 | : public EventTemplate<ReceiptEvent, Event, EventsWithReceipts> { |
28 | public: |
29 | QUO_EVENT(ReceiptEvent, "m.receipt" ) |
30 | using EventTemplate::EventTemplate; |
31 | |
32 | [[deprecated("Use content() instead" )]] |
33 | EventsWithReceipts eventsWithReceipts() const { return content(); } |
34 | }; |
35 | } // namespace Quotient |
36 | |