diff options
Diffstat (limited to 'lib/csapi/filter.cpp')
-rw-r--r-- | lib/csapi/filter.cpp | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/lib/csapi/filter.cpp b/lib/csapi/filter.cpp index 982e60b5..40743de4 100644 --- a/lib/csapi/filter.cpp +++ b/lib/csapi/filter.cpp @@ -15,32 +15,29 @@ static const auto basePath = QStringLiteral("/_matrix/client/r0"); class DefineFilterJob::Private { public: - QString filterId; + QString filterId; }; static const auto DefineFilterJobName = QStringLiteral("DefineFilterJob"); DefineFilterJob::DefineFilterJob(const QString& userId, const Filter& filter) : BaseJob(HttpVerb::Post, DefineFilterJobName, - basePath % "/user/" % userId % "/filter") - , d(new Private) + basePath % "/user/" % userId % "/filter"), + d(new Private) { setRequestData(Data(toJson(filter))); } DefineFilterJob::~DefineFilterJob() = default; -const QString& DefineFilterJob::filterId() const -{ - return d->filterId; -} +const QString& DefineFilterJob::filterId() const { return d->filterId; } BaseJob::Status DefineFilterJob::parseJson(const QJsonDocument& data) { auto json = data.object(); if (!json.contains("filter_id"_ls)) return { JsonParseError, - "The key 'filter_id' not found in the response" }; + "The key 'filter_id' not found in the response" }; fromJson(json.value("filter_id"_ls), d->filterId); return Success; } @@ -48,34 +45,32 @@ BaseJob::Status DefineFilterJob::parseJson(const QJsonDocument& data) class GetFilterJob::Private { public: - Filter data; + Filter data; }; -QUrl GetFilterJob::makeRequestUrl(QUrl baseUrl, const QString& userId, const QString& filterId) +QUrl GetFilterJob::makeRequestUrl(QUrl baseUrl, const QString& userId, + const QString& filterId) { return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/user/" % userId % "/filter/" % filterId); + basePath % "/user/" % userId % "/filter/" + % filterId); } static const auto GetFilterJobName = QStringLiteral("GetFilterJob"); GetFilterJob::GetFilterJob(const QString& userId, const QString& filterId) : BaseJob(HttpVerb::Get, GetFilterJobName, - basePath % "/user/" % userId % "/filter/" % filterId) - , d(new Private) + basePath % "/user/" % userId % "/filter/" % filterId), + d(new Private) { } GetFilterJob::~GetFilterJob() = default; -const Filter& GetFilterJob::data() const -{ - return d->data; -} +const Filter& GetFilterJob::data() const { return d->data; } BaseJob::Status GetFilterJob::parseJson(const QJsonDocument& data) { fromJson(data, d->data); return Success; } - |