docs: Add Rustdoc to handle_status function in server status API
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
2
PLAN.md
2
PLAN.md
@@ -279,7 +279,7 @@ Private helpers (e.g., internal `fn` without `pub`) are not flagged, as they don
|
|||||||
- `ProgramWriter` struct: Partial.
|
- `ProgramWriter` struct: Partial.
|
||||||
- Impl `Write`: No doc.
|
- Impl `Write`: No doc.
|
||||||
|
|
||||||
52. **src/modes/server/api/status.rs**
|
52. **src/modes/server/api/status.rs** [DONE]
|
||||||
- `handle_status()` function: No doc.
|
- `handle_status()` function: No doc.
|
||||||
|
|
||||||
53. **src/filter_plugin/tail.rs**
|
53. **src/filter_plugin/tail.rs**
|
||||||
|
|||||||
@@ -22,6 +22,33 @@ use crate::modes::server::common::{AppState, StatusInfoResponse};
|
|||||||
),
|
),
|
||||||
tag = "status"
|
tag = "status"
|
||||||
)]
|
)]
|
||||||
|
/// Axum handler for the /api/status GET endpoint.
|
||||||
|
///
|
||||||
|
/// Generates and returns comprehensive system status using the StatusService.
|
||||||
|
/// Includes paths, plugins, compression info, and configuration details.
|
||||||
|
///
|
||||||
|
/// # Arguments
|
||||||
|
///
|
||||||
|
/// * `State(state)` - The shared AppState containing settings, DB, and paths.
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
///
|
||||||
|
/// * `Ok(Json<StatusInfoResponse>)` - Success response with status data.
|
||||||
|
/// * `Err(StatusCode)` - HTTP error status (e.g., 500 for internal errors; 401 if auth fails elsewhere).
|
||||||
|
///
|
||||||
|
/// # Errors
|
||||||
|
///
|
||||||
|
/// Returns StatusCode::INTERNAL_SERVER_ERROR if status generation panics or fails (current impl assumes success).
|
||||||
|
/// Auth errors are handled by middleware before reaching this handler.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// // In an Axum app:
|
||||||
|
/// async fn app() -> Result<Json<StatusInfoResponse>, StatusCode> {
|
||||||
|
/// handle_status(State(app_state)).await
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub async fn handle_status(
|
pub async fn handle_status(
|
||||||
State(state): State<AppState>,
|
State(state): State<AppState>,
|
||||||
) -> Result<Json<StatusInfoResponse>, StatusCode> {
|
) -> Result<Json<StatusInfoResponse>, StatusCode> {
|
||||||
|
|||||||
Reference in New Issue
Block a user