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/notifications.h | 114 +++++++++++++++++++++++----------------------- 1 file changed, 58 insertions(+), 56 deletions(-) (limited to 'lib/csapi/notifications.h') diff --git a/lib/csapi/notifications.h b/lib/csapi/notifications.h index 898b5154..49bc33e9 100644 --- a/lib/csapi/notifications.h +++ b/lib/csapi/notifications.h @@ -6,14 +6,13 @@ #include "jobs/basejob.h" -#include "events/eventloader.h" #include "converters.h" -#include -#include +#include "events/eventloader.h" #include +#include +#include -namespace QMatrixClient -{ +namespace QMatrixClient { // Operations /// Gets a list of events that the user has been notified about @@ -23,67 +22,70 @@ namespace QMatrixClient class GetNotificationsJob : public BaseJob { public: - // Inner data structures + // Inner data structures - /// This API is used to paginate through the list of events that the - /// user has been, or would have been notified about. - struct Notification - { - /// The action(s) to perform when the conditions for this rule are met. - /// See `Push Rules: API`_. - QVector actions; - /// The Event object for the event that triggered the notification. - EventPtr event; - /// The profile tag of the rule that matched this event. - QString profileTag; - /// Indicates whether the user has sent a read receipt indicating - /// that they have read this message. - bool read; - /// The ID of the room in which the event was posted. - QString roomId; - /// The unix timestamp at which the event notification was sent, - /// in milliseconds. - int ts; - }; + /// This API is used to paginate through the list of events that the + /// user has been, or would have been notified about. + struct Notification { + /// The action(s) to perform when the conditions for this rule are + /// met. See `Push Rules: API`_. + QVector actions; + /// The Event object for the event that triggered the notification. + EventPtr event; + /// The profile tag of the rule that matched this event. + QString profileTag; + /// Indicates whether the user has sent a read receipt indicating + /// that they have read this message. + bool read; + /// The ID of the room in which the event was posted. + QString roomId; + /// The unix timestamp at which the event notification was sent, + /// in milliseconds. + int ts; + }; - // Construction/destruction + // Construction/destruction - /*! Gets a list of events that the user has been notified about - * \param from - * Pagination token given to retrieve the next set of events. - * \param limit - * Limit on the number of events to return in this request. - * \param only - * Allows basic filtering of events returned. Supply ``highlight`` - * to return only events where the notification had the highlight - * tweak set. - */ - explicit GetNotificationsJob(const QString& from = {}, Omittable limit = none, const QString& only = {}); + /*! Gets a list of events that the user has been notified about + * \param from + * Pagination token given to retrieve the next set of events. + * \param limit + * Limit on the number of events to return in this request. + * \param only + * Allows basic filtering of events returned. Supply ``highlight`` + * to return only events where the notification had the highlight + * tweak set. + */ + explicit GetNotificationsJob(const QString& from = {}, + Omittable limit = none, + const QString& only = {}); - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * GetNotificationsJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& from = {}, Omittable limit = none, const QString& only = {}); + /*! Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for + * GetNotificationsJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& from = {}, + Omittable limit = none, + const QString& only = {}); - ~GetNotificationsJob() override; + ~GetNotificationsJob() override; - // Result properties + // Result properties - /// The token to supply in the ``from`` param of the next - /// ``/notifications`` request in order to request more - /// events. If this is absent, there are no more results. - const QString& nextToken() const; - /// The list of events that triggered notifications. - std::vector&& notifications(); + /// The token to supply in the ``from`` param of the next + /// ``/notifications`` request in order to request more + /// events. If this is absent, there are no more results. + const QString& nextToken() const; + /// The list of events that triggered notifications. + std::vector&& notifications(); 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/notifications.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/csapi/notifications.h') diff --git a/lib/csapi/notifications.h b/lib/csapi/notifications.h index 4170d539..eeec5d4e 100644 --- a/lib/csapi/notifications.h +++ b/lib/csapi/notifications.h @@ -13,7 +13,7 @@ #include #include -namespace QMatrixClient +namespace Quotient { // Operations @@ -94,4 +94,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/notifications.h | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'lib/csapi/notifications.h') diff --git a/lib/csapi/notifications.h b/lib/csapi/notifications.h index eeec5d4e..0e86e424 100644 --- a/lib/csapi/notifications.h +++ b/lib/csapi/notifications.h @@ -13,45 +13,43 @@ #include #include -namespace Quotient -{ +namespace Quotient { // Operations -/// Gets a list of events that the user has been notified about -/*! +/*! \brief Gets a list of events that the user has been notified about + * * This API is used to paginate through the list of events that the * user has been, or would have been notified about. */ -class GetNotificationsJob : public BaseJob -{ +class GetNotificationsJob : public BaseJob { public: // Inner data structures - /// This API is used to paginate through the list of events that theuser has - /// been, or would have been notified about. - struct Notification - { - /// The action(s) to perform when the conditions for this rule are - /// met.See `Push Rules: API`_. + /// This API is used to paginate through the list of events that the + /// user has been, or would have been notified about. + struct Notification { + /// The action(s) to perform when the conditions for this rule are met. + /// See `Push Rules: API`_. QVector actions; /// The Event object for the event that triggered the notification. EventPtr event; /// The profile tag of the rule that matched this event. QString profileTag; - /// Indicates whether the user has sent a read receipt indicatingthat - /// they have read this message. + /// Indicates whether the user has sent a read receipt indicating + /// that they have read this message. bool read; /// The ID of the room in which the event was posted. QString roomId; - /// The unix timestamp at which the event notification was sent,in - /// milliseconds. + /// The unix timestamp at which the event notification was sent, + /// in milliseconds. int ts; }; // Construction/destruction - /*! Gets a list of events that the user has been notified about + /*! \brief Gets a list of events that the user has been notified about + * * \param from * Pagination token given to retrieve the next set of events. * \param limit @@ -65,16 +63,14 @@ public: Omittable limit = none, const QString& only = {}); - /*! 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 - * GetNotificationsJob is necessary but the job - * itself isn't. + * This function can be used when a URL for GetNotificationsJob + * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& from = {}, Omittable limit = none, const QString& only = {}); - ~GetNotificationsJob() override; // Result properties @@ -83,6 +79,7 @@ public: /// ``/notifications`` request in order to request more /// events. If this is absent, there are no more results. const QString& nextToken() const; + /// The list of events that triggered notifications. std::vector&& notifications(); -- 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/notifications.h | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'lib/csapi/notifications.h') diff --git a/lib/csapi/notifications.h b/lib/csapi/notifications.h index 0e86e424..095e9325 100644 --- a/lib/csapi/notifications.h +++ b/lib/csapi/notifications.h @@ -4,19 +4,11 @@ #pragma once -#include "converters.h" - #include "events/eventloader.h" #include "jobs/basejob.h" -#include -#include -#include - namespace Quotient { -// Operations - /*! \brief Gets a list of events that the user has been notified about * * This API is used to paginate through the list of events that the @@ -49,11 +41,14 @@ public: // Construction/destruction /*! \brief Gets a list of events that the user has been notified about + * * * \param from * Pagination token given to retrieve the next set of events. + * * \param limit * Limit on the number of events to return in this request. + * * \param only * Allows basic filtering of events returned. Supply ``highlight`` * to return only events where the notification had the highlight @@ -71,24 +66,33 @@ public: static QUrl makeRequestUrl(QUrl baseUrl, const QString& from = {}, Omittable limit = none, const QString& only = {}); - ~GetNotificationsJob() override; // Result properties /// The token to supply in the ``from`` param of the next /// ``/notifications`` request in order to request more /// events. If this is absent, there are no more results. - const QString& nextToken() const; + QString nextToken() const { return loadFromJson("next_token"_ls); } /// The list of events that triggered notifications. - std::vector&& notifications(); - -protected: - Status parseJson(const QJsonDocument& data) override; + std::vector notifications() + { + return takeFromJson>("notifications"_ls); + } +}; -private: - class Private; - QScopedPointer d; +template <> +struct JsonObjectConverter { + static void fillFrom(const QJsonObject& jo, + GetNotificationsJob::Notification& result) + { + fromJson(jo.value("actions"_ls), result.actions); + fromJson(jo.value("event"_ls), result.event); + fromJson(jo.value("profile_tag"_ls), result.profileTag); + fromJson(jo.value("read"_ls), result.read); + fromJson(jo.value("room_id"_ls), result.roomId); + fromJson(jo.value("ts"_ls), result.ts); + } }; } // 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/notifications.h | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/csapi/notifications.h') diff --git a/lib/csapi/notifications.h b/lib/csapi/notifications.h index 095e9325..ff499c7a 100644 --- a/lib/csapi/notifications.h +++ b/lib/csapi/notifications.h @@ -41,7 +41,6 @@ public: // Construction/destruction /*! \brief Gets a list of events that the user has been notified about - * * * \param from * Pagination token given to retrieve the next set of events. -- cgit v1.2.3