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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/******************************************************************************
* THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
*/
#include "event_context.h"
#include "converters.h"
#include <QtCore/QStringBuilder>
using namespace QMatrixClient;
static const auto basePath = QStringLiteral("/_matrix/client/r0");
class GetEventContextJob::Private
{
public:
QString begin;
QString end;
RoomEvents eventsBefore;
RoomEventPtr event;
RoomEvents eventsAfter;
StateEvents state;
};
BaseJob::Query queryToGetEventContext(Omittable<int> limit)
{
BaseJob::Query _q;
addParam<IfNotEmpty>(_q, "limit", limit);
return _q;
}
QUrl GetEventContextJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventId, Omittable<int> limit)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/rooms/" % roomId % "/context/" % eventId,
queryToGetEventContext(limit));
}
GetEventContextJob::GetEventContextJob(const QString& roomId, const QString& eventId, Omittable<int> limit)
: BaseJob(HttpVerb::Get, "GetEventContextJob",
basePath % "/rooms/" % roomId % "/context/" % eventId,
queryToGetEventContext(limit))
, d(new Private)
{
}
GetEventContextJob::~GetEventContextJob() = default;
const QString& GetEventContextJob::begin() const
{
return d->begin;
}
const QString& GetEventContextJob::end() const
{
return d->end;
}
RoomEvents&& GetEventContextJob::eventsBefore()
{
return std::move(d->eventsBefore);
}
RoomEventPtr&& GetEventContextJob::event()
{
return std::move(d->event);
}
RoomEvents&& GetEventContextJob::eventsAfter()
{
return std::move(d->eventsAfter);
}
StateEvents&& GetEventContextJob::state()
{
return std::move(d->state);
}
BaseJob::Status GetEventContextJob::parseJson(const QJsonDocument& data)
{
auto json = data.object();
d->begin = fromJson<QString>(json.value("start"));
d->end = fromJson<QString>(json.value("end"));
d->eventsBefore = fromJson<RoomEvents>(json.value("events_before"));
d->event = fromJson<RoomEventPtr>(json.value("event"));
d->eventsAfter = fromJson<RoomEvents>(json.value("events_after"));
d->state = fromJson<StateEvents>(json.value("state"));
return Success;
}
|