aws_sdk_comprehend/operation/detect_sentiment/
_detect_sentiment_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct DetectSentimentOutput {
6    /// <p>The inferred sentiment that Amazon Comprehend has the highest level of confidence in.</p>
7    pub sentiment: ::std::option::Option<crate::types::SentimentType>,
8    /// <p>An object that lists the sentiments, and their corresponding confidence levels.</p>
9    pub sentiment_score: ::std::option::Option<crate::types::SentimentScore>,
10    _request_id: Option<String>,
11}
12impl DetectSentimentOutput {
13    /// <p>The inferred sentiment that Amazon Comprehend has the highest level of confidence in.</p>
14    pub fn sentiment(&self) -> ::std::option::Option<&crate::types::SentimentType> {
15        self.sentiment.as_ref()
16    }
17    /// <p>An object that lists the sentiments, and their corresponding confidence levels.</p>
18    pub fn sentiment_score(&self) -> ::std::option::Option<&crate::types::SentimentScore> {
19        self.sentiment_score.as_ref()
20    }
21}
22impl ::std::fmt::Debug for DetectSentimentOutput {
23    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
24        let mut formatter = f.debug_struct("DetectSentimentOutput");
25        formatter.field("sentiment", &"*** Sensitive Data Redacted ***");
26        formatter.field("sentiment_score", &"*** Sensitive Data Redacted ***");
27        formatter.field("_request_id", &self._request_id);
28        formatter.finish()
29    }
30}
31impl ::aws_types::request_id::RequestId for DetectSentimentOutput {
32    fn request_id(&self) -> Option<&str> {
33        self._request_id.as_deref()
34    }
35}
36impl DetectSentimentOutput {
37    /// Creates a new builder-style object to manufacture [`DetectSentimentOutput`](crate::operation::detect_sentiment::DetectSentimentOutput).
38    pub fn builder() -> crate::operation::detect_sentiment::builders::DetectSentimentOutputBuilder {
39        crate::operation::detect_sentiment::builders::DetectSentimentOutputBuilder::default()
40    }
41}
42
43/// A builder for [`DetectSentimentOutput`](crate::operation::detect_sentiment::DetectSentimentOutput).
44#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
45#[non_exhaustive]
46pub struct DetectSentimentOutputBuilder {
47    pub(crate) sentiment: ::std::option::Option<crate::types::SentimentType>,
48    pub(crate) sentiment_score: ::std::option::Option<crate::types::SentimentScore>,
49    _request_id: Option<String>,
50}
51impl DetectSentimentOutputBuilder {
52    /// <p>The inferred sentiment that Amazon Comprehend has the highest level of confidence in.</p>
53    pub fn sentiment(mut self, input: crate::types::SentimentType) -> Self {
54        self.sentiment = ::std::option::Option::Some(input);
55        self
56    }
57    /// <p>The inferred sentiment that Amazon Comprehend has the highest level of confidence in.</p>
58    pub fn set_sentiment(mut self, input: ::std::option::Option<crate::types::SentimentType>) -> Self {
59        self.sentiment = input;
60        self
61    }
62    /// <p>The inferred sentiment that Amazon Comprehend has the highest level of confidence in.</p>
63    pub fn get_sentiment(&self) -> &::std::option::Option<crate::types::SentimentType> {
64        &self.sentiment
65    }
66    /// <p>An object that lists the sentiments, and their corresponding confidence levels.</p>
67    pub fn sentiment_score(mut self, input: crate::types::SentimentScore) -> Self {
68        self.sentiment_score = ::std::option::Option::Some(input);
69        self
70    }
71    /// <p>An object that lists the sentiments, and their corresponding confidence levels.</p>
72    pub fn set_sentiment_score(mut self, input: ::std::option::Option<crate::types::SentimentScore>) -> Self {
73        self.sentiment_score = input;
74        self
75    }
76    /// <p>An object that lists the sentiments, and their corresponding confidence levels.</p>
77    pub fn get_sentiment_score(&self) -> &::std::option::Option<crate::types::SentimentScore> {
78        &self.sentiment_score
79    }
80    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
81        self._request_id = Some(request_id.into());
82        self
83    }
84
85    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
86        self._request_id = request_id;
87        self
88    }
89    /// Consumes the builder and constructs a [`DetectSentimentOutput`](crate::operation::detect_sentiment::DetectSentimentOutput).
90    pub fn build(self) -> crate::operation::detect_sentiment::DetectSentimentOutput {
91        crate::operation::detect_sentiment::DetectSentimentOutput {
92            sentiment: self.sentiment,
93            sentiment_score: self.sentiment_score,
94            _request_id: self._request_id,
95        }
96    }
97}
98impl ::std::fmt::Debug for DetectSentimentOutputBuilder {
99    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
100        let mut formatter = f.debug_struct("DetectSentimentOutputBuilder");
101        formatter.field("sentiment", &"*** Sensitive Data Redacted ***");
102        formatter.field("sentiment_score", &"*** Sensitive Data Redacted ***");
103        formatter.field("_request_id", &self._request_id);
104        formatter.finish()
105    }
106}