5 #include <Quotient/events/roomevent.h>
6 #include <Quotient/jobs/basejob.h>
70 explicit GetRelatingEventsJob(
const QString& roomId,
const QString& eventId,
71 const QString& from = {},
const QString& to = {},
72 std::optional<
int> limit = std::nullopt,
const QString& dir = {},
73 std::optional<
bool> recurse = std::nullopt);
79 static QUrl makeRequestUrl(
const HomeserverData& hsData,
const QString& roomId,
80 const QString& eventId,
const QString& from = {},
81 const QString& to = {}, std::optional<
int> limit = std::nullopt,
82 const QString& dir = {}, std::optional<
bool> recurse = std::nullopt);
88 QString nextBatch()
const {
return loadFromJson<QString>(
"next_batch"_L1); }
92 QString prevBatch()
const {
return loadFromJson<QString>(
"prev_batch"_L1); }
97 std::optional<
int> recursionDepth()
const
99 return loadFromJson<std::optional<
int>>(
"recursion_depth"_L1);
103 RoomEvents chunk() {
return takeFromJson<RoomEvents>(
"chunk"_L1); }
117 std::optional<
int> recursionDepth{};
124 template <std::derived_from<GetRelatingEventsJob> JobT>
125 constexpr inline auto doCollectResponse<JobT> = [](JobT* j) -> GetRelatingEventsJob::Response {
126 return { j->nextBatch(), j->prevBatch(), j->recursionDepth(), j->chunk() };
193 explicit GetRelatingEventsWithRelTypeJob(
const QString& roomId,
const QString& eventId,
194 const QString& relType,
const QString& from = {},
195 const QString& to = {},
196 std::optional<
int> limit = std::nullopt,
197 const QString& dir = {},
198 std::optional<
bool> recurse = std::nullopt);
204 static QUrl makeRequestUrl(
const HomeserverData& hsData,
const QString& roomId,
205 const QString& eventId,
const QString& relType,
206 const QString& from = {},
const QString& to = {},
207 std::optional<
int> limit = std::nullopt,
const QString& dir = {},
208 std::optional<
bool> recurse = std::nullopt);
214 QString nextBatch()
const {
return loadFromJson<QString>(
"next_batch"_L1); }
218 QString prevBatch()
const {
return loadFromJson<QString>(
"prev_batch"_L1); }
223 std::optional<
int> recursionDepth()
const
225 return loadFromJson<std::optional<
int>>(
"recursion_depth"_L1);
231 RoomEvents chunk() {
return takeFromJson<RoomEvents>(
"chunk"_L1); }
245 std::optional<
int> recursionDepth{};
254 template <std::derived_from<GetRelatingEventsWithRelTypeJob> JobT>
255 constexpr inline auto doCollectResponse<JobT> =
256 [](JobT* j) -> GetRelatingEventsWithRelTypeJob::Response {
257 return { j->nextBatch(), j->prevBatch(), j->recursionDepth(), j->chunk() };
272 class QUOTIENT_API GetRelatingEventsWithRelTypeAndEventTypeJob :
public BaseJob {
330 explicit GetRelatingEventsWithRelTypeAndEventTypeJob(
331 const QString& roomId,
const QString& eventId,
const QString& relType,
332 const QString& eventType,
const QString& from = {},
const QString& to = {},
333 std::optional<
int> limit = std::nullopt,
const QString& dir = {},
334 std::optional<
bool> recurse = std::nullopt);
340 static QUrl makeRequestUrl(
const HomeserverData& hsData,
const QString& roomId,
341 const QString& eventId,
const QString& relType,
342 const QString& eventType,
const QString& from = {},
343 const QString& to = {}, std::optional<
int> limit = std::nullopt,
344 const QString& dir = {}, std::optional<
bool> recurse = std::nullopt);
350 QString nextBatch()
const {
return loadFromJson<QString>(
"next_batch"_L1); }
354 QString prevBatch()
const {
return loadFromJson<QString>(
"prev_batch"_L1); }
359 std::optional<
int> recursionDepth()
const
361 return loadFromJson<std::optional<
int>>(
"recursion_depth"_L1);
367 RoomEvents chunk() {
return takeFromJson<RoomEvents>(
"chunk"_L1); }
381 std::optional<
int> recursionDepth{};
390 template <std::derived_from<GetRelatingEventsWithRelTypeAndEventTypeJob> JobT>
391 constexpr inline auto doCollectResponse<JobT> =
392 [](JobT* j) -> GetRelatingEventsWithRelTypeAndEventTypeJob::Response {
393 return { j->nextBatch(), j->prevBatch(), j->recursionDepth(), j->chunk() };