28 lines
861 B
C++
28 lines
861 B
C++
//SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
|
|
//SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#include "test.h"
|
|
|
|
const std::map<QString, QMetaType::Type> Request::Test::structure({
|
|
{"type", QMetaType::QString}, {"version", QMetaType::QString},
|
|
});
|
|
|
|
Request::Test::Test (const QString& path):
|
|
Request(path + "/test")
|
|
{}
|
|
|
|
void Request::Test::onSuccess (const QVariantMap& data) {
|
|
if (!validateResponse(data, structure))
|
|
return onError("Malformed response", data);
|
|
|
|
QString type = data.value("type").toString();
|
|
if (type != "pica")
|
|
return onError("server of this type (" + type + ") is not supported", data);
|
|
|
|
QString version = data.value("version").toString();
|
|
if (version != "0.0.1")
|
|
return onError("server of this version (" + version + ") is not supported", data);
|
|
|
|
Request::onSuccess(data);
|
|
}
|