Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.lexruntime.model.PutSessionRequest Maven / Gradle / Ivy
Go to download
The AWS Java SDK for Amazon Lex Runtime module holds the client classes that are used for
communicating with Amazon Lex Runtime Service
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.lexruntime.model;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class PutSessionRequest extends LexRuntimeRequest implements
ToCopyableBuilder {
private static final SdkField BOT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("botName").getter(getter(PutSessionRequest::botName)).setter(setter(Builder::botName))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("botName").build()).build();
private static final SdkField BOT_ALIAS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("botAlias").getter(getter(PutSessionRequest::botAlias)).setter(setter(Builder::botAlias))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("botAlias").build()).build();
private static final SdkField USER_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("userId")
.getter(getter(PutSessionRequest::userId)).setter(setter(Builder::userId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("userId").build()).build();
private static final SdkField> SESSION_ATTRIBUTES_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("sessionAttributes")
.getter(getter(PutSessionRequest::sessionAttributes))
.setter(setter(Builder::sessionAttributes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sessionAttributes").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField DIALOG_ACTION_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("dialogAction").getter(getter(PutSessionRequest::dialogAction)).setter(setter(Builder::dialogAction))
.constructor(DialogAction::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dialogAction").build()).build();
private static final SdkField> RECENT_INTENT_SUMMARY_VIEW_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("recentIntentSummaryView")
.getter(getter(PutSessionRequest::recentIntentSummaryView))
.setter(setter(Builder::recentIntentSummaryView))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("recentIntentSummaryView").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(IntentSummary::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField ACCEPT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("accept")
.getter(getter(PutSessionRequest::accept)).setter(setter(Builder::accept))
.traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Accept").build()).build();
private static final SdkField> ACTIVE_CONTEXTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("activeContexts")
.getter(getter(PutSessionRequest::activeContexts))
.setter(setter(Builder::activeContexts))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("activeContexts").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ActiveContext::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BOT_NAME_FIELD,
BOT_ALIAS_FIELD, USER_ID_FIELD, SESSION_ATTRIBUTES_FIELD, DIALOG_ACTION_FIELD, RECENT_INTENT_SUMMARY_VIEW_FIELD,
ACCEPT_FIELD, ACTIVE_CONTEXTS_FIELD));
private final String botName;
private final String botAlias;
private final String userId;
private final Map sessionAttributes;
private final DialogAction dialogAction;
private final List recentIntentSummaryView;
private final String accept;
private final List activeContexts;
private PutSessionRequest(BuilderImpl builder) {
super(builder);
this.botName = builder.botName;
this.botAlias = builder.botAlias;
this.userId = builder.userId;
this.sessionAttributes = builder.sessionAttributes;
this.dialogAction = builder.dialogAction;
this.recentIntentSummaryView = builder.recentIntentSummaryView;
this.accept = builder.accept;
this.activeContexts = builder.activeContexts;
}
/**
*
* The name of the bot that contains the session data.
*
*
* @return The name of the bot that contains the session data.
*/
public final String botName() {
return botName;
}
/**
*
* The alias in use for the bot that contains the session data.
*
*
* @return The alias in use for the bot that contains the session data.
*/
public final String botAlias() {
return botAlias;
}
/**
*
* The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your bot.
*
*
* @return The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your
* bot.
*/
public final String userId() {
return userId;
}
/**
* For responses, this returns true if the service returned a value for the SessionAttributes property. This DOES
* NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasSessionAttributes() {
return sessionAttributes != null && !(sessionAttributes instanceof SdkAutoConstructMap);
}
/**
*
* Map of key/value pairs representing the session-specific context information. It contains application information
* passed between Amazon Lex and a client application.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasSessionAttributes} method.
*
*
* @return Map of key/value pairs representing the session-specific context information. It contains application
* information passed between Amazon Lex and a client application.
*/
public final Map sessionAttributes() {
return sessionAttributes;
}
/**
*
* Sets the next action that the bot should take to fulfill the conversation.
*
*
* @return Sets the next action that the bot should take to fulfill the conversation.
*/
public final DialogAction dialogAction() {
return dialogAction;
}
/**
* For responses, this returns true if the service returned a value for the RecentIntentSummaryView property. This
* DOES NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the
* property). This is useful because the SDK will never return a null collection or map, but you may need to
* differentiate between the service returning nothing (or null) and the service returning an empty collection or
* map. For requests, this returns true if a value for the property was specified in the request builder, and false
* if a value was not specified.
*/
public final boolean hasRecentIntentSummaryView() {
return recentIntentSummaryView != null && !(recentIntentSummaryView instanceof SdkAutoConstructList);
}
/**
*
* 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.
*
*
* 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:
*
*
*
*
* intentName
*
*
*
*
* slot names
*
*
*
*
* slotToElict
*
*
*
*
* If you send the recentIntentSummaryView
parameter in a PutSession
request, the contents
* of the new summary view replaces the old summary view. For example, if a GetSession
request returns
* three intents in the summary view and you call PutSession
with one intent in the summary view, the
* next call to GetSession
will only return one intent.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasRecentIntentSummaryView} method.
*
*
* @return 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.
*
* 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:
*
*
*
*
* intentName
*
*
*
*
* slot names
*
*
*
*
* slotToElict
*
*
*
*
* If you send the recentIntentSummaryView
parameter in a PutSession
request, the
* contents of the new summary view replaces the old summary view. For example, if a GetSession
* request returns three intents in the summary view and you call PutSession
with one intent in
* the summary view, the next call to GetSession
will only return one intent.
*/
public final List recentIntentSummaryView() {
return recentIntentSummaryView;
}
/**
*
* The message that Amazon Lex returns in the response can be either text or speech based depending on the value of
* this field.
*
*
*
*
* If the value is text/plain; charset=utf-8
, Amazon Lex returns text in the response.
*
*
*
*
* If the value begins with audio/
, 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
* audio/mpeg
as the value, Amazon Lex returns speech in the MPEG format.
*
*
*
*
* If the value is audio/pcm
, the speech is returned as audio/pcm
in 16-bit, little endian
* format.
*
*
*
*
* The following are the accepted values:
*
*
*
*
*
* @return The message that Amazon Lex returns in the response can be either text or speech based depending on the
* value of this field.
*
*
*
* If the value is text/plain; charset=utf-8
, Amazon Lex returns text in the response.
*
*
*
*
* If the value begins with audio/
, 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
* audio/mpeg
as the value, Amazon Lex returns speech in the MPEG format.
*
*
*
*
* If the value is audio/pcm
, the speech is returned as audio/pcm
in 16-bit,
* little endian format.
*
*
*
*
* The following are the accepted values:
*
*
*
*/
public final String accept() {
return accept;
}
/**
* For responses, this returns true if the service returned a value for the ActiveContexts property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasActiveContexts() {
return activeContexts != null && !(activeContexts instanceof SdkAutoConstructList);
}
/**
*
* 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,
*
*
* 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.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasActiveContexts} method.
*
*
* @return 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,
*
* 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.
*/
public final List activeContexts() {
return activeContexts;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(botName());
hashCode = 31 * hashCode + Objects.hashCode(botAlias());
hashCode = 31 * hashCode + Objects.hashCode(userId());
hashCode = 31 * hashCode + Objects.hashCode(hasSessionAttributes() ? sessionAttributes() : null);
hashCode = 31 * hashCode + Objects.hashCode(dialogAction());
hashCode = 31 * hashCode + Objects.hashCode(hasRecentIntentSummaryView() ? recentIntentSummaryView() : null);
hashCode = 31 * hashCode + Objects.hashCode(accept());
hashCode = 31 * hashCode + Objects.hashCode(hasActiveContexts() ? activeContexts() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof PutSessionRequest)) {
return false;
}
PutSessionRequest other = (PutSessionRequest) obj;
return Objects.equals(botName(), other.botName()) && Objects.equals(botAlias(), other.botAlias())
&& Objects.equals(userId(), other.userId()) && hasSessionAttributes() == other.hasSessionAttributes()
&& Objects.equals(sessionAttributes(), other.sessionAttributes())
&& Objects.equals(dialogAction(), other.dialogAction())
&& hasRecentIntentSummaryView() == other.hasRecentIntentSummaryView()
&& Objects.equals(recentIntentSummaryView(), other.recentIntentSummaryView())
&& Objects.equals(accept(), other.accept()) && hasActiveContexts() == other.hasActiveContexts()
&& Objects.equals(activeContexts(), other.activeContexts());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("PutSessionRequest").add("BotName", botName()).add("BotAlias", botAlias())
.add("UserId", userId())
.add("SessionAttributes", sessionAttributes() == null ? null : "*** Sensitive Data Redacted ***")
.add("DialogAction", dialogAction())
.add("RecentIntentSummaryView", hasRecentIntentSummaryView() ? recentIntentSummaryView() : null)
.add("Accept", accept())
.add("ActiveContexts", activeContexts() == null ? null : "*** Sensitive Data Redacted ***").build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "botName":
return Optional.ofNullable(clazz.cast(botName()));
case "botAlias":
return Optional.ofNullable(clazz.cast(botAlias()));
case "userId":
return Optional.ofNullable(clazz.cast(userId()));
case "sessionAttributes":
return Optional.ofNullable(clazz.cast(sessionAttributes()));
case "dialogAction":
return Optional.ofNullable(clazz.cast(dialogAction()));
case "recentIntentSummaryView":
return Optional.ofNullable(clazz.cast(recentIntentSummaryView()));
case "accept":
return Optional.ofNullable(clazz.cast(accept()));
case "activeContexts":
return Optional.ofNullable(clazz.cast(activeContexts()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((PutSessionRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends LexRuntimeRequest.Builder, SdkPojo, CopyableBuilder {
/**
*
* The name of the bot that contains the session data.
*
*
* @param botName
* The name of the bot that contains the session data.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder botName(String botName);
/**
*
* The alias in use for the bot that contains the session data.
*
*
* @param botAlias
* The alias in use for the bot that contains the session data.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder botAlias(String botAlias);
/**
*
* The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your bot.
*
*
* @param userId
* The ID of the client application user. Amazon Lex uses this to identify a user's conversation with
* your bot.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder userId(String userId);
/**
*
* Map of key/value pairs representing the session-specific context information. It contains application
* information passed between Amazon Lex and a client application.
*
*
* @param sessionAttributes
* Map of key/value pairs representing the session-specific context information. It contains application
* information passed between Amazon Lex and a client application.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sessionAttributes(Map sessionAttributes);
/**
*
* Sets the next action that the bot should take to fulfill the conversation.
*
*
* @param dialogAction
* Sets the next action that the bot should take to fulfill the conversation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dialogAction(DialogAction dialogAction);
/**
*
* Sets the next action that the bot should take to fulfill the conversation.
*
* This is a convenience method that creates an instance of the {@link DialogAction.Builder} avoiding the need
* to create one manually via {@link DialogAction#builder()}.
*
*
* When the {@link Consumer} completes, {@link DialogAction.Builder#build()} is called immediately and its
* result is passed to {@link #dialogAction(DialogAction)}.
*
* @param dialogAction
* a consumer that will call methods on {@link DialogAction.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #dialogAction(DialogAction)
*/
default Builder dialogAction(Consumer dialogAction) {
return dialogAction(DialogAction.builder().applyMutation(dialogAction).build());
}
/**
*
* 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.
*
*
* 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:
*
*
*
*
* intentName
*
*
*
*
* slot names
*
*
*
*
* slotToElict
*
*
*
*
* If you send the recentIntentSummaryView
parameter in a PutSession
request, the
* contents of the new summary view replaces the old summary view. For example, if a GetSession
* request returns three intents in the summary view and you call PutSession
with one intent in the
* summary view, the next call to GetSession
will only return one intent.
*
*
* @param recentIntentSummaryView
* 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.
*
* 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:
*
*
*
*
* intentName
*
*
*
*
* slot names
*
*
*
*
* slotToElict
*
*
*
*
* If you send the recentIntentSummaryView
parameter in a PutSession
request,
* the contents of the new summary view replaces the old summary view. For example, if a
* GetSession
request returns three intents in the summary view and you call
* PutSession
with one intent in the summary view, the next call to GetSession
* will only return one intent.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder recentIntentSummaryView(Collection recentIntentSummaryView);
/**
*
* 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.
*
*
* 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:
*
*
*
*
* intentName
*
*
*
*
* slot names
*
*
*
*
* slotToElict
*
*
*
*
* If you send the recentIntentSummaryView
parameter in a PutSession
request, the
* contents of the new summary view replaces the old summary view. For example, if a GetSession
* request returns three intents in the summary view and you call PutSession
with one intent in the
* summary view, the next call to GetSession
will only return one intent.
*
*
* @param recentIntentSummaryView
* 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.
*
* 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:
*
*
*
*
* intentName
*
*
*
*
* slot names
*
*
*
*
* slotToElict
*
*
*
*
* If you send the recentIntentSummaryView
parameter in a PutSession
request,
* the contents of the new summary view replaces the old summary view. For example, if a
* GetSession
request returns three intents in the summary view and you call
* PutSession
with one intent in the summary view, the next call to GetSession
* will only return one intent.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder recentIntentSummaryView(IntentSummary... recentIntentSummaryView);
/**
*
* 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.
*
*
* 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:
*
*
*
*
* intentName
*
*
*
*
* slot names
*
*
*
*
* slotToElict
*
*
*
*
* If you send the recentIntentSummaryView
parameter in a PutSession
request, the
* contents of the new summary view replaces the old summary view. For example, if a GetSession
* request returns three intents in the summary view and you call PutSession
with one intent in the
* summary view, the next call to GetSession
will only return one intent.
*
* This is a convenience method that creates an instance of the
* {@link software.amazon.awssdk.services.lexruntime.model.IntentSummary.Builder} avoiding the need to create
* one manually via {@link software.amazon.awssdk.services.lexruntime.model.IntentSummary#builder()}.
*
*
* When the {@link Consumer} completes,
* {@link software.amazon.awssdk.services.lexruntime.model.IntentSummary.Builder#build()} is called immediately
* and its result is passed to {@link #recentIntentSummaryView(List)}.
*
* @param recentIntentSummaryView
* a consumer that will call methods on
* {@link software.amazon.awssdk.services.lexruntime.model.IntentSummary.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #recentIntentSummaryView(java.util.Collection)
*/
Builder recentIntentSummaryView(Consumer... recentIntentSummaryView);
/**
*
* The message that Amazon Lex returns in the response can be either text or speech based depending on the value
* of this field.
*
*
*
*
* If the value is text/plain; charset=utf-8
, Amazon Lex returns text in the response.
*
*
*
*
* If the value begins with audio/
, 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
* audio/mpeg
as the value, Amazon Lex returns speech in the MPEG format.
*
*
*
*
* If the value is audio/pcm
, the speech is returned as audio/pcm
in 16-bit, little
* endian format.
*
*
*
*
* The following are the accepted values:
*
*
*
*
*
* @param accept
* The message that Amazon Lex returns in the response can be either text or speech based depending on
* the value of this field.
*
*
*
* If the value is text/plain; charset=utf-8
, Amazon Lex returns text in the response.
*
*
*
*
* If the value begins with audio/
, 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 audio/mpeg
as the value, Amazon Lex returns speech in the MPEG format.
*
*
*
*
* If the value is audio/pcm
, the speech is returned as audio/pcm
in 16-bit,
* little endian format.
*
*
*
*
* The following are the accepted values:
*
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder accept(String accept);
/**
*
* 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,
*
*
* 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.
*
*
* @param activeContexts
* 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,
*
* 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.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder activeContexts(Collection activeContexts);
/**
*
* 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,
*
*
* 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.
*
*
* @param activeContexts
* 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,
*
* 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.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder activeContexts(ActiveContext... activeContexts);
/**
*
* 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,
*
*
* 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.
*
* This is a convenience method that creates an instance of the
* {@link software.amazon.awssdk.services.lexruntime.model.ActiveContext.Builder} avoiding the need to create
* one manually via {@link software.amazon.awssdk.services.lexruntime.model.ActiveContext#builder()}.
*
*
* When the {@link Consumer} completes,
* {@link software.amazon.awssdk.services.lexruntime.model.ActiveContext.Builder#build()} is called immediately
* and its result is passed to {@link #activeContexts(List)}.
*
* @param activeContexts
* a consumer that will call methods on
* {@link software.amazon.awssdk.services.lexruntime.model.ActiveContext.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #activeContexts(java.util.Collection)
*/
Builder activeContexts(Consumer... activeContexts);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends LexRuntimeRequest.BuilderImpl implements Builder {
private String botName;
private String botAlias;
private String userId;
private Map sessionAttributes = DefaultSdkAutoConstructMap.getInstance();
private DialogAction dialogAction;
private List recentIntentSummaryView = DefaultSdkAutoConstructList.getInstance();
private String accept;
private List activeContexts = DefaultSdkAutoConstructList.getInstance();
private BuilderImpl() {
}
private BuilderImpl(PutSessionRequest model) {
super(model);
botName(model.botName);
botAlias(model.botAlias);
userId(model.userId);
sessionAttributes(model.sessionAttributes);
dialogAction(model.dialogAction);
recentIntentSummaryView(model.recentIntentSummaryView);
accept(model.accept);
activeContexts(model.activeContexts);
}
public final String getBotName() {
return botName;
}
public final void setBotName(String botName) {
this.botName = botName;
}
@Override
public final Builder botName(String botName) {
this.botName = botName;
return this;
}
public final String getBotAlias() {
return botAlias;
}
public final void setBotAlias(String botAlias) {
this.botAlias = botAlias;
}
@Override
public final Builder botAlias(String botAlias) {
this.botAlias = botAlias;
return this;
}
public final String getUserId() {
return userId;
}
public final void setUserId(String userId) {
this.userId = userId;
}
@Override
public final Builder userId(String userId) {
this.userId = userId;
return this;
}
public final Map getSessionAttributes() {
if (sessionAttributes instanceof SdkAutoConstructMap) {
return null;
}
return sessionAttributes;
}
public final void setSessionAttributes(Map sessionAttributes) {
this.sessionAttributes = StringMapCopier.copy(sessionAttributes);
}
@Override
public final Builder sessionAttributes(Map sessionAttributes) {
this.sessionAttributes = StringMapCopier.copy(sessionAttributes);
return this;
}
public final DialogAction.Builder getDialogAction() {
return dialogAction != null ? dialogAction.toBuilder() : null;
}
public final void setDialogAction(DialogAction.BuilderImpl dialogAction) {
this.dialogAction = dialogAction != null ? dialogAction.build() : null;
}
@Override
public final Builder dialogAction(DialogAction dialogAction) {
this.dialogAction = dialogAction;
return this;
}
public final List getRecentIntentSummaryView() {
List result = IntentSummaryListCopier.copyToBuilder(this.recentIntentSummaryView);
if (result instanceof SdkAutoConstructList) {
return null;
}
return result;
}
public final void setRecentIntentSummaryView(Collection recentIntentSummaryView) {
this.recentIntentSummaryView = IntentSummaryListCopier.copyFromBuilder(recentIntentSummaryView);
}
@Override
public final Builder recentIntentSummaryView(Collection recentIntentSummaryView) {
this.recentIntentSummaryView = IntentSummaryListCopier.copy(recentIntentSummaryView);
return this;
}
@Override
@SafeVarargs
public final Builder recentIntentSummaryView(IntentSummary... recentIntentSummaryView) {
recentIntentSummaryView(Arrays.asList(recentIntentSummaryView));
return this;
}
@Override
@SafeVarargs
public final Builder recentIntentSummaryView(Consumer... recentIntentSummaryView) {
recentIntentSummaryView(Stream.of(recentIntentSummaryView).map(c -> IntentSummary.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final String getAccept() {
return accept;
}
public final void setAccept(String accept) {
this.accept = accept;
}
@Override
public final Builder accept(String accept) {
this.accept = accept;
return this;
}
public final List getActiveContexts() {
List result = ActiveContextsListCopier.copyToBuilder(this.activeContexts);
if (result instanceof SdkAutoConstructList) {
return null;
}
return result;
}
public final void setActiveContexts(Collection activeContexts) {
this.activeContexts = ActiveContextsListCopier.copyFromBuilder(activeContexts);
}
@Override
public final Builder activeContexts(Collection activeContexts) {
this.activeContexts = ActiveContextsListCopier.copy(activeContexts);
return this;
}
@Override
@SafeVarargs
public final Builder activeContexts(ActiveContext... activeContexts) {
activeContexts(Arrays.asList(activeContexts));
return this;
}
@Override
@SafeVarargs
public final Builder activeContexts(Consumer... activeContexts) {
activeContexts(Stream.of(activeContexts).map(c -> ActiveContext.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public PutSessionRequest build() {
return new PutSessionRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}