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/pusher.h | 58 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 13 deletions(-) (limited to 'lib/csapi/pusher.h') diff --git a/lib/csapi/pusher.h b/lib/csapi/pusher.h index d60a2b56..40cd5796 100644 --- a/lib/csapi/pusher.h +++ b/lib/csapi/pusher.h @@ -4,16 +4,10 @@ #pragma once -#include "converters.h" - #include "jobs/basejob.h" -#include - namespace Quotient { -// Operations - /*! \brief Gets the current pushers for the authenticated user * * Gets all currently active pushers for the authenticated user. @@ -73,19 +67,39 @@ public: * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl); - ~GetPushersJob() override; // Result properties /// An array containing the current pushers for the user - const QVector& pushers() const; + QVector pushers() const + { + return loadFromJson>("pushers"_ls); + } +}; -protected: - Status parseJson(const QJsonDocument& data) override; +template <> +struct JsonObjectConverter { + static void fillFrom(const QJsonObject& jo, + GetPushersJob::PusherData& result) + { + fromJson(jo.value("url"_ls), result.url); + fromJson(jo.value("format"_ls), result.format); + } +}; -private: - class Private; - QScopedPointer d; +template <> +struct JsonObjectConverter { + static void fillFrom(const QJsonObject& jo, GetPushersJob::Pusher& result) + { + fromJson(jo.value("pushkey"_ls), result.pushkey); + fromJson(jo.value("kind"_ls), result.kind); + fromJson(jo.value("app_id"_ls), result.appId); + fromJson(jo.value("app_display_name"_ls), result.appDisplayName); + fromJson(jo.value("device_display_name"_ls), result.deviceDisplayName); + fromJson(jo.value("profile_tag"_ls), result.profileTag); + fromJson(jo.value("lang"_ls), result.lang); + fromJson(jo.value("data"_ls), result.data); + } }; /*! \brief Modify a pusher for this user on the homeserver. @@ -117,6 +131,7 @@ public: // Construction/destruction /*! \brief Modify a pusher for this user on the homeserver. + * * * \param pushkey * This is a unique identifier for this pusher. The value you @@ -128,10 +143,12 @@ public: * * If the ``kind`` is ``"email"``, this is the email address to * send notifications to. + * * \param kind * The kind of pusher to configure. ``"http"`` makes a pusher that * sends HTTP pokes. ``"email"`` makes a pusher that emails the * user with unread notifications. ``null`` deletes the pusher. + * * \param appId * This is a reverse-DNS style identifier for the application. * It is recommended that this end with the platform, such that @@ -139,22 +156,28 @@ public: * Max length, 64 chars. * * If the ``kind`` is ``"email"``, this is ``"m.email"``. + * * \param appDisplayName * A string that will allow the user to identify what application * owns this pusher. + * * \param deviceDisplayName * A string that will allow the user to identify what device owns * this pusher. + * * \param lang * The preferred language for receiving notifications (e.g. 'en' * or 'en-US'). + * * \param data * A dictionary of information for the pusher implementation * itself. If ``kind`` is ``http``, this should contain ``url`` * which is the URL to use to send notifications to. + * * \param profileTag * This string determines which set of device specific rules this * pusher executes. + * * \param append * If true, the homeserver should add another pusher with the * given pushkey and App ID in addition to any others with @@ -170,4 +193,13 @@ public: Omittable append = none); }; +template <> +struct JsonObjectConverter { + static void dumpTo(QJsonObject& jo, const PostPusherJob::PusherData& pod) + { + addParam(jo, QStringLiteral("url"), pod.url); + addParam(jo, QStringLiteral("format"), pod.format); + } +}; + } // namespace Quotient -- cgit v1.2.3