aws-sdk-lexruntime 1.98.0

AWS SDK for Amazon Lex Runtime Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::put_session::_put_session_input::PutSessionInputBuilder;

pub use crate::operation::put_session::_put_session_output::PutSessionOutputBuilder;

impl crate::operation::put_session::builders::PutSessionInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::put_session::PutSessionOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::put_session::PutSessionError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.put_session();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `PutSession`.
///
/// <p>Creates a new session or modifies an existing session with an Amazon Lex bot. Use this operation to enable your application to set the state of the bot.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/lex/latest/dg/how-session-api.html">Managing Sessions</a>.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct PutSessionFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::put_session::builders::PutSessionInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::put_session::PutSessionOutput,
        crate::operation::put_session::PutSessionError,
    > for PutSessionFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::put_session::PutSessionOutput,
            crate::operation::put_session::PutSessionError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl PutSessionFluentBuilder {
    /// Creates a new `PutSessionFluentBuilder`.
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: ::std::default::Default::default(),
            config_override: ::std::option::Option::None,
        }
    }
    /// Access the PutSession as a reference.
    pub fn as_input(&self) -> &crate::operation::put_session::builders::PutSessionInputBuilder {
        &self.inner
    }
    /// Sends the request and returns the response.
    ///
    /// If an error occurs, an `SdkError` will be returned with additional details that
    /// can be matched against.
    ///
    /// By default, any retryable failures will be retried twice. Retry behavior
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
    /// set when configuring the client.
    pub async fn send(
        self,
    ) -> ::std::result::Result<
        crate::operation::put_session::PutSessionOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::put_session::PutSessionError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let input = self
            .inner
            .build()
            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
        let runtime_plugins = crate::operation::put_session::PutSession::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::put_session::PutSession::orchestrate(&runtime_plugins, input).await
    }

    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
    pub fn customize(
        self,
    ) -> crate::client::customize::CustomizableOperation<
        crate::operation::put_session::PutSessionOutput,
        crate::operation::put_session::PutSessionError,
        Self,
    > {
        crate::client::customize::CustomizableOperation::new(self)
    }
    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
        self.set_config_override(::std::option::Option::Some(config_override.into()));
        self
    }

    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
        self.config_override = config_override;
        self
    }
    /// <p>The name of the bot that contains the session data.</p>
    pub fn bot_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.bot_name(input.into());
        self
    }
    /// <p>The name of the bot that contains the session data.</p>
    pub fn set_bot_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_bot_name(input);
        self
    }
    /// <p>The name of the bot that contains the session data.</p>
    pub fn get_bot_name(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_bot_name()
    }
    /// <p>The alias in use for the bot that contains the session data.</p>
    pub fn bot_alias(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.bot_alias(input.into());
        self
    }
    /// <p>The alias in use for the bot that contains the session data.</p>
    pub fn set_bot_alias(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_bot_alias(input);
        self
    }
    /// <p>The alias in use for the bot that contains the session data.</p>
    pub fn get_bot_alias(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_bot_alias()
    }
    /// <p>The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your bot.</p>
    pub fn user_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.user_id(input.into());
        self
    }
    /// <p>The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your bot.</p>
    pub fn set_user_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_user_id(input);
        self
    }
    /// <p>The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your bot.</p>
    pub fn get_user_id(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_user_id()
    }
    ///
    /// Adds a key-value pair to `sessionAttributes`.
    ///
    /// To override the contents of this collection use [`set_session_attributes`](Self::set_session_attributes).
    ///
    /// <p>Map of key/value pairs representing the session-specific context information. It contains application information passed between Amazon Lex and a client application.</p>
    pub fn session_attributes(
        mut self,
        k: impl ::std::convert::Into<::std::string::String>,
        v: impl ::std::convert::Into<::std::string::String>,
    ) -> Self {
        self.inner = self.inner.session_attributes(k.into(), v.into());
        self
    }
    /// <p>Map of key/value pairs representing the session-specific context information. It contains application information passed between Amazon Lex and a client application.</p>
    pub fn set_session_attributes(
        mut self,
        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    ) -> Self {
        self.inner = self.inner.set_session_attributes(input);
        self
    }
    /// <p>Map of key/value pairs representing the session-specific context information. It contains application information passed between Amazon Lex and a client application.</p>
    pub fn get_session_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.inner.get_session_attributes()
    }
    /// <p>Sets the next action that the bot should take to fulfill the conversation.</p>
    pub fn dialog_action(mut self, input: crate::types::DialogAction) -> Self {
        self.inner = self.inner.dialog_action(input);
        self
    }
    /// <p>Sets the next action that the bot should take to fulfill the conversation.</p>
    pub fn set_dialog_action(mut self, input: ::std::option::Option<crate::types::DialogAction>) -> Self {
        self.inner = self.inner.set_dialog_action(input);
        self
    }
    /// <p>Sets the next action that the bot should take to fulfill the conversation.</p>
    pub fn get_dialog_action(&self) -> &::std::option::Option<crate::types::DialogAction> {
        self.inner.get_dialog_action()
    }
    ///
    /// Appends an item to `recentIntentSummaryView`.
    ///
    /// To override the contents of this collection use [`set_recent_intent_summary_view`](Self::set_recent_intent_summary_view).
    ///
    /// <p>A summary of the recent intents for the bot. You can use the intent summary view to set a checkpoint label on an intent and modify attributes of intents. You can also use it to remove or add intent summary objects to the list.</p>
    /// <p>An intent that you modify or add to the list must make sense for the bot. For example, the intent name must be valid for the bot. You must provide valid values for:</p>
    /// <ul>
    /// <li>
    /// <p><code>intentName</code></p></li>
    /// <li>
    /// <p>slot names</p></li>
    /// <li>
    /// <p><code>slotToElict</code></p></li>
    /// </ul>
    /// <p>If you send the <code>recentIntentSummaryView</code> parameter in a <code>PutSession</code> request, the contents of the new summary view replaces the old summary view. For example, if a <code>GetSession</code> request returns three intents in the summary view and you call <code>PutSession</code> with one intent in the summary view, the next call to <code>GetSession</code> will only return one intent.</p>
    pub fn recent_intent_summary_view(mut self, input: crate::types::IntentSummary) -> Self {
        self.inner = self.inner.recent_intent_summary_view(input);
        self
    }
    /// <p>A summary of the recent intents for the bot. You can use the intent summary view to set a checkpoint label on an intent and modify attributes of intents. You can also use it to remove or add intent summary objects to the list.</p>
    /// <p>An intent that you modify or add to the list must make sense for the bot. For example, the intent name must be valid for the bot. You must provide valid values for:</p>
    /// <ul>
    /// <li>
    /// <p><code>intentName</code></p></li>
    /// <li>
    /// <p>slot names</p></li>
    /// <li>
    /// <p><code>slotToElict</code></p></li>
    /// </ul>
    /// <p>If you send the <code>recentIntentSummaryView</code> parameter in a <code>PutSession</code> request, the contents of the new summary view replaces the old summary view. For example, if a <code>GetSession</code> request returns three intents in the summary view and you call <code>PutSession</code> with one intent in the summary view, the next call to <code>GetSession</code> will only return one intent.</p>
    pub fn set_recent_intent_summary_view(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::IntentSummary>>) -> Self {
        self.inner = self.inner.set_recent_intent_summary_view(input);
        self
    }
    /// <p>A summary of the recent intents for the bot. You can use the intent summary view to set a checkpoint label on an intent and modify attributes of intents. You can also use it to remove or add intent summary objects to the list.</p>
    /// <p>An intent that you modify or add to the list must make sense for the bot. For example, the intent name must be valid for the bot. You must provide valid values for:</p>
    /// <ul>
    /// <li>
    /// <p><code>intentName</code></p></li>
    /// <li>
    /// <p>slot names</p></li>
    /// <li>
    /// <p><code>slotToElict</code></p></li>
    /// </ul>
    /// <p>If you send the <code>recentIntentSummaryView</code> parameter in a <code>PutSession</code> request, the contents of the new summary view replaces the old summary view. For example, if a <code>GetSession</code> request returns three intents in the summary view and you call <code>PutSession</code> with one intent in the summary view, the next call to <code>GetSession</code> will only return one intent.</p>
    pub fn get_recent_intent_summary_view(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::IntentSummary>> {
        self.inner.get_recent_intent_summary_view()
    }
    /// <p>The message that Amazon Lex returns in the response can be either text or speech based depending on the value of this field.</p>
    /// <ul>
    /// <li>
    /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex returns text in the response.</p></li>
    /// <li>
    /// <p>If the value begins with <code>audio/</code>, Amazon Lex returns speech in the response. Amazon Lex uses Amazon Polly to generate the speech in the configuration that you specify. For example, if you specify <code>audio/mpeg</code> as the value, Amazon Lex returns speech in the MPEG format.</p></li>
    /// <li>
    /// <p>If the value is <code>audio/pcm</code>, the speech is returned as <code>audio/pcm</code> in 16-bit, little endian format.</p></li>
    /// <li>
    /// <p>The following are the accepted values:</p>
    /// <ul>
    /// <li>
    /// <p><code>audio/mpeg</code></p></li>
    /// <li>
    /// <p><code>audio/ogg</code></p></li>
    /// <li>
    /// <p><code>audio/pcm</code></p></li>
    /// <li>
    /// <p><code>audio/*</code> (defaults to mpeg)</p></li>
    /// <li>
    /// <p><code>text/plain; charset=utf-8</code></p></li>
    /// </ul></li>
    /// </ul>
    pub fn accept(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.accept(input.into());
        self
    }
    /// <p>The message that Amazon Lex returns in the response can be either text or speech based depending on the value of this field.</p>
    /// <ul>
    /// <li>
    /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex returns text in the response.</p></li>
    /// <li>
    /// <p>If the value begins with <code>audio/</code>, Amazon Lex returns speech in the response. Amazon Lex uses Amazon Polly to generate the speech in the configuration that you specify. For example, if you specify <code>audio/mpeg</code> as the value, Amazon Lex returns speech in the MPEG format.</p></li>
    /// <li>
    /// <p>If the value is <code>audio/pcm</code>, the speech is returned as <code>audio/pcm</code> in 16-bit, little endian format.</p></li>
    /// <li>
    /// <p>The following are the accepted values:</p>
    /// <ul>
    /// <li>
    /// <p><code>audio/mpeg</code></p></li>
    /// <li>
    /// <p><code>audio/ogg</code></p></li>
    /// <li>
    /// <p><code>audio/pcm</code></p></li>
    /// <li>
    /// <p><code>audio/*</code> (defaults to mpeg)</p></li>
    /// <li>
    /// <p><code>text/plain; charset=utf-8</code></p></li>
    /// </ul></li>
    /// </ul>
    pub fn set_accept(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_accept(input);
        self
    }
    /// <p>The message that Amazon Lex returns in the response can be either text or speech based depending on the value of this field.</p>
    /// <ul>
    /// <li>
    /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex returns text in the response.</p></li>
    /// <li>
    /// <p>If the value begins with <code>audio/</code>, Amazon Lex returns speech in the response. Amazon Lex uses Amazon Polly to generate the speech in the configuration that you specify. For example, if you specify <code>audio/mpeg</code> as the value, Amazon Lex returns speech in the MPEG format.</p></li>
    /// <li>
    /// <p>If the value is <code>audio/pcm</code>, the speech is returned as <code>audio/pcm</code> in 16-bit, little endian format.</p></li>
    /// <li>
    /// <p>The following are the accepted values:</p>
    /// <ul>
    /// <li>
    /// <p><code>audio/mpeg</code></p></li>
    /// <li>
    /// <p><code>audio/ogg</code></p></li>
    /// <li>
    /// <p><code>audio/pcm</code></p></li>
    /// <li>
    /// <p><code>audio/*</code> (defaults to mpeg)</p></li>
    /// <li>
    /// <p><code>text/plain; charset=utf-8</code></p></li>
    /// </ul></li>
    /// </ul>
    pub fn get_accept(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_accept()
    }
    ///
    /// Appends an item to `activeContexts`.
    ///
    /// To override the contents of this collection use [`set_active_contexts`](Self::set_active_contexts).
    ///
    /// <p>A list of contexts active for the request. A context can be activated when a previous intent is fulfilled, or by including the context in the request,</p>
    /// <p>If you don't specify a list of contexts, Amazon Lex will use the current list of contexts for the session. If you specify an empty list, all contexts for the session are cleared.</p>
    pub fn active_contexts(mut self, input: crate::types::ActiveContext) -> Self {
        self.inner = self.inner.active_contexts(input);
        self
    }
    /// <p>A list of contexts active for the request. A context can be activated when a previous intent is fulfilled, or by including the context in the request,</p>
    /// <p>If you don't specify a list of contexts, Amazon Lex will use the current list of contexts for the session. If you specify an empty list, all contexts for the session are cleared.</p>
    pub fn set_active_contexts(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ActiveContext>>) -> Self {
        self.inner = self.inner.set_active_contexts(input);
        self
    }
    /// <p>A list of contexts active for the request. A context can be activated when a previous intent is fulfilled, or by including the context in the request,</p>
    /// <p>If you don't specify a list of contexts, Amazon Lex will use the current list of contexts for the session. If you specify an empty list, all contexts for the session are cleared.</p>
    pub fn get_active_contexts(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ActiveContext>> {
        self.inner.get_active_contexts()
    }
}