use crate::api::{ check_plugin_updates, search_plugins, PluginSearchResponse, PluginUpdatesResponse, }; use crate::error::Result; use crate::install::{delete_and_uninstall, download_and_install}; use tauri::{command, AppHandle, Runtime, WebviewWindow}; use yaak_models::models::Plugin; #[command] pub(crate) async fn search( app_handle: AppHandle, query: &str, ) -> Result { search_plugins(&app_handle, query).await } #[command] pub(crate) async fn install( window: WebviewWindow, name: &str, version: Option, ) -> Result<()> { download_and_install(&window, name, version).await?; Ok(()) } #[command] pub(crate) async fn uninstall( plugin_id: &str, window: WebviewWindow, ) -> Result { delete_and_uninstall(&window, plugin_id).await } #[command] pub(crate) async fn updates(app_handle: AppHandle) -> Result { check_plugin_updates(&app_handle).await }