@microsoft/agents-hosting-teams
Version:
Microsoft 365 Agents SDK for JavaScript
164 lines (163 loc) • 6.65 kB
TypeScript
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { Activity, ConversationReference } from '@microsoft/agents-activity';
import { AgentApplication, Authorization, RouteHandler, RouteSelector, TurnContext, TurnState } from '@microsoft/agents-hosting';
import { TeamsApplicationOptions } from './teamsApplicationOptions';
import { FileConsentCardResponse } from '../file/fileConsentCardResponse';
import { ChannelInfo } from '../channel-data/channelInfo';
import { TeamDetails } from '../connector-client/teamDetails';
import { TeamsPagedMembersResult } from '../connector-client/teamsPagedMembersResult';
import { ReadReceiptInfo } from '../message-read-info/readReceipInfo';
import { AdaptiveCardsActions } from './adaptive-cards-actions';
import { MessageReactionEvents, Messages, TeamsMessageEvents } from './messages';
import { MessageExtensions } from './messaging-extension';
import { Meetings } from './meeting';
import { TaskModules } from './task';
import { TeamsConversationUpdateEvents } from './conversation-events';
/**
* Represents a Teams application that extends the AgentApplication class.
* Provides various functionalities for handling Teams-specific events, messages, and interactions.
* @template TState - The type of the turn state.
*/
export declare class TeamsApplication<TState extends TurnState> extends AgentApplication<TState> {
/**
* Options for configuring the Teams application.
*/
private readonly _teamsOptions;
/**
* Routes for handling invoke activities.
*/
private readonly _invokeRoutes;
/**
* Handles adaptive card actions.
*/
private readonly _adaptiveCards;
/**
* Handles messages and message-related events.
*/
private readonly _messages;
/**
* Handles messaging extensions.
*/
private readonly _messageExtensions;
/**
* Handles meeting-related events and actions.
*/
private readonly _meetings;
/**
* Handles task modules.
*/
private readonly _taskModules;
/**
* Manages Teams OAuth flow for authentication.
*/
private readonly _teamsAuthManager?;
/**
* Initializes a new instance of the TeamsApplication class.
* @param options - Partial options for configuring the Teams application.
*/
constructor(options?: Partial<TeamsApplicationOptions<TState>>);
/**
* Gets the Teams application options.
*/
get teamsOptions(): TeamsApplicationOptions<TState>;
/**
* Gets the task modules handler.
*/
get taskModules(): TaskModules<TState>;
/**
* Gets the adaptive cards actions handler.
*/
get adaptiveCards(): AdaptiveCardsActions<TState>;
/**
* Gets the messages handler.
*/
get messages(): Messages<TState>;
/**
* Gets the messaging extensions handler.
*/
get messageExtensions(): MessageExtensions<TState>;
/**
* Gets the meetings handler.
*/
get meetings(): Meetings<TState>;
/**
* Gets the Teams OAuth flow manager.
* @throws Error if no authentication options were configured.
*/
get teamsAuthManager(): Authorization;
/**
* Adds a route to the application.
* @param selector - The route selector.
* @param handler - The route handler.
* @param isInvokeRoute - Whether the route is for invoke activities.
*/
addRoute(selector: RouteSelector, handler: RouteHandler<TState>, isInvokeRoute?: boolean): this;
/**
* Runs the application for the given turn context.
* @param turnContext - The turn context.
*/
run(turnContext: TurnContext): Promise<void>;
private runInternalTeams;
/**
* Handles conversation update events.
* @param event - The conversation update event.
* @param handler - The handler for the event.
*/
onConversationUpdate(event: TeamsConversationUpdateEvents, handler: (context: TurnContext, state: TState) => Promise<void>): this;
/**
* Handles message event updates.
* @param event - The message event.
* @param handler - The handler for the event.
*/
onMessageEventUpdate(event: TeamsMessageEvents, handler: (context: TurnContext, state: TState) => Promise<void>): this;
/**
* Handles message reactions.
* @param event - The message reaction event.
* @param handler - The handler for the event.
*/
onMessageReactions(event: MessageReactionEvents, handler: (context: TurnContext, state: TState) => Promise<void>): this;
/**
* Handles file consent accept actions.
* @param handler - The handler for the file consent accept action.
*/
fileConsentAccept(handler: (context: TurnContext, state: TState, fileConsentResponse: FileConsentCardResponse) => Promise<void>): this;
/**
* Handles file consent decline actions.
* @param handler - The handler for the file consent decline action.
*/
fileConsentDecline(handler: (context: TurnContext, state: TState, fileConsentResponse: FileConsentCardResponse) => Promise<void>): this;
/**
* Handles handoff actions.
* @param handler - The handler for the handoff action.
*/
onHandoff(handler: (context: TurnContext, state: TState, continuation: string) => Promise<void>): this;
/**
* Gets the channels of a team.
* @param context - The turn context, conversation reference, or activity.
*/
getTeamChannels(context: TurnContext | ConversationReference | Activity): Promise<ChannelInfo[]>;
/**
* Gets the details of a team.
* @param context - The turn context, conversation reference, or activity.
*/
getTeamDetails(context: TurnContext | ConversationReference | Activity): Promise<TeamDetails | undefined>;
/**
* Gets the paged members of a team.
* @param context - The turn context or conversation reference.
* @param pageSize - The number of members per page.
* @param continuationToken - The continuation token for pagination.
*/
getPagedMembers(context: TurnContext | ConversationReference, pageSize?: number, continuationToken?: string): Promise<TeamsPagedMembersResult>;
/**
* Handles Teams read receipt events.
* @param handler - The handler for the read receipt event.
*/
onTeamsReadReceipt(handler: (context: TurnContext, state: TState, readReceiptInfo: ReadReceiptInfo) => Promise<void>): this;
private createMessageEventUpdateSelector;
private createMessageReactionSelector;
private getConversationReference;
private createTeamsConversationUpdateSelector;
}