19 lines
616 B
C++
19 lines
616 B
C++
//SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
|
|
//SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#include "assets.h"
|
|
|
|
#include "utils/helpers.h"
|
|
|
|
Request::Assets::Assets (const QUrl& baseUrl):
|
|
Request(createUrl(baseUrl, "/assets")) {}
|
|
|
|
void Request::Assets::onSuccess (const QVariantMap& data) {
|
|
QVariantMap::ConstIterator itr = data.find("assets");
|
|
if (itr == data.constEnd() || !itr->canConvert<QVariantList>())
|
|
return Request::onError("Error receiving assets: assets are missing or not in an array", std::nullopt);
|
|
|
|
emit success(qast<QVariantList>(itr.value()));
|
|
emit done();
|
|
}
|