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>A value that Amazon Lex V2 uses to fulfill an intent.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Slot {
    /// <p>The current value of the slot.</p>
    pub value: ::std::option::Option<crate::types::Value>,
    /// <p>When the <code>shape</code> value is <code>List</code>, it indicates that the <code>values</code> field contains a list of slot values. When the value is <code>Scalar</code>, it indicates that the <code>value</code> field contains a single value.</p>
    pub shape: ::std::option::Option<crate::types::Shape>,
    /// <p>A list of one or more values that the user provided for the slot. For example, if a for a slot that elicits pizza toppings, the values might be "pepperoni" and "pineapple."</p>
    pub values: ::std::option::Option<::std::vec::Vec<crate::types::Slot>>,
    /// <p>The constituent sub slots of a composite slot.</p>
    pub sub_slots: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::Slot>>,
}
impl Slot {
    /// <p>The current value of the slot.</p>
    pub fn value(&self) -> ::std::option::Option<&crate::types::Value> {
        self.value.as_ref()
    }
    /// <p>When the <code>shape</code> value is <code>List</code>, it indicates that the <code>values</code> field contains a list of slot values. When the value is <code>Scalar</code>, it indicates that the <code>value</code> field contains a single value.</p>
    pub fn shape(&self) -> ::std::option::Option<&crate::types::Shape> {
        self.shape.as_ref()
    }
    /// <p>A list of one or more values that the user provided for the slot. For example, if a for a slot that elicits pizza toppings, the values might be "pepperoni" and "pineapple."</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 `.values.is_none()`.
    pub fn values(&self) -> &[crate::types::Slot] {
        self.values.as_deref().unwrap_or_default()
    }
    /// <p>The constituent sub slots of a composite slot.</p>
    pub fn sub_slots(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::Slot>> {
        self.sub_slots.as_ref()
    }
}
impl Slot {
    /// Creates a new builder-style object to manufacture [`Slot`](crate::types::Slot).
    pub fn builder() -> crate::types::builders::SlotBuilder {
        crate::types::builders::SlotBuilder::default()
    }
}

/// A builder for [`Slot`](crate::types::Slot).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SlotBuilder {
    pub(crate) value: ::std::option::Option<crate::types::Value>,
    pub(crate) shape: ::std::option::Option<crate::types::Shape>,
    pub(crate) values: ::std::option::Option<::std::vec::Vec<crate::types::Slot>>,
    pub(crate) sub_slots: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::Slot>>,
}
impl SlotBuilder {
    /// <p>The current value of the slot.</p>
    pub fn value(mut self, input: crate::types::Value) -> Self {
        self.value = ::std::option::Option::Some(input);
        self
    }
    /// <p>The current value of the slot.</p>
    pub fn set_value(mut self, input: ::std::option::Option<crate::types::Value>) -> Self {
        self.value = input;
        self
    }
    /// <p>The current value of the slot.</p>
    pub fn get_value(&self) -> &::std::option::Option<crate::types::Value> {
        &self.value
    }
    /// <p>When the <code>shape</code> value is <code>List</code>, it indicates that the <code>values</code> field contains a list of slot values. When the value is <code>Scalar</code>, it indicates that the <code>value</code> field contains a single value.</p>
    pub fn shape(mut self, input: crate::types::Shape) -> Self {
        self.shape = ::std::option::Option::Some(input);
        self
    }
    /// <p>When the <code>shape</code> value is <code>List</code>, it indicates that the <code>values</code> field contains a list of slot values. When the value is <code>Scalar</code>, it indicates that the <code>value</code> field contains a single value.</p>
    pub fn set_shape(mut self, input: ::std::option::Option<crate::types::Shape>) -> Self {
        self.shape = input;
        self
    }
    /// <p>When the <code>shape</code> value is <code>List</code>, it indicates that the <code>values</code> field contains a list of slot values. When the value is <code>Scalar</code>, it indicates that the <code>value</code> field contains a single value.</p>
    pub fn get_shape(&self) -> &::std::option::Option<crate::types::Shape> {
        &self.shape
    }
    /// Appends an item to `values`.
    ///
    /// To override the contents of this collection use [`set_values`](Self::set_values).
    ///
    /// <p>A list of one or more values that the user provided for the slot. For example, if a for a slot that elicits pizza toppings, the values might be "pepperoni" and "pineapple."</p>
    pub fn values(mut self, input: crate::types::Slot) -> Self {
        let mut v = self.values.unwrap_or_default();
        v.push(input);
        self.values = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of one or more values that the user provided for the slot. For example, if a for a slot that elicits pizza toppings, the values might be "pepperoni" and "pineapple."</p>
    pub fn set_values(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Slot>>) -> Self {
        self.values = input;
        self
    }
    /// <p>A list of one or more values that the user provided for the slot. For example, if a for a slot that elicits pizza toppings, the values might be "pepperoni" and "pineapple."</p>
    pub fn get_values(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Slot>> {
        &self.values
    }
    /// Adds a key-value pair to `sub_slots`.
    ///
    /// To override the contents of this collection use [`set_sub_slots`](Self::set_sub_slots).
    ///
    /// <p>The constituent sub slots of a composite slot.</p>
    pub fn sub_slots(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::Slot) -> Self {
        let mut hash_map = self.sub_slots.unwrap_or_default();
        hash_map.insert(k.into(), v);
        self.sub_slots = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>The constituent sub slots of a composite slot.</p>
    pub fn set_sub_slots(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::Slot>>) -> Self {
        self.sub_slots = input;
        self
    }
    /// <p>The constituent sub slots of a composite slot.</p>
    pub fn get_sub_slots(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::Slot>> {
        &self.sub_slots
    }
    /// Consumes the builder and constructs a [`Slot`](crate::types::Slot).
    pub fn build(self) -> crate::types::Slot {
        crate::types::Slot {
            value: self.value,
            shape: self.shape,
            values: self.values,
            sub_slots: self.sub_slots,
        }
    }
}