aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/filter.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/csapi/filter.h')
-rw-r--r--lib/csapi/filter.h35
1 files changed, 9 insertions, 26 deletions
diff --git a/lib/csapi/filter.h b/lib/csapi/filter.h
index 7a0f8958..9aa7dc79 100644
--- a/lib/csapi/filter.h
+++ b/lib/csapi/filter.h
@@ -4,16 +4,12 @@
#pragma once
-#include "converters.h"
-
#include "csapi/definitions/sync_filter.h"
#include "jobs/basejob.h"
namespace Quotient {
-// Operations
-
/*! \brief Upload a new filter.
*
* Uploads a new filter definition to the homeserver.
@@ -24,30 +20,23 @@ class DefineFilterJob : public BaseJob {
public:
/*! \brief Upload a new filter.
*
+ *
* \param userId
* The id of the user uploading the filter. The access token must be
- * authorized to make requests for this user id. \param filter Uploads a new
- * filter definition to the homeserver. Returns a filter ID that may be used
- * in future requests to restrict which events are returned to the client.
+ * authorized to make requests for this user id.
+ *
+ * \param filter
+ * The filter to upload.
*/
explicit DefineFilterJob(const QString& userId, const Filter& filter);
- ~DefineFilterJob() override;
-
// Result properties
/// The ID of the filter that was created. Cannot start
/// with a ``{`` as this character is used to determine
/// if the filter provided is inline JSON or a previously
/// declared filter by homeservers on some APIs.
- const QString& filterId() const;
-
-protected:
- Status parseJson(const QJsonDocument& data) override;
-
-private:
- class Private;
- QScopedPointer<Private> d;
+ QString filterId() const { return loadFromJson<QString>("filter_id"_ls); }
};
/*! \brief Download a filter
@@ -57,8 +46,10 @@ class GetFilterJob : public BaseJob {
public:
/*! \brief Download a filter
*
+ *
* \param userId
* The user ID to download a filter for.
+ *
* \param filterId
* The filter ID to download.
*/
@@ -71,19 +62,11 @@ public:
*/
static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId,
const QString& filterId);
- ~GetFilterJob() override;
// Result properties
/// "The filter defintion"
- const Filter& data() const;
-
-protected:
- Status parseJson(const QJsonDocument& data) override;
-
-private:
- class Private;
- QScopedPointer<Private> d;
+ Filter data() const { return fromJson<Filter>(jsonData()); }
};
} // namespace Quotient