5 #include <Quotient/events/roomevent.h>
6 #include <Quotient/events/stateevent.h>
7 #include <Quotient/jobs/basejob.h>
22 explicit GetOneRoomEventJob(
const QString& roomId,
const QString& eventId);
28 static QUrl makeRequestUrl(
const HomeserverData& hsData,
const QString& roomId,
29 const QString& eventId);
34 RoomEventPtr event() {
return fromJson<RoomEventPtr>(jsonData()); }
37 inline auto collectResponse(GetOneRoomEventJob* job) {
return job->event(); }
56 explicit GetRoomStateWithKeyJob(
const QString& roomId,
const QString& eventType,
57 const QString& stateKey);
63 static QUrl makeRequestUrl(
const HomeserverData& hsData,
const QString& roomId,
64 const QString& eventType,
const QString& stateKey);
69 QJsonObject content()
const {
return fromJson<QJsonObject>(jsonData()); }
72 inline auto collectResponse(
const GetRoomStateWithKeyJob* job) {
return job->content(); }
81 explicit GetRoomStateJob(
const QString& roomId);
87 static QUrl makeRequestUrl(
const HomeserverData& hsData,
const QString& roomId);
92 StateEvents events() {
return fromJson<StateEvents>(jsonData()); }
95 inline auto collectResponse(GetRoomStateJob* job) {
return job->events(); }
120 explicit GetMembersByRoomJob(
const QString& roomId,
const QString& at = {},
121 const QString& membership = {},
const QString& notMembership = {});
127 static QUrl makeRequestUrl(
const HomeserverData& hsData,
const QString& roomId,
128 const QString& at = {},
const QString& membership = {},
129 const QString& notMembership = {});
133 StateEvents chunk() {
return takeFromJson<StateEvents>(
"chunk"_L1); }
136 inline auto collectResponse(GetMembersByRoomJob* job) {
return job->chunk(); }
150 QString displayName{};
161 explicit GetJoinedMembersByRoomJob(
const QString& roomId);
167 static QUrl makeRequestUrl(
const HomeserverData& hsData,
const QString& roomId);
172 QHash<UserId, RoomMember> joined()
const
174 return loadFromJson<QHash<UserId, RoomMember>>(
"joined"_L1);
178 inline auto collectResponse(
const GetJoinedMembersByRoomJob* job) {
return job->joined(); }
181 struct QUOTIENT_API JsonObjectConverter<GetJoinedMembersByRoomJob::RoomMember> {
182 static void fillFrom(
const QJsonObject& jo, GetJoinedMembersByRoomJob::RoomMember& result)
184 fillFromJson(jo.value(
"display_name"_L1), result.displayName);
185 fillFromJson(jo.value(
"avatar_url"_L1), result.avatarUrl);