()
| 3508 | } |
| 3509 | |
| 3510 | pub async fn fetch_admin_api_behavior_config() -> Result<ApiBehaviorConfig, String> { |
| 3511 | #[cfg(feature = "mock")] |
| 3512 | { |
| 3513 | Ok(ApiBehaviorConfig { |
| 3514 | retention_days: 90, |
| 3515 | default_days: 30, |
| 3516 | max_days: 180, |
| 3517 | flush_batch_size: 256, |
| 3518 | flush_interval_seconds: 15, |
| 3519 | flush_max_buffer_bytes: 4 * 1024 * 1024, |
| 3520 | }) |
| 3521 | } |
| 3522 | |
| 3523 | #[cfg(not(feature = "mock"))] |
| 3524 | { |
| 3525 | let url = format!("{}/admin/api-behavior-config", admin_base()); |
| 3526 | let response = api_get(&url) |
| 3527 | .send() |
| 3528 | .await |
| 3529 | .map_err(|e| format!("Network error: {:?}", e))?; |
| 3530 | if !response.ok() { |
| 3531 | return Err(format!("HTTP error: {}", response.status())); |
| 3532 | } |
| 3533 | response |
| 3534 | .json() |
| 3535 | .await |
| 3536 | .map_err(|e| format!("Parse error: {:?}", e)) |
| 3537 | } |
| 3538 | } |
| 3539 | |
| 3540 | pub async fn update_admin_api_behavior_config( |
| 3541 | config: &ApiBehaviorConfig, |
no test coverage detected