aws-sdk-comprehend 1.98.0

AWS SDK for Amazon Comprehend
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct DetectToxicContentInput {
    /// <p>A list of up to 10 text strings. Each string has a maximum size of 1 KB, and the maximum size of the list is 10 KB.</p>
    pub text_segments: ::std::option::Option<::std::vec::Vec<crate::types::TextSegment>>,
    /// <p>The language of the input text. Currently, English is the only supported language.</p>
    pub language_code: ::std::option::Option<crate::types::LanguageCode>,
}
impl DetectToxicContentInput {
    /// <p>A list of up to 10 text strings. Each string has a maximum size of 1 KB, and the maximum size of the list is 10 KB.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.text_segments.is_none()`.
    pub fn text_segments(&self) -> &[crate::types::TextSegment] {
        self.text_segments.as_deref().unwrap_or_default()
    }
    /// <p>The language of the input text. Currently, English is the only supported language.</p>
    pub fn language_code(&self) -> ::std::option::Option<&crate::types::LanguageCode> {
        self.language_code.as_ref()
    }
}
impl ::std::fmt::Debug for DetectToxicContentInput {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("DetectToxicContentInput");
        formatter.field("text_segments", &"*** Sensitive Data Redacted ***");
        formatter.field("language_code", &self.language_code);
        formatter.finish()
    }
}
impl DetectToxicContentInput {
    /// Creates a new builder-style object to manufacture [`DetectToxicContentInput`](crate::operation::detect_toxic_content::DetectToxicContentInput).
    pub fn builder() -> crate::operation::detect_toxic_content::builders::DetectToxicContentInputBuilder {
        crate::operation::detect_toxic_content::builders::DetectToxicContentInputBuilder::default()
    }
}

/// A builder for [`DetectToxicContentInput`](crate::operation::detect_toxic_content::DetectToxicContentInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct DetectToxicContentInputBuilder {
    pub(crate) text_segments: ::std::option::Option<::std::vec::Vec<crate::types::TextSegment>>,
    pub(crate) language_code: ::std::option::Option<crate::types::LanguageCode>,
}
impl DetectToxicContentInputBuilder {
    /// Appends an item to `text_segments`.
    ///
    /// To override the contents of this collection use [`set_text_segments`](Self::set_text_segments).
    ///
    /// <p>A list of up to 10 text strings. Each string has a maximum size of 1 KB, and the maximum size of the list is 10 KB.</p>
    pub fn text_segments(mut self, input: crate::types::TextSegment) -> Self {
        let mut v = self.text_segments.unwrap_or_default();
        v.push(input);
        self.text_segments = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of up to 10 text strings. Each string has a maximum size of 1 KB, and the maximum size of the list is 10 KB.</p>
    pub fn set_text_segments(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TextSegment>>) -> Self {
        self.text_segments = input;
        self
    }
    /// <p>A list of up to 10 text strings. Each string has a maximum size of 1 KB, and the maximum size of the list is 10 KB.</p>
    pub fn get_text_segments(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TextSegment>> {
        &self.text_segments
    }
    /// <p>The language of the input text. Currently, English is the only supported language.</p>
    /// This field is required.
    pub fn language_code(mut self, input: crate::types::LanguageCode) -> Self {
        self.language_code = ::std::option::Option::Some(input);
        self
    }
    /// <p>The language of the input text. Currently, English is the only supported language.</p>
    pub fn set_language_code(mut self, input: ::std::option::Option<crate::types::LanguageCode>) -> Self {
        self.language_code = input;
        self
    }
    /// <p>The language of the input text. Currently, English is the only supported language.</p>
    pub fn get_language_code(&self) -> &::std::option::Option<crate::types::LanguageCode> {
        &self.language_code
    }
    /// Consumes the builder and constructs a [`DetectToxicContentInput`](crate::operation::detect_toxic_content::DetectToxicContentInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::detect_toxic_content::DetectToxicContentInput, ::aws_smithy_types::error::operation::BuildError>
    {
        ::std::result::Result::Ok(crate::operation::detect_toxic_content::DetectToxicContentInput {
            text_segments: self.text_segments,
            language_code: self.language_code,
        })
    }
}
impl ::std::fmt::Debug for DetectToxicContentInputBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("DetectToxicContentInputBuilder");
        formatter.field("text_segments", &"*** Sensitive Data Redacted ***");
        formatter.field("language_code", &self.language_code);
        formatter.finish()
    }
}