aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/message_pagination.h
diff options
context:
space:
mode:
authorBlack Hat <bhat@encom.eu.org>2019-09-26 22:22:36 -0700
committerBlack Hat <bhat@encom.eu.org>2019-09-26 22:22:36 -0700
commit363cf452bcdbaf6ff1cf94a83ca66cbb31122346 (patch)
treec64c8fda885e4e1785130e8ee3e7c47fd18cbf67 /lib/csapi/message_pagination.h
parent412e2cf19449e73aa7da729e9c5de6502687aade (diff)
parent944653463fe4134c82d85e2d01e2bc0fa43fd727 (diff)
downloadlibquotient-363cf452bcdbaf6ff1cf94a83ca66cbb31122346.tar.gz
libquotient-363cf452bcdbaf6ff1cf94a83ca66cbb31122346.zip
Merge branch 'master' of https://github.com/quotient-im/libQuotient into
bhat-libqtolm-update
Diffstat (limited to 'lib/csapi/message_pagination.h')
-rw-r--r--lib/csapi/message_pagination.h122
1 files changed, 66 insertions, 56 deletions
diff --git a/lib/csapi/message_pagination.h b/lib/csapi/message_pagination.h
index 12544f0c..271e1dd9 100644
--- a/lib/csapi/message_pagination.h
+++ b/lib/csapi/message_pagination.h
@@ -4,70 +4,80 @@
#pragma once
-#include "jobs/basejob.h"
+#include "converters.h"
#include "events/eventloader.h"
-#include "converters.h"
+#include "jobs/basejob.h"
-namespace QMatrixClient
+namespace Quotient
+{
+
+// Operations
+
+/// Get a list of events for this room
+/*!
+ * This API returns a list of message and state events for a room. It uses
+ * pagination query parameters to paginate history in the room.
+ */
+class GetRoomEventsJob : public BaseJob
{
- // Operations
+public:
+ /*! Get a list of events for this room
+ * \param roomId
+ * The room to get events from.
+ * \param from
+ * The token to start returning events from. This token can be obtained
+ * from a ``prev_batch`` token returned for each room by the sync API,
+ * or from a ``start`` or ``end`` token returned by a previous request
+ * to this endpoint.
+ * \param dir
+ * The direction to return events from.
+ * \param to
+ * The token to stop returning events at. This token can be obtained from
+ * a ``prev_batch`` token returned for each room by the sync endpoint,
+ * or from a ``start`` or ``end`` token returned by a previous request to
+ * this endpoint.
+ * \param limit
+ * The maximum number of events to return. Default: 10.
+ * \param filter
+ * A JSON RoomEventFilter to filter returned events with.
+ */
+ explicit GetRoomEventsJob(const QString& roomId, const QString& from,
+ const QString& dir, const QString& to = {},
+ Omittable<int> limit = none,
+ const QString& filter = {});
- /// Get a list of events for this room
- ///
- /// This API returns a list of message and state events for a room. It uses
- /// pagination query parameters to paginate history in the room.
- class GetRoomEventsJob : public BaseJob
- {
- public:
- /*! Get a list of events for this room
- * \param roomId
- * The room to get events from.
- * \param from
- * The token to start returning events from. This token can be obtained
- * from a ``prev_batch`` token returned for each room by the sync API,
- * or from a ``start`` or ``end`` token returned by a previous request
- * to this endpoint.
- * \param dir
- * The direction to return events from.
- * \param to
- * The token to stop returning events at. This token can be obtained from
- * a ``prev_batch`` token returned for each room by the sync endpoint,
- * or from a ``start`` or ``end`` token returned by a previous request to
- * this endpoint.
- * \param limit
- * The maximum number of events to return. Default: 10.
- * \param filter
- * A JSON RoomEventFilter to filter returned events with.
- */
- explicit GetRoomEventsJob(const QString& roomId, const QString& from, const QString& dir, const QString& to = {}, Omittable<int> limit = none, const QString& filter = {});
+ /*! Construct a URL without creating a full-fledged job object
+ *
+ * This function can be used when a URL for
+ * GetRoomEventsJob is necessary but the job
+ * itself isn't.
+ */
+ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId,
+ const QString& from, const QString& dir,
+ const QString& to = {},
+ Omittable<int> limit = none,
+ const QString& filter = {});
- /*! Construct a URL without creating a full-fledged job object
- *
- * This function can be used when a URL for
- * GetRoomEventsJob is necessary but the job
- * itself isn't.
- */
- static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& from, const QString& dir, const QString& to = {}, Omittable<int> limit = none, const QString& filter = {});
+ ~GetRoomEventsJob() override;
- ~GetRoomEventsJob() override;
+ // Result properties
- // Result properties
+ /// The token the pagination starts from. If ``dir=b`` this will be
+ /// the token supplied in ``from``.
+ const QString& begin() const;
+ /// The token the pagination ends at. If ``dir=b`` this token should
+ /// be used again to request even earlier events.
+ const QString& end() const;
+ /// A list of room events.
+ RoomEvents&& chunk();
- /// The token the pagination starts from. If ``dir=b`` this will be
- /// the token supplied in ``from``.
- const QString& begin() const;
- /// The token the pagination ends at. If ``dir=b`` this token should
- /// be used again to request even earlier events.
- const QString& end() const;
- /// A list of room events.
- RoomEvents&& chunk();
+protected:
+ Status parseJson(const QJsonDocument& data) override;
- protected:
- Status parseJson(const QJsonDocument& data) override;
+private:
+ class Private;
+ QScopedPointer<Private> d;
+};
- private:
- class Private;
- QScopedPointer<Private> d;
- };
-} // namespace QMatrixClient
+} // namespace Quotient