1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// 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,
}
}
}