import { launcherFetch } from "@/api/http" // API client for Pico Channel configuration. interface PicoInfoResponse { ws_url: string enabled: boolean configured?: boolean } interface PicoSetupResponse { ws_url: string enabled: boolean configured?: boolean changed: boolean } const BASE_URL = "" async function request(path: string, options?: RequestInit): Promise { const res = await launcherFetch(`${BASE_URL}${path}`, options) if (!res.ok) { throw new Error(`API error: ${res.status} ${res.statusText}`) } return res.json() as Promise } export async function getPicoInfo(): Promise { return request("/api/pico/info") } export async function regenPicoToken(): Promise { return request("/api/pico/token", { method: "POST" }) } export async function setupPico(): Promise { return request("/api/pico/setup", { method: "POST" }) } export type { PicoInfoResponse, PicoSetupResponse }