(
task_id: &str,
request: &AdminPatchCommentTaskRequest,
)
| 4194 | } |
| 4195 | |
| 4196 | pub async fn patch_admin_comment_task( |
| 4197 | task_id: &str, |
| 4198 | request: &AdminPatchCommentTaskRequest, |
| 4199 | ) -> Result<AdminCommentTask, String> { |
| 4200 | #[cfg(feature = "mock")] |
| 4201 | { |
| 4202 | let _ = (task_id, request); |
| 4203 | Err("not implemented in mock".to_string()) |
| 4204 | } |
| 4205 | |
| 4206 | #[cfg(not(feature = "mock"))] |
| 4207 | { |
| 4208 | let url = |
| 4209 | format!("{}/admin/comments/tasks/{}", admin_base(), urlencoding::encode(task_id),); |
| 4210 | let response = api_patch(&url) |
| 4211 | .header("Content-Type", "application/json") |
| 4212 | .json(request) |
| 4213 | .map_err(|e| format!("Serialize error: {:?}", e))? |
| 4214 | .send() |
| 4215 | .await |
| 4216 | .map_err(|e| format!("Network error: {:?}", e))?; |
| 4217 | if !response.ok() { |
| 4218 | return Err(format!("HTTP error: {}", response.status())); |
| 4219 | } |
| 4220 | response |
| 4221 | .json() |
| 4222 | .await |
| 4223 | .map_err(|e| format!("Parse error: {:?}", e)) |
| 4224 | } |
| 4225 | } |
| 4226 | |
| 4227 | pub async fn admin_approve_comment_task( |
| 4228 | task_id: &str, |
no test coverage detected