UNPKG

3.06 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 * @deprecated Use `BotFrameworkAuthentication.createBotFrameworkClient()` to obtain a client and perform the operations that were accomplished through `BotFrameworkHttpClient`.
12 * HttpClient for calling skills from a Node.js BotBuilder V4 SDK bot.
13 */
14export declare class BotFrameworkHttpClient implements BotFrameworkClient {
15 protected readonly channelService: string;
16 /**
17 * Cache for appCredentials to speed up token acquisition (a token is not requested unless is expired)
18 * AppCredentials are cached using appId + scope (this last parameter is only used if the app credentials are used to call a skill)
19 */
20 private static readonly appCredentialMapCache;
21 private readonly credentialProvider;
22 /**
23 * Creates a new instance of the [BotFrameworkHttpClient](xref:botbuilder.BotFrameworkHttpClient) class
24 *
25 * @param credentialProvider An instance of [ICredentialProvider](xref:botframework-connector.ICredentialProvider).
26 * @param channelService Optional. The channel service.
27 */
28 constructor(credentialProvider: ICredentialProvider, channelService?: string);
29 /**
30 * Forwards an activity to another bot.
31 *
32 * @remarks
33 * @template T The type of body in the InvokeResponse.
34 * @param fromBotId The MicrosoftAppId of the bot sending the activity.
35 * @param toBotId The MicrosoftAppId of the bot receiving the activity.
36 * @param toUrl The URL of the bot receiving the activity.
37 * @param serviceUrl The callback Url for the skill host.
38 * @param conversationId A conversation ID to use for the conversation with the skill.
39 * @param activity Activity to forward.
40 * @returns {Promise<InvokeResponse<T>>} A promise representing the asynchronous operation.
41 */
42 postActivity<T = any>(fromBotId: string, toBotId: string, toUrl: string, serviceUrl: string, conversationId: string, activity: Activity): Promise<InvokeResponse<T>>;
43 /**
44 * Logic to build an [AppCredentials](xref:botframework-connector.AppCredentials) to be used to acquire tokens for this `HttpClient`.
45 *
46 * @param appId The application id.
47 * @param oAuthScope Optional. The OAuth scope.
48 *
49 * @returns The app credentials to be used to acquire tokens.
50 */
51 protected buildCredentials(appId: string, oAuthScope?: string): Promise<AppCredentials>;
52 /**
53 * Gets the application credentials. App Credentials are cached so as to ensure we are not refreshing
54 * token every time.
55 * @private
56 * @param appId The application identifier (AAD Id for the bot).
57 * @param oAuthScope The scope for the token, skills will use the Skill App Id.
58 */
59 private getAppCredentials;
60}
61//# sourceMappingURL=botFrameworkHttpClient.d.ts.map
\No newline at end of file