feat: add 'getFiles' by fileIds route in Flame API
Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
208ed73e59
commit
242fb156a2
@ -183,3 +183,26 @@ auto FlameAPI::getProjects(QStringList addonIds, QByteArray* response) const ->
|
||||
|
||||
return netJob;
|
||||
}
|
||||
|
||||
auto FlameAPI::getFiles(QStringList fileIds, QByteArray* response) const -> NetJob*
|
||||
{
|
||||
auto* netJob = new NetJob(QString("Flame::GetFiles"), APPLICATION->network());
|
||||
|
||||
QJsonObject body_obj;
|
||||
QJsonArray files_arr;
|
||||
for (auto& fileId : fileIds) {
|
||||
files_arr.append(fileId);
|
||||
}
|
||||
|
||||
body_obj["fileIds"] = files_arr;
|
||||
|
||||
QJsonDocument body(body_obj);
|
||||
auto body_raw = body.toJson();
|
||||
|
||||
netJob->addNetAction(Net::Upload::makeByteArray(QString("https://api.curseforge.com/v1/mods/files"), response, body_raw));
|
||||
|
||||
QObject::connect(netJob, &NetJob::finished, [response, netJob] { delete response; netJob->deleteLater(); });
|
||||
QObject::connect(netJob, &NetJob::failed, [body_raw] { qDebug() << body_raw; });
|
||||
|
||||
return netJob;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ class FlameAPI : public NetworkModAPI {
|
||||
auto getLatestVersion(VersionSearchArgs&& args) -> ModPlatform::IndexedVersion;
|
||||
|
||||
auto getProjects(QStringList addonIds, QByteArray* response) const -> NetJob* override;
|
||||
auto getFiles(QStringList fileIds, QByteArray* response) const -> NetJob*;
|
||||
|
||||
private:
|
||||
inline auto getSortFieldInt(QString sortString) const -> int
|
||||
|
Loading…
Reference in New Issue
Block a user