pollymc/launcher/modplatform/flame/FlameAPI.h
flow 2d68308d49
refactor: move url creation for mods to modplatform/
Moves all things related to creating the URLs of the mod platforms
that go to network tasks to a single place, so that:

1. Maintaining and fixing eventual issues is more straightforward.
2. Makes it possible to factor out more common code between the
   different modplatform pages
2022-03-02 23:13:04 -03:00

28 lines
1007 B
C++

#pragma once
#include "modplatform/ModAPI.h"
class FlameAPI : public ModAPI {
public:
inline QString getModSearchURL(int index, QString searchFilter, QString sort, bool fabricCompatible, QString version) const override
{
return QString("https://addons-ecs.forgesvc.net/api/v2/addon/search?"
"gameId=432&" "categoryId=0&" "sectionId=6&"
"index=%1&" "pageSize=25&" "searchFilter=%2&"
"sort=%3&" "modLoaderType=%4&" "gameVersion=%5")
.arg(index)
.arg(searchFilter)
.arg(sort)
.arg(fabricCompatible ? 4 : 1) // Enum: https://docs.curseforge.com/?http#tocS_ModLoaderType
.arg(version);
};
inline QString getVersionsURL(const QString& addonId) const override
{
return QString("https://addons-ecs.forgesvc.net/api/v2/addon/%1/files").arg(addonId);
};
inline QString getAuthorURL(const QString& name) const override { return ""; };
};