aws-sdk-lexmodelbuilding 1.101.0

AWS SDK for Amazon Lex Model Building Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The message object that provides the message text and its type.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Message {
    /// <p>The content type of the message string.</p>
    pub content_type: crate::types::ContentType,
    /// <p>The text of the message.</p>
    pub content: ::std::string::String,
    /// <p>Identifies the message group that the message belongs to. When a group is assigned to a message, Amazon Lex returns one message from each group in the response.</p>
    pub group_number: ::std::option::Option<i32>,
}
impl Message {
    /// <p>The content type of the message string.</p>
    pub fn content_type(&self) -> &crate::types::ContentType {
        &self.content_type
    }
    /// <p>The text of the message.</p>
    pub fn content(&self) -> &str {
        use std::ops::Deref;
        self.content.deref()
    }
    /// <p>Identifies the message group that the message belongs to. When a group is assigned to a message, Amazon Lex returns one message from each group in the response.</p>
    pub fn group_number(&self) -> ::std::option::Option<i32> {
        self.group_number
    }
}
impl Message {
    /// Creates a new builder-style object to manufacture [`Message`](crate::types::Message).
    pub fn builder() -> crate::types::builders::MessageBuilder {
        crate::types::builders::MessageBuilder::default()
    }
}

/// A builder for [`Message`](crate::types::Message).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct MessageBuilder {
    pub(crate) content_type: ::std::option::Option<crate::types::ContentType>,
    pub(crate) content: ::std::option::Option<::std::string::String>,
    pub(crate) group_number: ::std::option::Option<i32>,
}
impl MessageBuilder {
    /// <p>The content type of the message string.</p>
    /// This field is required.
    pub fn content_type(mut self, input: crate::types::ContentType) -> Self {
        self.content_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The content type of the message string.</p>
    pub fn set_content_type(mut self, input: ::std::option::Option<crate::types::ContentType>) -> Self {
        self.content_type = input;
        self
    }
    /// <p>The content type of the message string.</p>
    pub fn get_content_type(&self) -> &::std::option::Option<crate::types::ContentType> {
        &self.content_type
    }
    /// <p>The text of the message.</p>
    /// This field is required.
    pub fn content(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.content = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The text of the message.</p>
    pub fn set_content(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.content = input;
        self
    }
    /// <p>The text of the message.</p>
    pub fn get_content(&self) -> &::std::option::Option<::std::string::String> {
        &self.content
    }
    /// <p>Identifies the message group that the message belongs to. When a group is assigned to a message, Amazon Lex returns one message from each group in the response.</p>
    pub fn group_number(mut self, input: i32) -> Self {
        self.group_number = ::std::option::Option::Some(input);
        self
    }
    /// <p>Identifies the message group that the message belongs to. When a group is assigned to a message, Amazon Lex returns one message from each group in the response.</p>
    pub fn set_group_number(mut self, input: ::std::option::Option<i32>) -> Self {
        self.group_number = input;
        self
    }
    /// <p>Identifies the message group that the message belongs to. When a group is assigned to a message, Amazon Lex returns one message from each group in the response.</p>
    pub fn get_group_number(&self) -> &::std::option::Option<i32> {
        &self.group_number
    }
    /// Consumes the builder and constructs a [`Message`](crate::types::Message).
    /// This method will fail if any of the following fields are not set:
    /// - [`content_type`](crate::types::builders::MessageBuilder::content_type)
    /// - [`content`](crate::types::builders::MessageBuilder::content)
    pub fn build(self) -> ::std::result::Result<crate::types::Message, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Message {
            content_type: self.content_type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "content_type",
                    "content_type was not specified but it is required when building Message",
                )
            })?,
            content: self.content.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "content",
                    "content was not specified but it is required when building Message",
                )
            })?,
            group_number: self.group_number,
        })
    }
}