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/filter.cpp | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'lib/csapi/filter.cpp') 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; } - -- cgit v1.2.3 From 93f0c8fe89f448d1d58caa757573f17102369471 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 7 Jun 2019 19:16:33 +0900 Subject: Generated files in csapi/: switch from now-deprecated JsonParserError to IncorrectResponse --- lib/csapi/filter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/csapi/filter.cpp') diff --git a/lib/csapi/filter.cpp b/lib/csapi/filter.cpp index 982e60b5..9f412d53 100644 --- a/lib/csapi/filter.cpp +++ b/lib/csapi/filter.cpp @@ -39,7 +39,7 @@ BaseJob::Status DefineFilterJob::parseJson(const QJsonDocument& data) { auto json = data.object(); if (!json.contains("filter_id"_ls)) - return { JsonParseError, + return { IncorrectResponse, "The key 'filter_id' not found in the response" }; fromJson(json.value("filter_id"_ls), d->filterId); return Success; -- 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/filter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/csapi/filter.cpp') diff --git a/lib/csapi/filter.cpp b/lib/csapi/filter.cpp index 79dd5ea5..b4160ba4 100644 --- a/lib/csapi/filter.cpp +++ b/lib/csapi/filter.cpp @@ -8,7 +8,7 @@ #include -using namespace QMatrixClient; +using namespace Quotient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); -- 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/filter.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'lib/csapi/filter.cpp') diff --git a/lib/csapi/filter.cpp b/lib/csapi/filter.cpp index b4160ba4..98b85f83 100644 --- a/lib/csapi/filter.cpp +++ b/lib/csapi/filter.cpp @@ -12,16 +12,13 @@ using namespace Quotient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); -class DefineFilterJob::Private -{ +class DefineFilterJob::Private { public: QString filterId; }; -static const auto DefineFilterJobName = QStringLiteral("DefineFilterJob"); - DefineFilterJob::DefineFilterJob(const QString& userId, const Filter& filter) - : BaseJob(HttpVerb::Post, DefineFilterJobName, + : BaseJob(HttpVerb::Post, QStringLiteral("DefineFilterJob"), basePath % "/user/" % userId % "/filter") , d(new Private) { @@ -43,8 +40,7 @@ BaseJob::Status DefineFilterJob::parseJson(const QJsonDocument& data) return Success; } -class GetFilterJob::Private -{ +class GetFilterJob::Private { public: Filter data; }; @@ -57,10 +53,8 @@ QUrl GetFilterJob::makeRequestUrl(QUrl baseUrl, const QString& userId, % filterId); } -static const auto GetFilterJobName = QStringLiteral("GetFilterJob"); - GetFilterJob::GetFilterJob(const QString& userId, const QString& filterId) - : BaseJob(HttpVerb::Get, GetFilterJobName, + : BaseJob(HttpVerb::Get, QStringLiteral("GetFilterJob"), basePath % "/user/" % userId % "/filter/" % filterId) , d(new Private) {} @@ -72,5 +66,6 @@ const Filter& GetFilterJob::data() const { return d->data; } BaseJob::Status GetFilterJob::parseJson(const QJsonDocument& data) { fromJson(data, d->data); + return Success; } -- 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/filter.cpp | 55 ++++++++-------------------------------------------- 1 file changed, 8 insertions(+), 47 deletions(-) (limited to 'lib/csapi/filter.cpp') diff --git a/lib/csapi/filter.cpp b/lib/csapi/filter.cpp index 98b85f83..bb3a893f 100644 --- a/lib/csapi/filter.cpp +++ b/lib/csapi/filter.cpp @@ -4,68 +4,29 @@ #include "filter.h" -#include "converters.h" - #include using namespace Quotient; -static const auto basePath = QStringLiteral("/_matrix/client/r0"); - -class DefineFilterJob::Private { -public: - QString filterId; -}; - DefineFilterJob::DefineFilterJob(const QString& userId, const Filter& filter) : BaseJob(HttpVerb::Post, QStringLiteral("DefineFilterJob"), - basePath % "/user/" % userId % "/filter") - , d(new Private) + QStringLiteral("/_matrix/client/r0") % "/user/" % userId + % "/filter") { setRequestData(Data(toJson(filter))); + addExpectedKey("filter_id"); } -DefineFilterJob::~DefineFilterJob() = default; - -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 { IncorrectResponse, - "The key 'filter_id' not found in the response" }; - fromJson(json.value("filter_id"_ls), d->filterId); - - return Success; -} - -class GetFilterJob::Private { -public: - Filter data; -}; - QUrl GetFilterJob::makeRequestUrl(QUrl baseUrl, const QString& userId, const QString& filterId) { - return BaseJob::makeRequestUrl(std::move(baseUrl), basePath % "/user/" - % userId % "/filter/" - % filterId); + return BaseJob::makeRequestUrl(std::move(baseUrl), + QStringLiteral("/_matrix/client/r0") % "/user/" + % userId % "/filter/" % filterId); } GetFilterJob::GetFilterJob(const QString& userId, const QString& filterId) : BaseJob(HttpVerb::Get, QStringLiteral("GetFilterJob"), - basePath % "/user/" % userId % "/filter/" % filterId) - , d(new Private) + QStringLiteral("/_matrix/client/r0") % "/user/" % userId + % "/filter/" % filterId) {} - -GetFilterJob::~GetFilterJob() = default; - -const Filter& GetFilterJob::data() const { return d->data; } - -BaseJob::Status GetFilterJob::parseJson(const QJsonDocument& data) -{ - fromJson(data, d->data); - - return Success; -} -- cgit v1.2.3