aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/modrinth/ModrinthAPI.h
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/modplatform/modrinth/ModrinthAPI.h')
-rw-r--r--launcher/modplatform/modrinth/ModrinthAPI.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h
new file mode 100644
index 00000000..4ae8b8f9
--- /dev/null
+++ b/launcher/modplatform/modrinth/ModrinthAPI.h
@@ -0,0 +1,25 @@
+#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; };
+};