UNPKG

2.77 kBTypeScriptView Raw
1/**
2 * @module botbuilder
3 */
4/**
5 * Copyright (c) Microsoft Corporation. All rights reserved.
6 * Licensed under the MIT License.
7 */
8import { Activity, BotFrameworkClient, InvokeResponse } from 'botbuilder-core';
9import { AppCredentials, ICredentialProvider } from 'botframework-connector';
10/**
11 * HttpClient for calling skills from a Node.js BotBuilder V4 SDK bot.
12 */
13export declare class BotFrameworkHttpClient implements BotFrameworkClient {
14 protected readonly channelService: string;
15 /**
16 * Cache for appCredentials to speed up token acquisition (a token is not requested unless is expired)
17 * AppCredentials are cached using appId + scope (this last parameter is only used if the app credentials are used to call a skill)
18 */
19 private static readonly appCredentialMapCache;
20 private readonly credentialProvider;
21 /**
22 * Creates a new instance of the [BotFrameworkHttpClient](xref:botbuilder.BotFrameworkHttpClient) class
23 * @param credentialProvider An instance of [ICredentialProvider](xref:botframework-connector.ICredentialProvider).
24 * @param channelService Optional. The channel service.
25 */
26 constructor(credentialProvider: ICredentialProvider, channelService?: string);
27 /**
28 * Forwards an activity to another bot.
29 * @remarks
30 *
31 * @template T The type of body in the InvokeResponse.
32 * @param fromBotId The MicrosoftAppId of the bot sending the activity.
33 * @param toBotId The MicrosoftAppId of the bot receiving the activity.
34 * @param toUrl The URL of the bot receiving the activity.
35 * @param serviceUrl The callback Url for the skill host.
36 * @param conversationId A conversation ID to use for the conversation with the skill.
37 * @param activity Activity to forward.
38 */
39 postActivity<T = any>(fromBotId: string, toBotId: string, toUrl: string, serviceUrl: string, conversationId: string, activity: Activity): Promise<InvokeResponse<T>>;
40 /**
41 * Logic to build an [AppCredentials](xref:botframework-connector.AppCredentials) to be used to acquire tokens for this `HttpClient`.
42 * @param appId The application id.
43 * @param oAuthScope Optional. The OAuth scope.
44 *
45 * @returns The app credentials to be used to acquire tokens.
46 */
47 protected buildCredentials(appId: string, oAuthScope?: string): Promise<AppCredentials>;
48 /**
49 * Gets the application credentials. App Credentials are cached so as to ensure we are not refreshing
50 * token every time.
51 * @private
52 * @param appId The application identifier (AAD Id for the bot).
53 * @param oAuthScope The scope for the token, skills will use the Skill App Id.
54 */
55 private getAppCredentials;
56}
57//# sourceMappingURL=botFrameworkHttpClient.d.ts.map
\No newline at end of file