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 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/notifications.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib/csapi/notifications.h') diff --git a/lib/csapi/notifications.h b/lib/csapi/notifications.h index ff499c7a..0cc165ce 100644 --- a/lib/csapi/notifications.h +++ b/lib/csapi/notifications.h @@ -22,7 +22,7 @@ public: /// 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`_. + /// See [Push Rules: API](/client-server-api/#push-rules-api). QVector actions; /// The Event object for the event that triggered the notification. EventPtr event; @@ -35,7 +35,7 @@ public: QString roomId; /// The unix timestamp at which the event notification was sent, /// in milliseconds. - int ts; + qint64 ts; }; // Construction/destruction @@ -49,7 +49,7 @@ public: * Limit on the number of events to return in this request. * * \param only - * Allows basic filtering of events returned. Supply ``highlight`` + * Allows basic filtering of events returned. Supply `highlight` * to return only events where the notification had the highlight * tweak set. */ @@ -68,10 +68,13 @@ public: // Result properties - /// The token to supply in the ``from`` param of the next - /// ``/notifications`` request in order to request more + /// 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. - QString nextToken() const { return loadFromJson("next_token"_ls); } + QString nextToken() const + { + return loadFromJson("next_token"_ls); + } /// The list of events that triggered notifications. std::vector notifications() -- 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/notifications.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/csapi/notifications.h') diff --git a/lib/csapi/notifications.h b/lib/csapi/notifications.h index 0cc165ce..0c38fe6b 100644 --- a/lib/csapi/notifications.h +++ b/lib/csapi/notifications.h @@ -71,10 +71,7 @@ public: /// 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. - QString nextToken() const - { - return loadFromJson("next_token"_ls); - } + QString nextToken() const { return loadFromJson("next_token"_ls); } /// The list of events that triggered notifications. std::vector notifications() -- 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/notifications.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/csapi/notifications.h') diff --git a/lib/csapi/notifications.h b/lib/csapi/notifications.h index 0c38fe6b..23211758 100644 --- a/lib/csapi/notifications.h +++ b/lib/csapi/notifications.h @@ -14,7 +14,7 @@ namespace Quotient { * 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 QUOTIENT_API GetNotificationsJob : 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/notifications.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/csapi/notifications.h') diff --git a/lib/csapi/notifications.h b/lib/csapi/notifications.h index 23211758..48167877 100644 --- a/lib/csapi/notifications.h +++ b/lib/csapi/notifications.h @@ -43,7 +43,8 @@ public: /*! \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. + * Pagination token to continue from. This should be the `next_token` + * returned from an earlier call to this endpoint. * * \param limit * Limit on the number of events to return in this request. -- 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/notifications.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/csapi/notifications.h') diff --git a/lib/csapi/notifications.h b/lib/csapi/notifications.h index 48167877..ff8aa47f 100644 --- a/lib/csapi/notifications.h +++ b/lib/csapi/notifications.h @@ -4,7 +4,7 @@ #pragma once -#include "events/eventloader.h" +#include "events/event.h" #include "jobs/basejob.h" namespace Quotient { -- cgit v1.2.3