aws_sdk_lexmodelsv2/operation/list_session_metrics/
builders.rs

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