| 185 | } |
| 186 | |
| 187 | auto FlameAPI::getFiles(const QStringList& fileIds, QByteArray* response) const -> NetJob* |
| 188 | { |
| 189 | auto* netJob = new NetJob(QString("Flame::GetFiles"), APPLICATION->network()); |
| 190 | |
| 191 | QJsonObject body_obj; |
| 192 | QJsonArray files_arr; |
| 193 | for (auto& fileId : fileIds) { |
| 194 | files_arr.append(fileId); |
| 195 | } |
| 196 | |
| 197 | body_obj["fileIds"] = files_arr; |
| 198 | |
| 199 | QJsonDocument body(body_obj); |
| 200 | auto body_raw = body.toJson(); |
| 201 | |
| 202 | netJob->addNetAction(Net::Upload::makeByteArray(QString("https://api.curseforge.com/v1/mods/files"), response, body_raw)); |
| 203 | |
| 204 | QObject::connect(netJob, &NetJob::finished, [response, netJob] { delete response; netJob->deleteLater(); }); |
| 205 | QObject::connect(netJob, &NetJob::failed, [body_raw] { qDebug() << body_raw; }); |
| 206 | |
| 207 | return netJob; |
| 208 | } |
no test coverage detected