| 1 | /****************************************************************************** |
| 2 | * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN |
| 3 | */ |
| 4 | |
| 5 | #pragma once |
| 6 | |
| 7 | #include <Quotient/events/roomevent.h> |
| 8 | #include <Quotient/jobs/basejob.h> |
| 9 | |
| 10 | namespace Quotient { |
| 11 | |
| 12 | /*! \brief Get the child events for a given parent event. |
| 13 | * |
| 14 | * Retrieve all of the child events for a given parent event. |
| 15 | * |
| 16 | * Note that when paginating the `from` token should be "after" the `to` token |
| 17 | * in terms of topological ordering, because it is only possible to paginate |
| 18 | * "backwards" through events, starting at `from`. |
| 19 | * |
| 20 | * For example, passing a `from` token from page 2 of the results, and a `to` |
| 21 | * token from page 1, would return the empty set. The caller can use a `from` |
| 22 | * token from page 1 and a `to` token from page 2 to paginate over the same |
| 23 | * range, however. |
| 24 | */ |
| 25 | class QUOTIENT_API GetRelatingEventsJob : public BaseJob { |
| 26 | public: |
| 27 | /*! \brief Get the child events for a given parent event. |
| 28 | * |
| 29 | * \param roomId |
| 30 | * The ID of the room containing the parent event. |
| 31 | * |
| 32 | * \param eventId |
| 33 | * The ID of the parent event whose child events are to be returned. |
| 34 | * |
| 35 | * \param from |
| 36 | * The pagination token to start returning results from. If not supplied, |
| 37 | * results start at the most recent topological event known to the server. |
| 38 | * |
| 39 | * Can be a `next_batch` or `prev_batch` token from a previous call, or a |
| 40 | * returned `start` token from |
| 41 | * [`/messages`](/client-server-api/#get_matrixclientv3roomsroomidmessages), |
| 42 | * or a `next_batch` token from |
| 43 | * [`/sync`](/client-server-api/#get_matrixclientv3sync). |
| 44 | * |
| 45 | * \param to |
| 46 | * The pagination token to stop returning results at. If not supplied, |
| 47 | * results continue up to `limit` or until there are no more events. |
| 48 | * |
| 49 | * Like `from`, this can be a previous token from a prior call to this |
| 50 | * endpoint or from `/messages` or `/sync`. |
| 51 | * |
| 52 | * \param limit |
| 53 | * The maximum number of results to return in a single `chunk`. The server |
| 54 | * can and should apply a maximum value to this parameter to avoid large |
| 55 | * responses. |
| 56 | * |
| 57 | * Similarly, the server should apply a default value when not supplied. |
| 58 | * |
| 59 | * \param dir |
| 60 | * Optional (default `b`) direction to return events from. If this is set |
| 61 | * to `f`, events will be returned in chronological order starting at |
| 62 | * `from`. If it is set to `b`, events will be returned in *reverse* |
| 63 | * chronological order, again starting at `from`. |
| 64 | */ |
| 65 | explicit GetRelatingEventsJob(const QString& roomId, const QString& eventId, |
| 66 | const QString& from = {}, |
| 67 | const QString& to = {}, |
| 68 | Omittable<int> limit = none, |
| 69 | const QString& dir = {}); |
| 70 | |
| 71 | /*! \brief Construct a URL without creating a full-fledged job object |
| 72 | * |
| 73 | * This function can be used when a URL for GetRelatingEventsJob |
| 74 | * is necessary but the job itself isn't. |
| 75 | */ |
| 76 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, |
| 77 | const QString& eventId, const QString& from = {}, |
| 78 | const QString& to = {}, |
| 79 | Omittable<int> limit = none, |
| 80 | const QString& dir = {}); |
| 81 | |
| 82 | // Result properties |
| 83 | |
| 84 | /// The child events of the requested event, ordered topologically |
| 85 | /// most-recent first. |
| 86 | RoomEvents chunk() { return takeFromJson<RoomEvents>(key: "chunk"_ls ); } |
| 87 | |
| 88 | /// An opaque string representing a pagination token. The absence of this |
| 89 | /// token means there are no more results to fetch and the client should |
| 90 | /// stop paginating. |
| 91 | QString nextBatch() const { return loadFromJson<QString>(keyName: "next_batch"_ls ); } |
| 92 | |
| 93 | /// An opaque string representing a pagination token. The absence of this |
| 94 | /// token means this is the start of the result set, i.e. this is the first |
| 95 | /// batch/page. |
| 96 | QString prevBatch() const { return loadFromJson<QString>(keyName: "prev_batch"_ls ); } |
| 97 | }; |
| 98 | |
| 99 | /*! \brief Get the child events for a given parent event, with a given |
| 100 | * `relType`. |
| 101 | * |
| 102 | * Retrieve all of the child events for a given parent event which relate to the |
| 103 | * parent using the given `relType`. |
| 104 | * |
| 105 | * Note that when paginating the `from` token should be "after" the `to` token |
| 106 | * in terms of topological ordering, because it is only possible to paginate |
| 107 | * "backwards" through events, starting at `from`. |
| 108 | * |
| 109 | * For example, passing a `from` token from page 2 of the results, and a `to` |
| 110 | * token from page 1, would return the empty set. The caller can use a `from` |
| 111 | * token from page 1 and a `to` token from page 2 to paginate over the same |
| 112 | * range, however. |
| 113 | */ |
| 114 | class QUOTIENT_API GetRelatingEventsWithRelTypeJob : public BaseJob { |
| 115 | public: |
| 116 | /*! \brief Get the child events for a given parent event, with a given |
| 117 | * `relType`. |
| 118 | * |
| 119 | * \param roomId |
| 120 | * The ID of the room containing the parent event. |
| 121 | * |
| 122 | * \param eventId |
| 123 | * The ID of the parent event whose child events are to be returned. |
| 124 | * |
| 125 | * \param relType |
| 126 | * The [relationship type](/client-server-api/#relationship-types) to |
| 127 | * search for. |
| 128 | * |
| 129 | * \param from |
| 130 | * The pagination token to start returning results from. If not supplied, |
| 131 | * results start at the most recent topological event known to the server. |
| 132 | * |
| 133 | * Can be a `next_batch` or `prev_batch` token from a previous call, or a |
| 134 | * returned `start` token from |
| 135 | * [`/messages`](/client-server-api/#get_matrixclientv3roomsroomidmessages), |
| 136 | * or a `next_batch` token from |
| 137 | * [`/sync`](/client-server-api/#get_matrixclientv3sync). |
| 138 | * |
| 139 | * \param to |
| 140 | * The pagination token to stop returning results at. If not supplied, |
| 141 | * results continue up to `limit` or until there are no more events. |
| 142 | * |
| 143 | * Like `from`, this can be a previous token from a prior call to this |
| 144 | * endpoint or from `/messages` or `/sync`. |
| 145 | * |
| 146 | * \param limit |
| 147 | * The maximum number of results to return in a single `chunk`. The server |
| 148 | * can and should apply a maximum value to this parameter to avoid large |
| 149 | * responses. |
| 150 | * |
| 151 | * Similarly, the server should apply a default value when not supplied. |
| 152 | * |
| 153 | * \param dir |
| 154 | * Optional (default `b`) direction to return events from. If this is set |
| 155 | * to `f`, events will be returned in chronological order starting at |
| 156 | * `from`. If it is set to `b`, events will be returned in *reverse* |
| 157 | * chronological order, again starting at `from`. |
| 158 | */ |
| 159 | explicit GetRelatingEventsWithRelTypeJob( |
| 160 | const QString& roomId, const QString& eventId, const QString& relType, |
| 161 | const QString& from = {}, const QString& to = {}, |
| 162 | Omittable<int> limit = none, const QString& dir = {}); |
| 163 | |
| 164 | /*! \brief Construct a URL without creating a full-fledged job object |
| 165 | * |
| 166 | * This function can be used when a URL for GetRelatingEventsWithRelTypeJob |
| 167 | * is necessary but the job itself isn't. |
| 168 | */ |
| 169 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, |
| 170 | const QString& eventId, const QString& relType, |
| 171 | const QString& from = {}, const QString& to = {}, |
| 172 | Omittable<int> limit = none, |
| 173 | const QString& dir = {}); |
| 174 | |
| 175 | // Result properties |
| 176 | |
| 177 | /// The child events of the requested event, ordered topologically |
| 178 | /// most-recent first. The events returned will match the `relType` |
| 179 | /// supplied in the URL. |
| 180 | RoomEvents chunk() { return takeFromJson<RoomEvents>(key: "chunk"_ls ); } |
| 181 | |
| 182 | /// An opaque string representing a pagination token. The absence of this |
| 183 | /// token means there are no more results to fetch and the client should |
| 184 | /// stop paginating. |
| 185 | QString nextBatch() const { return loadFromJson<QString>(keyName: "next_batch"_ls ); } |
| 186 | |
| 187 | /// An opaque string representing a pagination token. The absence of this |
| 188 | /// token means this is the start of the result set, i.e. this is the first |
| 189 | /// batch/page. |
| 190 | QString prevBatch() const { return loadFromJson<QString>(keyName: "prev_batch"_ls ); } |
| 191 | }; |
| 192 | |
| 193 | /*! \brief Get the child events for a given parent event, with a given `relType` |
| 194 | * and `eventType`. |
| 195 | * |
| 196 | * Retrieve all of the child events for a given parent event which relate to the |
| 197 | * parent using the given `relType` and have the given `eventType`. |
| 198 | * |
| 199 | * Note that when paginating the `from` token should be "after" the `to` token |
| 200 | * in terms of topological ordering, because it is only possible to paginate |
| 201 | * "backwards" through events, starting at `from`. |
| 202 | * |
| 203 | * For example, passing a `from` token from page 2 of the results, and a `to` |
| 204 | * token from page 1, would return the empty set. The caller can use a `from` |
| 205 | * token from page 1 and a `to` token from page 2 to paginate over the same |
| 206 | * range, however. |
| 207 | */ |
| 208 | class QUOTIENT_API GetRelatingEventsWithRelTypeAndEventTypeJob |
| 209 | : public BaseJob { |
| 210 | public: |
| 211 | /*! \brief Get the child events for a given parent event, with a given |
| 212 | * `relType` and `eventType`. |
| 213 | * |
| 214 | * \param roomId |
| 215 | * The ID of the room containing the parent event. |
| 216 | * |
| 217 | * \param eventId |
| 218 | * The ID of the parent event whose child events are to be returned. |
| 219 | * |
| 220 | * \param relType |
| 221 | * The [relationship type](/client-server-api/#relationship-types) to |
| 222 | * search for. |
| 223 | * |
| 224 | * \param eventType |
| 225 | * The event type of child events to search for. |
| 226 | * |
| 227 | * Note that in encrypted rooms this will typically always be |
| 228 | * `m.room.encrypted` regardless of the event type contained within the |
| 229 | * encrypted payload. |
| 230 | * |
| 231 | * \param from |
| 232 | * The pagination token to start returning results from. If not supplied, |
| 233 | * results start at the most recent topological event known to the server. |
| 234 | * |
| 235 | * Can be a `next_batch` or `prev_batch` token from a previous call, or a |
| 236 | * returned `start` token from |
| 237 | * [`/messages`](/client-server-api/#get_matrixclientv3roomsroomidmessages), |
| 238 | * or a `next_batch` token from |
| 239 | * [`/sync`](/client-server-api/#get_matrixclientv3sync). |
| 240 | * |
| 241 | * \param to |
| 242 | * The pagination token to stop returning results at. If not supplied, |
| 243 | * results continue up to `limit` or until there are no more events. |
| 244 | * |
| 245 | * Like `from`, this can be a previous token from a prior call to this |
| 246 | * endpoint or from `/messages` or `/sync`. |
| 247 | * |
| 248 | * \param limit |
| 249 | * The maximum number of results to return in a single `chunk`. The server |
| 250 | * can and should apply a maximum value to this parameter to avoid large |
| 251 | * responses. |
| 252 | * |
| 253 | * Similarly, the server should apply a default value when not supplied. |
| 254 | * |
| 255 | * \param dir |
| 256 | * Optional (default `b`) direction to return events from. If this is set |
| 257 | * to `f`, events will be returned in chronological order starting at |
| 258 | * `from`. If it is set to `b`, events will be returned in *reverse* |
| 259 | * chronological order, again starting at `from`. |
| 260 | */ |
| 261 | explicit GetRelatingEventsWithRelTypeAndEventTypeJob( |
| 262 | const QString& roomId, const QString& eventId, const QString& relType, |
| 263 | const QString& eventType, const QString& from = {}, |
| 264 | const QString& to = {}, Omittable<int> limit = none, |
| 265 | const QString& dir = {}); |
| 266 | |
| 267 | /*! \brief Construct a URL without creating a full-fledged job object |
| 268 | * |
| 269 | * This function can be used when a URL for |
| 270 | * GetRelatingEventsWithRelTypeAndEventTypeJob is necessary but the job |
| 271 | * itself isn't. |
| 272 | */ |
| 273 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, |
| 274 | const QString& eventId, const QString& relType, |
| 275 | const QString& eventType, |
| 276 | const QString& from = {}, const QString& to = {}, |
| 277 | Omittable<int> limit = none, |
| 278 | const QString& dir = {}); |
| 279 | |
| 280 | // Result properties |
| 281 | |
| 282 | /// The child events of the requested event, ordered topologically |
| 283 | /// most-recent first. The events returned will match the `relType` and |
| 284 | /// `eventType` supplied in the URL. |
| 285 | RoomEvents chunk() { return takeFromJson<RoomEvents>(key: "chunk"_ls ); } |
| 286 | |
| 287 | /// An opaque string representing a pagination token. The absence of this |
| 288 | /// token means there are no more results to fetch and the client should |
| 289 | /// stop paginating. |
| 290 | QString nextBatch() const { return loadFromJson<QString>(keyName: "next_batch"_ls ); } |
| 291 | |
| 292 | /// An opaque string representing a pagination token. The absence of this |
| 293 | /// token means this is the start of the result set, i.e. this is the first |
| 294 | /// batch/page. |
| 295 | QString prevBatch() const { return loadFromJson<QString>(keyName: "prev_batch"_ls ); } |
| 296 | }; |
| 297 | |
| 298 | } // namespace Quotient |
| 299 | |