UNPKG

5.82 kBTypeScriptView Raw
1import { BotFrameworkAuthentication, ClaimsIdentity } from 'botframework-connector';
2import { CloudChannelServiceHandler } from '../cloudChannelServiceHandler';
3import { Activity, BotAdapter, ChannelAccount, ResourceResponse, SkillConversationIdFactoryBase, TurnContext } from 'botbuilder-core';
4/**
5 * A Bot Framework Handler for skills.
6 */
7export declare class CloudSkillHandler extends CloudChannelServiceHandler {
8 /**
9 * Used to access the CovnersationReference sent from the Skill to the Parent.
10 */
11 readonly SkillConversationReferenceKey: symbol;
12 private readonly inner;
13 /**
14 * Initializes a new instance of the CloudSkillHandler class.
15 *
16 * @param adapter An instance of the BotAdapter that will handle the request.
17 * @param logic The Bot logic function
18 * @param conversationIdFactory A SkillConversationIdFactoryBase to unpack the conversation ID and map it to the calling bot.
19 * @param auth Bot Framework Authentication to use
20 */
21 constructor(adapter: BotAdapter, logic: (context: TurnContext) => Promise<void>, conversationIdFactory: SkillConversationIdFactoryBase, auth: BotFrameworkAuthentication);
22 /**
23 * sendToConversation() API for Skill.
24 *
25 * @remarks
26 * This method allows you to send an activity to the end of a conversation.
27 *
28 * This is slightly different from replyToActivity().
29 * * sendToConversation(conversationId) - will append the activity to the end
30 * of the conversation according to the timestamp or semantics of the channel.
31 * * replyToActivity(conversationId,ActivityId) - adds the activity as a reply
32 * to another activity, if the channel supports it. If the channel does not
33 * support nested replies, replyToActivity falls back to sendToConversation.
34 *
35 * Use replyToActivity when replying to a specific activity in the conversation.
36 *
37 * Use sendToConversation in all other cases.
38 * @param claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
39 * @param conversationId Conversation ID.
40 * @param activity Activity to send.
41 * @returns A Promise with a ResourceResponse.
42 */
43 protected onSendToConversation(claimsIdentity: ClaimsIdentity, conversationId: string, activity: Activity): Promise<ResourceResponse>;
44 /**
45 * replyToActivity() API for Skill.
46 *
47 * @remarks
48 * This method allows you to reply to an activity.
49 *
50 * This is slightly different from sendToConversation().
51 * * sendToConversation(conversationId) - will append the activity to the end
52 * of the conversation according to the timestamp or semantics of the channel.
53 * * replyToActivity(conversationId,ActivityId) - adds the activity as a reply
54 * to another activity, if the channel supports it. If the channel does not
55 * support nested replies, replyToActivity falls back to sendToConversation.
56 *
57 * Use replyToActivity when replying to a specific activity in the conversation.
58 *
59 * Use sendToConversation in all other cases.
60 * @param claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
61 * @param conversationId Conversation ID.
62 * @param activityId activityId the reply is to.
63 * @param activity Activity to send.
64 * @returns A Promise with a ResourceResponse.
65 */
66 protected onReplyToActivity(claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string, activity: Activity): Promise<ResourceResponse>;
67 /**
68 *
69 * UpdateActivity() API for Skill.
70 *
71 * @remarks
72 * Edit an existing activity.
73 *
74 * Some channels allow you to edit an existing activity to reflect the new
75 * state of a bot conversation.
76 *
77 * For example, you can remove buttons after someone has clicked "Approve" button.
78 * @param claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
79 * @param conversationId Conversation ID.
80 * @param activityId activityId to update.
81 * @param activity replacement Activity.
82 * @returns a promise resolving to the underlying resource response
83 */
84 protected onUpdateActivity(claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string, activity: Activity): Promise<ResourceResponse>;
85 /**
86 * DeleteActivity() API for Skill.
87 *
88 * @remarks
89 * Delete an existing activity.
90 *
91 * Some channels allow you to delete an existing activity, and if successful
92 * this method will remove the specified activity.
93 *
94 *
95 * @param claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
96 * @param conversationId Conversation ID.
97 * @param activityId activityId to delete.
98 * @returns a promise representing the async operation
99 */
100 protected onDeleteActivity(claimsIdentity: ClaimsIdentity, conversationId: string, activityId: string): Promise<void>;
101 /**
102 * getConversationMember() API for Skill.
103 *
104 * @remarks
105 * Get the account of a single conversation member.
106 *
107 * This REST API takes a ConversationId and UserId and returns the ChannelAccount
108 * object representing the member of the conversation.
109 * @param claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
110 * @param userId User ID.
111 * @param conversationId Conversation ID.
112 *
113 * @returns The ChannelAccount object representing the member of the conversation.
114 */
115 protected onGetConversationMember(claimsIdentity: ClaimsIdentity, userId: string, conversationId: string): Promise<ChannelAccount>;
116}
117//# sourceMappingURL=cloudSkillHandler.d.ts.map
\No newline at end of file