1 | #pragma once |
2 | |
3 | /// @file |
4 | /// @brief Reponses from the message pagination API. |
5 | |
6 | #include <string> |
7 | |
8 | #if __has_include(<nlohmann/json_fwd.hpp>) |
9 | #include <nlohmann/json_fwd.hpp> |
10 | #else |
11 | #include <nlohmann/json.hpp> |
12 | #endif |
13 | |
14 | #include "mtx/events/collections.hpp" |
15 | |
16 | namespace mtx { |
17 | namespace responses { |
18 | |
19 | //! Response of the `GET /_matrix/client/r0/rooms/{roomId}/messages` endpoint. |
20 | // |
21 | //! This API returns a list of message and state events for a room. |
22 | //! It uses pagination query parameters to paginate history in the room. |
23 | struct Messages |
24 | { |
25 | //! The token the pagination starts from. |
26 | std::string start; |
27 | //! The token the pagination ends at. |
28 | std::string end; |
29 | //! A list of room events. |
30 | std::vector<mtx::events::collections::TimelineEvents> chunk; |
31 | |
32 | friend void from_json(const nlohmann::json &obj, Messages &messages); |
33 | }; |
34 | } |
35 | } |
36 | |