aws-sdk-lexruntimev2 1.93.0

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

/// <p>The current intent that Amazon Lex V2 is attempting to fulfill.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Intent {
    /// <p>The name of the intent.</p>
    pub name: ::std::string::String,
    /// <p>A map of all of the slots for the intent. The name of the slot maps to the value of the slot. If a slot has not been filled, the value is null.</p>
    pub slots: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::Slot>>,
    /// <p>Indicates the fulfillment state for the intent. The meanings of each value are as follows:</p>
    /// <ul>
    /// <li>
    /// <p><code>Failed</code> – The bot failed to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>Fulfilled</code> – The bot has completed fulfillment of the intent.</p></li>
    /// <li>
    /// <p><code>FulfillmentInProgress</code> – The bot is in the middle of fulfilling the intent.</p></li>
    /// <li>
    /// <p><code>InProgress</code> – The bot is in the middle of eliciting the slot values that are necessary to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>ReadyForFulfillment</code> – The bot has elicited all the slot values for the intent and is ready to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>Waiting</code> – The bot is waiting for a response from the user (limited to streaming conversations).</p></li>
    /// </ul>
    pub state: ::std::option::Option<crate::types::IntentState>,
    /// <p>Indicates whether the intent has been <code>Confirmed</code>, <code>Denied</code>, or <code>None</code> if the confirmation stage has not yet been reached.</p>
    pub confirmation_state: ::std::option::Option<crate::types::ConfirmationState>,
}
impl Intent {
    /// <p>The name of the intent.</p>
    pub fn name(&self) -> &str {
        use std::ops::Deref;
        self.name.deref()
    }
    /// <p>A map of all of the slots for the intent. The name of the slot maps to the value of the slot. If a slot has not been filled, the value is null.</p>
    pub fn slots(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::Slot>> {
        self.slots.as_ref()
    }
    /// <p>Indicates the fulfillment state for the intent. The meanings of each value are as follows:</p>
    /// <ul>
    /// <li>
    /// <p><code>Failed</code> – The bot failed to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>Fulfilled</code> – The bot has completed fulfillment of the intent.</p></li>
    /// <li>
    /// <p><code>FulfillmentInProgress</code> – The bot is in the middle of fulfilling the intent.</p></li>
    /// <li>
    /// <p><code>InProgress</code> – The bot is in the middle of eliciting the slot values that are necessary to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>ReadyForFulfillment</code> – The bot has elicited all the slot values for the intent and is ready to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>Waiting</code> – The bot is waiting for a response from the user (limited to streaming conversations).</p></li>
    /// </ul>
    pub fn state(&self) -> ::std::option::Option<&crate::types::IntentState> {
        self.state.as_ref()
    }
    /// <p>Indicates whether the intent has been <code>Confirmed</code>, <code>Denied</code>, or <code>None</code> if the confirmation stage has not yet been reached.</p>
    pub fn confirmation_state(&self) -> ::std::option::Option<&crate::types::ConfirmationState> {
        self.confirmation_state.as_ref()
    }
}
impl Intent {
    /// Creates a new builder-style object to manufacture [`Intent`](crate::types::Intent).
    pub fn builder() -> crate::types::builders::IntentBuilder {
        crate::types::builders::IntentBuilder::default()
    }
}

/// A builder for [`Intent`](crate::types::Intent).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct IntentBuilder {
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) slots: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::Slot>>,
    pub(crate) state: ::std::option::Option<crate::types::IntentState>,
    pub(crate) confirmation_state: ::std::option::Option<crate::types::ConfirmationState>,
}
impl IntentBuilder {
    /// <p>The name of the intent.</p>
    /// This field is required.
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the intent.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>The name of the intent.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// Adds a key-value pair to `slots`.
    ///
    /// To override the contents of this collection use [`set_slots`](Self::set_slots).
    ///
    /// <p>A map of all of the slots for the intent. The name of the slot maps to the value of the slot. If a slot has not been filled, the value is null.</p>
    pub fn slots(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::Slot) -> Self {
        let mut hash_map = self.slots.unwrap_or_default();
        hash_map.insert(k.into(), v);
        self.slots = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>A map of all of the slots for the intent. The name of the slot maps to the value of the slot. If a slot has not been filled, the value is null.</p>
    pub fn set_slots(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::Slot>>) -> Self {
        self.slots = input;
        self
    }
    /// <p>A map of all of the slots for the intent. The name of the slot maps to the value of the slot. If a slot has not been filled, the value is null.</p>
    pub fn get_slots(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::Slot>> {
        &self.slots
    }
    /// <p>Indicates the fulfillment state for the intent. The meanings of each value are as follows:</p>
    /// <ul>
    /// <li>
    /// <p><code>Failed</code> – The bot failed to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>Fulfilled</code> – The bot has completed fulfillment of the intent.</p></li>
    /// <li>
    /// <p><code>FulfillmentInProgress</code> – The bot is in the middle of fulfilling the intent.</p></li>
    /// <li>
    /// <p><code>InProgress</code> – The bot is in the middle of eliciting the slot values that are necessary to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>ReadyForFulfillment</code> – The bot has elicited all the slot values for the intent and is ready to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>Waiting</code> – The bot is waiting for a response from the user (limited to streaming conversations).</p></li>
    /// </ul>
    pub fn state(mut self, input: crate::types::IntentState) -> Self {
        self.state = ::std::option::Option::Some(input);
        self
    }
    /// <p>Indicates the fulfillment state for the intent. The meanings of each value are as follows:</p>
    /// <ul>
    /// <li>
    /// <p><code>Failed</code> – The bot failed to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>Fulfilled</code> – The bot has completed fulfillment of the intent.</p></li>
    /// <li>
    /// <p><code>FulfillmentInProgress</code> – The bot is in the middle of fulfilling the intent.</p></li>
    /// <li>
    /// <p><code>InProgress</code> – The bot is in the middle of eliciting the slot values that are necessary to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>ReadyForFulfillment</code> – The bot has elicited all the slot values for the intent and is ready to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>Waiting</code> – The bot is waiting for a response from the user (limited to streaming conversations).</p></li>
    /// </ul>
    pub fn set_state(mut self, input: ::std::option::Option<crate::types::IntentState>) -> Self {
        self.state = input;
        self
    }
    /// <p>Indicates the fulfillment state for the intent. The meanings of each value are as follows:</p>
    /// <ul>
    /// <li>
    /// <p><code>Failed</code> – The bot failed to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>Fulfilled</code> – The bot has completed fulfillment of the intent.</p></li>
    /// <li>
    /// <p><code>FulfillmentInProgress</code> – The bot is in the middle of fulfilling the intent.</p></li>
    /// <li>
    /// <p><code>InProgress</code> – The bot is in the middle of eliciting the slot values that are necessary to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>ReadyForFulfillment</code> – The bot has elicited all the slot values for the intent and is ready to fulfill the intent.</p></li>
    /// <li>
    /// <p><code>Waiting</code> – The bot is waiting for a response from the user (limited to streaming conversations).</p></li>
    /// </ul>
    pub fn get_state(&self) -> &::std::option::Option<crate::types::IntentState> {
        &self.state
    }
    /// <p>Indicates whether the intent has been <code>Confirmed</code>, <code>Denied</code>, or <code>None</code> if the confirmation stage has not yet been reached.</p>
    pub fn confirmation_state(mut self, input: crate::types::ConfirmationState) -> Self {
        self.confirmation_state = ::std::option::Option::Some(input);
        self
    }
    /// <p>Indicates whether the intent has been <code>Confirmed</code>, <code>Denied</code>, or <code>None</code> if the confirmation stage has not yet been reached.</p>
    pub fn set_confirmation_state(mut self, input: ::std::option::Option<crate::types::ConfirmationState>) -> Self {
        self.confirmation_state = input;
        self
    }
    /// <p>Indicates whether the intent has been <code>Confirmed</code>, <code>Denied</code>, or <code>None</code> if the confirmation stage has not yet been reached.</p>
    pub fn get_confirmation_state(&self) -> &::std::option::Option<crate::types::ConfirmationState> {
        &self.confirmation_state
    }
    /// Consumes the builder and constructs a [`Intent`](crate::types::Intent).
    /// This method will fail if any of the following fields are not set:
    /// - [`name`](crate::types::builders::IntentBuilder::name)
    pub fn build(self) -> ::std::result::Result<crate::types::Intent, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Intent {
            name: self.name.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "name",
                    "name was not specified but it is required when building Intent",
                )
            })?,
            slots: self.slots,
            state: self.state,
            confirmation_state: self.confirmation_state,
        })
    }
}