removed static functions
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
5bd5627a96
commit
df9f54454a
@ -86,7 +86,7 @@ class FlameAPI : public NetworkResourceAPI {
|
||||
static const QString getModLoaderFilters(ModPlatform::ModLoaderTypes types) { return "[" + getModLoaderStrings(types).join(',') + "]"; }
|
||||
|
||||
public:
|
||||
static std::optional<QString> getStaticSearchURL(SearchArgs const& args)
|
||||
[[nodiscard]] std::optional<QString> getSearchURL(SearchArgs const& args) const override
|
||||
{
|
||||
QStringList get_arguments;
|
||||
get_arguments.append(QString("classId=%1").arg(getClassId(args.type)));
|
||||
@ -107,7 +107,6 @@ class FlameAPI : public NetworkResourceAPI {
|
||||
|
||||
return "https://api.curseforge.com/v1/mods/search?gameId=432&" + get_arguments.join('&');
|
||||
}
|
||||
[[nodiscard]] std::optional<QString> getSearchURL(SearchArgs const& args) const override { return getStaticSearchURL(args); }
|
||||
|
||||
private:
|
||||
[[nodiscard]] std::optional<QString> getInfoURL(QString const& id) const override
|
||||
|
@ -101,7 +101,7 @@ class ModrinthAPI : public NetworkResourceAPI {
|
||||
return "";
|
||||
}
|
||||
|
||||
[[nodiscard]] static QString createFacets(SearchArgs const& args)
|
||||
[[nodiscard]] QString createFacets(SearchArgs const& args) const
|
||||
{
|
||||
QStringList facets_list;
|
||||
|
||||
@ -123,7 +123,7 @@ class ModrinthAPI : public NetworkResourceAPI {
|
||||
}
|
||||
|
||||
public:
|
||||
static std::optional<QString> getStaticSearchURL(SearchArgs const& args)
|
||||
[[nodiscard]] inline auto getSearchURL(SearchArgs const& args) const -> std::optional<QString> override
|
||||
{
|
||||
if (args.loaders.has_value() && args.loaders.value() != 0) {
|
||||
if (!validateModLoaders(args.loaders.value())) {
|
||||
@ -144,11 +144,6 @@ class ModrinthAPI : public NetworkResourceAPI {
|
||||
return BuildConfig.MODRINTH_PROD_URL + "/search?" + get_arguments.join('&');
|
||||
};
|
||||
|
||||
[[nodiscard]] inline auto getSearchURL(SearchArgs const& args) const -> std::optional<QString> override
|
||||
{
|
||||
return getStaticSearchURL(args);
|
||||
}
|
||||
|
||||
inline auto getInfoURL(QString const& id) const -> std::optional<QString> override
|
||||
{
|
||||
return BuildConfig.MODRINTH_PROD_URL + "/project/" + id;
|
||||
@ -171,7 +166,7 @@ class ModrinthAPI : public NetworkResourceAPI {
|
||||
.arg(BuildConfig.MODRINTH_PROD_URL, args.pack.addonId.toString(), get_arguments.isEmpty() ? "" : "?", get_arguments.join('&'));
|
||||
};
|
||||
|
||||
static QString getGameVersionsArray(std::list<Version> mcVersions)
|
||||
QString getGameVersionsArray(std::list<Version> mcVersions) const
|
||||
{
|
||||
QString s;
|
||||
for (auto& ver : mcVersions) {
|
||||
|
@ -188,8 +188,8 @@ void ListModel::performPaginatedSearch()
|
||||
sort.index = currentSort + 1;
|
||||
|
||||
auto netJob = makeShared<NetJob>("Flame::Search", APPLICATION->network());
|
||||
auto searchUrl = FlameAPI::getStaticSearchURL({ ModPlatform::ResourceType::MODPACK, nextSearchOffset, currentSearchTerm, sort,
|
||||
m_filter->loaders, m_filter->versions, "", m_filter->categoryIds });
|
||||
auto searchUrl = FlameAPI().getSearchURL({ ModPlatform::ResourceType::MODPACK, nextSearchOffset, currentSearchTerm, sort,
|
||||
m_filter->loaders, m_filter->versions, "", m_filter->categoryIds });
|
||||
|
||||
netJob->addNetAction(Net::ApiDownload::makeByteArray(QUrl(searchUrl.value()), response));
|
||||
jobPtr = netJob;
|
||||
|
@ -154,8 +154,8 @@ void ModpackListModel::performPaginatedSearch()
|
||||
} // TODO: Move to standalone API
|
||||
ResourceAPI::SortingMethod sort{};
|
||||
sort.name = currentSort;
|
||||
auto searchUrl = ModrinthAPI::getStaticSearchURL({ ModPlatform::ResourceType::MODPACK, nextSearchOffset, currentSearchTerm, sort,
|
||||
m_filter->loaders, m_filter->versions, "", m_filter->categoryIds });
|
||||
auto searchUrl = ModrinthAPI().getSearchURL({ ModPlatform::ResourceType::MODPACK, nextSearchOffset, currentSearchTerm, sort,
|
||||
m_filter->loaders, m_filter->versions, "", m_filter->categoryIds });
|
||||
|
||||
auto netJob = makeShared<NetJob>("Modrinth::SearchModpack", APPLICATION->network());
|
||||
netJob->addNetAction(Net::ApiDownload::makeByteArray(QUrl(searchUrl.value()), m_allResponse));
|
||||
|
Loading…
Reference in New Issue
Block a user