use axum::{ extract::{Path, Query, State}, Json, }; use serde::Deserialize; use crate::Result; use super::{CallDetail, CallSummary, ControlService}; #[derive(Deserialize)] pub struct CallQuery { #[serde(default = "default_limit")] limit: i64, } pub async fn list( State(service): State, Query(query): Query, ) -> Result>> { Ok(Json(service.calls(query.limit).await?)) } pub async fn detail( State(service): State, Path(call_id): Path, ) -> Result> { Ok(Json(service.call(&call_id).await?)) } fn default_limit() -> i64 { 100 }