Skip to main content

mangofetch_plugin_sdk/
host.rs

1use std::path::PathBuf;
2
3pub trait PluginHost: Send + Sync {
4    fn emit_event(&self, name: &str, payload: serde_json::Value) -> anyhow::Result<()>;
5    fn show_toast(&self, toast_type: &str, message: &str) -> anyhow::Result<()>;
6    fn plugin_data_dir(&self, plugin_id: &str) -> PathBuf;
7    fn plugin_frontend_dir(&self, plugin_id: &str) -> PathBuf;
8    fn get_settings(&self, plugin_id: &str) -> serde_json::Value;
9    fn save_settings(&self, plugin_id: &str, settings: serde_json::Value) -> anyhow::Result<()>;
10    fn proxy_config(&self) -> Option<ProxyConfig>;
11    fn tool_path(&self, tool: &str) -> Option<PathBuf>;
12    fn default_output_dir(&self) -> PathBuf;
13}
14
15#[derive(Debug, Clone)]
16pub struct ProxyConfig {
17    pub proxy_type: String,
18    pub host: String,
19    pub port: u16,
20    pub username: Option<String>,
21    pub password: Option<String>,
22}