feat(plugin): add typed RPC wrappers for Python backend
This commit is contained in:
@@ -0,0 +1,76 @@
|
|||||||
|
import { callable } from "@decky/api"
|
||||||
|
|
||||||
|
// ── Settings ────────────────────────────────────────────────────
|
||||||
|
export const getSettings = callable<[], Record<string, unknown>>("get_settings")
|
||||||
|
export const setSetting = callable<[key: string, value: unknown], Record<string, unknown>>("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<string, unknown>, exportPath: string], {
|
||||||
|
success: boolean
|
||||||
|
path: string
|
||||||
|
error?: string
|
||||||
|
}>("export_to_file")
|
||||||
|
|
||||||
|
// ── Upload ──────────────────────────────────────────────────────
|
||||||
|
export const uploadToDeckyvault = callable<[
|
||||||
|
data: Record<string, unknown>,
|
||||||
|
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")
|
||||||
Reference in New Issue
Block a user