1 | import { ClaimsIdentity } from 'botframework-connector';
|
2 | import { Activity, AttachmentData, ChannelAccount, ConversationParameters, ConversationResourceResponse, ConversationsResult, PagedMembersResult, ResourceResponse, Transcript } from 'botbuilder-core';
|
3 | /**
|
4 | * The ChannelServiceHandlerBase implements API to forward activity to a skill and
|
5 | * implements routing ChannelAPI calls from the Skill up through the bot/adapter.
|
6 | */
|
7 | export declare abstract class ChannelServiceHandlerBase {
|
8 | /**
|
9 | * Sends an [Activity](xref:botframework-schema.Activity) to the end of a conversation.
|
10 | *
|
11 | * @param authHeader The authentication header.
|
12 | * @param conversationId The conversation Id.
|
13 | * @param activity The [Activity](xref:botframework-schema.Activity) to send.
|
14 | * @returns A `Promise` representing the [ResourceResponse](xref:botframework-schema.ResourceResponse) for the operation.
|
15 | */
|
16 | handleSendToConversation(authHeader: string, conversationId: string, activity: Activity): Promise<ResourceResponse>;
|
17 | /**
|
18 | * Sends a reply to an [Activity](xref:botframework-schema.Activity).
|
19 | *
|
20 | * @param authHeader The authentication header.
|
21 | * @param conversationId The conversation Id.
|
22 | * @param activityId The activity Id the reply is to.
|
23 | * @param activity The [Activity](xref:botframework-schema.Activity) to send.
|
24 | * @returns A `Promise` representing the [ResourceResponse](xref:botframework-schema.ResourceResponse) for the operation.
|
25 | */
|
26 | handleReplyToActivity(authHeader: string, conversationId: string, activityId: string, activity: Activity): Promise<ResourceResponse>;
|
27 | /**
|
28 | * Edits a previously sent existing [Activity](xref:botframework-schema.Activity).
|
29 | *
|
30 | * @param authHeader The authentication header.
|
31 | * @param conversationId The conversation Id.
|
32 | * @param activityId The activity Id to update.
|
33 | * @param activity The replacement [Activity](xref:botframework-schema.Activity).
|
34 | * @returns A `Promise` representing the [ResourceResponse](xref:botframework-schema.ResourceResponse) for the operation.
|
35 | */
|
36 | handleUpdateActivity(authHeader: string, conversationId: string, activityId: string, activity: Activity): Promise<ResourceResponse>;
|
37 | /**
|
38 | * Deletes an existing [Activity](xref:botframework-schema.Activity).
|
39 | *
|
40 | * @param authHeader The authentication header.
|
41 | * @param conversationId The conversation Id.
|
42 | * @param activityId The activity Id to delete.
|
43 | */
|
44 | handleDeleteActivity(authHeader: string, conversationId: string, activityId: string): Promise<void>;
|
45 | /**
|
46 | * Enumerates the members of an [Activity](xref:botframework-schema.Activity).
|
47 | *
|
48 | * @param authHeader The authentication header.
|
49 | * @param conversationId The conversation Id.
|
50 | * @param activityId The activity Id.
|
51 | * @returns The enumerated [ChannelAccount](xref:botframework-schema.ChannelAccount) list.
|
52 | */
|
53 | handleGetActivityMembers(authHeader: string, conversationId: string, activityId: string): Promise<ChannelAccount[]>;
|
54 | /**
|
55 | * Creates a new Conversation.
|
56 | *
|
57 | * @param authHeader The authentication header.
|
58 | * @param parameters [ConversationParameters](xref:botbuilder-core.ConversationParameters) to create the conversation from.
|
59 | * @returns A `Promise` representation for the operation.
|
60 | */
|
61 | handleCreateConversation(authHeader: string, parameters: ConversationParameters): Promise<ConversationResourceResponse>;
|
62 | /**
|
63 | * Lists the Conversations in which the bot has participated.
|
64 | *
|
65 | * @param authHeader The authentication header.
|
66 | * @param conversationId The conversation Id.
|
67 | * @param continuationToken A skip or continuation token.
|
68 | * @returns A `Promise` representation for the operation.
|
69 | */
|
70 | handleGetConversations(authHeader: string, conversationId: string, continuationToken?: string): Promise<ConversationsResult>;
|
71 | /**
|
72 | * Enumerates the members of a conversation.
|
73 | *
|
74 | * @param authHeader The authentication header.
|
75 | * @param conversationId The conversation Id.
|
76 | * @returns The enumerated [ChannelAccount](xref:botframework-schema.ChannelAccount) list.
|
77 | */
|
78 | handleGetConversationMembers(authHeader: string, conversationId: string): Promise<ChannelAccount[]>;
|
79 | /**
|
80 | * Gets the account of a single conversation member.
|
81 | *
|
82 | * @param authHeader The authentication header.
|
83 | * @param userId The user Id.
|
84 | * @param conversationId The conversation Id.
|
85 | * @returns The [ChannelAccount](xref:botframework-schema.ChannelAccount) for the provided user id.
|
86 | */
|
87 | handleGetConversationMember(authHeader: string, userId: string, conversationId: string): Promise<ChannelAccount>;
|
88 | /**
|
89 | * Enumerates the members of a conversation one page at a time.
|
90 | *
|
91 | * @param authHeader The authentication header.
|
92 | * @param conversationId The conversation Id.
|
93 | * @param pageSize Suggested page size.
|
94 | * @param continuationToken A continuation token.
|
95 | * @returns A `Promise` representing the [PagedMembersResult](xref:botframework-schema.PagedMembersResult) for the operation.
|
96 | */
|
97 | handleGetConversationPagedMembers(authHeader: string, conversationId: string, pageSize?: number, continuationToken?: string): Promise<PagedMembersResult>;
|
98 | /**
|
99 | * Deletes a member from a conversation.
|
100 | *
|
101 | * @param authHeader The authentication header.
|
102 | * @param conversationId The conversation Id.
|
103 | * @param memberId Id of the member to delete from this conversation.
|
104 | */
|
105 | handleDeleteConversationMember(authHeader: string, conversationId: string, memberId: string): Promise<void>;
|
106 | /**
|
107 | * Uploads the historic activities of the conversation.
|
108 | *
|
109 | * @param authHeader The authentication header.
|
110 | * @param conversationId The conversation Id.
|
111 | * @param transcript [Transcript](xref:botframework-schema.Transcript) of activities.
|
112 | * @returns A `Promise` representing the [ResourceResponse](xref:botframework-schema.ResourceResponse) for the operation.
|
113 | */
|
114 | handleSendConversationHistory(authHeader: string, conversationId: string, transcript: Transcript): Promise<ResourceResponse>;
|
115 | /**
|
116 | * Stores data in a compliant store when dealing with enterprises.
|
117 | *
|
118 | * @param authHeader The authentication header.
|
119 | * @param conversationId The conversation Id.
|
120 | * @param attachmentUpload [AttachmentData](xref:botframework-schema.AttachmentData).
|
121 | * @returns A `Promise` representing the [ResourceResponse](xref:botframework-schema.ResourceResponse) for the operation.
|
122 | */
|
123 | handleUploadAttachment(authHeader: string, conversationId: string, attachmentUpload: AttachmentData): Promise<ResourceResponse>;
|
124 | /**
|
125 | * SendToConversation() API for Skill.
|
126 | *
|
127 | * @remarks
|
128 | * This method allows you to send an activity to the end of a conversation.
|
129 | * This is slightly different from ReplyToActivity().
|
130 | * * SendToConversation(conversationId) - will append the activity to the end
|
131 | * of the conversation according to the timestamp or semantics of the channel.
|
132 | * * ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply
|
133 | * to another activity, if the channel supports it. If the channel does not
|
134 | * support nested replies, ReplyToActivity falls back to SendToConversation.
|
135 | *
|
136 | * Use ReplyToActivity when replying to a specific activity in the
|
137 | * conversation.
|
138 | *
|
139 | * Use SendToConversation in all other cases.
|
140 | * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
|
141 | * @param _conversationId Conversation identifier
|
142 | * @param _activity Activity to send
|
143 | */
|
144 | protected onSendToConversation(_claimsIdentity: ClaimsIdentity, _conversationId: string, _activity: Activity): Promise<ResourceResponse>;
|
145 | /**
|
146 | * ReplyToActivity() API for Skill.
|
147 | *
|
148 | * @remarks
|
149 | * This method allows you to reply to an activity.
|
150 | *
|
151 | * This is slightly different from SendToConversation().
|
152 | * * SendToConversation(conversationId) - will append the activity to the end
|
153 | * of the conversation according to the timestamp or semantics of the channel.
|
154 | * * ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply
|
155 | * to another activity, if the channel supports it. If the channel does not
|
156 | * support nested replies, ReplyToActivity falls back to SendToConversation.
|
157 | *
|
158 | * Use ReplyToActivity when replying to a specific activity in the
|
159 | * conversation.
|
160 | *
|
161 | * Use SendToConversation in all other cases.
|
162 | * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
|
163 | * @param _conversationId Conversation ID.
|
164 | * @param _activityId activityId the reply is to (OPTIONAL).
|
165 | * @param _activity Activity to send.
|
166 | */
|
167 | protected onReplyToActivity(_claimsIdentity: ClaimsIdentity, _conversationId: string, _activityId: string, _activity: Activity): Promise<ResourceResponse>;
|
168 | /**
|
169 | * UpdateActivity() API for Skill.
|
170 | *
|
171 | * @remarks
|
172 | * Edit an existing activity.
|
173 | *
|
174 | * Some channels allow you to edit an existing activity to reflect the new
|
175 | * state of a bot conversation.
|
176 | *
|
177 | * For example, you can remove buttons after someone has clicked "Approve" button.
|
178 | * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
|
179 | * @param _conversationId Conversation ID.
|
180 | * @param _activityId activityId to update.
|
181 | * @param _activity replacement Activity.
|
182 | */
|
183 | protected onUpdateActivity(_claimsIdentity: ClaimsIdentity, _conversationId: string, _activityId: string, _activity: Activity): Promise<ResourceResponse>;
|
184 | /**
|
185 | * DeleteActivity() API for Skill.
|
186 | *
|
187 | * @remarks
|
188 | * Delete an existing activity.
|
189 | *
|
190 | * Some channels allow you to delete an existing activity, and if successful
|
191 | * this method will remove the specified activity.
|
192 | *
|
193 | *
|
194 | * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
|
195 | * @param _conversationId Conversation ID.
|
196 | * @param _activityId activityId to delete.
|
197 | */
|
198 | protected onDeleteActivity(_claimsIdentity: ClaimsIdentity, _conversationId: string, _activityId: string): Promise<void>;
|
199 | /**
|
200 | * GetActivityMembers() API for Skill.
|
201 | *
|
202 | * @remarks
|
203 | * Enumerate the members of an activity.
|
204 | *
|
205 | * This REST API takes a ConversationId and a ActivityId, returning an array
|
206 | * of ChannelAccount objects representing the members of the particular
|
207 | * activity in the conversation.
|
208 | * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
|
209 | * @param _conversationId Conversation ID.
|
210 | * @param _activityId Activity ID.
|
211 | */
|
212 | protected onGetActivityMembers(_claimsIdentity: ClaimsIdentity, _conversationId: string, _activityId: string): Promise<ChannelAccount[]>;
|
213 | /**
|
214 | * CreateConversation() API for Skill.
|
215 | *
|
216 | * @remarks
|
217 | * Create a new Conversation.
|
218 | *
|
219 | * POST to this method with a
|
220 | * * Bot being the bot creating the conversation
|
221 | * * IsGroup set to true if this is not a direct message (default is false)
|
222 | * * Array containing the members to include in the conversation
|
223 | *
|
224 | * The return value is a ResourceResponse which contains a conversation id
|
225 | * which is suitable for use in the message payload and REST API uris.
|
226 | *
|
227 | * Most channels only support the semantics of bots initiating a direct
|
228 | * message conversation.
|
229 | *
|
230 | * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
|
231 | * @param _parameters Parameters to create the conversation from.
|
232 | */
|
233 | protected onCreateConversation(_claimsIdentity: ClaimsIdentity, _parameters: ConversationParameters): Promise<ConversationResourceResponse>;
|
234 | /**
|
235 | * onGetConversations() API for Skill.
|
236 | *
|
237 | * @remarks
|
238 | * List the Conversations in which this bot has participated.
|
239 | *
|
240 | * GET from this method with a skip token
|
241 | *
|
242 | * The return value is a ConversationsResult, which contains an array of
|
243 | * ConversationMembers and a skip token. If the skip token is not empty, then
|
244 | * there are further values to be returned. Call this method again with the
|
245 | * returned token to get more values.
|
246 | *
|
247 | * Each ConversationMembers object contains the ID of the conversation and an
|
248 | * array of ChannelAccounts that describe the members of the conversation.
|
249 | *
|
250 | * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
|
251 | * @param _conversationId Conversation ID.
|
252 | * @param _continuationToken Skip or continuation token.
|
253 | */
|
254 | protected onGetConversations(_claimsIdentity: ClaimsIdentity, _conversationId: string, _continuationToken?: string): Promise<ConversationsResult>;
|
255 | /**
|
256 | * getConversationMembers() API for Skill.
|
257 | *
|
258 | * @remarks
|
259 | * Enumerate the members of a conversation.
|
260 | *
|
261 | * This REST API takes a ConversationId and returns an array of ChannelAccount
|
262 | * objects representing the members of the conversation.
|
263 | * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
|
264 | * @param _conversationId Conversation ID.
|
265 | */
|
266 | protected onGetConversationMembers(_claimsIdentity: ClaimsIdentity, _conversationId: string): Promise<ChannelAccount[]>;
|
267 | /**
|
268 | * getConversationMember() API for Skill.
|
269 | *
|
270 | * @remarks
|
271 | * Get the account of a single conversation member.
|
272 | *
|
273 | * This REST API takes a ConversationId and UserId and returns the ChannelAccount
|
274 | * object representing the member of the conversation.
|
275 | * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
|
276 | * @param _userId User ID.
|
277 | * @param _conversationId Conversation ID.
|
278 | */
|
279 | protected onGetConversationMember(_claimsIdentity: ClaimsIdentity, _userId: string, _conversationId: string): Promise<ChannelAccount>;
|
280 | /**
|
281 | * getConversationPagedMembers() API for Skill.
|
282 | *
|
283 | * @remarks
|
284 | * Enumerate the members of a conversation one page at a time.
|
285 | *
|
286 | * This REST API takes a ConversationId. Optionally a pageSize and/or
|
287 | * continuationToken can be provided. It returns a PagedMembersResult, which
|
288 | * contains an array
|
289 | * of ChannelAccounts representing the members of the conversation and a
|
290 | * continuation token that can be used to get more values.
|
291 | *
|
292 | * One page of ChannelAccounts records are returned with each call. The number
|
293 | * of records in a page may vary between channels and calls. The pageSize
|
294 | * parameter can be used as
|
295 | * a suggestion. If there are no additional results the response will not
|
296 | * contain a continuation token. If there are no members in the conversation
|
297 | * the Members will be empty or not present in the response.
|
298 | *
|
299 | * A response to a request that has a continuation token from a prior request
|
300 | * may rarely return members from a previous request.
|
301 | * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
|
302 | * @param _conversationId Conversation ID.
|
303 | * @param _pageSize Suggested page size.
|
304 | * @param _continuationToken Continuation Token.
|
305 | */
|
306 | protected onGetConversationPagedMembers(_claimsIdentity: ClaimsIdentity, _conversationId: string, _pageSize?: number, _continuationToken?: string): Promise<PagedMembersResult>;
|
307 | /**
|
308 | * DeleteConversationMember() API for Skill.
|
309 | *
|
310 | * @remarks
|
311 | * Deletes a member from a conversation.
|
312 | *
|
313 | * This REST API takes a ConversationId and a memberId (of type string) and
|
314 | * removes that member from the conversation. If that member was the last member
|
315 | * of the conversation, the conversation will also be deleted.
|
316 | * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
|
317 | * @param _conversationId Conversation ID.
|
318 | * @param _memberId ID of the member to delete from this conversation.
|
319 | */
|
320 | protected onDeleteConversationMember(_claimsIdentity: ClaimsIdentity, _conversationId: string, _memberId: string): Promise<void>;
|
321 | /**
|
322 | * SendConversationHistory() API for Skill.
|
323 | *
|
324 | * @remarks
|
325 | * This method allows you to upload the historic activities to the
|
326 | * conversation.
|
327 | *
|
328 | * Sender must ensure that the historic activities have unique ids and
|
329 | * appropriate timestamps. The ids are used by the client to deal with
|
330 | * duplicate activities and the timestamps are used by the client to render
|
331 | * the activities in the right order.
|
332 | * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
|
333 | * @param _conversationId Conversation ID.
|
334 | * @param _transcript Transcript of activities.
|
335 | */
|
336 | protected onSendConversationHistory(_claimsIdentity: ClaimsIdentity, _conversationId: string, _transcript: Transcript): Promise<ResourceResponse>;
|
337 | /**
|
338 | * UploadAttachment() API for Skill.
|
339 | *
|
340 | * @remarks
|
341 | * Upload an attachment directly into a channel's blob storage.
|
342 | *
|
343 | * This is useful because it allows you to store data in a compliant store
|
344 | * when dealing with enterprises.
|
345 | *
|
346 | * The response is a ResourceResponse which contains an AttachmentId which is
|
347 | * suitable for using with the attachments API.
|
348 | * @param _claimsIdentity ClaimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
|
349 | * @param _conversationId Conversation ID.
|
350 | * @param _attachmentUpload Attachment data.
|
351 | */
|
352 | protected onUploadAttachment(_claimsIdentity: ClaimsIdentity, _conversationId: string, _attachmentUpload: AttachmentData): Promise<ResourceResponse>;
|
353 | /**
|
354 | * Helper to authenticate the header token and extract the claims.
|
355 | *
|
356 | * @param authHeader HTTP authorization header
|
357 | * @returns a promise resolving to the authorization header claims
|
358 | */
|
359 | protected abstract authenticate(authHeader: string): Promise<ClaimsIdentity>;
|
360 | }
|
361 | //# sourceMappingURL=channelServiceHandlerBase.d.ts.map |
\ | No newline at end of file |