UNPKG

3.38 kBTypeScriptView Raw
1import { Activity, PagedResult, TranscriptInfo, TranscriptStore } from 'botbuilder-core';
2/**
3 * The file transcript store stores transcripts in file system with each activity as a file.
4 *
5 * @remarks
6 * This class provides an interface to log all incoming and outgoing activities to the filesystem.
7 * It implements the features necessary to work alongside the TranscriptLoggerMiddleware plugin.
8 * When used in concert, your bot will automatically log all conversations.
9 *
10 * Below is the boilerplate code needed to use this in your app:
11 * ```javascript
12 * const { FileTranscriptStore, TranscriptLoggerMiddleware } = require('botbuilder');
13 *
14 * adapter.use(new TranscriptLoggerMiddleware(new FileTranscriptStore(__dirname + '/transcripts/')));
15 * ```
16 */
17export declare class FileTranscriptStore implements TranscriptStore {
18 private static readonly PageSize;
19 private readonly rootFolder;
20 /**
21 * Creates an instance of FileTranscriptStore.
22 *
23 * @param folder Root folder where transcript will be stored.
24 */
25 constructor(folder: string);
26 /**
27 * Log an activity to the transcript.
28 *
29 * @param activity Activity being logged.
30 * @returns {Promise<void>} a promise representing the asynchronous operation.
31 */
32 logActivity(activity: Activity): Promise<void>;
33 /**
34 * Get all activities associated with a conversation id (aka get the transcript).
35 *
36 * @param channelId Channel Id.
37 * @param conversationId Conversation Id.
38 * @param continuationToken (Optional) Continuation token to page through results.
39 * @param startDate (Optional) Earliest time to include.
40 * @returns {Promise<PagedResult<Activity>>} PagedResult of activities.
41 */
42 getTranscriptActivities(channelId: string, conversationId: string, continuationToken?: string, startDate?: Date): Promise<PagedResult<Activity>>;
43 /**
44 * List all the logged conversations for a given channelId.
45 *
46 * @param channelId Channel Id.
47 * @param continuationToken (Optional) Continuation token to page through results.
48 * @returns {Promise<PagedResult<TranscriptInfo>>} PagedResult of transcripts.
49 */
50 listTranscripts(channelId: string, continuationToken?: string): Promise<PagedResult<TranscriptInfo>>;
51 /**
52 * Delete a conversation and all of it's activities.
53 *
54 * @param channelId Channel Id where conversation took place.
55 * @param conversationId Id of the conversation to delete.
56 * @returns {Promise<void>} A promise representing the asynchronous operation.
57 */
58 deleteTranscript(channelId: string, conversationId: string): Promise<void>;
59 /**
60 * Saves the [Activity](xref:botframework-schema.Activity) as a JSON file.
61 *
62 * @param activity The [Activity](xref:botframework-schema.Activity) to transcript.
63 * @param transcriptPath The path where the transcript will be saved.
64 * @param activityFilename The name for the file.
65 * @returns {Promise<void>} A promise representing the asynchronous operation.
66 */
67 private saveActivity;
68 /**
69 * @private
70 */
71 private getActivityFilename;
72 /**
73 * @private
74 */
75 private getChannelFolder;
76 /**
77 * @private
78 */
79 private getTranscriptFolder;
80 /**
81 * @private
82 */
83 private sanitizeKey;
84}
85//# sourceMappingURL=fileTranscriptStore.d.ts.map
\No newline at end of file