diff --git a/plugins/decky-vault/src/lib/api.ts b/plugins/decky-vault/src/lib/api.ts new file mode 100644 index 0000000..c6db3e5 --- /dev/null +++ b/plugins/decky-vault/src/lib/api.ts @@ -0,0 +1,76 @@ +import { callable } from "@decky/api" + +// ── Settings ──────────────────────────────────────────────────── +export const getSettings = callable<[], Record>("get_settings") +export const setSetting = callable<[key: string, value: unknown], Record>("set_setting") + +// ── MangoHud ──────────────────────────────────────────────────── +export const checkMangohud = callable<[], { + installed: boolean + path: string + version: string + error?: string +}>("check_mangohud") + +export const writeMangohudConfig = callable<[], { + success: boolean + path: string + error?: string +}>("write_mangohud_config") + +export const getMangohudConfig = callable<[], { + exists: boolean + content: string + path: string +}>("get_mangohud_config") + +export const readAndParseMangohudLog = callable<[logPath?: string], { + fpsAvg?: number + fpsLow?: number + fpsHigh?: number + fpsOnePercentLow?: number | null + tdpWatts?: number | null + error?: string +}>("read_and_parse_mangohud_log") + +export const clearMangohudLog = callable<[logPath?: string], { + success: boolean + error?: string +}>("clear_mangohud_log") + +// ── System Info ───────────────────────────────────────────────── +export const getHardwareInfo = callable<[], { + slug: string + name: string + raw: string +}>("get_hardware_info") + +export const getOsVersion = callable<[], string>("get_os_version") + +export const getProtonVersion = callable<[appId: number], string>("get_proton_version") + +export const getLaunchOptions = callable<[appId: number], string>("get_launch_options") + +// ── Export ────────────────────────────────────────────────────── +export const exportToFile = callable<[data: Record, exportPath: string], { + success: boolean + path: string + error?: string +}>("export_to_file") + +// ── Upload ────────────────────────────────────────────────────── +export const uploadToDeckyvault = callable<[ + data: Record, + apiKey: string, + baseUrl?: string +], { + success: boolean + data?: { id: string; gameId: string; versionId: string; createdAt: string; authMethod: string } + error?: string + status?: number +}>("upload_to_deckyvault") + +export const testApiKey = callable<[apiKey: string, baseUrl?: string], { + valid: boolean + error?: string +}>("test_api_key") \ No newline at end of file