/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { Activity } from '@microsoft/agents-activity'; import { RouteSelector, TurnContext, TurnState } from '@microsoft/agents-hosting'; import { TeamsApplication } from '../teamsApplication'; import { TaskModuleTaskInfo } from '../../task/taskModuleTaskInfo'; import { MessagingExtensionResult } from '../../messaging-extension/messagingExtensionResult'; import { Query } from '../query'; /** * The MessageExtensions class provides methods to handle various messaging extension scenarios in a Teams application. * It allows developers to define handlers for different invoke activities such as queries, task fetches, and message previews. * @template TState - The type of the TurnState used in the application. */ export declare class MessageExtensions { private readonly _app; /** * Creates an instance of MessageExtensions. * @param app - The TeamsApplication instance to associate with this MessageExtensions instance. */ constructor(app: TeamsApplication); /** * Registers a handler for the anonymous query link invoke activity. * @param handler - A function to handle the anonymous query link. * @returns The TeamsApplication instance. */ anonymousQueryLink(handler: (context: TurnContext, state: TState, url: string) => Promise): TeamsApplication; /** * Registers a handler for editing a message preview. * @param commandId - The command ID(s) or selector(s) to match the activity. * @param handler - A function to handle the message preview edit. * @returns The TeamsApplication instance. */ messagePreviewEdit(commandId: string | RegExp | RouteSelector | (string | RegExp | RouteSelector)[], handler: (context: TurnContext, state: TState, previewActivity: Partial) => Promise): TeamsApplication; /** * Registers a handler for sending a message preview. * @param commandId - The command ID(s) or selector(s) to match the activity. * @param handler - A function to handle the message preview send. * @returns The TeamsApplication instance. */ messagePreviewSend(commandId: string | RegExp | RouteSelector | (string | RegExp | RouteSelector)[], handler: (context: TurnContext, state: TState, previewActivity: Partial) => Promise): TeamsApplication; /** * Registers a handler for fetching a task module. * @param commandId - The command ID(s) or selector(s) to match the activity. * @param handler - A function to handle the task fetch. * @returns The TeamsApplication instance. */ fetchTask(commandId: string | RegExp | RouteSelector | (string | RegExp | RouteSelector)[], handler: (context: TurnContext, state: TState) => Promise): TeamsApplication; /** * Registers a handler for a query invoke activity. * @param commandId - The command ID(s) or selector(s) to match the activity. * @param handler - A function to handle the query. * @returns The TeamsApplication instance. */ query = Record>(commandId: string | RegExp | RouteSelector | (string | RegExp | RouteSelector)[], handler: (context: TurnContext, state: TState, query: Query) => Promise): TeamsApplication; /** * Registers a handler for a query link invoke activity. * @param handler - A function to handle the query link. * @returns The TeamsApplication instance. */ queryLink(handler: (context: TurnContext, state: TState, url: string) => Promise): TeamsApplication; /** * Registers a handler for selecting an item in a messaging extension. * @param handler - A function to handle the item selection. * @returns The TeamsApplication instance. */ selectItem = Record>(handler: (context: TurnContext, state: TState, item: TItem) => Promise): TeamsApplication; /** * Registers a handler for submitting an action in a messaging extension. * @param commandId - The command ID(s) or selector(s) to match the activity. * @param handler - A function to handle the action submission. * @returns The TeamsApplication instance. */ submitAction>(commandId: string | RegExp | RouteSelector | (string | RegExp | RouteSelector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise): TeamsApplication; /** * Sends a response for a submit action invoke activity. * @param context - The TurnContext of the activity. * @param result - The result to send in the response. */ private returnSubmitActionResponse; /** * Registers a handler for querying a URL setting in a messaging extension. * @param handler - A function to handle the URL setting query. * @returns The TeamsApplication instance. */ queryUrlSetting(handler: (context: TurnContext, state: TState) => Promise): TeamsApplication; /** * Registers a handler for configuring settings in a messaging extension. * @param handler - A function to handle the settings configuration. * @returns The TeamsApplication instance. */ configureSettings>(handler: (context: TurnContext, state: TState, settings: TData) => Promise): TeamsApplication; /** * Registers a handler for handling button clicks in a messaging extension card. * @param handler - A function to handle the button click. * @returns The TeamsApplication instance. */ handleOnButtonClicked>(handler: (context: TurnContext, state: TState, data: TData) => Promise): TeamsApplication; }