Share via


AdaptiveCardsActions class

A class to handle Adaptive Card actions such as executing actions, submitting actions, and performing searches.

Constructors

AdaptiveCardsActions<TState>(AgentApplication<TState>)

Constructs an instance of AdaptiveCardsActions.

Methods

actionExecute<TData>(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => Promise<string | AdaptiveCard>)

Registers a handler for the Action.Execute event.

actionSubmit<TData>(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => Promise<void>)

Registers a handler for the Action.Submit event.

search(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, query: Query<AdaptiveCardsSearchParams>) => Promise<AdaptiveCardSearchResult[]>)

Registers a handler for the search event.

Constructor Details

AdaptiveCardsActions<TState>(AgentApplication<TState>)

Constructs an instance of AdaptiveCardsActions.

new AdaptiveCardsActions(app: AgentApplication<TState>)

Parameters

app

AgentApplication<TState>

The Teams application instance.

Method Details

actionExecute<TData>(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => Promise<string | AdaptiveCard>)

Registers a handler for the Action.Execute event.

function actionExecute<TData>(verb: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise<string | AdaptiveCard>): AgentApplication<TState>

Parameters

verb

string | RegExp | Selector | (string | RegExp | Selector)[]

A string, RegExp, RouteSelector, or an array of these to match the action verb.

handler

(context: TurnContext, state: TState, data: TData) => Promise<string | AdaptiveCard>

A function to handle the action execution.

Returns

The Teams application instance.

actionSubmit<TData>(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => Promise<void>)

Registers a handler for the Action.Submit event.

function actionSubmit<TData>(verb: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise<void>): AgentApplication<TState>

Parameters

verb

string | RegExp | Selector | (string | RegExp | Selector)[]

A string, RegExp, RouteSelector, or an array of these to match the action verb.

handler

(context: TurnContext, state: TState, data: TData) => Promise<void>

A function to handle the action submission.

Returns

The Teams application instance.

Registers a handler for the search event.

function search(dataset: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, query: Query<AdaptiveCardsSearchParams>) => Promise<AdaptiveCardSearchResult[]>): AgentApplication<TState>

Parameters

dataset

string | RegExp | Selector | (string | RegExp | Selector)[]

A string, RegExp, RouteSelector, or an array of these to match the dataset.

handler

(context: TurnContext, state: TState, query: Query<AdaptiveCardsSearchParams>) => Promise<AdaptiveCardSearchResult[]>

A function to handle the search query.

Returns

The Teams application instance.