Phase5
Some checks failed
CI / Node — lint, typecheck, test, build (push) Failing after 9s
CI / Go — node-agent tests (push) Failing after 9s
CI / Go — edge-gateway build (push) Successful in 13s

This commit is contained in:
smueller
2026-06-26 13:00:01 +02:00
parent 4262464cd5
commit d29a02f2a4
93 changed files with 1875 additions and 55 deletions

View File

@@ -0,0 +1,81 @@
import { apiFetch } from "./auth";
import type { SoftwareFamily } from "./servers";
export interface CatalogProject {
id: string;
slug: string;
name: string;
description: string;
projectType: string;
downloads: number;
iconUrl: string | null;
}
export interface CatalogVersion {
id: string;
projectId: string;
name: string;
versionNumber: string;
gameVersions: string[];
loaders: string[];
compatible: boolean;
publishedAt: string;
}
export interface InstalledAddon {
id: string;
projectId: string;
projectName: string;
versionNumber: string;
addonType: string;
fileName: string;
status: string;
failureReason: string | null;
}
export async function searchCatalog(input: {
q: string;
gameVersion: string;
softwareFamily: SoftwareFamily;
}): Promise<{ projects: CatalogProject[] }> {
const params = new URLSearchParams({
q: input.q,
gameVersion: input.gameVersion,
softwareFamily: input.softwareFamily,
});
return apiFetch(`/catalog/projects?${params.toString()}`);
}
export async function listCatalogVersions(
projectId: string,
serverId: string,
): Promise<{ versions: CatalogVersion[] }> {
const params = new URLSearchParams({ serverId });
return apiFetch(`/catalog/projects/${projectId}/versions?${params.toString()}`);
}
export async function listInstalledAddons(
serverId: string,
): Promise<{ addons: InstalledAddon[] }> {
return apiFetch(`/servers/${serverId}/addons`);
}
export async function installAddon(
serverId: string,
projectId: string,
versionId: string,
): Promise<unknown> {
return apiFetch(`/servers/${serverId}/addons`, {
method: "POST",
body: JSON.stringify({ projectId, versionId }),
});
}
export async function removeAddon(
serverId: string,
addonId: string,
): Promise<unknown> {
return apiFetch(`/servers/${serverId}/addons/${addonId}`, {
method: "DELETE",
});
}