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 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
|
// THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
#pragma once
#include <Quotient/events/roomevent.h>
#include <Quotient/jobs/basejob.h>
namespace Quotient {
//! \brief Get the child events for a given parent event.
//!
//! Retrieve all of the child events for a given parent event.
//!
//! Note that when paginating the `from` token should be "after" the `to` token in
//! terms of topological ordering, because it is only possible to paginate "backwards"
//! through events, starting at `from`.
//!
//! For example, passing a `from` token from page 2 of the results, and a `to` token
//! from page 1, would return the empty set. The caller can use a `from` token from
//! page 1 and a `to` token from page 2 to paginate over the same range, however.
class QUOTIENT_API GetRelatingEventsJob : public BaseJob {
public:
//! \param roomId
//! The ID of the room containing the parent event.
//!
//! \param eventId
//! The ID of the parent event whose child events are to be returned.
//!
//! \param from
//! The pagination token to start returning results from. If not supplied, results
//! start at the most recent topological event known to the server.
//!
//! Can be a `next_batch` or `prev_batch` token from a previous call, or a returned
//! `start` token from
//! [`/messages`](/client-server-api/#get_matrixclientv3roomsroomidmessages), or a
//! `next_batch` token from [`/sync`](/client-server-api/#get_matrixclientv3sync).
//!
//! \param to
//! The pagination token to stop returning results at. If not supplied, results
//! continue up to `limit` or until there are no more events.
//!
//! Like `from`, this can be a previous token from a prior call to this endpoint
//! or from `/messages` or `/sync`.
//!
//! \param limit
//! The maximum number of results to return in a single `chunk`. The server can
//! and should apply a maximum value to this parameter to avoid large responses.
//!
//! Similarly, the server should apply a default value when not supplied.
//!
//! \param dir
//! Optional (default `b`) direction to return events from. If this is set to `f`, events
//! will be returned in chronological order starting at `from`. If it
//! is set to `b`, events will be returned in *reverse* chronological
//! order, again starting at `from`.
//!
//! \param recurse
//! Whether to additionally include events which only relate indirectly to the
//! given event, i.e. events related to the given event via two or more direct relationships.
//!
//! If set to `false`, only events which have a direct relation with the given
//! event will be included.
//!
//! If set to `true`, events which have an indirect relation with the given event
//! will be included additionally up to a certain depth level. Homeservers SHOULD traverse
//! at least 3 levels of relationships. Implementations MAY perform more but MUST be careful
//! to not infinitely recurse.
//!
//! The default value is `false`.
explicit GetRelatingEventsJob(const QString& roomId, const QString& eventId,
const QString& from = {}, const QString& to = {},
std::optional<int> limit = std::nullopt, const QString& dir = {},
std::optional<bool> recurse = std::nullopt);
//! \brief Construct a URL without creating a full-fledged job object
//!
//! This function can be used when a URL for GetRelatingEventsJob
//! is necessary but the job itself isn't.
static QUrl makeRequestUrl(const HomeserverData& hsData, const QString& roomId,
const QString& eventId, const QString& from = {},
const QString& to = {}, std::optional<int> limit = std::nullopt,
const QString& dir = {}, std::optional<bool> recurse = std::nullopt);
// Result properties
//! An opaque string representing a pagination token. The absence of this token
//! means there are no more results to fetch and the client should stop paginating.
QString nextBatch() const { return loadFromJson<QString>("next_batch"_L1); }
//! An opaque string representing a pagination token. The absence of this token
//! means this is the start of the result set, i.e. this is the first batch/page.
QString prevBatch() const { return loadFromJson<QString>("prev_batch"_L1); }
//! If the `recurse` parameter was supplied by the client, this response field is
//! mandatory and gives the actual depth to which the server recursed. If the client
//! did not specify the `recurse` parameter, this field must be absent.
std::optional<int> recursionDepth() const
{
return loadFromJson<std::optional<int>>("recursion_depth"_L1);
}
//! The child events of the requested event, ordered topologically most-recent first.
RoomEvents chunk() { return takeFromJson<RoomEvents>("chunk"_L1); }
struct Response {
//! An opaque string representing a pagination token. The absence of this token
//! means there are no more results to fetch and the client should stop paginating.
QString nextBatch{};
//! An opaque string representing a pagination token. The absence of this token
//! means this is the start of the result set, i.e. this is the first batch/page.
QString prevBatch{};
//! If the `recurse` parameter was supplied by the client, this response field is
//! mandatory and gives the actual depth to which the server recursed. If the client
//! did not specify the `recurse` parameter, this field must be absent.
std::optional<int> recursionDepth{};
//! The child events of the requested event, ordered topologically most-recent first.
RoomEvents chunk{};
};
};
template <std::derived_from<GetRelatingEventsJob> JobT>
constexpr inline auto doCollectResponse<JobT> = [](JobT* j) -> GetRelatingEventsJob::Response {
return { j->nextBatch(), j->prevBatch(), j->recursionDepth(), j->chunk() };
};
//! \brief Get the child events for a given parent event, with a given `relType`.
//!
//! Retrieve all of the child events for a given parent event which relate to the parent
//! using the given `relType`.
//!
//! Note that when paginating the `from` token should be "after" the `to` token in
//! terms of topological ordering, because it is only possible to paginate "backwards"
//! through events, starting at `from`.
//!
//! For example, passing a `from` token from page 2 of the results, and a `to` token
//! from page 1, would return the empty set. The caller can use a `from` token from
//! page 1 and a `to` token from page 2 to paginate over the same range, however.
class QUOTIENT_API GetRelatingEventsWithRelTypeJob : public BaseJob {
public:
//! \param roomId
//! The ID of the room containing the parent event.
//!
//! \param eventId
//! The ID of the parent event whose child events are to be returned.
//!
//! \param relType
//! The [relationship type](/client-server-api/#relationship-types) to search for.
//!
//! \param from
//! The pagination token to start returning results from. If not supplied, results
//! start at the most recent topological event known to the server.
//!
//! Can be a `next_batch` or `prev_batch` token from a previous call, or a returned
//! `start` token from
//! [`/messages`](/client-server-api/#get_matrixclientv3roomsroomidmessages), or a
//! `next_batch` token from [`/sync`](/client-server-api/#get_matrixclientv3sync).
//!
//! \param to
//! The pagination token to stop returning results at. If not supplied, results
//! continue up to `limit` or until there are no more events.
//!
//! Like `from`, this can be a previous token from a prior call to this endpoint
//! or from `/messages` or `/sync`.
//!
//! \param limit
//! The maximum number of results to return in a single `chunk`. The server can
//! and should apply a maximum value to this parameter to avoid large responses.
//!
//! Similarly, the server should apply a default value when not supplied.
//!
//! \param dir
//! Optional (default `b`) direction to return events from. If this is set to `f`, events
//! will be returned in chronological order starting at `from`. If it
//! is set to `b`, events will be returned in *reverse* chronological
//! order, again starting at `from`.
//!
//! \param recurse
//! Whether to additionally include events which only relate indirectly to the
//! given event, i.e. events related to the given event via two or more direct relationships.
//!
//! If set to `false`, only events which have a direct relation with the given
//! event will be included.
//!
//! If set to `true`, events which have an indirect relation with the given event
//! will be included additionally up to a certain depth level. Homeservers SHOULD traverse
//! at least 3 levels of relationships. Implementations MAY perform more but MUST be careful
//! to not infinitely recurse.
//!
//! The default value is `false`.
explicit GetRelatingEventsWithRelTypeJob(const QString& roomId, const QString& eventId,
const QString& relType, const QString& from = {},
const QString& to = {},
std::optional<int> limit = std::nullopt,
const QString& dir = {},
std::optional<bool> recurse = std::nullopt);
//! \brief Construct a URL without creating a full-fledged job object
//!
//! This function can be used when a URL for GetRelatingEventsWithRelTypeJob
//! is necessary but the job itself isn't.
static QUrl makeRequestUrl(const HomeserverData& hsData, const QString& roomId,
const QString& eventId, const QString& relType,
const QString& from = {}, const QString& to = {},
std::optional<int> limit = std::nullopt, const QString& dir = {},
std::optional<bool> recurse = std::nullopt);
// Result properties
//! An opaque string representing a pagination token. The absence of this token
//! means there are no more results to fetch and the client should stop paginating.
QString nextBatch() const { return loadFromJson<QString>("next_batch"_L1); }
//! An opaque string representing a pagination token. The absence of this token
//! means this is the start of the result set, i.e. this is the first batch/page.
QString prevBatch() const { return loadFromJson<QString>("prev_batch"_L1); }
//! If the `recurse` parameter was supplied by the client, this response field is
//! mandatory and gives the actual depth to which the server recursed. If the client
//! did not specify the `recurse` parameter, this field must be absent.
std::optional<int> recursionDepth() const
{
return loadFromJson<std::optional<int>>("recursion_depth"_L1);
}
//! The child events of the requested event, ordered topologically
//! most-recent first. The events returned will match the `relType`
//! supplied in the URL.
RoomEvents chunk() { return takeFromJson<RoomEvents>("chunk"_L1); }
struct Response {
//! An opaque string representing a pagination token. The absence of this token
//! means there are no more results to fetch and the client should stop paginating.
QString nextBatch{};
//! An opaque string representing a pagination token. The absence of this token
//! means this is the start of the result set, i.e. this is the first batch/page.
QString prevBatch{};
//! If the `recurse` parameter was supplied by the client, this response field is
//! mandatory and gives the actual depth to which the server recursed. If the client
//! did not specify the `recurse` parameter, this field must be absent.
std::optional<int> recursionDepth{};
//! The child events of the requested event, ordered topologically
//! most-recent first. The events returned will match the `relType`
//! supplied in the URL.
RoomEvents chunk{};
};
};
template <std::derived_from<GetRelatingEventsWithRelTypeJob> JobT>
constexpr inline auto doCollectResponse<JobT> =
[](JobT* j) -> GetRelatingEventsWithRelTypeJob::Response {
return { j->nextBatch(), j->prevBatch(), j->recursionDepth(), j->chunk() };
};
//! \brief Get the child events for a given parent event, with a given `relType` and `eventType`.
//!
//! Retrieve all of the child events for a given parent event which relate to the parent
//! using the given `relType` and have the given `eventType`.
//!
//! Note that when paginating the `from` token should be "after" the `to` token in
//! terms of topological ordering, because it is only possible to paginate "backwards"
//! through events, starting at `from`.
//!
//! For example, passing a `from` token from page 2 of the results, and a `to` token
//! from page 1, would return the empty set. The caller can use a `from` token from
//! page 1 and a `to` token from page 2 to paginate over the same range, however.
class QUOTIENT_API GetRelatingEventsWithRelTypeAndEventTypeJob : public BaseJob {
public:
//! \param roomId
//! The ID of the room containing the parent event.
//!
//! \param eventId
//! The ID of the parent event whose child events are to be returned.
//!
//! \param relType
//! The [relationship type](/client-server-api/#relationship-types) to search for.
//!
//! \param eventType
//! The event type of child events to search for.
//!
//! Note that in encrypted rooms this will typically always be `m.room.encrypted`
//! regardless of the event type contained within the encrypted payload.
//!
//! \param from
//! The pagination token to start returning results from. If not supplied, results
//! start at the most recent topological event known to the server.
//!
//! Can be a `next_batch` or `prev_batch` token from a previous call, or a returned
//! `start` token from
//! [`/messages`](/client-server-api/#get_matrixclientv3roomsroomidmessages), or a
//! `next_batch` token from [`/sync`](/client-server-api/#get_matrixclientv3sync).
//!
//! \param to
//! The pagination token to stop returning results at. If not supplied, results
//! continue up to `limit` or until there are no more events.
//!
//! Like `from`, this can be a previous token from a prior call to this endpoint
//! or from `/messages` or `/sync`.
//!
//! \param limit
//! The maximum number of results to return in a single `chunk`. The server can
//! and should apply a maximum value to this parameter to avoid large responses.
//!
//! Similarly, the server should apply a default value when not supplied.
//!
//! \param dir
//! Optional (default `b`) direction to return events from. If this is set to `f`, events
//! will be returned in chronological order starting at `from`. If it
//! is set to `b`, events will be returned in *reverse* chronological
//! order, again starting at `from`.
//!
//! \param recurse
//! Whether to additionally include events which only relate indirectly to the
//! given event, i.e. events related to the given event via two or more direct relationships.
//!
//! If set to `false`, only events which have a direct relation with the given
//! event will be included.
//!
//! If set to `true`, events which have an indirect relation with the given event
//! will be included additionally up to a certain depth level. Homeservers SHOULD traverse
//! at least 3 levels of relationships. Implementations MAY perform more but MUST be careful
//! to not infinitely recurse.
//!
//! The default value is `false`.
explicit GetRelatingEventsWithRelTypeAndEventTypeJob(
const QString& roomId, const QString& eventId, const QString& relType,
const QString& eventType, const QString& from = {}, const QString& to = {},
std::optional<int> limit = std::nullopt, const QString& dir = {},
std::optional<bool> recurse = std::nullopt);
//! \brief Construct a URL without creating a full-fledged job object
//!
//! This function can be used when a URL for GetRelatingEventsWithRelTypeAndEventTypeJob
//! is necessary but the job itself isn't.
static QUrl makeRequestUrl(const HomeserverData& hsData, const QString& roomId,
const QString& eventId, const QString& relType,
const QString& eventType, const QString& from = {},
const QString& to = {}, std::optional<int> limit = std::nullopt,
const QString& dir = {}, std::optional<bool> recurse = std::nullopt);
// Result properties
//! An opaque string representing a pagination token. The absence of this token
//! means there are no more results to fetch and the client should stop paginating.
QString nextBatch() const { return loadFromJson<QString>("next_batch"_L1); }
//! An opaque string representing a pagination token. The absence of this token
//! means this is the start of the result set, i.e. this is the first batch/page.
QString prevBatch() const { return loadFromJson<QString>("prev_batch"_L1); }
//! If the `recurse` parameter was supplied by the client, this response field is
//! mandatory and gives the actual depth to which the server recursed. If the client
//! did not specify the `recurse` parameter, this field must be absent.
std::optional<int> recursionDepth() const
{
return loadFromJson<std::optional<int>>("recursion_depth"_L1);
}
//! The child events of the requested event, ordered topologically most-recent
//! first. The events returned will match the `relType` and `eventType` supplied
//! in the URL.
RoomEvents chunk() { return takeFromJson<RoomEvents>("chunk"_L1); }
struct Response {
//! An opaque string representing a pagination token. The absence of this token
//! means there are no more results to fetch and the client should stop paginating.
QString nextBatch{};
//! An opaque string representing a pagination token. The absence of this token
//! means this is the start of the result set, i.e. this is the first batch/page.
QString prevBatch{};
//! If the `recurse` parameter was supplied by the client, this response field is
//! mandatory and gives the actual depth to which the server recursed. If the client
//! did not specify the `recurse` parameter, this field must be absent.
std::optional<int> recursionDepth{};
//! The child events of the requested event, ordered topologically most-recent
//! first. The events returned will match the `relType` and `eventType` supplied
//! in the URL.
RoomEvents chunk{};
};
};
template <std::derived_from<GetRelatingEventsWithRelTypeAndEventTypeJob> JobT>
constexpr inline auto doCollectResponse<JobT> =
[](JobT* j) -> GetRelatingEventsWithRelTypeAndEventTypeJob::Response {
return { j->nextBatch(), j->prevBatch(), j->recursionDepth(), j->chunk() };
};
} // namespace Quotient
|