diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-09-02 16:08:13 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-09-29 22:00:06 +0900 |
commit | 1e6510790dab6b9141ae52993987b406399668cd (patch) | |
tree | 1a45c0ccfec8f5f7ba37eb4385cdc7f61afa0c97 /lib/csapi/filter.cpp | |
parent | 4244cee8d5e0f760cccd2b45ad587670573ef03c (diff) | |
download | libquotient-1e6510790dab6b9141ae52993987b406399668cd.tar.gz libquotient-1e6510790dab6b9141ae52993987b406399668cd.zip |
Support CS API 0.4.0
Numerous changes in CS (and now also AS) API, including compatibility-breaking ones - see the diff for details.
Diffstat (limited to 'lib/csapi/filter.cpp')
-rw-r--r-- | lib/csapi/filter.cpp | 15 |
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; } |