UNPKG

@microsoft/agents-hosting-teams

Version:

Microsoft 365 Agents SDK for JavaScript

50 lines (49 loc) 2.79 kB
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { RouteSelector, TurnContext, TurnState } from '@microsoft/agents-hosting'; import { AdaptiveCard } from './adaptiveCard'; import { TeamsApplication } from '../teamsApplication'; import { AdaptiveCardSearchResult } from './adaptiveCardSearchResult'; import { Query } from '../query'; import { AdaptiveCardsSearchParams } from '../../adaptive-cards'; export declare const ACTION_INVOKE_NAME = "adaptiveCard/action"; /** * A class to handle Adaptive Card actions such as executing actions, submitting actions, and performing searches. * @template TState - The type of the TurnState used in the application. */ export declare class AdaptiveCardsActions<TState extends TurnState> { /** * The Teams application instance associated with this class. */ private readonly _app; /** * Constructs an instance of AdaptiveCardsActions. * @param app - The Teams application instance. */ constructor(app: TeamsApplication<TState>); /** * Registers a handler for the Action.Execute event. * @template TData - The type of the data passed to the handler. * @param verb - A string, RegExp, RouteSelector, or an array of these to match the action verb. * @param handler - A function to handle the action execution. * @returns The Teams application instance. */ actionExecute<TData = Record<string, any>>(verb: string | RegExp | RouteSelector | (string | RegExp | RouteSelector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise<AdaptiveCard | string>): TeamsApplication<TState>; /** * Registers a handler for the Action.Submit event. * @template TData - The type of the data passed to the handler. * @param verb - A string, RegExp, RouteSelector, or an array of these to match the action verb. * @param handler - A function to handle the action submission. * @returns The Teams application instance. */ actionSubmit<TData = Record<string, any>>(verb: string | RegExp | RouteSelector | (string | RegExp | RouteSelector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise<void>): TeamsApplication<TState>; /** * Registers a handler for the search event. * @param dataset - A string, RegExp, RouteSelector, or an array of these to match the dataset. * @param handler - A function to handle the search query. * @returns The Teams application instance. */ search(dataset: string | RegExp | RouteSelector | (string | RegExp | RouteSelector)[], handler: (context: TurnContext, state: TState, query: Query<AdaptiveCardsSearchParams>) => Promise<AdaptiveCardSearchResult[]>): TeamsApplication<TState>; }