use std::collections::HashMap; use actix_web::{get, post, web, Responder}; use crate::storage::IStorage; #[get("/stats")] pub async fn decky_statistics(data: actix_web::web::Data>) -> impl Responder { let plugins: HashMap = data.get_statistics(); web::Json(plugins) } #[post("/plugins/{name}/versions/{version}")] pub async fn decky_statistics_increment(data: actix_web::web::Data>, path: actix_web::web::Path<(String, String)>, query: actix_web::web::Query) -> actix_web::Result { let new_version_info = data.increment_statistic(&path.0, &path.1, &*query) .map_err(|e| actix_web::error::ErrorNotFound(e.to_string()))?; Ok(web::Json(new_version_info)) }