diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-27 20:20:28 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-27 20:20:28 +0900 |
commit | 52afbb96cee8ea1aa739909fc54b28dd7dcb4a2f (patch) | |
tree | 79324452d50536546245ccbcd9552a8cf631cf06 /jobs/generated | |
parent | f1f71255fb1a9e90dadd34fd055d14155da485ea (diff) | |
download | libquotient-52afbb96cee8ea1aa739909fc54b28dd7dcb4a2f.tar.gz libquotient-52afbb96cee8ea1aa739909fc54b28dd7dcb4a2f.zip |
jobs/generated: SendMessageJob (might or might not preempt non-generated SendEventJob)
Diffstat (limited to 'jobs/generated')
-rw-r--r-- | jobs/generated/room_send.cpp | 42 | ||||
-rw-r--r-- | jobs/generated/room_send.h | 31 |
2 files changed, 73 insertions, 0 deletions
diff --git a/jobs/generated/room_send.cpp b/jobs/generated/room_send.cpp new file mode 100644 index 00000000..c9a3280d --- /dev/null +++ b/jobs/generated/room_send.cpp @@ -0,0 +1,42 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "room_send.h" + +#include "converters.h" + +#include <QtCore/QStringBuilder> + +using namespace QMatrixClient; + +static const auto basePath = QStringLiteral("/_matrix/client/r0"); + +class SendMessageJob::Private +{ + public: + QString eventId; +}; + +SendMessageJob::SendMessageJob(const QString& roomId, const QString& eventType, const QString& txnId, const QJsonObject& body) + : BaseJob(HttpVerb::Put, "SendMessageJob", + basePath % "/rooms/" % roomId % "/send/" % eventType % "/" % txnId) + , d(new Private) +{ + setRequestData(Data(body)); +} + +SendMessageJob::~SendMessageJob() = default; + +const QString& SendMessageJob::eventId() const +{ + return d->eventId; +} + +BaseJob::Status SendMessageJob::parseJson(const QJsonDocument& data) +{ + auto json = data.object(); + d->eventId = fromJson<QString>(json.value("event_id")); + return Success; +} + diff --git a/jobs/generated/room_send.h b/jobs/generated/room_send.h new file mode 100644 index 00000000..d20ce523 --- /dev/null +++ b/jobs/generated/room_send.h @@ -0,0 +1,31 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#pragma once + +#include "../basejob.h" + +#include <QtCore/QJsonObject> + + +namespace QMatrixClient +{ + // Operations + + class SendMessageJob : public BaseJob + { + public: + explicit SendMessageJob(const QString& roomId, const QString& eventType, const QString& txnId, const QJsonObject& body = {}); + ~SendMessageJob() override; + + const QString& eventId() const; + + protected: + Status parseJson(const QJsonDocument& data) override; + + private: + class Private; + QScopedPointer<Private> d; + }; +} // namespace QMatrixClient |