diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-05-04 23:04:04 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-05-04 23:04:04 +0900 |
commit | 49022915fde72b83d9f18944c268110b01fa3469 (patch) | |
tree | 1b465b553a2e341486cd6051530a63faba17288e /lib/csapi/room_state.cpp | |
parent | f70ec41accd6da9f223bc41b446ad1d2d77de3f4 (diff) | |
download | libquotient-49022915fde72b83d9f18944c268110b01fa3469.tar.gz libquotient-49022915fde72b83d9f18944c268110b01fa3469.zip |
New home for the generated code - lib/csapi
Diffstat (limited to 'lib/csapi/room_state.cpp')
-rw-r--r-- | lib/csapi/room_state.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/lib/csapi/room_state.cpp b/lib/csapi/room_state.cpp new file mode 100644 index 00000000..39f36afb --- /dev/null +++ b/lib/csapi/room_state.cpp @@ -0,0 +1,70 @@ +/****************************************************************************** + * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN + */ + +#include "room_state.h" + +#include "converters.h" + +#include <QtCore/QStringBuilder> + +using namespace QMatrixClient; + +static const auto basePath = QStringLiteral("/_matrix/client/r0"); + +class SetRoomStateWithKeyJob::Private +{ + public: + QString eventId; +}; + +SetRoomStateWithKeyJob::SetRoomStateWithKeyJob(const QString& roomId, const QString& eventType, const QString& stateKey, const QJsonObject& body) + : BaseJob(HttpVerb::Put, "SetRoomStateWithKeyJob", + basePath % "/rooms/" % roomId % "/state/" % eventType % "/" % stateKey) + , d(new Private) +{ + setRequestData(Data(toJson(body))); +} + +SetRoomStateWithKeyJob::~SetRoomStateWithKeyJob() = default; + +const QString& SetRoomStateWithKeyJob::eventId() const +{ + return d->eventId; +} + +BaseJob::Status SetRoomStateWithKeyJob::parseJson(const QJsonDocument& data) +{ + auto json = data.object(); + d->eventId = fromJson<QString>(json.value("event_id")); + return Success; +} + +class SetRoomStateJob::Private +{ + public: + QString eventId; +}; + +SetRoomStateJob::SetRoomStateJob(const QString& roomId, const QString& eventType, const QJsonObject& body) + : BaseJob(HttpVerb::Put, "SetRoomStateJob", + basePath % "/rooms/" % roomId % "/state/" % eventType) + , d(new Private) +{ + setRequestData(Data(toJson(body))); +} + +SetRoomStateJob::~SetRoomStateJob() = default; + +const QString& SetRoomStateJob::eventId() const +{ + return d->eventId; +} + +BaseJob::Status SetRoomStateJob::parseJson(const QJsonDocument& data) +{ + auto json = data.object(); + d->eventId = fromJson<QString>(json.value("event_id")); + return Success; +} + |