aws_sdk_qconnect/operation/query_assistant/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::query_assistant::_query_assistant_output::QueryAssistantOutputBuilder;
3
4pub use crate::operation::query_assistant::_query_assistant_input::QueryAssistantInputBuilder;
5
6impl crate::operation::query_assistant::builders::QueryAssistantInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::query_assistant::QueryAssistantOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::query_assistant::QueryAssistantError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.query_assistant();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `QueryAssistant`.
24///
25/// <important>
26/// <p>This API will be discontinued starting June 1, 2024. To receive generative responses after March 1, 2024, you will need to create a new Assistant in the Amazon Connect console and integrate the Amazon Q in Connect JavaScript library (amazon-q-connectjs) into your applications.</p>
27/// </important>
28/// <p>Performs a manual search against the specified assistant. To retrieve recommendations for an assistant, use <a href="https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_GetRecommendations.html">GetRecommendations</a>.</p>
29#[deprecated(
30    note = "QueryAssistant API will be discontinued starting June 1, 2024. To receive generative responses after March 1, 2024 you will need to create a new Assistant in the Connect console and integrate the Amazon Q in Connect JavaScript library (amazon-q-connectjs) into your applications."
31)]
32#[derive(::std::clone::Clone, ::std::fmt::Debug)]
33pub struct QueryAssistantFluentBuilder {
34    handle: ::std::sync::Arc<crate::client::Handle>,
35    inner: crate::operation::query_assistant::builders::QueryAssistantInputBuilder,
36    config_override: ::std::option::Option<crate::config::Builder>,
37}
38impl
39    crate::client::customize::internal::CustomizableSend<
40        crate::operation::query_assistant::QueryAssistantOutput,
41        crate::operation::query_assistant::QueryAssistantError,
42    > for QueryAssistantFluentBuilder
43{
44    fn send(
45        self,
46        config_override: crate::config::Builder,
47    ) -> crate::client::customize::internal::BoxFuture<
48        crate::client::customize::internal::SendResult<
49            crate::operation::query_assistant::QueryAssistantOutput,
50            crate::operation::query_assistant::QueryAssistantError,
51        >,
52    > {
53        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
54    }
55}
56impl QueryAssistantFluentBuilder {
57    /// Creates a new `QueryAssistantFluentBuilder`.
58    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
59        Self {
60            handle,
61            inner: ::std::default::Default::default(),
62            config_override: ::std::option::Option::None,
63        }
64    }
65    /// Access the QueryAssistant as a reference.
66    pub fn as_input(&self) -> &crate::operation::query_assistant::builders::QueryAssistantInputBuilder {
67        &self.inner
68    }
69    /// Sends the request and returns the response.
70    ///
71    /// If an error occurs, an `SdkError` will be returned with additional details that
72    /// can be matched against.
73    ///
74    /// By default, any retryable failures will be retried twice. Retry behavior
75    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
76    /// set when configuring the client.
77    pub async fn send(
78        self,
79    ) -> ::std::result::Result<
80        crate::operation::query_assistant::QueryAssistantOutput,
81        ::aws_smithy_runtime_api::client::result::SdkError<
82            crate::operation::query_assistant::QueryAssistantError,
83            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
84        >,
85    > {
86        let input = self
87            .inner
88            .build()
89            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
90        let runtime_plugins = crate::operation::query_assistant::QueryAssistant::operation_runtime_plugins(
91            self.handle.runtime_plugins.clone(),
92            &self.handle.conf,
93            self.config_override,
94        );
95        crate::operation::query_assistant::QueryAssistant::orchestrate(&runtime_plugins, input).await
96    }
97
98    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
99    pub fn customize(
100        self,
101    ) -> crate::client::customize::CustomizableOperation<
102        crate::operation::query_assistant::QueryAssistantOutput,
103        crate::operation::query_assistant::QueryAssistantError,
104        Self,
105    > {
106        crate::client::customize::CustomizableOperation::new(self)
107    }
108    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
109        self.set_config_override(::std::option::Option::Some(config_override.into()));
110        self
111    }
112
113    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
114        self.config_override = config_override;
115        self
116    }
117    /// Create a paginator for this request
118    ///
119    /// Paginators are used by calling [`send().await`](crate::operation::query_assistant::paginator::QueryAssistantPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
120    pub fn into_paginator(self) -> crate::operation::query_assistant::paginator::QueryAssistantPaginator {
121        crate::operation::query_assistant::paginator::QueryAssistantPaginator::new(self.handle, self.inner)
122    }
123    /// <p>The identifier of the Amazon Q in Connect assistant. Can be either the ID or the ARN. URLs cannot contain the ARN.</p>
124    pub fn assistant_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125        self.inner = self.inner.assistant_id(input.into());
126        self
127    }
128    /// <p>The identifier of the Amazon Q in Connect assistant. Can be either the ID or the ARN. URLs cannot contain the ARN.</p>
129    pub fn set_assistant_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130        self.inner = self.inner.set_assistant_id(input);
131        self
132    }
133    /// <p>The identifier of the Amazon Q in Connect assistant. Can be either the ID or the ARN. URLs cannot contain the ARN.</p>
134    pub fn get_assistant_id(&self) -> &::std::option::Option<::std::string::String> {
135        self.inner.get_assistant_id()
136    }
137    /// <p>The text to search for.</p>
138    pub fn query_text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
139        self.inner = self.inner.query_text(input.into());
140        self
141    }
142    /// <p>The text to search for.</p>
143    pub fn set_query_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
144        self.inner = self.inner.set_query_text(input);
145        self
146    }
147    /// <p>The text to search for.</p>
148    pub fn get_query_text(&self) -> &::std::option::Option<::std::string::String> {
149        self.inner.get_query_text()
150    }
151    /// <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>
152    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153        self.inner = self.inner.next_token(input.into());
154        self
155    }
156    /// <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>
157    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158        self.inner = self.inner.set_next_token(input);
159        self
160    }
161    /// <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>
162    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
163        self.inner.get_next_token()
164    }
165    /// <p>The maximum number of results to return per page.</p>
166    pub fn max_results(mut self, input: i32) -> Self {
167        self.inner = self.inner.max_results(input);
168        self
169    }
170    /// <p>The maximum number of results to return per page.</p>
171    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
172        self.inner = self.inner.set_max_results(input);
173        self
174    }
175    /// <p>The maximum number of results to return per page.</p>
176    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
177        self.inner.get_max_results()
178    }
179    /// <p>The identifier of the Amazon Q in Connect session. Can be either the ID or the ARN. URLs cannot contain the ARN.</p>
180    pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
181        self.inner = self.inner.session_id(input.into());
182        self
183    }
184    /// <p>The identifier of the Amazon Q in Connect session. Can be either the ID or the ARN. URLs cannot contain the ARN.</p>
185    pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
186        self.inner = self.inner.set_session_id(input);
187        self
188    }
189    /// <p>The identifier of the Amazon Q in Connect session. Can be either the ID or the ARN. URLs cannot contain the ARN.</p>
190    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
191        self.inner.get_session_id()
192    }
193    ///
194    /// Appends an item to `queryCondition`.
195    ///
196    /// To override the contents of this collection use [`set_query_condition`](Self::set_query_condition).
197    ///
198    /// <p>Information about how to query content.</p>
199    pub fn query_condition(mut self, input: crate::types::QueryCondition) -> Self {
200        self.inner = self.inner.query_condition(input);
201        self
202    }
203    /// <p>Information about how to query content.</p>
204    pub fn set_query_condition(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::QueryCondition>>) -> Self {
205        self.inner = self.inner.set_query_condition(input);
206        self
207    }
208    /// <p>Information about how to query content.</p>
209    pub fn get_query_condition(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::QueryCondition>> {
210        self.inner.get_query_condition()
211    }
212    /// <p>Information about the query.</p>
213    pub fn query_input_data(mut self, input: crate::types::QueryInputData) -> Self {
214        self.inner = self.inner.query_input_data(input);
215        self
216    }
217    /// <p>Information about the query.</p>
218    pub fn set_query_input_data(mut self, input: ::std::option::Option<crate::types::QueryInputData>) -> Self {
219        self.inner = self.inner.set_query_input_data(input);
220        self
221    }
222    /// <p>Information about the query.</p>
223    pub fn get_query_input_data(&self) -> &::std::option::Option<crate::types::QueryInputData> {
224        self.inner.get_query_input_data()
225    }
226    /// <p>The search type to be used against the Knowledge Base for this request. The values can be <code>SEMANTIC</code> which uses vector embeddings or <code>HYBRID</code> which use vector embeddings and raw text.</p>
227    pub fn override_knowledge_base_search_type(mut self, input: crate::types::KnowledgeBaseSearchType) -> Self {
228        self.inner = self.inner.override_knowledge_base_search_type(input);
229        self
230    }
231    /// <p>The search type to be used against the Knowledge Base for this request. The values can be <code>SEMANTIC</code> which uses vector embeddings or <code>HYBRID</code> which use vector embeddings and raw text.</p>
232    pub fn set_override_knowledge_base_search_type(mut self, input: ::std::option::Option<crate::types::KnowledgeBaseSearchType>) -> Self {
233        self.inner = self.inner.set_override_knowledge_base_search_type(input);
234        self
235    }
236    /// <p>The search type to be used against the Knowledge Base for this request. The values can be <code>SEMANTIC</code> which uses vector embeddings or <code>HYBRID</code> which use vector embeddings and raw text.</p>
237    pub fn get_override_knowledge_base_search_type(&self) -> &::std::option::Option<crate::types::KnowledgeBaseSearchType> {
238        self.inner.get_override_knowledge_base_search_type()
239    }
240}