aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/filter.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-09-29 22:22:49 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-09-29 22:22:49 +0900
commitb55334ac0fe89f780776bc4eab90ffe1ca3c57bb (patch)
tree1a45c0ccfec8f5f7ba37eb4385cdc7f61afa0c97 /lib/csapi/filter.cpp
parentf5c2e47fa1ab84fdaffe03c30ba973d7dea5ac05 (diff)
parent1e6510790dab6b9141ae52993987b406399668cd (diff)
downloadlibquotient-b55334ac0fe89f780776bc4eab90ffe1ca3c57bb.tar.gz
libquotient-b55334ac0fe89f780776bc4eab90ffe1ca3c57bb.zip
Merge branch 'cs-api-0.4.0'
Diffstat (limited to 'lib/csapi/filter.cpp')
-rw-r--r--lib/csapi/filter.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/csapi/filter.cpp b/lib/csapi/filter.cpp
index 51056cc3..77dc9b92 100644
--- a/lib/csapi/filter.cpp
+++ b/lib/csapi/filter.cpp
@@ -20,7 +20,7 @@ class DefineFilterJob::Private
static const auto DefineFilterJobName = QStringLiteral("DefineFilterJob");
-DefineFilterJob::DefineFilterJob(const QString& userId, const SyncFilter& filter)
+DefineFilterJob::DefineFilterJob(const QString& userId, const Filter& filter)
: BaseJob(HttpVerb::Post, DefineFilterJobName,
basePath % "/user/" % userId % "/filter")
, d(new Private)
@@ -38,6 +38,9 @@ const QString& DefineFilterJob::filterId() const
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" };
d->filterId = fromJson<QString>(json.value("filter_id"_ls));
return Success;
}
@@ -45,7 +48,7 @@ BaseJob::Status DefineFilterJob::parseJson(const QJsonDocument& data)
class GetFilterJob::Private
{
public:
- SyncFilter data;
+ Filter data;
};
QUrl GetFilterJob::makeRequestUrl(QUrl baseUrl, const QString& userId, const QString& filterId)
@@ -65,18 +68,14 @@ GetFilterJob::GetFilterJob(const QString& userId, const QString& filterId)
GetFilterJob::~GetFilterJob() = default;
-const SyncFilter& GetFilterJob::data() const
+const Filter& GetFilterJob::data() const
{
return d->data;
}
BaseJob::Status GetFilterJob::parseJson(const QJsonDocument& data)
{
- auto json = data.object();
- if (!json.contains("data"_ls))
- return { JsonParseError,
- "The key 'data' not found in the response" };
- d->data = fromJson<SyncFilter>(json.value("data"_ls));
+ d->data = fromJson<Filter>(data);
return Success;
}