diff options
Diffstat (limited to 'lib/csapi/redaction.cpp')
-rw-r--r-- | lib/csapi/redaction.cpp | 46 |
1 files changed, 9 insertions, 37 deletions
diff --git a/lib/csapi/redaction.cpp b/lib/csapi/redaction.cpp index 64098670..154abd9b 100644 --- a/lib/csapi/redaction.cpp +++ b/lib/csapi/redaction.cpp @@ -4,43 +4,15 @@ #include "redaction.h" -#include "converters.h" +using namespace Quotient; -#include <QtCore/QStringBuilder> - -using namespace QMatrixClient; - -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -class RedactEventJob::Private -{ - public: - QString eventId; -}; - -static const auto RedactEventJobName = QStringLiteral("RedactEventJob"); - -RedactEventJob::RedactEventJob(const QString& roomId, const QString& eventId, const QString& txnId, const QString& reason) - : BaseJob(HttpVerb::Put, RedactEventJobName, - basePath % "/rooms/" % roomId % "/redact/" % eventId % "/" % txnId) - , d(new Private) -{ - QJsonObject _data; - addParam<IfNotEmpty>(_data, QStringLiteral("reason"), reason); - setRequestData(_data); -} - -RedactEventJob::~RedactEventJob() = default; - -const QString& RedactEventJob::eventId() const +RedactEventJob::RedactEventJob(const QString& roomId, const QString& eventId, + const QString& txnId, const QString& reason) + : BaseJob(HttpVerb::Put, QStringLiteral("RedactEventJob"), + makePath("/_matrix/client/v3", "/rooms/", roomId, "/redact/", + eventId, "/", txnId)) { - return d->eventId; + QJsonObject _dataJson; + addParam<IfNotEmpty>(_dataJson, QStringLiteral("reason"), reason); + setRequestData({ _dataJson }); } - -BaseJob::Status RedactEventJob::parseJson(const QJsonDocument& data) -{ - auto json = data.object(); - d->eventId = fromJson<QString>(json.value("event_id"_ls)); - return Success; -} - |