(
request: &AdminApiBehaviorCleanupRequest,
)
| 3769 | } |
| 3770 | |
| 3771 | pub async fn admin_cleanup_api_behavior( |
| 3772 | request: &AdminApiBehaviorCleanupRequest, |
| 3773 | ) -> Result<AdminApiBehaviorCleanupResponse, String> { |
| 3774 | #[cfg(feature = "mock")] |
| 3775 | { |
| 3776 | Ok(AdminApiBehaviorCleanupResponse { |
| 3777 | deleted_events: 0, |
| 3778 | before_ms: 0, |
| 3779 | retention_days: request.retention_days.unwrap_or(90), |
| 3780 | }) |
| 3781 | } |
| 3782 | |
| 3783 | #[cfg(not(feature = "mock"))] |
| 3784 | { |
| 3785 | let url = format!("{}/admin/api-behavior/cleanup", admin_base()); |
| 3786 | let response = api_post(&url) |
| 3787 | .header("Content-Type", "application/json") |
| 3788 | .json(request) |
| 3789 | .map_err(|e| format!("Serialize error: {:?}", e))? |
| 3790 | .send() |
| 3791 | .await |
| 3792 | .map_err(|e| format!("Network error: {:?}", e))?; |
| 3793 | if !response.ok() { |
| 3794 | return Err(format!("HTTP error: {}", response.status())); |
| 3795 | } |
| 3796 | response |
| 3797 | .json() |
| 3798 | .await |
| 3799 | .map_err(|e| format!("Parse error: {:?}", e)) |
| 3800 | } |
| 3801 | } |
| 3802 | |
| 3803 | pub async fn fetch_admin_memory_profiler_overview() -> Result<MemoryProfilerOverview, String> { |
| 3804 | #[cfg(feature = "mock")] |
no test coverage detected