refactor: move NetJob away from ModModel to ModAPI
This is done so that 1. ModAPI behaves more like an actual API instead of just a helper, and 2. Allows for more easily creating other mod providers that may or may not use network tasks (foreshadowing lol)
This commit is contained in:
@ -1,21 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QString>
|
||||
|
||||
namespace ModPlatform {
|
||||
class ListModel;
|
||||
}
|
||||
|
||||
class ModAPI {
|
||||
public:
|
||||
virtual ~ModAPI() = default;
|
||||
protected:
|
||||
using CallerType = ModPlatform::ListModel;
|
||||
|
||||
// https://docs.curseforge.com/?http#tocS_ModLoaderType
|
||||
enum ModLoaderType {
|
||||
Any = 0,
|
||||
Forge = 1,
|
||||
Cauldron = 2,
|
||||
LiteLoader = 3,
|
||||
Fabric = 4
|
||||
};
|
||||
public:
|
||||
virtual ~ModAPI() = default;
|
||||
|
||||
inline virtual QString getModSearchURL(int, QString, QString, ModLoaderType, QString) const { return ""; };
|
||||
inline virtual QString getVersionsURL(const QString& addonId) const { return ""; };
|
||||
inline virtual QString getAuthorURL(const QString& name) const { return ""; };
|
||||
// https://docs.curseforge.com/?http#tocS_ModLoaderType
|
||||
enum ModLoaderType { Any = 0, Forge = 1, Cauldron = 2, LiteLoader = 3, Fabric = 4 };
|
||||
|
||||
struct SearchArgs {
|
||||
int offset;
|
||||
QString search;
|
||||
QString sorting;
|
||||
ModLoaderType mod_loader;
|
||||
QString version;
|
||||
};
|
||||
|
||||
inline virtual void searchMods(CallerType* caller, SearchArgs&& args) const {};
|
||||
inline virtual void getVersions(CallerType* caller, const QString& addonId, const QString& debugName = "") const {};
|
||||
};
|
||||
|
Reference in New Issue
Block a user