2d68308d49
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
26 lines
941 B
C++
26 lines
941 B
C++
#pragma once
|
|
|
|
#include "modplatform/ModAPI.h"
|
|
|
|
class ModrinthAPI : public ModAPI {
|
|
public:
|
|
inline QString getModSearchURL(int offset, QString query, QString sort, bool fabricCompatible, QString version) const override
|
|
{
|
|
return QString("https://api.modrinth.com/v2/search?"
|
|
"offset=%1&" "limit=25&" "query=%2&" "index=%3&"
|
|
"facets=[[\"categories:%4\"],[\"versions:%5\"],[\"project_type:mod\"]]")
|
|
.arg(offset)
|
|
.arg(query)
|
|
.arg(sort)
|
|
.arg(fabricCompatible ? "fabric" : "forge")
|
|
.arg(version);
|
|
};
|
|
|
|
inline QString getVersionsURL(const QString& addonId) const override
|
|
{
|
|
return QString("https://api.modrinth.com/v2/project/%1/version").arg(addonId);
|
|
};
|
|
|
|
inline QString getAuthorURL(const QString& name) const override { return "https://modrinth.com/user/" + name; };
|
|
};
|