@microsoft/teams-ai
Version:
SDK focused on building AI based applications for Microsoft Teams.
62 lines • 2.32 kB
TypeScript
import { TokenResponse, TurnContext } from 'botbuilder';
/**
* @internal
*/
export interface AdaptiveCardLoginRequest {
statusCode: number;
type: 'application/vnd.microsoft.activity.loginRequest';
value: {
text: string;
connectionName: string;
tokenExchangeResource?: {
id: string;
uri: string;
providerId?: string;
};
buttons: {
title: string;
text: string;
type: string;
value: string;
}[];
};
}
/**
* @internal
*
* Base class to handle adaptive card authentication.
*/
export declare abstract class AdaptiveCardAuthenticationBase {
/**
* Authenticates the user.
* @param {TurnContext} context - The turn context.
* @returns {Promise<string | undefined>} - The authentication token, or undefined if authentication failed. Teams will ask user to sign-in if authentication failed.
*/
authenticate(context: TurnContext): Promise<string | undefined>;
/**
* Checks if the activity is a valid Adaptive Card activity that supports authentication.
* @param {TurnContext} context - The turn context.
* @returns {boolean} A boolean indicating if the activity is valid.
*/
isValidActivity(context: TurnContext): boolean;
/**
* Handles the SSO token exchange.
* @param context - The turn context.
* @returns A promise that resolves to the token response or undefined if token exchange failed.
*/
abstract handleSsoTokenExchange(context: TurnContext): Promise<TokenResponse | undefined>;
/**
* Handles the user sign-in.
* @param context - The turn context.
* @param magicCode - The magic code from user sign-in.
* @returns A promise that resolves to the token response or undefined if failed to verify the magic code.
*/
abstract handleUserSignIn(context: TurnContext, magicCode: string): Promise<TokenResponse | undefined>;
/**
* Gets the login request for Adaptive Card authentication.
* @param context - The turn context.
* @returns A promise that resolves to the login request.
*/
abstract getLoginRequest(context: TurnContext): Promise<AdaptiveCardLoginRequest>;
}
//# sourceMappingURL=AdaptiveCardAuthenticationBase.d.ts.map