pub mod hangar; pub mod spigotmc; pub mod modrinth; pub mod github; use std::path::Path; use crate::models::repository::RepositoryPlugin; use crate::models::server::ServerType; use async_trait::async_trait; /// Common interface for all repository crawlers #[async_trait] pub trait Repository { /// Get the name of the repository fn get_repository_name(&self) -> String; /// Search for plugins in the repository async fn search(&self, query: &str) -> Result, String>; /// Get plugin details from the repository async fn get_plugin_details(&self, plugin_id: &str) -> Result; /// Get plugin details with server type consideration async fn get_plugin_details_with_server_type(&self, plugin_id: &str, server_type: Option<&ServerType>) -> Result { // Default implementation just calls the regular get_plugin_details self.get_plugin_details(plugin_id).await } /// Download a plugin from the repository async fn download_plugin(&self, plugin_id: &str, version: &str, destination: &Path) -> Result; /// Download a plugin with server type consideration async fn download_plugin_with_server_type(&self, plugin_id: &str, version: &str, destination: &Path, server_type: Option<&ServerType>) -> Result { // Default implementation calls the regular download_plugin self.download_plugin(plugin_id, version, destination).await } } // Re-export the crawler implementations pub use hangar::HangarCrawler; pub use spigotmc::SpigotMCCrawler; pub use modrinth::ModrinthCrawler; pub use github::GitHubCrawler;