5 #include <Quotient/events/stateevent.h>
6 #include <Quotient/jobs/basejob.h>
42 StateEvents childrenState;
45 QString canonicalAlias{};
92 explicit GetSpaceHierarchyJob(
const QString& roomId,
93 std::optional<
bool> suggestedOnly = std::nullopt,
94 std::optional<
int> limit = std::nullopt,
95 std::optional<
int> maxDepth = std::nullopt,
96 const QString& from = {});
102 static QUrl makeRequestUrl(
const HomeserverData& hsData,
const QString& roomId,
103 std::optional<
bool> suggestedOnly = std::nullopt,
104 std::optional<
int> limit = std::nullopt,
105 std::optional<
int> maxDepth = std::nullopt,
const QString& from = {});
110 std::vector<SpaceHierarchyRoomsChunk> rooms()
112 return takeFromJson<std::vector<SpaceHierarchyRoomsChunk>>(
"rooms"_L1);
117 QString nextBatch()
const {
return loadFromJson<QString>(
"next_batch"_L1); }
121 std::vector<SpaceHierarchyRoomsChunk> rooms{};
129 template <std::derived_from<GetSpaceHierarchyJob> JobT>
130 constexpr inline auto doCollectResponse<JobT> =
131 [](JobT* j) -> GetSpaceHierarchyJob::Response {
return { j->rooms(), j->nextBatch() }; };
134 struct QUOTIENT_API JsonObjectConverter<GetSpaceHierarchyJob::SpaceHierarchyRoomsChunk> {
135 static void fillFrom(
const QJsonObject& jo,
136 GetSpaceHierarchyJob::SpaceHierarchyRoomsChunk& result)
138 fillFromJson(jo.value(
"num_joined_members"_L1), result.numJoinedMembers);
139 fillFromJson(jo.value(
"room_id"_L1), result.roomId);
140 fillFromJson(jo.value(
"world_readable"_L1), result.worldReadable);
141 fillFromJson(jo.value(
"guest_can_join"_L1), result.guestCanJoin);
142 fillFromJson(jo.value(
"children_state"_L1), result.childrenState);
143 fillFromJson(jo.value(
"canonical_alias"_L1), result.canonicalAlias);
144 fillFromJson(jo.value(
"name"_L1), result.name);
145 fillFromJson(jo.value(
"topic"_L1), result.topic);
146 fillFromJson(jo.value(
"avatar_url"_L1), result.avatarUrl);
147 fillFromJson(jo.value(
"join_rule"_L1), result.joinRule);
148 fillFromJson(jo.value(
"room_type"_L1), result.roomType);