UNPKG

1.88 kBTypeScriptView Raw
1/**
2 * @module botkit
3 */
4/**
5 * Copyright (c) Microsoft Corporation. All rights reserved.
6 * Licensed under the MIT License.
7 */
8import { BotFrameworkAdapter, TurnContext, ChannelInfo } from 'botbuilder';
9import { ConnectorClient, TokenApiClient } from 'botframework-connector';
10import { TeamsBotWorker } from './teamsHelpers';
11/**
12 * This class extends the [BotFrameworkAdapter](https://docs.microsoft.com/en-us/javascript/api/botbuilder/botframeworkadapter?view=botbuilder-ts-latest) with a few additional features to support Microsoft Teams.
13 * * Changes userAgent to reflect Botkit instead of BotBuilder
14 * * Adds getChannels() (MS Teams)
15 * * Adds middleware for adjusting location of tenant id field (MS Teams)
16 */
17export declare class BotkitBotFrameworkAdapter extends BotFrameworkAdapter {
18 botkit_worker: typeof TeamsBotWorker;
19 /**
20 * Allows for mocking of the connector client in unit tests.
21 * Overridden by Botkit in order to change userAgent.
22 * @ignore
23 * @param serviceUrl Clients service url.
24 */
25 createConnectorClient(serviceUrl: string): ConnectorClient;
26 /**
27 * Allows for mocking of the OAuth API Client in unit tests.
28 * Overridden by Botkit in order to change userAgent.
29 * @ignore
30 * @param serviceUrl Clients service url.
31 */
32 protected createTokenApiClient(serviceUrl: string): TokenApiClient;
33 /**
34 * Get the list of channels in a MS Teams team.
35 * Can only be called with a TurnContext that originated in a team conversation - 1:1 conversations happen _outside a team_ and thus do not contain the required information to call this API.
36 * @param context A TurnContext object representing a message or event from a user in Teams
37 * @returns an array of channels in the format [{name: string, id: string}]
38 */
39 getChannels(context: TurnContext): Promise<ChannelInfo[]>;
40}