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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The facet values for the documents in the response.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct FacetResult {
    /// <p>The key for the facet values. This is the same as the <code>DocumentAttributeKey</code> provided in the query.</p>
    pub document_attribute_key: ::std::option::Option<::std::string::String>,
    /// <p>The data type of the facet value. This is the same as the type defined for the index field when it was created.</p>
    pub document_attribute_value_type: ::std::option::Option<crate::types::DocumentAttributeValueType>,
    /// <p>An array of key/value pairs, where the key is the value of the attribute and the count is the number of documents that share the key value.</p>
    pub document_attribute_value_count_pairs: ::std::option::Option<::std::vec::Vec<crate::types::DocumentAttributeValueCountPair>>,
}
impl FacetResult {
    /// <p>The key for the facet values. This is the same as the <code>DocumentAttributeKey</code> provided in the query.</p>
    pub fn document_attribute_key(&self) -> ::std::option::Option<&str> {
        self.document_attribute_key.as_deref()
    }
    /// <p>The data type of the facet value. This is the same as the type defined for the index field when it was created.</p>
    pub fn document_attribute_value_type(&self) -> ::std::option::Option<&crate::types::DocumentAttributeValueType> {
        self.document_attribute_value_type.as_ref()
    }
    /// <p>An array of key/value pairs, where the key is the value of the attribute and the count is the number of documents that share the key value.</p>
    pub fn document_attribute_value_count_pairs(&self) -> ::std::option::Option<&[crate::types::DocumentAttributeValueCountPair]> {
        self.document_attribute_value_count_pairs.as_deref()
    }
}
impl FacetResult {
    /// Creates a new builder-style object to manufacture [`FacetResult`](crate::types::FacetResult).
    pub fn builder() -> crate::types::builders::FacetResultBuilder {
        crate::types::builders::FacetResultBuilder::default()
    }
}

/// A builder for [`FacetResult`](crate::types::FacetResult).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct FacetResultBuilder {
    pub(crate) document_attribute_key: ::std::option::Option<::std::string::String>,
    pub(crate) document_attribute_value_type: ::std::option::Option<crate::types::DocumentAttributeValueType>,
    pub(crate) document_attribute_value_count_pairs: ::std::option::Option<::std::vec::Vec<crate::types::DocumentAttributeValueCountPair>>,
}
impl FacetResultBuilder {
    /// <p>The key for the facet values. This is the same as the <code>DocumentAttributeKey</code> provided in the query.</p>
    pub fn document_attribute_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.document_attribute_key = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The key for the facet values. This is the same as the <code>DocumentAttributeKey</code> provided in the query.</p>
    pub fn set_document_attribute_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.document_attribute_key = input;
        self
    }
    /// <p>The key for the facet values. This is the same as the <code>DocumentAttributeKey</code> provided in the query.</p>
    pub fn get_document_attribute_key(&self) -> &::std::option::Option<::std::string::String> {
        &self.document_attribute_key
    }
    /// <p>The data type of the facet value. This is the same as the type defined for the index field when it was created.</p>
    pub fn document_attribute_value_type(mut self, input: crate::types::DocumentAttributeValueType) -> Self {
        self.document_attribute_value_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The data type of the facet value. This is the same as the type defined for the index field when it was created.</p>
    pub fn set_document_attribute_value_type(mut self, input: ::std::option::Option<crate::types::DocumentAttributeValueType>) -> Self {
        self.document_attribute_value_type = input;
        self
    }
    /// <p>The data type of the facet value. This is the same as the type defined for the index field when it was created.</p>
    pub fn get_document_attribute_value_type(&self) -> &::std::option::Option<crate::types::DocumentAttributeValueType> {
        &self.document_attribute_value_type
    }
    /// Appends an item to `document_attribute_value_count_pairs`.
    ///
    /// To override the contents of this collection use [`set_document_attribute_value_count_pairs`](Self::set_document_attribute_value_count_pairs).
    ///
    /// <p>An array of key/value pairs, where the key is the value of the attribute and the count is the number of documents that share the key value.</p>
    pub fn document_attribute_value_count_pairs(mut self, input: crate::types::DocumentAttributeValueCountPair) -> Self {
        let mut v = self.document_attribute_value_count_pairs.unwrap_or_default();
        v.push(input);
        self.document_attribute_value_count_pairs = ::std::option::Option::Some(v);
        self
    }
    /// <p>An array of key/value pairs, where the key is the value of the attribute and the count is the number of documents that share the key value.</p>
    pub fn set_document_attribute_value_count_pairs(
        mut self,
        input: ::std::option::Option<::std::vec::Vec<crate::types::DocumentAttributeValueCountPair>>,
    ) -> Self {
        self.document_attribute_value_count_pairs = input;
        self
    }
    /// <p>An array of key/value pairs, where the key is the value of the attribute and the count is the number of documents that share the key value.</p>
    pub fn get_document_attribute_value_count_pairs(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DocumentAttributeValueCountPair>> {
        &self.document_attribute_value_count_pairs
    }
    /// Consumes the builder and constructs a [`FacetResult`](crate::types::FacetResult).
    pub fn build(self) -> crate::types::FacetResult {
        crate::types::FacetResult {
            document_attribute_key: self.document_attribute_key,
            document_attribute_value_type: self.document_attribute_value_type,
            document_attribute_value_count_pairs: self.document_attribute_value_count_pairs,
        }
    }
}