import { invoke } from "@tauri-apps/api/tauri"; import { ApiType, CmdType } from "./types"; export async function restartSidecar() { return invoke("restart_sidecar"); } export async function getClashInfo() { return invoke("get_clash_info"); } export async function patchClashConfig(payload: Partial) { return invoke("patch_clash_config", { payload }); } export async function importProfile(url: string) { return invoke("import_profile", { url }); } export async function updateProfile(index: number) { return invoke("update_profile", { index }); } export async function getProfiles() { return (await invoke("get_profiles")) ?? {}; } export async function setProfiles(index: number, profile: CmdType.ProfileItem) { return invoke("set_profiles", { index, profile }); } export async function putProfiles(current: number) { return invoke("put_profiles", { current }); } export async function setSysProxy(enable: boolean) { return invoke("set_sys_proxy", { enable }); } export async function getVergeConfig() { return invoke("get_verge_config"); } export async function patchVergeConfig(payload: CmdType.VergeConfig) { return invoke("patch_verge_config", { payload }); }