| 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 Fetches a list of the threads in a room. |
| 13 | * |
| 14 | * This API is used to paginate through the list of the thread roots in a given |
| 15 | * room. |
| 16 | * |
| 17 | * Optionally, the returned list may be filtered according to whether the |
| 18 | * requesting user has participated in the thread. |
| 19 | */ |
| 20 | class QUOTIENT_API GetThreadRootsJob : public BaseJob { |
| 21 | public: |
| 22 | /*! \brief Fetches a list of the threads in a room. |
| 23 | * |
| 24 | * \param roomId |
| 25 | * The room ID where the thread roots are located. |
| 26 | * |
| 27 | * \param include |
| 28 | * Optional (default `all`) flag to denote which thread roots are of |
| 29 | * interest to the caller. When `all`, all thread roots found in the room |
| 30 | * are returned. When `participated`, only thread roots for threads the user |
| 31 | * has [participated |
| 32 | * in](/client-server-api/#server-side-aggregation-of-mthread-relationships) |
| 33 | * will be returned. |
| 34 | * |
| 35 | * \param limit |
| 36 | * Optional limit for the maximum number of thread roots to include per |
| 37 | * response. Must be an integer greater than zero. |
| 38 | * |
| 39 | * Servers should apply a default value, and impose a maximum value to |
| 40 | * avoid resource exhaustion. |
| 41 | * |
| 42 | * \param from |
| 43 | * A pagination token from a previous result. When not provided, the |
| 44 | * server starts paginating from the most recent event visible to the user |
| 45 | * (as per history visibility rules; topologically). |
| 46 | */ |
| 47 | explicit GetThreadRootsJob(const QString& roomId, |
| 48 | const QString& include = {}, |
| 49 | Omittable<int> limit = none, |
| 50 | const QString& from = {}); |
| 51 | |
| 52 | /*! \brief Construct a URL without creating a full-fledged job object |
| 53 | * |
| 54 | * This function can be used when a URL for GetThreadRootsJob |
| 55 | * is necessary but the job itself isn't. |
| 56 | */ |
| 57 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, |
| 58 | const QString& include = {}, |
| 59 | Omittable<int> limit = none, |
| 60 | const QString& from = {}); |
| 61 | |
| 62 | // Result properties |
| 63 | |
| 64 | /// The thread roots, ordered by the `latest_event` in each event's |
| 65 | /// aggregated children. All events returned include bundled |
| 66 | /// [aggregations](/client-server-api/#aggregations-of-child-events). |
| 67 | /// |
| 68 | /// If the thread root event was sent by an [ignored |
| 69 | /// user](/client-server-api/#ignoring-users), the event is returned |
| 70 | /// redacted to the caller. This is to simulate the same behaviour of a |
| 71 | /// client doing aggregation locally on the thread. |
| 72 | RoomEvents chunk() { return takeFromJson<RoomEvents>(key: "chunk"_ls ); } |
| 73 | |
| 74 | /// A token to supply to `from` to keep paginating the responses. Not |
| 75 | /// present when there are no further results. |
| 76 | QString nextBatch() const { return loadFromJson<QString>(keyName: "next_batch"_ls ); } |
| 77 | }; |
| 78 | |
| 79 | } // namespace Quotient |
| 80 | |