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 BatchDetectSentimentOutput {
    /// <p>A list of objects containing the results of the operation. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If all of the documents contain an error, the <code>ResultList</code> is empty.</p>
    pub result_list: ::std::vec::Vec<crate::types::BatchDetectSentimentItemResult>,
    /// <p>A list containing one object for each document that contained an error. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If there are no errors in the batch, the <code>ErrorList</code> is empty.</p>
    pub error_list: ::std::vec::Vec<crate::types::BatchItemError>,
    _request_id: Option<String>,
}
impl BatchDetectSentimentOutput {
    /// <p>A list of objects containing the results of the operation. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If all of the documents contain an error, the <code>ResultList</code> is empty.</p>
    pub fn result_list(&self) -> &[crate::types::BatchDetectSentimentItemResult] {
        use std::ops::Deref;
        self.result_list.deref()
    }
    /// <p>A list containing one object for each document that contained an error. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If there are no errors in the batch, the <code>ErrorList</code> is empty.</p>
    pub fn error_list(&self) -> &[crate::types::BatchItemError] {
        use std::ops::Deref;
        self.error_list.deref()
    }
}
impl ::std::fmt::Debug for BatchDetectSentimentOutput {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("BatchDetectSentimentOutput");
        formatter.field("result_list", &"*** Sensitive Data Redacted ***");
        formatter.field("error_list", &"*** Sensitive Data Redacted ***");
        formatter.field("_request_id", &self._request_id);
        formatter.finish()
    }
}
impl ::aws_types::request_id::RequestId for BatchDetectSentimentOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl BatchDetectSentimentOutput {
    /// Creates a new builder-style object to manufacture [`BatchDetectSentimentOutput`](crate::operation::batch_detect_sentiment::BatchDetectSentimentOutput).
    pub fn builder() -> crate::operation::batch_detect_sentiment::builders::BatchDetectSentimentOutputBuilder {
        crate::operation::batch_detect_sentiment::builders::BatchDetectSentimentOutputBuilder::default()
    }
}

/// A builder for [`BatchDetectSentimentOutput`](crate::operation::batch_detect_sentiment::BatchDetectSentimentOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct BatchDetectSentimentOutputBuilder {
    pub(crate) result_list: ::std::option::Option<::std::vec::Vec<crate::types::BatchDetectSentimentItemResult>>,
    pub(crate) error_list: ::std::option::Option<::std::vec::Vec<crate::types::BatchItemError>>,
    _request_id: Option<String>,
}
impl BatchDetectSentimentOutputBuilder {
    /// Appends an item to `result_list`.
    ///
    /// To override the contents of this collection use [`set_result_list`](Self::set_result_list).
    ///
    /// <p>A list of objects containing the results of the operation. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If all of the documents contain an error, the <code>ResultList</code> is empty.</p>
    pub fn result_list(mut self, input: crate::types::BatchDetectSentimentItemResult) -> Self {
        let mut v = self.result_list.unwrap_or_default();
        v.push(input);
        self.result_list = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of objects containing the results of the operation. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If all of the documents contain an error, the <code>ResultList</code> is empty.</p>
    pub fn set_result_list(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::BatchDetectSentimentItemResult>>) -> Self {
        self.result_list = input;
        self
    }
    /// <p>A list of objects containing the results of the operation. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If all of the documents contain an error, the <code>ResultList</code> is empty.</p>
    pub fn get_result_list(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::BatchDetectSentimentItemResult>> {
        &self.result_list
    }
    /// Appends an item to `error_list`.
    ///
    /// To override the contents of this collection use [`set_error_list`](Self::set_error_list).
    ///
    /// <p>A list containing one object for each document that contained an error. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If there are no errors in the batch, the <code>ErrorList</code> is empty.</p>
    pub fn error_list(mut self, input: crate::types::BatchItemError) -> Self {
        let mut v = self.error_list.unwrap_or_default();
        v.push(input);
        self.error_list = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list containing one object for each document that contained an error. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If there are no errors in the batch, the <code>ErrorList</code> is empty.</p>
    pub fn set_error_list(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::BatchItemError>>) -> Self {
        self.error_list = input;
        self
    }
    /// <p>A list containing one object for each document that contained an error. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If there are no errors in the batch, the <code>ErrorList</code> is empty.</p>
    pub fn get_error_list(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::BatchItemError>> {
        &self.error_list
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`BatchDetectSentimentOutput`](crate::operation::batch_detect_sentiment::BatchDetectSentimentOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`result_list`](crate::operation::batch_detect_sentiment::builders::BatchDetectSentimentOutputBuilder::result_list)
    /// - [`error_list`](crate::operation::batch_detect_sentiment::builders::BatchDetectSentimentOutputBuilder::error_list)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::batch_detect_sentiment::BatchDetectSentimentOutput, ::aws_smithy_types::error::operation::BuildError>
    {
        ::std::result::Result::Ok(crate::operation::batch_detect_sentiment::BatchDetectSentimentOutput {
            result_list: self.result_list.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "result_list",
                    "result_list was not specified but it is required when building BatchDetectSentimentOutput",
                )
            })?,
            error_list: self.error_list.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "error_list",
                    "error_list was not specified but it is required when building BatchDetectSentimentOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}
impl ::std::fmt::Debug for BatchDetectSentimentOutputBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("BatchDetectSentimentOutputBuilder");
        formatter.field("result_list", &"*** Sensitive Data Redacted ***");
        formatter.field("error_list", &"*** Sensitive Data Redacted ***");
        formatter.field("_request_id", &self._request_id);
        formatter.finish()
    }
}