/* * Copyright (C) 2025 Jonni Liljamo * * This file is licensed under GPL-3.0-or-later, see NOTICE and LICENSE for * more information. */ use async_trait::async_trait; use crate::config::ServiceConfig; pub mod gotify; pub mod matrix; #[async_trait] pub trait Service { async fn send(&self, title: &str, message: &str) -> Result<(), Box>; } pub fn build( client: reqwest::Client, service_config: &dyn ServiceConfig, ) -> Box { match service_config.typetag_name() { "gotify" => Box::new(gotify::GotifyService::new( client, service_config .as_any() .downcast_ref::() .expect("fuck") .clone(), )), "matrix" => Box::new(matrix::MatrixService::new( client, service_config .as_any() .downcast_ref::() .expect("fuck") .clone(), )), _ => unreachable!(), } }