feat: add some api calls to modrinth

Calls added:
- Get version from hash
- Get versions from hashes
- Latest version of a project from a hash, loader(s), and game version(s)
- Latest versions of multiple project from hashes, loader(s), and game version(s)

Some of those are not used yet, but may be of use later on, so we have
it if we need it :)

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow
2022-06-03 19:04:49 -03:00
parent 32a9545360
commit 0e52112016
6 changed files with 141 additions and 9 deletions

View File

@ -22,10 +22,32 @@
#include "modplatform/ModAPI.h"
#include "modplatform/ModIndex.h"
#include "modplatform/helpers/NetworkModAPI.h"
#include "net/NetJob.h"
#include <QDebug>
class ModrinthAPI : public NetworkModAPI {
public:
auto currentVersion(QString hash,
QString hash_format,
QByteArray* response) -> NetJob::Ptr;
auto currentVersions(const QStringList& hashes,
QString hash_format,
QByteArray* response) -> NetJob::Ptr;
auto latestVersion(QString hash,
QString hash_format,
std::list<Version> mcVersions,
ModLoaderTypes loaders,
QByteArray* response) -> NetJob::Ptr;
auto latestVersions(const QStringList& hashes,
QString hash_format,
std::list<Version> mcVersions,
ModLoaderTypes loaders,
QByteArray* response) -> NetJob::Ptr;
public:
inline auto getAuthorURL(const QString& name) const -> QString { return "https://modrinth.com/user/" + name; };