From bea4a7c81769c7e241478e4b0b29c62f389bc957 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 23 Nov 2018 19:20:00 +0900 Subject: Update CS API --- lib/csapi/rooms.h | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index 2366918b..80895b4e 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -80,19 +80,6 @@ namespace QMatrixClient */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventType, const QString& stateKey); - ~GetRoomStateWithKeyJob() override; - - // Result properties - - /// The content of the state event. - StateEventPtr&& data(); - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer d; }; /// Get the state identified by the type, with the empty state key. @@ -122,19 +109,6 @@ namespace QMatrixClient */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventType); - ~GetRoomStateByTypeJob() override; - - // Result properties - - /// The content of the state event. - StateEventPtr&& data(); - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer d; }; /// Get all state events in the current state of a room. -- cgit v1.2.3 From 3392e66fd015e191b01f6e3fc6839edc3948e31f Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 8 Dec 2018 15:36:04 +0900 Subject: Refactor toJson/fillJson Both now use through a common JsonConverter<> template class with its base definition tuned for structs/QJsonObjects and specialisations for non-object types. This new implementation doesn't work with virtual fillJson functions yet (so EventContent classes still use toJson as a member function) and does not cope quite well with non-constructible objects (you have to specialise JsonConverter<> rather than, more intuitively, JsonObjectConverter<>), but overall is more streamlined compared to the previous implementation. It also fixes one important issue that pushed for a rewrite: the previous implementation was not working with structure hierarchies at all so (in particular) the Filter part of CS API was totally disfunctional. --- lib/csapi/rooms.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index 80895b4e..415aa4ed 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -158,8 +158,17 @@ namespace QMatrixClient /*! Get the m.room.member events for the room. * \param roomId * The room to get the member events for. + * \param at + * The token defining the timeline position as-of which to return + * the list of members. 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 /messages request. + * \param membership + * Only return users with the specified membership + * \param notMembership + * Only return users with membership state other than specified */ - explicit GetMembersByRoomJob(const QString& roomId); + explicit GetMembersByRoomJob(const QString& roomId, const QString& at = {}, const QString& membership = {}, const QString& notMembership = {}); /*! Construct a URL without creating a full-fledged job object * @@ -167,7 +176,7 @@ namespace QMatrixClient * GetMembersByRoomJob is necessary but the job * itself isn't. */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); + static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& at = {}, const QString& membership = {}, const QString& notMembership = {}); ~GetMembersByRoomJob() override; -- cgit v1.2.3 From c33680b62d968e1e0e2abcdc084eaecf5dd94d2f Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Wed, 12 Dec 2018 16:50:00 +0900 Subject: csapi/rooms.h: regenerate to update doc-comments --- lib/csapi/rooms.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index 415aa4ed..b4d3d9b6 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -160,9 +160,9 @@ namespace QMatrixClient * The room to get the member events for. * \param at * The token defining the timeline position as-of which to return - * the list of members. 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 /messages request. + * the list of members. This token can be obtained from a batch token + * returned for each room by the sync API, or from + * a ``start``/``end`` token returned by a ``/messages`` request. * \param membership * Only return users with the specified membership * \param notMembership -- cgit v1.2.3 From aacc4bcb4a487871daae6717f77605aaba444341 Mon Sep 17 00:00:00 2001 From: Marc Deop Date: Sat, 2 Mar 2019 12:26:57 +0100 Subject: style: apply .clang-format to all .cpp and .h files --- lib/csapi/rooms.h | 343 +++++++++++++++++++++++++++++------------------------- 1 file changed, 182 insertions(+), 161 deletions(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index b4d3d9b6..20bdd20e 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -6,51 +6,53 @@ #include "jobs/basejob.h" -#include "events/roommemberevent.h" +#include "converters.h" #include "events/eventloader.h" +#include "events/roommemberevent.h" #include -#include "converters.h" -namespace QMatrixClient -{ +namespace QMatrixClient { // Operations /// Get a single event by event ID. /// - /// Get a single event based on ``roomId/eventId``. You must have permission to - /// retrieve this event e.g. by being a member in the room for this event. + /// Get a single event based on ``roomId/eventId``. You must have permission + /// to retrieve this event e.g. by being a member in the room for this + /// event. class GetOneRoomEventJob : public BaseJob { public: - /*! Get a single event by event ID. - * \param roomId - * The ID of the room the event is in. - * \param eventId - * The event ID to get. - */ - explicit GetOneRoomEventJob(const QString& roomId, const QString& eventId); - - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * GetOneRoomEventJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventId); - - ~GetOneRoomEventJob() override; - - // Result properties - - /// The full event. - EventPtr&& data(); + /*! Get a single event by event ID. + * \param roomId + * The ID of the room the event is in. + * \param eventId + * The event ID to get. + */ + explicit GetOneRoomEventJob(const QString& roomId, + const QString& eventId); + + /*! Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for + * GetOneRoomEventJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, + const QString& eventId); + + ~GetOneRoomEventJob() override; + + // Result properties + + /// The full event. + EventPtr&& data(); protected: - Status parseJson(const QJsonDocument& data) override; + Status parseJson(const QJsonDocument& data) override; private: - class Private; - QScopedPointer d; + class Private; + QScopedPointer d; }; /// Get the state identified by the type and key. @@ -62,24 +64,27 @@ namespace QMatrixClient class GetRoomStateWithKeyJob : public BaseJob { public: - /*! Get the state identified by the type and key. - * \param roomId - * The room to look up the state in. - * \param eventType - * The type of state to look up. - * \param stateKey - * The key of the state to look up. - */ - explicit GetRoomStateWithKeyJob(const QString& roomId, const QString& eventType, const QString& stateKey); - - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * GetRoomStateWithKeyJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventType, const QString& stateKey); - + /*! Get the state identified by the type and key. + * \param roomId + * The room to look up the state in. + * \param eventType + * The type of state to look up. + * \param stateKey + * The key of the state to look up. + */ + explicit GetRoomStateWithKeyJob(const QString& roomId, + const QString& eventType, + const QString& stateKey); + + /*! Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for + * GetRoomStateWithKeyJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, + const QString& eventType, + const QString& stateKey); }; /// Get the state identified by the type, with the empty state key. @@ -88,27 +93,28 @@ namespace QMatrixClient /// joined to the room then the state is taken from the current /// state of the room. If the user has left the room then the state is /// taken from the state of the room when they left. - /// + /// /// This looks up the state event with the empty state key. class GetRoomStateByTypeJob : public BaseJob { public: - /*! Get the state identified by the type, with the empty state key. - * \param roomId - * The room to look up the state in. - * \param eventType - * The type of state to look up. - */ - explicit GetRoomStateByTypeJob(const QString& roomId, const QString& eventType); - - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * GetRoomStateByTypeJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventType); - + /*! Get the state identified by the type, with the empty state key. + * \param roomId + * The room to look up the state in. + * \param eventType + * The type of state to look up. + */ + explicit GetRoomStateByTypeJob(const QString& roomId, + const QString& eventType); + + /*! Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for + * GetRoomStateByTypeJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, + const QString& eventType); }; /// Get all state events in the current state of a room. @@ -117,36 +123,36 @@ namespace QMatrixClient class GetRoomStateJob : public BaseJob { public: - /*! Get all state events in the current state of a room. - * \param roomId - * The room to look up the state for. - */ - explicit GetRoomStateJob(const QString& roomId); - - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * GetRoomStateJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); - - ~GetRoomStateJob() override; - - // Result properties - - /// If the user is a member of the room this will be the - /// current state of the room as a list of events. If the user - /// has left the room then this will be the state of the room - /// when they left as a list of events. - StateEvents&& data(); + /*! Get all state events in the current state of a room. + * \param roomId + * The room to look up the state for. + */ + explicit GetRoomStateJob(const QString& roomId); + + /*! Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for + * GetRoomStateJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); + + ~GetRoomStateJob() override; + + // Result properties + + /// If the user is a member of the room this will be the + /// current state of the room as a list of events. If the user + /// has left the room then this will be the state of the room + /// when they left as a list of events. + StateEvents&& data(); protected: - Status parseJson(const QJsonDocument& data) override; + Status parseJson(const QJsonDocument& data) override; private: - class Private; - QScopedPointer d; + class Private; + QScopedPointer d; }; /// Get the m.room.member events for the room. @@ -155,89 +161,104 @@ namespace QMatrixClient class GetMembersByRoomJob : public BaseJob { public: - /*! Get the m.room.member events for the room. - * \param roomId - * The room to get the member events for. - * \param at - * The token defining the timeline position as-of which to return - * the list of members. This token can be obtained from a batch token - * returned for each room by the sync API, or from - * a ``start``/``end`` token returned by a ``/messages`` request. - * \param membership - * Only return users with the specified membership - * \param notMembership - * Only return users with membership state other than specified - */ - explicit GetMembersByRoomJob(const QString& roomId, const QString& at = {}, const QString& membership = {}, const QString& notMembership = {}); - - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * GetMembersByRoomJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& at = {}, const QString& membership = {}, const QString& notMembership = {}); - - ~GetMembersByRoomJob() override; - - // Result properties - - /// Get the list of members for this room. - EventsArray&& chunk(); + /*! Get the m.room.member events for the room. + * \param roomId + * The room to get the member events for. + * \param at + * The token defining the timeline position as-of which to return + * the list of members. This token can be obtained from a batch token + * returned for each room by the sync API, or from + * a ``start``/``end`` token returned by a ``/messages`` request. + * \param membership + * Only return users with the specified membership + * \param notMembership + * Only return users with membership state other than specified + */ + explicit GetMembersByRoomJob(const QString& roomId, + const QString& at = {}, + const QString& membership = {}, + const QString& notMembership = {}); + + /*! Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for + * GetMembersByRoomJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, + const QString& at = {}, + const QString& membership = {}, + const QString& notMembership = {}); + + ~GetMembersByRoomJob() override; + + // Result properties + + /// Get the list of members for this room. + EventsArray&& chunk(); protected: - Status parseJson(const QJsonDocument& data) override; + Status parseJson(const QJsonDocument& data) override; private: - class Private; - QScopedPointer d; + class Private; + QScopedPointer d; }; /// Gets the list of currently joined users and their profile data. /// - /// This API returns a map of MXIDs to member info objects for members of the room. The current user must be in the room for it to work, unless it is an Application Service in which case any of the AS's users must be in the room. This API is primarily for Application Services and should be faster to respond than ``/members`` as it can be implemented more efficiently on the server. + /// This API returns a map of MXIDs to member info objects for members of + /// the room. The current user must be in the room for it to work, unless it + /// is an Application Service in which case any of the AS's users must be in + /// the room. This API is primarily for Application Services and should be + /// faster to respond than ``/members`` as it can be implemented more + /// efficiently on the server. class GetJoinedMembersByRoomJob : public BaseJob { public: - // Inner data structures - - /// This API returns a map of MXIDs to member info objects for members of the room. The current user must be in the room for it to work, unless it is an Application Service in which case any of the AS's users must be in the room. This API is primarily for Application Services and should be faster to respond than ``/members`` as it can be implemented more efficiently on the server. - struct RoomMember - { - /// The display name of the user this object is representing. - QString displayName; - /// The mxc avatar url of the user this object is representing. - QString avatarUrl; - }; - - // Construction/destruction - - /*! Gets the list of currently joined users and their profile data. - * \param roomId - * The room to get the members of. - */ - explicit GetJoinedMembersByRoomJob(const QString& roomId); - - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * GetJoinedMembersByRoomJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); - - ~GetJoinedMembersByRoomJob() override; - - // Result properties - - /// A map from user ID to a RoomMember object. - const QHash& joined() const; + // Inner data structures + + /// This API returns a map of MXIDs to member info objects for members + /// of the room. The current user must be in the room for it to work, + /// unless it is an Application Service in which case any of the AS's + /// users must be in the room. This API is primarily for Application + /// Services and should be faster to respond than ``/members`` as it can + /// be implemented more efficiently on the server. + struct RoomMember { + /// The display name of the user this object is representing. + QString displayName; + /// The mxc avatar url of the user this object is representing. + QString avatarUrl; + }; + + // Construction/destruction + + /*! Gets the list of currently joined users and their profile data. + * \param roomId + * The room to get the members of. + */ + explicit GetJoinedMembersByRoomJob(const QString& roomId); + + /*! Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for + * GetJoinedMembersByRoomJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); + + ~GetJoinedMembersByRoomJob() override; + + // Result properties + + /// A map from user ID to a RoomMember object. + const QHash& joined() const; protected: - Status parseJson(const QJsonDocument& data) override; + Status parseJson(const QJsonDocument& data) override; private: - class Private; - QScopedPointer d; + class Private; + QScopedPointer d; }; } // namespace QMatrixClient -- cgit v1.2.3 From 27ca32a1e5a56e09b9cc1d94224d2831004dcf3d Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jul 2019 19:32:34 +0900 Subject: Namespace: QMatrixClient -> Quotient (with back comp alias) --- lib/csapi/rooms.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index 29d7808e..1020fdb1 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -12,7 +12,7 @@ #include -namespace QMatrixClient +namespace Quotient { // Operations @@ -269,4 +269,4 @@ private: QScopedPointer d; }; -} // namespace QMatrixClient +} // namespace Quotient -- cgit v1.2.3 From 7036ed0dcb137cb5cbb6b426dd338c5e2e4c6424 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 17 Apr 2020 07:42:13 +0200 Subject: Regenerate API files using new GTAD and refreshed templates No functional changes. --- lib/csapi/rooms.h | 112 ++++++++++++++++++++++++------------------------------ 1 file changed, 50 insertions(+), 62 deletions(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index 1020fdb1..05c5b82a 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -12,20 +12,19 @@ #include -namespace Quotient -{ +namespace Quotient { // Operations -/// Get a single event by event ID. -/*! +/*! \brief Get a single event by event ID. + * * Get a single event based on ``roomId/eventId``. You must have permission to * retrieve this event e.g. by being a member in the room for this event. */ -class GetOneRoomEventJob : public BaseJob -{ +class GetOneRoomEventJob : public BaseJob { public: - /*! Get a single event by event ID. + /*! \brief Get a single event by event ID. + * * \param roomId * The ID of the room the event is in. * \param eventId @@ -33,15 +32,13 @@ public: */ explicit GetOneRoomEventJob(const QString& roomId, const QString& eventId); - /*! Construct a URL without creating a full-fledged job object + /*! \brief Construct a URL without creating a full-fledged job object * - * This function can be used when a URL for - * GetOneRoomEventJob is necessary but the job - * itself isn't. + * This function can be used when a URL for GetOneRoomEventJob + * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventId); - ~GetOneRoomEventJob() override; // Result properties @@ -57,17 +54,17 @@ private: QScopedPointer d; }; -/// Get the state identified by the type and key. -/*! +/*! \brief Get the state identified by the type and key. + * * Looks up the contents of a state event in a room. If the user is * joined to the room then the state is taken from the current * state of the room. If the user has left the room then the state is * taken from the state of the room when they left. */ -class GetRoomStateWithKeyJob : public BaseJob -{ +class GetRoomStateWithKeyJob : public BaseJob { public: - /*! Get the state identified by the type and key. + /*! \brief Get the state identified by the type and key. + * * \param roomId * The room to look up the state in. * \param eventType @@ -79,19 +76,18 @@ public: const QString& eventType, const QString& stateKey); - /*! Construct a URL without creating a full-fledged job object + /*! \brief Construct a URL without creating a full-fledged job object * - * This function can be used when a URL for - * GetRoomStateWithKeyJob is necessary but the job - * itself isn't. + * This function can be used when a URL for GetRoomStateWithKeyJob + * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventType, const QString& stateKey); }; -/// Get the state identified by the type, with the empty state key. -/*! +/*! \brief Get the state identified by the type, with the empty state key. + * * Looks up the contents of a state event in a room. If the user is * joined to the room then the state is taken from the current * state of the room. If the user has left the room then the state is @@ -99,10 +95,10 @@ public: * * This looks up the state event with the empty state key. */ -class GetRoomStateByTypeJob : public BaseJob -{ +class GetRoomStateByTypeJob : public BaseJob { public: - /*! Get the state identified by the type, with the empty state key. + /*! \brief Get the state identified by the type, with the empty state key. + * * \param roomId * The room to look up the state in. * \param eventType @@ -111,37 +107,34 @@ public: explicit GetRoomStateByTypeJob(const QString& roomId, const QString& eventType); - /*! Construct a URL without creating a full-fledged job object + /*! \brief Construct a URL without creating a full-fledged job object * - * This function can be used when a URL for - * GetRoomStateByTypeJob is necessary but the job - * itself isn't. + * This function can be used when a URL for GetRoomStateByTypeJob + * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventType); }; -/// Get all state events in the current state of a room. -/*! +/*! \brief Get all state events in the current state of a room. + * * Get the state events for the current state of a room. */ -class GetRoomStateJob : public BaseJob -{ +class GetRoomStateJob : public BaseJob { public: - /*! Get all state events in the current state of a room. + /*! \brief Get all state events in the current state of a room. + * * \param roomId * The room to look up the state for. */ explicit GetRoomStateJob(const QString& roomId); - /*! Construct a URL without creating a full-fledged job object + /*! \brief Construct a URL without creating a full-fledged job object * - * This function can be used when a URL for - * GetRoomStateJob is necessary but the job - * itself isn't. + * This function can be used when a URL for GetRoomStateJob + * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); - ~GetRoomStateJob() override; // Result properties @@ -160,14 +153,14 @@ private: QScopedPointer d; }; -/// Get the m.room.member events for the room. -/*! +/*! \brief Get the m.room.member events for the room. + * * Get the list of members for this room. */ -class GetMembersByRoomJob : public BaseJob -{ +class GetMembersByRoomJob : public BaseJob { public: - /*! Get the m.room.member events for the room. + /*! \brief Get the m.room.member events for the room. + * * \param roomId * The room to get the member events for. * \param at @@ -184,17 +177,15 @@ public: const QString& membership = {}, const QString& notMembership = {}); - /*! Construct a URL without creating a full-fledged job object + /*! \brief Construct a URL without creating a full-fledged job object * - * This function can be used when a URL for - * GetMembersByRoomJob is necessary but the job - * itself isn't. + * This function can be used when a URL for GetMembersByRoomJob + * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& at = {}, const QString& membership = {}, const QString& notMembership = {}); - ~GetMembersByRoomJob() override; // Result properties @@ -210,8 +201,8 @@ private: QScopedPointer d; }; -/// Gets the list of currently joined users and their profile data. -/*! +/*! \brief Gets the list of currently joined users and their profile data. + * * This API returns a map of MXIDs to member info objects for members of the * room. The current user must be in the room for it to work, unless it is an * Application Service in which case any of the AS's users must be in the room. @@ -219,8 +210,7 @@ private: * respond than ``/members`` as it can be implemented more efficiently on the * server. */ -class GetJoinedMembersByRoomJob : public BaseJob -{ +class GetJoinedMembersByRoomJob : public BaseJob { public: // Inner data structures @@ -230,8 +220,7 @@ public: /// the room. This API is primarily for Application Services and should be /// faster to respond than ``/members`` as it can be implemented more /// efficiently on the server. - struct RoomMember - { + struct RoomMember { /// The display name of the user this object is representing. QString displayName; /// The mxc avatar url of the user this object is representing. @@ -240,20 +229,19 @@ public: // Construction/destruction - /*! Gets the list of currently joined users and their profile data. + /*! \brief Gets the list of currently joined users and their profile data. + * * \param roomId * The room to get the members of. */ explicit GetJoinedMembersByRoomJob(const QString& roomId); - /*! Construct a URL without creating a full-fledged job object + /*! \brief Construct a URL without creating a full-fledged job object * - * This function can be used when a URL for - * GetJoinedMembersByRoomJob is necessary but the job - * itself isn't. + * This function can be used when a URL for GetJoinedMembersByRoomJob + * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); - ~GetJoinedMembersByRoomJob() override; // Result properties -- cgit v1.2.3 From 32729d9a7519cd2c4cddb0174b8329c6fd4a4a83 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jun 2020 19:46:40 +0200 Subject: Update generated files according to gtad/* changes --- lib/csapi/rooms.h | 129 ++++++++++++++++++++---------------------------------- 1 file changed, 47 insertions(+), 82 deletions(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index 05c5b82a..6137bcbd 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -4,18 +4,12 @@ #pragma once -#include "converters.h" - #include "events/eventloader.h" #include "events/roommemberevent.h" #include "jobs/basejob.h" -#include - namespace Quotient { -// Operations - /*! \brief Get a single event by event ID. * * Get a single event based on ``roomId/eventId``. You must have permission to @@ -24,9 +18,11 @@ namespace Quotient { class GetOneRoomEventJob : public BaseJob { public: /*! \brief Get a single event by event ID. + * * * \param roomId * The ID of the room the event is in. + * * \param eventId * The event ID to get. */ @@ -39,22 +35,17 @@ public: */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventId); - ~GetOneRoomEventJob() override; // Result properties /// The full event. - EventPtr&& data(); - -protected: - Status parseJson(const QJsonDocument& data) override; - -private: - class Private; - QScopedPointer d; + EventPtr data() { return fromJson(jsonData()); } }; /*! \brief Get the state identified by the type and key. + * + * .. For backwards compatibility with older links... + * .. _`get-matrix-client-r0-rooms-roomid-state-eventtype`: * * Looks up the contents of a state event in a room. If the user is * joined to the room then the state is taken from the current @@ -64,13 +55,17 @@ private: class GetRoomStateWithKeyJob : public BaseJob { public: /*! \brief Get the state identified by the type and key. + * * * \param roomId * The room to look up the state in. + * * \param eventType * The type of state to look up. + * * \param stateKey - * The key of the state to look up. + * The key of the state to look up. Defaults to an empty string. When + * an empty string, the trailing slash on this endpoint is optional. */ explicit GetRoomStateWithKeyJob(const QString& roomId, const QString& eventType, @@ -86,36 +81,6 @@ public: const QString& stateKey); }; -/*! \brief Get the state identified by the type, with the empty state key. - * - * Looks up the contents of a state event in a room. If the user is - * joined to the room then the state is taken from the current - * state of the room. If the user has left the room then the state is - * taken from the state of the room when they left. - * - * This looks up the state event with the empty state key. - */ -class GetRoomStateByTypeJob : public BaseJob { -public: - /*! \brief Get the state identified by the type, with the empty state key. - * - * \param roomId - * The room to look up the state in. - * \param eventType - * The type of state to look up. - */ - explicit GetRoomStateByTypeJob(const QString& roomId, - const QString& eventType); - - /*! \brief Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for GetRoomStateByTypeJob - * is necessary but the job itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, - const QString& eventType); -}; - /*! \brief Get all state events in the current state of a room. * * Get the state events for the current state of a room. @@ -123,6 +88,7 @@ public: class GetRoomStateJob : public BaseJob { public: /*! \brief Get all state events in the current state of a room. + * * * \param roomId * The room to look up the state for. @@ -135,22 +101,11 @@ public: * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); - ~GetRoomStateJob() override; // Result properties - /// If the user is a member of the room this will be the - /// current state of the room as a list of events. If the user - /// has left the room then this will be the state of the room - /// when they left as a list of events. - StateEvents&& data(); - -protected: - Status parseJson(const QJsonDocument& data) override; - -private: - class Private; - QScopedPointer d; + /// The current state of the room + StateEvents data() { return fromJson(jsonData()); } }; /*! \brief Get the m.room.member events for the room. @@ -160,18 +115,27 @@ private: class GetMembersByRoomJob : public BaseJob { public: /*! \brief Get the m.room.member events for the room. + * * * \param roomId * The room to get the member events for. + * * \param at - * The token defining the timeline position as-of which to return - * the list of members. This token can be obtained from a batch token - * returned for each room by the sync API, or from - * a ``start``/``end`` token returned by a ``/messages`` request. + * The point in time (pagination token) to return members for in the room. + * This token can be obtained from a ``prev_batch`` token returned for + * each room by the sync API. Defaults to the current state of the room, + * as determined by the server. + * * \param membership - * Only return users with the specified membership + * The kind of membership to filter for. Defaults to no filtering if + * unspecified. When specified alongside ``not_membership``, the two + * parameters create an 'or' condition: either the membership *is* + * the same as ``membership`` **or** *is not* the same as + * ``not_membership``. + * * \param notMembership - * Only return users with membership state other than specified + * The kind of membership to exclude from the results. Defaults to no + * filtering if unspecified. */ explicit GetMembersByRoomJob(const QString& roomId, const QString& at = {}, const QString& membership = {}, @@ -186,19 +150,14 @@ public: const QString& at = {}, const QString& membership = {}, const QString& notMembership = {}); - ~GetMembersByRoomJob() override; // Result properties /// Get the list of members for this room. - EventsArray&& chunk(); - -protected: - Status parseJson(const QJsonDocument& data) override; - -private: - class Private; - QScopedPointer d; + EventsArray chunk() + { + return takeFromJson>("chunk"_ls); + } }; /*! \brief Gets the list of currently joined users and their profile data. @@ -230,6 +189,7 @@ public: // Construction/destruction /*! \brief Gets the list of currently joined users and their profile data. + * * * \param roomId * The room to get the members of. @@ -242,19 +202,24 @@ public: * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); - ~GetJoinedMembersByRoomJob() override; // Result properties /// A map from user ID to a RoomMember object. - const QHash& joined() const; - -protected: - Status parseJson(const QJsonDocument& data) override; + QHash joined() const + { + return loadFromJson>("joined"_ls); + } +}; -private: - class Private; - QScopedPointer d; +template <> +struct JsonObjectConverter { + static void fillFrom(const QJsonObject& jo, + GetJoinedMembersByRoomJob::RoomMember& result) + { + fromJson(jo.value("display_name"_ls), result.displayName); + fromJson(jo.value("avatar_url"_ls), result.avatarUrl); + } }; } // namespace Quotient -- cgit v1.2.3 From e17764a1ae81393968dfb747c7b67353c109bc71 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 19 Jun 2020 15:01:33 +0200 Subject: csapi/: generated using the latest GTAD and matrix-doc For matrix-doc, specifically, it is master (5cb4b086) merged with https://github.com/matrix-org/matrix-doc/pull/2518. --- lib/csapi/rooms.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index 6137bcbd..f0bfa349 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -18,7 +18,6 @@ namespace Quotient { class GetOneRoomEventJob : public BaseJob { public: /*! \brief Get a single event by event ID. - * * * \param roomId * The ID of the room the event is in. @@ -39,7 +38,7 @@ public: // Result properties /// The full event. - EventPtr data() { return fromJson(jsonData()); } + EventPtr event() { return fromJson(jsonData()); } }; /*! \brief Get the state identified by the type and key. @@ -55,7 +54,6 @@ public: class GetRoomStateWithKeyJob : public BaseJob { public: /*! \brief Get the state identified by the type and key. - * * * \param roomId * The room to look up the state in. @@ -88,7 +86,6 @@ public: class GetRoomStateJob : public BaseJob { public: /*! \brief Get all state events in the current state of a room. - * * * \param roomId * The room to look up the state for. @@ -105,7 +102,7 @@ public: // Result properties /// The current state of the room - StateEvents data() { return fromJson(jsonData()); } + StateEvents events() { return fromJson(jsonData()); } }; /*! \brief Get the m.room.member events for the room. @@ -115,7 +112,6 @@ public: class GetMembersByRoomJob : public BaseJob { public: /*! \brief Get the m.room.member events for the room. - * * * \param roomId * The room to get the member events for. @@ -189,7 +185,6 @@ public: // Construction/destruction /*! \brief Gets the list of currently joined users and their profile data. - * * * \param roomId * The room to get the members of. -- cgit v1.2.3 From 0d4315008374d9a4dfb11f934875b1a16670ec74 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Wed, 23 Jun 2021 19:12:38 +0200 Subject: Re-generate API files --- lib/csapi/rooms.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index f0bfa349..179d7a27 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -12,7 +12,7 @@ namespace Quotient { /*! \brief Get a single event by event ID. * - * Get a single event based on ``roomId/eventId``. You must have permission to + * Get a single event based on `roomId/eventId`. You must have permission to * retrieve this event e.g. by being a member in the room for this event. */ class GetOneRoomEventJob : public BaseJob { @@ -38,13 +38,14 @@ public: // Result properties /// The full event. - EventPtr event() { return fromJson(jsonData()); } + EventPtr event() + + { + return fromJson(jsonData()); + } }; /*! \brief Get the state identified by the type and key. - * - * .. For backwards compatibility with older links... - * .. _`get-matrix-client-r0-rooms-roomid-state-eventtype`: * * Looks up the contents of a state event in a room. If the user is * joined to the room then the state is taken from the current @@ -102,7 +103,11 @@ public: // Result properties /// The current state of the room - StateEvents events() { return fromJson(jsonData()); } + StateEvents events() + + { + return fromJson(jsonData()); + } }; /*! \brief Get the m.room.member events for the room. @@ -118,16 +123,15 @@ public: * * \param at * The point in time (pagination token) to return members for in the room. - * This token can be obtained from a ``prev_batch`` token returned for + * This token can be obtained from a `prev_batch` token returned for * each room by the sync API. Defaults to the current state of the room, * as determined by the server. * * \param membership * The kind of membership to filter for. Defaults to no filtering if - * unspecified. When specified alongside ``not_membership``, the two + * unspecified. When specified alongside `not_membership`, the two * parameters create an 'or' condition: either the membership *is* - * the same as ``membership`` **or** *is not* the same as - * ``not_membership``. + * the same as `membership` **or** *is not* the same as `not_membership`. * * \param notMembership * The kind of membership to exclude from the results. Defaults to no @@ -162,7 +166,7 @@ public: * room. The current user must be in the room for it to work, unless it is an * Application Service in which case any of the AS's users must be in the room. * This API is primarily for Application Services and should be faster to - * respond than ``/members`` as it can be implemented more efficiently on the + * respond than `/members` as it can be implemented more efficiently on the * server. */ class GetJoinedMembersByRoomJob : public BaseJob { @@ -173,7 +177,7 @@ public: /// the room. The current user must be in the room for it to work, unless it /// is an Application Service in which case any of the AS's users must be in /// the room. This API is primarily for Application Services and should be - /// faster to respond than ``/members`` as it can be implemented more + /// faster to respond than `/members` as it can be implemented more /// efficiently on the server. struct RoomMember { /// The display name of the user this object is representing. -- cgit v1.2.3 From f7cbefe5ad626ae1798a5d7bb7546e89ad336acd Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 7 Aug 2021 16:55:06 +0200 Subject: API files: reformat after .clang-format change See 000b5730. --- lib/csapi/rooms.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index 179d7a27..51af2c65 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -38,11 +38,7 @@ public: // Result properties /// The full event. - EventPtr event() - - { - return fromJson(jsonData()); - } + EventPtr event() { return fromJson(jsonData()); } }; /*! \brief Get the state identified by the type and key. @@ -103,11 +99,7 @@ public: // Result properties /// The current state of the room - StateEvents events() - - { - return fromJson(jsonData()); - } + StateEvents events() { return fromJson(jsonData()); } }; /*! \brief Get the m.room.member events for the room. -- cgit v1.2.3 From bd649c591fa020fde0bd56a63c13025097b831ae Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 7 Aug 2021 22:12:46 +0200 Subject: Update generated files This uses API definition files from https://github.com/matrix-org/matrix-doc/pull/3236, and additionally makes uploadFile>content_uri to have 'format: uri' (as suggested in the PR review). Only use this commit with the next one; alone it breaks the build. --- lib/csapi/rooms.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index 51af2c65..2620582b 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -175,7 +175,7 @@ public: /// The display name of the user this object is representing. QString displayName; /// The mxc avatar url of the user this object is representing. - QString avatarUrl; + QUrl avatarUrl; }; // Construction/destruction -- cgit v1.2.3 From 952f8aa8ad19348b50a3b3545d98f7889bfdae76 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Wed, 29 Dec 2021 15:57:33 +0100 Subject: Regenerate CS API files --- lib/csapi/rooms.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index 2620582b..f0815109 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -15,7 +15,7 @@ namespace Quotient { * Get a single event based on `roomId/eventId`. You must have permission to * retrieve this event e.g. by being a member in the room for this event. */ -class GetOneRoomEventJob : public BaseJob { +class QUOTIENT_API GetOneRoomEventJob : public BaseJob { public: /*! \brief Get a single event by event ID. * @@ -48,7 +48,7 @@ public: * state of the room. If the user has left the room then the state is * taken from the state of the room when they left. */ -class GetRoomStateWithKeyJob : public BaseJob { +class QUOTIENT_API GetRoomStateWithKeyJob : public BaseJob { public: /*! \brief Get the state identified by the type and key. * @@ -80,7 +80,7 @@ public: * * Get the state events for the current state of a room. */ -class GetRoomStateJob : public BaseJob { +class QUOTIENT_API GetRoomStateJob : public BaseJob { public: /*! \brief Get all state events in the current state of a room. * @@ -106,7 +106,7 @@ public: * * Get the list of members for this room. */ -class GetMembersByRoomJob : public BaseJob { +class QUOTIENT_API GetMembersByRoomJob : public BaseJob { public: /*! \brief Get the m.room.member events for the room. * @@ -161,7 +161,7 @@ public: * respond than `/members` as it can be implemented more efficiently on the * server. */ -class GetJoinedMembersByRoomJob : public BaseJob { +class QUOTIENT_API GetJoinedMembersByRoomJob : public BaseJob { public: // Inner data structures -- cgit v1.2.3 From 42811660094c88a4a1bfa8bd8ace5f4b148c246a Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Tue, 31 May 2022 18:24:53 +0200 Subject: Regenerate API files (FTBFS; see the next commit) --- lib/csapi/rooms.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index f0815109..247fb13f 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -5,7 +5,6 @@ #pragma once #include "events/eventloader.h" -#include "events/roommemberevent.h" #include "jobs/basejob.h" namespace Quotient { @@ -38,7 +37,7 @@ public: // Result properties /// The full event. - EventPtr event() { return fromJson(jsonData()); } + RoomEventPtr event() { return fromJson(jsonData()); } }; /*! \brief Get the state identified by the type and key. @@ -146,10 +145,7 @@ public: // Result properties /// Get the list of members for this room. - EventsArray chunk() - { - return takeFromJson>("chunk"_ls); - } + StateEvents chunk() { return takeFromJson("chunk"_ls); } }; /*! \brief Gets the list of currently joined users and their profile data. @@ -157,9 +153,8 @@ public: * This API returns a map of MXIDs to member info objects for members of the * room. The current user must be in the room for it to work, unless it is an * Application Service in which case any of the AS's users must be in the room. - * This API is primarily for Application Services and should be faster to - * respond than `/members` as it can be implemented more efficiently on the - * server. + * This API is primarily for Application Services and should be faster to respond + * than `/members` as it can be implemented more efficiently on the server. */ class QUOTIENT_API GetJoinedMembersByRoomJob : public BaseJob { public: -- cgit v1.2.3 From d5eef705b2b5d9dec17d72ab27cbdd48a1391485 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 12 Aug 2022 17:07:55 +0200 Subject: Regenerate CS API upon GTAD config change --- lib/csapi/rooms.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/csapi/rooms.h') diff --git a/lib/csapi/rooms.h b/lib/csapi/rooms.h index 247fb13f..7823a1b0 100644 --- a/lib/csapi/rooms.h +++ b/lib/csapi/rooms.h @@ -4,7 +4,8 @@ #pragma once -#include "events/eventloader.h" +#include "events/roomevent.h" +#include "events/stateevent.h" #include "jobs/basejob.h" namespace Quotient { -- cgit v1.2.3