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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>A single query suggestion.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Suggestion {
/// <p>The UUID (universally unique identifier) of a single query suggestion.</p>
pub id: ::std::option::Option<::std::string::String>,
/// <p>The value for the UUID (universally unique identifier) of a single query suggestion.</p>
/// <p>The value is the text string of a suggestion.</p>
pub value: ::std::option::Option<crate::types::SuggestionValue>,
/// <p>The list of document IDs and their fields/attributes that are used for a single query suggestion, if document fields set to use for query suggestions.</p>
pub source_documents: ::std::option::Option<::std::vec::Vec<crate::types::SourceDocument>>,
}
impl Suggestion {
/// <p>The UUID (universally unique identifier) of a single query suggestion.</p>
pub fn id(&self) -> ::std::option::Option<&str> {
self.id.as_deref()
}
/// <p>The value for the UUID (universally unique identifier) of a single query suggestion.</p>
/// <p>The value is the text string of a suggestion.</p>
pub fn value(&self) -> ::std::option::Option<&crate::types::SuggestionValue> {
self.value.as_ref()
}
/// <p>The list of document IDs and their fields/attributes that are used for a single query suggestion, if document fields set to use for query suggestions.</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 `.source_documents.is_none()`.
pub fn source_documents(&self) -> &[crate::types::SourceDocument] {
self.source_documents.as_deref().unwrap_or_default()
}
}
impl Suggestion {
/// Creates a new builder-style object to manufacture [`Suggestion`](crate::types::Suggestion).
pub fn builder() -> crate::types::builders::SuggestionBuilder {
crate::types::builders::SuggestionBuilder::default()
}
}
/// A builder for [`Suggestion`](crate::types::Suggestion).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SuggestionBuilder {
pub(crate) id: ::std::option::Option<::std::string::String>,
pub(crate) value: ::std::option::Option<crate::types::SuggestionValue>,
pub(crate) source_documents: ::std::option::Option<::std::vec::Vec<crate::types::SourceDocument>>,
}
impl SuggestionBuilder {
/// <p>The UUID (universally unique identifier) of a single query suggestion.</p>
pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.id = ::std::option::Option::Some(input.into());
self
}
/// <p>The UUID (universally unique identifier) of a single query suggestion.</p>
pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.id = input;
self
}
/// <p>The UUID (universally unique identifier) of a single query suggestion.</p>
pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
&self.id
}
/// <p>The value for the UUID (universally unique identifier) of a single query suggestion.</p>
/// <p>The value is the text string of a suggestion.</p>
pub fn value(mut self, input: crate::types::SuggestionValue) -> Self {
self.value = ::std::option::Option::Some(input);
self
}
/// <p>The value for the UUID (universally unique identifier) of a single query suggestion.</p>
/// <p>The value is the text string of a suggestion.</p>
pub fn set_value(mut self, input: ::std::option::Option<crate::types::SuggestionValue>) -> Self {
self.value = input;
self
}
/// <p>The value for the UUID (universally unique identifier) of a single query suggestion.</p>
/// <p>The value is the text string of a suggestion.</p>
pub fn get_value(&self) -> &::std::option::Option<crate::types::SuggestionValue> {
&self.value
}
/// Appends an item to `source_documents`.
///
/// To override the contents of this collection use [`set_source_documents`](Self::set_source_documents).
///
/// <p>The list of document IDs and their fields/attributes that are used for a single query suggestion, if document fields set to use for query suggestions.</p>
pub fn source_documents(mut self, input: crate::types::SourceDocument) -> Self {
let mut v = self.source_documents.unwrap_or_default();
v.push(input);
self.source_documents = ::std::option::Option::Some(v);
self
}
/// <p>The list of document IDs and their fields/attributes that are used for a single query suggestion, if document fields set to use for query suggestions.</p>
pub fn set_source_documents(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SourceDocument>>) -> Self {
self.source_documents = input;
self
}
/// <p>The list of document IDs and their fields/attributes that are used for a single query suggestion, if document fields set to use for query suggestions.</p>
pub fn get_source_documents(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SourceDocument>> {
&self.source_documents
}
/// Consumes the builder and constructs a [`Suggestion`](crate::types::Suggestion).
pub fn build(self) -> crate::types::Suggestion {
crate::types::Suggestion {
id: self.id,
value: self.value,
source_documents: self.source_documents,
}
}
}