pub struct Moderation {
pub key: String,
/* private fields */
}Expand description
Content moderation client.
This client provides functionality to moderate content for safety risks, supporting text, image, audio, and video formats.
§Examples
ⓘ
let api_key = "your-api-key".to_string();
let moderation = Moderation::new_text("审核内容安全样例字符串。", api_key);
let result = moderation.send().await?;Fields§
§key: StringAPI key for authentication
Implementations§
Source§impl Moderation
impl Moderation
Sourcepub fn new_multimedia(
content_type: MediaType,
url: impl Into<String>,
key: String,
) -> Self
pub fn new_multimedia( content_type: MediaType, url: impl Into<String>, key: String, ) -> Self
Sourcepub fn body_mut(&mut self) -> &mut ModerationRequest
pub fn body_mut(&mut self) -> &mut ModerationRequest
Gets mutable access to the request body for further customization.
pub fn validate(&self) -> ZaiResult<()>
Sourcepub async fn send(&self) -> ZaiResult<ModerationResponse>
pub async fn send(&self) -> ZaiResult<ModerationResponse>
Sends the moderation request and returns the structured response.
This method automatically validates the request before sending.
§Returns
A ModerationResponse containing the moderation results and usage
statistics.
Trait Implementations§
Source§impl HttpClient for Moderation
impl HttpClient for Moderation
type Body = ModerationRequest
type ApiUrl = &'static str
type ApiKey = String
fn api_key(&self) -> &Self::ApiKey
fn body(&self) -> &Self::Body
Source§fn http_config(&self) -> Arc<HttpClientConfig> ⓘ
fn http_config(&self) -> Arc<HttpClientConfig> ⓘ
Get HTTP client configuration for this request Read more
Auto Trait Implementations§
impl Freeze for Moderation
impl RefUnwindSafe for Moderation
impl Send for Moderation
impl Sync for Moderation
impl Unpin for Moderation
impl UnsafeUnpin for Moderation
impl UnwindSafe for Moderation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more