BotFrameworkAdapter class interface complete.
This commit is contained in:
Родитель
04100e9a07
Коммит
13a3e99c1f
|
@ -153,7 +153,7 @@ public class ActivityHandler implements Bot {
|
|||
* @return A task that represents the work queued to execute.
|
||||
*/
|
||||
protected CompletableFuture<Void> onMessageReactionActivity(TurnContext turnContext) {
|
||||
CompletableFuture task = null;
|
||||
CompletableFuture<Void> task = null;
|
||||
|
||||
if (turnContext.getActivity().getReactionsAdded() != null) {
|
||||
task = onReactionsAdded(turnContext.getActivity().getReactionsAdded(), turnContext);
|
||||
|
@ -224,8 +224,8 @@ public class ActivityHandler implements Bot {
|
|||
* <p>
|
||||
* By default, this method does nothing.
|
||||
*
|
||||
* @param turnContext
|
||||
* @return
|
||||
* @param turnContext The context object for this turn.
|
||||
* @return A task that represents the work queued to execute.
|
||||
*/
|
||||
protected CompletableFuture<Void> onTokenResponseEvent(TurnContext turnContext) {
|
||||
return CompletableFuture.completedFuture(null);
|
||||
|
@ -247,9 +247,9 @@ public class ActivityHandler implements Bot {
|
|||
}
|
||||
|
||||
/**
|
||||
* Invoked when an activity other than a message, conversation update, or event is received when the base behavior of
|
||||
* {@link #onTurn(TurnContext)} is used.
|
||||
* <p>
|
||||
* Invoked when an activity other than a message, conversation update, or event is received
|
||||
* when the base behavior of {@link #onTurn(TurnContext)} is used.
|
||||
*
|
||||
* If overridden, this could potentially respond to any of the other activity types like
|
||||
* {@link com.microsoft.bot.schema.ActivityTypes#CONTACT_RELATION_UPDATE} or
|
||||
* {@link com.microsoft.bot.schema.ActivityTypes#END_OF_CONVERSATION}.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
package com.microsoft.bot.builder;
|
||||
|
||||
import com.microsoft.bot.schema.Activity;
|
||||
|
@ -11,7 +12,14 @@ import java.util.List;
|
|||
/**
|
||||
* Provides methods for debugging Bot Builder code.
|
||||
*/
|
||||
public class BotAssert {
|
||||
public final class BotAssert {
|
||||
/**
|
||||
* This class can't be created.
|
||||
*/
|
||||
private BotAssert() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that an activity object is not {@code null}.
|
||||
*
|
||||
|
@ -19,8 +27,9 @@ public class BotAssert {
|
|||
* @throws NullPointerException {@code activity} is {@code null}.
|
||||
*/
|
||||
public static void activityNotNull(Activity activity) {
|
||||
if (activity == null)
|
||||
if (activity == null) {
|
||||
throw new IllegalArgumentException("Activity");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,8 +39,9 @@ public class BotAssert {
|
|||
* @throws NullPointerException {@code context} is {@code null}.
|
||||
*/
|
||||
public static void contextNotNull(TurnContext context) {
|
||||
if (context == null)
|
||||
if (context == null) {
|
||||
throw new IllegalArgumentException("TurnContext");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,8 +51,9 @@ public class BotAssert {
|
|||
* @throws NullPointerException {@code reference} is {@code null}.
|
||||
*/
|
||||
public static void conversationReferenceNotNull(ConversationReference reference) {
|
||||
if (reference == null)
|
||||
if (reference == null) {
|
||||
throw new IllegalArgumentException("ConversationReference");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,8 +63,9 @@ public class BotAssert {
|
|||
* @throws NullPointerException {@code activities} is {@code null}.
|
||||
*/
|
||||
public static void activityListNotNull(List<Activity> activities) {
|
||||
if (activities == null)
|
||||
if (activities == null) {
|
||||
throw new NullPointerException("List<Activity>");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,8 +75,9 @@ public class BotAssert {
|
|||
* @throws NullPointerException {@code middleware} is {@code null}.
|
||||
*/
|
||||
public static void middlewareNotNull(Middleware middleware) {
|
||||
if (middleware == null)
|
||||
if (middleware == null) {
|
||||
throw new NullPointerException("Middleware");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,7 +87,8 @@ public class BotAssert {
|
|||
* @throws NullPointerException {@code middleware} is {@code null}.
|
||||
*/
|
||||
public static void middlewareNotNull(ArrayList<Middleware> middleware) {
|
||||
if (middleware == null)
|
||||
if (middleware == null) {
|
||||
throw new NullPointerException("List<Middleware>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -10,8 +10,8 @@ public final class OAuthClientConfig {
|
|||
|
||||
}
|
||||
|
||||
public static String OAUTHENDPOINT = AuthenticationConstants.OAUTH_URL;
|
||||
public static boolean EMULATEOAUTHCARDS = false;
|
||||
public final static String OAUTHENDPOINT = AuthenticationConstants.OAUTH_URL;
|
||||
public static boolean emulateOAuthCards = false;
|
||||
|
||||
public static CompletableFuture<Void> sendEmulateOAuthCards(OAuthClient client, boolean emulateOAuthCards) {
|
||||
throw new NotImplementedException("sendEmulateOAuthCards");
|
||||
|
|
|
@ -87,4 +87,22 @@ public final class ActivityTypes {
|
|||
* Enum value handoff.
|
||||
*/
|
||||
public static final String HANDOFF = "handoff";
|
||||
|
||||
/**
|
||||
* The type value for delay activities.
|
||||
*
|
||||
* As an outgoing activity type, causes the adapter to pause for {@link Activity#getValue} milliseconds.
|
||||
* The activity's {@link Activity#getValue} should be an integer value.
|
||||
*/
|
||||
public static final String DELAY = "delay";
|
||||
|
||||
/**
|
||||
* The type value for invoke response activities.
|
||||
*
|
||||
* This is used for a return payload in response to an invoke activity.
|
||||
* Invoke activities communicate programmatic information from a client or channel to a bot, and
|
||||
* have a corresponding return payload for use within the channel. The meaning of an invoke activity
|
||||
* is defined by the {@link Activity#getName} property, which is meaningful within the scope of a channel.
|
||||
*/
|
||||
public static final String INVOKE_RESPONSE = "invokeResponse";
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ public class ConversationAccount {
|
|||
* Gets this conversation's {@link #tenantId}.
|
||||
* @return The tenantId value.
|
||||
*/
|
||||
public String setTenantId() {
|
||||
public String getTenantId() {
|
||||
return this.tenantId;
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ public class ConversationAccount {
|
|||
* Sets this conversation's {@link #tenantId}.
|
||||
* @param withTenantId this conversation's tenant ID
|
||||
*/
|
||||
public void getTenantId(String withTenantId) {
|
||||
public void setTenantId(String withTenantId) {
|
||||
this.tenantId = withTenantId;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
package com.microsoft.bot.schema;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
|
@ -64,6 +66,21 @@ public class ConversationReference {
|
|||
}};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates {@link Activity} from conversation reference as it is posted to bot.
|
||||
*/
|
||||
public Activity getContinuationActivity() {
|
||||
Activity activity = Activity.createEventActivity();
|
||||
activity.setName("ContinueConversation");
|
||||
activity.setId(UUID.randomUUID().toString());
|
||||
activity.setChannelId(getChannelId());
|
||||
activity.setConversation(getConversation());
|
||||
activity.setRecipient(getBot());
|
||||
activity.setFrom(getUser());
|
||||
activity.setRelatesTo(this);
|
||||
return activity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the activityId value.
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче