(task_id: &str)
| 4117 | } |
| 4118 | |
| 4119 | pub async fn fetch_admin_comment_task(task_id: &str) -> Result<AdminCommentTask, String> { |
| 4120 | #[cfg(feature = "mock")] |
| 4121 | { |
| 4122 | let _ = task_id; |
| 4123 | Err("not found".to_string()) |
| 4124 | } |
| 4125 | |
| 4126 | #[cfg(not(feature = "mock"))] |
| 4127 | { |
| 4128 | let url = |
| 4129 | format!("{}/admin/comments/tasks/{}", admin_base(), urlencoding::encode(task_id),); |
| 4130 | let response = api_get(&url) |
| 4131 | .send() |
| 4132 | .await |
| 4133 | .map_err(|e| format!("Network error: {:?}", e))?; |
| 4134 | if !response.ok() { |
| 4135 | return Err(format!("HTTP error: {}", response.status())); |
| 4136 | } |
| 4137 | response |
| 4138 | .json() |
| 4139 | .await |
| 4140 | .map_err(|e| format!("Parse error: {:?}", e)) |
| 4141 | } |
| 4142 | } |
| 4143 | |
| 4144 | pub async fn fetch_admin_comment_task_ai_output( |
| 4145 | task_id: &str, |
no test coverage detected