Moderate a record
Create or update a record and return its moderation result immediately.
moderate_a_record is the synchronous moderation path. It creates or updates the record identified by your client_id and returns the decision in the same awaited response.
let request = ModerateRequest::builder()
.client_id("comment-42")
.client_url("https://example.com/comments/42")
.name("Comment 42")
.entity("comment")
.content(Content::String("Submitted comment text".to_string()))
.user(UserInput::builder().client_id("member-9").build()?)
.build()?;
let result = client.moderate_a_record(&request, None).await?;
println!("{:?}: {:?}", result.status, result.category_ids);Signature and request
async fn moderate_a_record(
&self,
request: &ModerateRequest,
options: Option<RequestOptions>,
) -> Result<ModerateResponse, ApiError>client_id, name, entity, and content are required by ModerateRequest::builder(). Optional fields are client_url, metadata, a UserInput, and passthrough. Set passthrough(true) to moderate without persisting the record name/content or the user's email/name/username. Reusing the same client_id updates the same logical record.
Response
ModerateResponse contains Insion record id, typed status, moderation ID, optional user ID, message, category_ids, and flagged. flagged is deprecated in the API model; prefer status. Store the returned record id for retrieval, but remember that deletion expects client_id.