aws_sdk_lexmodelsv2/operation/list_utterance_metrics/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::list_utterance_metrics::_list_utterance_metrics_output::ListUtteranceMetricsOutputBuilder;
3
4pub use crate::operation::list_utterance_metrics::_list_utterance_metrics_input::ListUtteranceMetricsInputBuilder;
5
6impl crate::operation::list_utterance_metrics::builders::ListUtteranceMetricsInputBuilder {
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::list_utterance_metrics::ListUtteranceMetricsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::list_utterance_metrics::ListUtteranceMetricsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.list_utterance_metrics();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ListUtteranceMetrics`.
24///
25/// <note>
26/// <p>To use this API operation, your IAM role must have permissions to perform the <a href="https://docs.aws.amazon.com/lexv2/latest/APIReference/API_ListAggregatedUtterances.html">ListAggregatedUtterances</a> operation, which provides access to utterance-related analytics. See <a href="https://docs.aws.amazon.com/lexv2/latest/dg/monitoring-utterances.html">Viewing utterance statistics</a> for the IAM policy to apply to the IAM role.</p>
27/// </note>
28/// <p>Retrieves summary metrics for the utterances in your bot. The following fields are required:</p>
29/// <ul>
30/// <li>
31/// <p><code>metrics</code> – A list of <a href="https://docs.aws.amazon.com/lexv2/latest/APIReference/API_AnalyticsUtteranceMetric.html">AnalyticsUtteranceMetric</a> objects. In each object, use the <code>name</code> field to specify the metric to calculate, the <code>statistic</code> field to specify whether to calculate the <code>Sum</code>, <code>Average</code>, or <code>Max</code> number, and the <code>order</code> field to specify whether to sort the results in <code>Ascending</code> or <code>Descending</code> order.</p></li>
32/// <li>
33/// <p><code>startDateTime</code> and <code>endDateTime</code> – Define a time range for which you want to retrieve results.</p></li>
34/// </ul>
35/// <p>Of the optional fields, you can organize the results in the following ways:</p>
36/// <ul>
37/// <li>
38/// <p>Use the <code>filters</code> field to filter the results, the <code>groupBy</code> field to specify categories by which to group the results, and the <code>binBy</code> field to specify time intervals by which to group the results.</p></li>
39/// <li>
40/// <p>Use the <code>maxResults</code> field to limit the number of results to return in a single response and the <code>nextToken</code> field to return the next batch of results if the response does not return the full set of results.</p></li>
41/// </ul>
42/// <p>Note that an <code>order</code> field exists in both <code>binBy</code> and <code>metrics</code>. Currently, you can specify it in either field, but not in both.</p>
43#[derive(::std::clone::Clone, ::std::fmt::Debug)]
44pub struct ListUtteranceMetricsFluentBuilder {
45    handle: ::std::sync::Arc<crate::client::Handle>,
46    inner: crate::operation::list_utterance_metrics::builders::ListUtteranceMetricsInputBuilder,
47    config_override: ::std::option::Option<crate::config::Builder>,
48}
49impl
50    crate::client::customize::internal::CustomizableSend<
51        crate::operation::list_utterance_metrics::ListUtteranceMetricsOutput,
52        crate::operation::list_utterance_metrics::ListUtteranceMetricsError,
53    > for ListUtteranceMetricsFluentBuilder
54{
55    fn send(
56        self,
57        config_override: crate::config::Builder,
58    ) -> crate::client::customize::internal::BoxFuture<
59        crate::client::customize::internal::SendResult<
60            crate::operation::list_utterance_metrics::ListUtteranceMetricsOutput,
61            crate::operation::list_utterance_metrics::ListUtteranceMetricsError,
62        >,
63    > {
64        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
65    }
66}
67impl ListUtteranceMetricsFluentBuilder {
68    /// Creates a new `ListUtteranceMetricsFluentBuilder`.
69    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
70        Self {
71            handle,
72            inner: ::std::default::Default::default(),
73            config_override: ::std::option::Option::None,
74        }
75    }
76    /// Access the ListUtteranceMetrics as a reference.
77    pub fn as_input(&self) -> &crate::operation::list_utterance_metrics::builders::ListUtteranceMetricsInputBuilder {
78        &self.inner
79    }
80    /// Sends the request and returns the response.
81    ///
82    /// If an error occurs, an `SdkError` will be returned with additional details that
83    /// can be matched against.
84    ///
85    /// By default, any retryable failures will be retried twice. Retry behavior
86    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
87    /// set when configuring the client.
88    pub async fn send(
89        self,
90    ) -> ::std::result::Result<
91        crate::operation::list_utterance_metrics::ListUtteranceMetricsOutput,
92        ::aws_smithy_runtime_api::client::result::SdkError<
93            crate::operation::list_utterance_metrics::ListUtteranceMetricsError,
94            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
95        >,
96    > {
97        let input = self
98            .inner
99            .build()
100            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
101        let runtime_plugins = crate::operation::list_utterance_metrics::ListUtteranceMetrics::operation_runtime_plugins(
102            self.handle.runtime_plugins.clone(),
103            &self.handle.conf,
104            self.config_override,
105        );
106        crate::operation::list_utterance_metrics::ListUtteranceMetrics::orchestrate(&runtime_plugins, input).await
107    }
108
109    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
110    pub fn customize(
111        self,
112    ) -> crate::client::customize::CustomizableOperation<
113        crate::operation::list_utterance_metrics::ListUtteranceMetricsOutput,
114        crate::operation::list_utterance_metrics::ListUtteranceMetricsError,
115        Self,
116    > {
117        crate::client::customize::CustomizableOperation::new(self)
118    }
119    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
120        self.set_config_override(::std::option::Option::Some(config_override.into()));
121        self
122    }
123
124    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
125        self.config_override = config_override;
126        self
127    }
128    /// Create a paginator for this request
129    ///
130    /// Paginators are used by calling [`send().await`](crate::operation::list_utterance_metrics::paginator::ListUtteranceMetricsPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
131    pub fn into_paginator(self) -> crate::operation::list_utterance_metrics::paginator::ListUtteranceMetricsPaginator {
132        crate::operation::list_utterance_metrics::paginator::ListUtteranceMetricsPaginator::new(self.handle, self.inner)
133    }
134    /// <p>The identifier for the bot for which you want to retrieve utterance metrics.</p>
135    pub fn bot_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136        self.inner = self.inner.bot_id(input.into());
137        self
138    }
139    /// <p>The identifier for the bot for which you want to retrieve utterance metrics.</p>
140    pub fn set_bot_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141        self.inner = self.inner.set_bot_id(input);
142        self
143    }
144    /// <p>The identifier for the bot for which you want to retrieve utterance metrics.</p>
145    pub fn get_bot_id(&self) -> &::std::option::Option<::std::string::String> {
146        self.inner.get_bot_id()
147    }
148    /// <p>The date and time that marks the beginning of the range of time for which you want to see utterance metrics.</p>
149    pub fn start_date_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
150        self.inner = self.inner.start_date_time(input);
151        self
152    }
153    /// <p>The date and time that marks the beginning of the range of time for which you want to see utterance metrics.</p>
154    pub fn set_start_date_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
155        self.inner = self.inner.set_start_date_time(input);
156        self
157    }
158    /// <p>The date and time that marks the beginning of the range of time for which you want to see utterance metrics.</p>
159    pub fn get_start_date_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
160        self.inner.get_start_date_time()
161    }
162    /// <p>The date and time that marks the end of the range of time for which you want to see utterance metrics.</p>
163    pub fn end_date_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
164        self.inner = self.inner.end_date_time(input);
165        self
166    }
167    /// <p>The date and time that marks the end of the range of time for which you want to see utterance metrics.</p>
168    pub fn set_end_date_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
169        self.inner = self.inner.set_end_date_time(input);
170        self
171    }
172    /// <p>The date and time that marks the end of the range of time for which you want to see utterance metrics.</p>
173    pub fn get_end_date_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
174        self.inner.get_end_date_time()
175    }
176    ///
177    /// Appends an item to `metrics`.
178    ///
179    /// To override the contents of this collection use [`set_metrics`](Self::set_metrics).
180    ///
181    /// <p>A list of objects, each of which contains a metric you want to list, the statistic for the metric you want to return, and the method by which to organize the results.</p>
182    pub fn metrics(mut self, input: crate::types::AnalyticsUtteranceMetric) -> Self {
183        self.inner = self.inner.metrics(input);
184        self
185    }
186    /// <p>A list of objects, each of which contains a metric you want to list, the statistic for the metric you want to return, and the method by which to organize the results.</p>
187    pub fn set_metrics(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AnalyticsUtteranceMetric>>) -> Self {
188        self.inner = self.inner.set_metrics(input);
189        self
190    }
191    /// <p>A list of objects, each of which contains a metric you want to list, the statistic for the metric you want to return, and the method by which to organize the results.</p>
192    pub fn get_metrics(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AnalyticsUtteranceMetric>> {
193        self.inner.get_metrics()
194    }
195    ///
196    /// Appends an item to `binBy`.
197    ///
198    /// To override the contents of this collection use [`set_bin_by`](Self::set_bin_by).
199    ///
200    /// <p>A list of objects, each of which contains specifications for organizing the results by time.</p>
201    pub fn bin_by(mut self, input: crate::types::AnalyticsBinBySpecification) -> Self {
202        self.inner = self.inner.bin_by(input);
203        self
204    }
205    /// <p>A list of objects, each of which contains specifications for organizing the results by time.</p>
206    pub fn set_bin_by(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AnalyticsBinBySpecification>>) -> Self {
207        self.inner = self.inner.set_bin_by(input);
208        self
209    }
210    /// <p>A list of objects, each of which contains specifications for organizing the results by time.</p>
211    pub fn get_bin_by(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AnalyticsBinBySpecification>> {
212        self.inner.get_bin_by()
213    }
214    ///
215    /// Appends an item to `groupBy`.
216    ///
217    /// To override the contents of this collection use [`set_group_by`](Self::set_group_by).
218    ///
219    /// <p>A list of objects, each of which specifies how to group the results. You can group by the following criteria:</p>
220    /// <ul>
221    /// <li>
222    /// <p><code>UtteranceText</code> – The transcription of the utterance.</p></li>
223    /// <li>
224    /// <p><code>UtteranceState</code> – The state of the utterance. The possible states are detailed in <a href="https://docs.aws.amazon.com/analytics-key-definitions-utterances">Key definitions</a> in the user guide.</p></li>
225    /// </ul>
226    pub fn group_by(mut self, input: crate::types::AnalyticsUtteranceGroupBySpecification) -> Self {
227        self.inner = self.inner.group_by(input);
228        self
229    }
230    /// <p>A list of objects, each of which specifies how to group the results. You can group by the following criteria:</p>
231    /// <ul>
232    /// <li>
233    /// <p><code>UtteranceText</code> – The transcription of the utterance.</p></li>
234    /// <li>
235    /// <p><code>UtteranceState</code> – The state of the utterance. The possible states are detailed in <a href="https://docs.aws.amazon.com/analytics-key-definitions-utterances">Key definitions</a> in the user guide.</p></li>
236    /// </ul>
237    pub fn set_group_by(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AnalyticsUtteranceGroupBySpecification>>) -> Self {
238        self.inner = self.inner.set_group_by(input);
239        self
240    }
241    /// <p>A list of objects, each of which specifies how to group the results. You can group by the following criteria:</p>
242    /// <ul>
243    /// <li>
244    /// <p><code>UtteranceText</code> – The transcription of the utterance.</p></li>
245    /// <li>
246    /// <p><code>UtteranceState</code> – The state of the utterance. The possible states are detailed in <a href="https://docs.aws.amazon.com/analytics-key-definitions-utterances">Key definitions</a> in the user guide.</p></li>
247    /// </ul>
248    pub fn get_group_by(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AnalyticsUtteranceGroupBySpecification>> {
249        self.inner.get_group_by()
250    }
251    ///
252    /// Appends an item to `attributes`.
253    ///
254    /// To override the contents of this collection use [`set_attributes`](Self::set_attributes).
255    ///
256    /// <p>A list containing attributes related to the utterance that you want the response to return. The following attributes are possible:</p>
257    /// <ul>
258    /// <li>
259    /// <p><code>LastUsedIntent</code> – The last used intent at the time of the utterance.</p></li>
260    /// </ul>
261    pub fn attributes(mut self, input: crate::types::AnalyticsUtteranceAttribute) -> Self {
262        self.inner = self.inner.attributes(input);
263        self
264    }
265    /// <p>A list containing attributes related to the utterance that you want the response to return. The following attributes are possible:</p>
266    /// <ul>
267    /// <li>
268    /// <p><code>LastUsedIntent</code> – The last used intent at the time of the utterance.</p></li>
269    /// </ul>
270    pub fn set_attributes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AnalyticsUtteranceAttribute>>) -> Self {
271        self.inner = self.inner.set_attributes(input);
272        self
273    }
274    /// <p>A list containing attributes related to the utterance that you want the response to return. The following attributes are possible:</p>
275    /// <ul>
276    /// <li>
277    /// <p><code>LastUsedIntent</code> – The last used intent at the time of the utterance.</p></li>
278    /// </ul>
279    pub fn get_attributes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AnalyticsUtteranceAttribute>> {
280        self.inner.get_attributes()
281    }
282    ///
283    /// Appends an item to `filters`.
284    ///
285    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
286    ///
287    /// <p>A list of objects, each of which describes a condition by which you want to filter the results.</p>
288    pub fn filters(mut self, input: crate::types::AnalyticsUtteranceFilter) -> Self {
289        self.inner = self.inner.filters(input);
290        self
291    }
292    /// <p>A list of objects, each of which describes a condition by which you want to filter the results.</p>
293    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AnalyticsUtteranceFilter>>) -> Self {
294        self.inner = self.inner.set_filters(input);
295        self
296    }
297    /// <p>A list of objects, each of which describes a condition by which you want to filter the results.</p>
298    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AnalyticsUtteranceFilter>> {
299        self.inner.get_filters()
300    }
301    /// <p>The maximum number of results to return in each page of results. If there are fewer results than the maximum page size, only the actual number of results are returned.</p>
302    pub fn max_results(mut self, input: i32) -> Self {
303        self.inner = self.inner.max_results(input);
304        self
305    }
306    /// <p>The maximum number of results to return in each page of results. If there are fewer results than the maximum page size, only the actual number of results are returned.</p>
307    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
308        self.inner = self.inner.set_max_results(input);
309        self
310    }
311    /// <p>The maximum number of results to return in each page of results. If there are fewer results than the maximum page size, only the actual number of results are returned.</p>
312    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
313        self.inner.get_max_results()
314    }
315    /// <p>If the response from the ListUtteranceMetrics operation contains more results than specified in the maxResults parameter, a token is returned in the response.</p>
316    /// <p>Use the returned token in the nextToken parameter of a ListUtteranceMetrics request to return the next page of results. For a complete set of results, call the ListUtteranceMetrics operation until the nextToken returned in the response is null.</p>
317    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
318        self.inner = self.inner.next_token(input.into());
319        self
320    }
321    /// <p>If the response from the ListUtteranceMetrics operation contains more results than specified in the maxResults parameter, a token is returned in the response.</p>
322    /// <p>Use the returned token in the nextToken parameter of a ListUtteranceMetrics request to return the next page of results. For a complete set of results, call the ListUtteranceMetrics operation until the nextToken returned in the response is null.</p>
323    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
324        self.inner = self.inner.set_next_token(input);
325        self
326    }
327    /// <p>If the response from the ListUtteranceMetrics operation contains more results than specified in the maxResults parameter, a token is returned in the response.</p>
328    /// <p>Use the returned token in the nextToken parameter of a ListUtteranceMetrics request to return the next page of results. For a complete set of results, call the ListUtteranceMetrics operation until the nextToken returned in the response is null.</p>
329    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
330        self.inner.get_next_token()
331    }
332}