aws_sdk_kendra/operation/submit_feedback/
_submit_feedback_input.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 SubmitFeedbackInput {
6    /// <p>The identifier of the index that was queried.</p>
7    pub index_id: ::std::option::Option<::std::string::String>,
8    /// <p>The identifier of the specific query for which you are submitting feedback. The query ID is returned in the response to the <code>Query</code> API.</p>
9    pub query_id: ::std::option::Option<::std::string::String>,
10    /// <p>Tells Amazon Kendra that a particular search result link was chosen by the user.</p>
11    pub click_feedback_items: ::std::option::Option<::std::vec::Vec<crate::types::ClickFeedback>>,
12    /// <p>Provides Amazon Kendra with relevant or not relevant feedback for whether a particular item was relevant to the search.</p>
13    pub relevance_feedback_items: ::std::option::Option<::std::vec::Vec<crate::types::RelevanceFeedback>>,
14}
15impl SubmitFeedbackInput {
16    /// <p>The identifier of the index that was queried.</p>
17    pub fn index_id(&self) -> ::std::option::Option<&str> {
18        self.index_id.as_deref()
19    }
20    /// <p>The identifier of the specific query for which you are submitting feedback. The query ID is returned in the response to the <code>Query</code> API.</p>
21    pub fn query_id(&self) -> ::std::option::Option<&str> {
22        self.query_id.as_deref()
23    }
24    /// <p>Tells Amazon Kendra that a particular search result link was chosen by the user.</p>
25    ///
26    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.click_feedback_items.is_none()`.
27    pub fn click_feedback_items(&self) -> &[crate::types::ClickFeedback] {
28        self.click_feedback_items.as_deref().unwrap_or_default()
29    }
30    /// <p>Provides Amazon Kendra with relevant or not relevant feedback for whether a particular item was relevant to the search.</p>
31    ///
32    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.relevance_feedback_items.is_none()`.
33    pub fn relevance_feedback_items(&self) -> &[crate::types::RelevanceFeedback] {
34        self.relevance_feedback_items.as_deref().unwrap_or_default()
35    }
36}
37impl SubmitFeedbackInput {
38    /// Creates a new builder-style object to manufacture [`SubmitFeedbackInput`](crate::operation::submit_feedback::SubmitFeedbackInput).
39    pub fn builder() -> crate::operation::submit_feedback::builders::SubmitFeedbackInputBuilder {
40        crate::operation::submit_feedback::builders::SubmitFeedbackInputBuilder::default()
41    }
42}
43
44/// A builder for [`SubmitFeedbackInput`](crate::operation::submit_feedback::SubmitFeedbackInput).
45#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
46#[non_exhaustive]
47pub struct SubmitFeedbackInputBuilder {
48    pub(crate) index_id: ::std::option::Option<::std::string::String>,
49    pub(crate) query_id: ::std::option::Option<::std::string::String>,
50    pub(crate) click_feedback_items: ::std::option::Option<::std::vec::Vec<crate::types::ClickFeedback>>,
51    pub(crate) relevance_feedback_items: ::std::option::Option<::std::vec::Vec<crate::types::RelevanceFeedback>>,
52}
53impl SubmitFeedbackInputBuilder {
54    /// <p>The identifier of the index that was queried.</p>
55    /// This field is required.
56    pub fn index_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
57        self.index_id = ::std::option::Option::Some(input.into());
58        self
59    }
60    /// <p>The identifier of the index that was queried.</p>
61    pub fn set_index_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
62        self.index_id = input;
63        self
64    }
65    /// <p>The identifier of the index that was queried.</p>
66    pub fn get_index_id(&self) -> &::std::option::Option<::std::string::String> {
67        &self.index_id
68    }
69    /// <p>The identifier of the specific query for which you are submitting feedback. The query ID is returned in the response to the <code>Query</code> API.</p>
70    /// This field is required.
71    pub fn query_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
72        self.query_id = ::std::option::Option::Some(input.into());
73        self
74    }
75    /// <p>The identifier of the specific query for which you are submitting feedback. The query ID is returned in the response to the <code>Query</code> API.</p>
76    pub fn set_query_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
77        self.query_id = input;
78        self
79    }
80    /// <p>The identifier of the specific query for which you are submitting feedback. The query ID is returned in the response to the <code>Query</code> API.</p>
81    pub fn get_query_id(&self) -> &::std::option::Option<::std::string::String> {
82        &self.query_id
83    }
84    /// Appends an item to `click_feedback_items`.
85    ///
86    /// To override the contents of this collection use [`set_click_feedback_items`](Self::set_click_feedback_items).
87    ///
88    /// <p>Tells Amazon Kendra that a particular search result link was chosen by the user.</p>
89    pub fn click_feedback_items(mut self, input: crate::types::ClickFeedback) -> Self {
90        let mut v = self.click_feedback_items.unwrap_or_default();
91        v.push(input);
92        self.click_feedback_items = ::std::option::Option::Some(v);
93        self
94    }
95    /// <p>Tells Amazon Kendra that a particular search result link was chosen by the user.</p>
96    pub fn set_click_feedback_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ClickFeedback>>) -> Self {
97        self.click_feedback_items = input;
98        self
99    }
100    /// <p>Tells Amazon Kendra that a particular search result link was chosen by the user.</p>
101    pub fn get_click_feedback_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ClickFeedback>> {
102        &self.click_feedback_items
103    }
104    /// Appends an item to `relevance_feedback_items`.
105    ///
106    /// To override the contents of this collection use [`set_relevance_feedback_items`](Self::set_relevance_feedback_items).
107    ///
108    /// <p>Provides Amazon Kendra with relevant or not relevant feedback for whether a particular item was relevant to the search.</p>
109    pub fn relevance_feedback_items(mut self, input: crate::types::RelevanceFeedback) -> Self {
110        let mut v = self.relevance_feedback_items.unwrap_or_default();
111        v.push(input);
112        self.relevance_feedback_items = ::std::option::Option::Some(v);
113        self
114    }
115    /// <p>Provides Amazon Kendra with relevant or not relevant feedback for whether a particular item was relevant to the search.</p>
116    pub fn set_relevance_feedback_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RelevanceFeedback>>) -> Self {
117        self.relevance_feedback_items = input;
118        self
119    }
120    /// <p>Provides Amazon Kendra with relevant or not relevant feedback for whether a particular item was relevant to the search.</p>
121    pub fn get_relevance_feedback_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RelevanceFeedback>> {
122        &self.relevance_feedback_items
123    }
124    /// Consumes the builder and constructs a [`SubmitFeedbackInput`](crate::operation::submit_feedback::SubmitFeedbackInput).
125    pub fn build(
126        self,
127    ) -> ::std::result::Result<crate::operation::submit_feedback::SubmitFeedbackInput, ::aws_smithy_types::error::operation::BuildError> {
128        ::std::result::Result::Ok(crate::operation::submit_feedback::SubmitFeedbackInput {
129            index_id: self.index_id,
130            query_id: self.query_id,
131            click_feedback_items: self.click_feedback_items,
132            relevance_feedback_items: self.relevance_feedback_items,
133        })
134    }
135}