/****************************************************************************** * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN */ #include "peeking_events.h" #include "converters.h" #include using namespace QMatrixClient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); class PeekEventsJob::Private { public: QString begin; QString end; RoomEvents chunk; }; BaseJob::Query queryToPeekEvents(const QString& from, Omittable timeout, const QString& roomId) { BaseJob::Query _q; addToQuery(_q, "from", from); addToQuery(_q, "timeout", timeout); addToQuery(_q, "room_id", roomId); return _q; } QUrl PeekEventsJob::makeRequestUrl(QUrl baseUrl, const QString& from, Omittable timeout, const QString& roomId) { return BaseJob::makeRequestUrl(std::move(baseUrl), basePath % "/events", queryToPeekEvents(from, timeout, roomId)); } PeekEventsJob::PeekEventsJob(const QString& from, Omittable timeout, const QString& roomId) : BaseJob(HttpVerb::Get, "PeekEventsJob", basePath % "/events", queryToPeekEvents(from, timeout, roomId)) , d(new Private) { } PeekEventsJob::~PeekEventsJob() = default; const QString& PeekEventsJob::begin() const { return d->begin; } const QString& PeekEventsJob::end() const { return d->end; } RoomEvents&& PeekEventsJob::chunk() { return std::move(d->chunk); } BaseJob::Status PeekEventsJob::parseJson(const QJsonDocument& data) { auto json = data.object(); d->begin = fromJson(json.value("start")); d->end = fromJson(json.value("end")); d->chunk = fromJson(json.value("chunk")); return Success; }