DelegatingTurnContext Class

  • java.lang.Object
    • com.microsoft.bot.builder.DelegatingTurnContext

Implements

public class DelegatingTurnContext
implements TurnContext

A TurnContext that wraps an untyped inner TurnContext.

Constructor Summary

Constructor Description
DelegatingTurnContext(TurnContext withTurnContext)

Initializes a new instance of the DelegatingTurnContext class.

Method Summary

Modifier and Type Method and Description
java.util.concurrent.CompletableFuture<java.lang.Void> deleteActivity(ConversationReference conversationReference)

Deletes an existing activity.

java.util.concurrent.CompletableFuture<java.lang.Void> deleteActivity(String activityId)

Deletes an existing activity.

Activity getActivity()

Gets the inner context's activity.

BotAdapter getAdapter()

Gets the inner context's activity.

java.lang.String getLocale()

Gets the locale on this context object.

boolean getResponded()

Gets the inner context's responded value.

TurnContextStateCollection getTurnState()

Gets the inner context's activity.

TurnContext onDeleteActivity(DeleteActivityHandler handler)

Adds a response handler for delete activity operations.

TurnContext onSendActivities(SendActivitiesHandler handler)

Adds a response handler for send activity operations.

TurnContext onUpdateActivity(UpdateActivityHandler handler)

Adds a response handler for update activity operations.

java.util.concurrent.CompletableFuture<ResourceResponse[]> sendActivities(List<Activity> activities)

Sends a list of activities to the sender of the incoming activity.

java.util.concurrent.CompletableFuture<ResourceResponse> sendActivity(Activity activity)

Sends an activity to the sender of the incoming activity.

java.util.concurrent.CompletableFuture<ResourceResponse> sendActivity(String textReplyToSend)

Sends a message activity to the sender of the incoming activity.

java.util.concurrent.CompletableFuture<ResourceResponse> sendActivity(String textReplyToSend, String speak)

Sends a message activity to the sender of the incoming activity.

java.util.concurrent.CompletableFuture<ResourceResponse> sendActivity(String textReplyToSend, String speak, InputHints inputHint)

Sends a message activity to the sender of the incoming activity.

void setLocale(String withLocale)

Set the locale on this context object.

java.util.concurrent.CompletableFuture<ResourceResponse> updateActivity(Activity activity)

Replaces an existing activity.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

DelegatingTurnContext

public DelegatingTurnContext(TurnContext withTurnContext)

Initializes a new instance of the DelegatingTurnContext class.

Parameters:

withTurnContext - The TurnContext to wrap.

Method Details

deleteActivity

public CompletableFuture deleteActivity(ConversationReference conversationReference)

Deletes an existing activity.

Parameters:

conversationReference

deleteActivity

public CompletableFuture deleteActivity(String activityId)

Deletes an existing activity.

Parameters:

activityId

getActivity

public Activity getActivity()

Gets the inner context's activity.

Returns:

The inner getActivity().

getAdapter

public BotAdapter getAdapter()

Gets the inner context's activity.

Returns:

The inner getAdapter().

getLocale

public String getLocale()

Gets the locale on this context object.

Returns:

The string of locale on this context object.

getResponded

public boolean getResponded()

Gets the inner context's responded value.

Returns:

The inner getResponded().

getTurnState

public TurnContextStateCollection getTurnState()

Gets the inner context's activity.

Returns:

The inner getTurnState().

onDeleteActivity

public TurnContext onDeleteActivity(DeleteActivityHandler handler)

Adds a response handler for delete activity operations.

When the context's deleteActivity(String activityId) is called, the adapter calls the registered handlers in the order in which they were added to the context object.

Parameters:

handler

onSendActivities

public TurnContext onSendActivities(SendActivitiesHandler handler)

Adds a response handler for send activity operations.

When the context's sendActivity(Activity activity) or sendActivities(List<Activity> activities) methods are called, the adapter calls the registered handlers in the order in which they were added to the context object.

Parameters:

handler

onUpdateActivity

public TurnContext onUpdateActivity(UpdateActivityHandler handler)

Adds a response handler for update activity operations.

When the context's updateActivity(Activity activity) is called, the adapter calls the registered handlers in the order in which they were added to the context object.

Parameters:

handler

sendActivities

public CompletableFuture sendActivities(List activities)

Sends a list of activities to the sender of the incoming activity.

If the activities are successfully sent, the task result contains an array of ResourceResponse objects containing the IDs that the receiving channel assigned to the activities.

Parameters:

activities

sendActivity

public CompletableFuture sendActivity(Activity activity)

Sends an activity to the sender of the incoming activity.

Parameters:

activity

sendActivity

public CompletableFuture sendActivity(String textReplyToSend)

Sends a message activity to the sender of the incoming activity.

If the activity is successfully sent, the task result contains a ResourceResponse object containing the ID that the receiving channel assigned to the activity.

See the channel's documentation for limits imposed upon the contents of textReplyToSend.

Parameters:

textReplyToSend

sendActivity

public CompletableFuture sendActivity(String textReplyToSend, String speak)

Sends a message activity to the sender of the incoming activity.

If the activity is successfully sent, the task result contains a ResourceResponse object containing the ID that the receiving channel assigned to the activity.

See the channel's documentation for limits imposed upon the contents of textReplyToSend.

To control various characteristics of your bot's speech such as voice, rate, volume, pronunciation, and pitch, specify speak in Speech Synthesis Markup Language (SSML) format.

Parameters:

textReplyToSend
speak

sendActivity

public CompletableFuture sendActivity(String textReplyToSend, String speak, InputHints inputHint)

Sends a message activity to the sender of the incoming activity.

If the activity is successfully sent, the task result contains a ResourceResponse object containing the ID that the receiving channel assigned to the activity.

See the channel's documentation for limits imposed upon the contents of textReplyToSend.

To control various characteristics of your bot's speech such as voice, rate, volume, pronunciation, and pitch, specify speak in Speech Synthesis Markup Language (SSML) format.

Parameters:

textReplyToSend
speak
inputHint

setLocale

public void setLocale(String withLocale)

Set the locale on this context object.

Parameters:

withLocale - The string of locale on this context object.

updateActivity

public CompletableFuture updateActivity(Activity activity)

Replaces an existing activity.

If the activity is successfully sent, the task result contains a ResourceResponse object containing the ID that the receiving channel assigned to the activity.

Before calling this, set the ID of the replacement activity to the ID of the activity to replace.

Parameters:

activity

Applies to