MCPcopy Create free account
hub / github.com/acking-you/static_flow / patch_admin_published_comment

Function patch_admin_published_comment

crates/frontend/src/api.rs:4338–4370  ·  view source on GitHub ↗
(
    comment_id: &str,
    request: &AdminPatchPublishedCommentRequest,
)

Source from the content-addressed store, hash-verified

4336}
4337
4338pub 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
4372pub async fn delete_admin_published_comment(
4373 comment_id: &str,

Callers 1

admin_pageFunction · 0.85

Calls 2

api_patchFunction · 0.85
okMethod · 0.80

Tested by

no test coverage detected