aws_sdk_kendra/operation/retrieve/
_retrieve_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct RetrieveOutput {
6    /// <p>The identifier of query used for the search. You also use <code>QueryId</code> to identify the search when using the <a href="https://docs.aws.amazon.com/kendra/latest/APIReference/API_SubmitFeedback.html">Submitfeedback</a> API.</p>
7    pub query_id: ::std::option::Option<::std::string::String>,
8    /// <p>The results of the retrieved relevant passages for the search.</p>
9    pub result_items: ::std::option::Option<::std::vec::Vec<crate::types::RetrieveResultItem>>,
10    _request_id: Option<String>,
11}
12impl RetrieveOutput {
13    /// <p>The identifier of query used for the search. You also use <code>QueryId</code> to identify the search when using the <a href="https://docs.aws.amazon.com/kendra/latest/APIReference/API_SubmitFeedback.html">Submitfeedback</a> API.</p>
14    pub fn query_id(&self) -> ::std::option::Option<&str> {
15        self.query_id.as_deref()
16    }
17    /// <p>The results of the retrieved relevant passages for the search.</p>
18    ///
19    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.result_items.is_none()`.
20    pub fn result_items(&self) -> &[crate::types::RetrieveResultItem] {
21        self.result_items.as_deref().unwrap_or_default()
22    }
23}
24impl ::aws_types::request_id::RequestId for RetrieveOutput {
25    fn request_id(&self) -> Option<&str> {
26        self._request_id.as_deref()
27    }
28}
29impl RetrieveOutput {
30    /// Creates a new builder-style object to manufacture [`RetrieveOutput`](crate::operation::retrieve::RetrieveOutput).
31    pub fn builder() -> crate::operation::retrieve::builders::RetrieveOutputBuilder {
32        crate::operation::retrieve::builders::RetrieveOutputBuilder::default()
33    }
34}
35
36/// A builder for [`RetrieveOutput`](crate::operation::retrieve::RetrieveOutput).
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
38#[non_exhaustive]
39pub struct RetrieveOutputBuilder {
40    pub(crate) query_id: ::std::option::Option<::std::string::String>,
41    pub(crate) result_items: ::std::option::Option<::std::vec::Vec<crate::types::RetrieveResultItem>>,
42    _request_id: Option<String>,
43}
44impl RetrieveOutputBuilder {
45    /// <p>The identifier of query used for the search. You also use <code>QueryId</code> to identify the search when using the <a href="https://docs.aws.amazon.com/kendra/latest/APIReference/API_SubmitFeedback.html">Submitfeedback</a> API.</p>
46    pub fn query_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
47        self.query_id = ::std::option::Option::Some(input.into());
48        self
49    }
50    /// <p>The identifier of query used for the search. You also use <code>QueryId</code> to identify the search when using the <a href="https://docs.aws.amazon.com/kendra/latest/APIReference/API_SubmitFeedback.html">Submitfeedback</a> API.</p>
51    pub fn set_query_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
52        self.query_id = input;
53        self
54    }
55    /// <p>The identifier of query used for the search. You also use <code>QueryId</code> to identify the search when using the <a href="https://docs.aws.amazon.com/kendra/latest/APIReference/API_SubmitFeedback.html">Submitfeedback</a> API.</p>
56    pub fn get_query_id(&self) -> &::std::option::Option<::std::string::String> {
57        &self.query_id
58    }
59    /// Appends an item to `result_items`.
60    ///
61    /// To override the contents of this collection use [`set_result_items`](Self::set_result_items).
62    ///
63    /// <p>The results of the retrieved relevant passages for the search.</p>
64    pub fn result_items(mut self, input: crate::types::RetrieveResultItem) -> Self {
65        let mut v = self.result_items.unwrap_or_default();
66        v.push(input);
67        self.result_items = ::std::option::Option::Some(v);
68        self
69    }
70    /// <p>The results of the retrieved relevant passages for the search.</p>
71    pub fn set_result_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RetrieveResultItem>>) -> Self {
72        self.result_items = input;
73        self
74    }
75    /// <p>The results of the retrieved relevant passages for the search.</p>
76    pub fn get_result_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RetrieveResultItem>> {
77        &self.result_items
78    }
79    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
80        self._request_id = Some(request_id.into());
81        self
82    }
83
84    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
85        self._request_id = request_id;
86        self
87    }
88    /// Consumes the builder and constructs a [`RetrieveOutput`](crate::operation::retrieve::RetrieveOutput).
89    pub fn build(self) -> crate::operation::retrieve::RetrieveOutput {
90        crate::operation::retrieve::RetrieveOutput {
91            query_id: self.query_id,
92            result_items: self.result_items,
93            _request_id: self._request_id,
94        }
95    }
96}