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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
/******************************************************************************
* THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
*/
#include "rooms.h"
#include "converters.h"
#include <QtCore/QStringBuilder>
using namespace QMatrixClient;
static const auto basePath = QStringLiteral("/_matrix/client/r0");
class GetOneRoomEventJob::Private
{
public:
EventPtr data;
};
QUrl GetOneRoomEventJob::makeRequestUrl(QUrl baseUrl, const QString& roomId,
const QString& eventId)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/rooms/" % roomId % "/event/"
% eventId);
}
static const auto GetOneRoomEventJobName = QStringLiteral("GetOneRoomEventJob");
GetOneRoomEventJob::GetOneRoomEventJob(const QString& roomId,
const QString& eventId)
: BaseJob(HttpVerb::Get, GetOneRoomEventJobName,
basePath % "/rooms/" % roomId % "/event/" % eventId),
d(new Private)
{
}
GetOneRoomEventJob::~GetOneRoomEventJob() = default;
EventPtr&& GetOneRoomEventJob::data() { return std::move(d->data); }
BaseJob::Status GetOneRoomEventJob::parseJson(const QJsonDocument& data)
{
fromJson(data, d->data);
return Success;
}
QUrl GetRoomStateWithKeyJob::makeRequestUrl(QUrl baseUrl, const QString& roomId,
const QString& eventType,
const QString& stateKey)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/rooms/" % roomId % "/state/"
% eventType % "/" % stateKey);
}
static const auto GetRoomStateWithKeyJobName =
QStringLiteral("GetRoomStateWithKeyJob");
GetRoomStateWithKeyJob::GetRoomStateWithKeyJob(const QString& roomId,
const QString& eventType,
const QString& stateKey)
: BaseJob(HttpVerb::Get, GetRoomStateWithKeyJobName,
basePath % "/rooms/" % roomId % "/state/" % eventType % "/"
% stateKey)
{
}
QUrl GetRoomStateByTypeJob::makeRequestUrl(QUrl baseUrl, const QString& roomId,
const QString& eventType)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/rooms/" % roomId % "/state/"
% eventType);
}
static const auto GetRoomStateByTypeJobName =
QStringLiteral("GetRoomStateByTypeJob");
GetRoomStateByTypeJob::GetRoomStateByTypeJob(const QString& roomId,
const QString& eventType)
: BaseJob(HttpVerb::Get, GetRoomStateByTypeJobName,
basePath % "/rooms/" % roomId % "/state/" % eventType)
{
}
class GetRoomStateJob::Private
{
public:
StateEvents data;
};
QUrl GetRoomStateJob::makeRequestUrl(QUrl baseUrl, const QString& roomId)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/rooms/" % roomId % "/state");
}
static const auto GetRoomStateJobName = QStringLiteral("GetRoomStateJob");
GetRoomStateJob::GetRoomStateJob(const QString& roomId)
: BaseJob(HttpVerb::Get, GetRoomStateJobName,
basePath % "/rooms/" % roomId % "/state"),
d(new Private)
{
}
GetRoomStateJob::~GetRoomStateJob() = default;
StateEvents&& GetRoomStateJob::data() { return std::move(d->data); }
BaseJob::Status GetRoomStateJob::parseJson(const QJsonDocument& data)
{
fromJson(data, d->data);
return Success;
}
class GetMembersByRoomJob::Private
{
public:
EventsArray<RoomMemberEvent> chunk;
};
BaseJob::Query queryToGetMembersByRoom(const QString& at,
const QString& membership,
const QString& notMembership)
{
BaseJob::Query _q;
addParam<IfNotEmpty>(_q, QStringLiteral("at"), at);
addParam<IfNotEmpty>(_q, QStringLiteral("membership"), membership);
addParam<IfNotEmpty>(_q, QStringLiteral("not_membership"), notMembership);
return _q;
}
QUrl GetMembersByRoomJob::makeRequestUrl(QUrl baseUrl, const QString& roomId,
const QString& at,
const QString& membership,
const QString& notMembership)
{
return BaseJob::makeRequestUrl(
std::move(baseUrl), basePath % "/rooms/" % roomId % "/members",
queryToGetMembersByRoom(at, membership, notMembership));
}
static const auto GetMembersByRoomJobName =
QStringLiteral("GetMembersByRoomJob");
GetMembersByRoomJob::GetMembersByRoomJob(const QString& roomId,
const QString& at,
const QString& membership,
const QString& notMembership)
: BaseJob(HttpVerb::Get, GetMembersByRoomJobName,
basePath % "/rooms/" % roomId % "/members",
queryToGetMembersByRoom(at, membership, notMembership)),
d(new Private)
{
}
GetMembersByRoomJob::~GetMembersByRoomJob() = default;
EventsArray<RoomMemberEvent>&& GetMembersByRoomJob::chunk()
{
return std::move(d->chunk);
}
BaseJob::Status GetMembersByRoomJob::parseJson(const QJsonDocument& data)
{
auto json = data.object();
fromJson(json.value("chunk"_ls), d->chunk);
return Success;
}
namespace QMatrixClient {
// Converters
template <>
struct JsonObjectConverter<GetJoinedMembersByRoomJob::RoomMember> {
static void fillFrom(const QJsonObject& jo,
GetJoinedMembersByRoomJob::RoomMember& result)
{
fromJson(jo.value("display_name"_ls), result.displayName);
fromJson(jo.value("avatar_url"_ls), result.avatarUrl);
}
};
} // namespace QMatrixClient
class GetJoinedMembersByRoomJob::Private
{
public:
QHash<QString, RoomMember> joined;
};
QUrl GetJoinedMembersByRoomJob::makeRequestUrl(QUrl baseUrl,
const QString& roomId)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/rooms/" % roomId
% "/joined_members");
}
static const auto GetJoinedMembersByRoomJobName =
QStringLiteral("GetJoinedMembersByRoomJob");
GetJoinedMembersByRoomJob::GetJoinedMembersByRoomJob(const QString& roomId)
: BaseJob(HttpVerb::Get, GetJoinedMembersByRoomJobName,
basePath % "/rooms/" % roomId % "/joined_members"),
d(new Private)
{
}
GetJoinedMembersByRoomJob::~GetJoinedMembersByRoomJob() = default;
const QHash<QString, GetJoinedMembersByRoomJob::RoomMember>&
GetJoinedMembersByRoomJob::joined() const
{
return d->joined;
}
BaseJob::Status GetJoinedMembersByRoomJob::parseJson(const QJsonDocument& data)
{
auto json = data.object();
fromJson(json.value("joined"_ls), d->joined);
return Success;
}
|