(
comment_id: &str,
request: &AdminPatchPublishedCommentRequest,
)
| 4336 | } |
| 4337 | |
| 4338 | pub async fn patch_admin_published_comment( |
| 4339 | comment_id: &str, |
| 4340 | request: &AdminPatchPublishedCommentRequest, |
| 4341 | ) -> Result<ArticleComment, String> { |
| 4342 | #[cfg(feature = "mock")] |
| 4343 | { |
| 4344 | let _ = (comment_id, request); |
| 4345 | Err("not implemented in mock".to_string()) |
| 4346 | } |
| 4347 | |
| 4348 | #[cfg(not(feature = "mock"))] |
| 4349 | { |
| 4350 | let url = format!( |
| 4351 | "{}/admin/comments/published/{}", |
| 4352 | admin_base(), |
| 4353 | urlencoding::encode(comment_id), |
| 4354 | ); |
| 4355 | let response = api_patch(&url) |
| 4356 | .header("Content-Type", "application/json") |
| 4357 | .json(request) |
| 4358 | .map_err(|e| format!("Serialize error: {:?}", e))? |
| 4359 | .send() |
| 4360 | .await |
| 4361 | .map_err(|e| format!("Network error: {:?}", e))?; |
| 4362 | if !response.ok() { |
| 4363 | return Err(format!("HTTP error: {}", response.status())); |
| 4364 | } |
| 4365 | response |
| 4366 | .json() |
| 4367 | .await |
| 4368 | .map_err(|e| format!("Parse error: {:?}", e)) |
| 4369 | } |
| 4370 | } |
| 4371 | |
| 4372 | pub async fn delete_admin_published_comment( |
| 4373 | comment_id: &str, |
no test coverage detected