blob: 244f5b7403ab0f8d925793564ada8ba77455d4cc (
plain)
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
|
/******************************************************************************
* THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
*/
#include "room_upgrades.h"
#include "converters.h"
#include <QtCore/QStringBuilder>
using namespace Quotient;
static const auto basePath = QStringLiteral("/_matrix/client/r0");
class UpgradeRoomJob::Private {
public:
QString replacementRoom;
};
UpgradeRoomJob::UpgradeRoomJob(const QString& roomId, const QString& newVersion)
: BaseJob(HttpVerb::Post, QStringLiteral("UpgradeRoomJob"),
basePath % "/rooms/" % roomId % "/upgrade")
, d(new Private)
{
QJsonObject _data;
addParam<>(_data, QStringLiteral("new_version"), newVersion);
setRequestData(_data);
}
UpgradeRoomJob::~UpgradeRoomJob() = default;
const QString& UpgradeRoomJob::replacementRoom() const
{
return d->replacementRoom;
}
BaseJob::Status UpgradeRoomJob::parseJson(const QJsonDocument& data)
{
auto json = data.object();
if (!json.contains("replacement_room"_ls))
return { IncorrectResponse,
"The key 'replacement_room' not found in the response" };
fromJson(json.value("replacement_room"_ls), d->replacementRoom);
return Success;
}
|