AdaptiveCards class
AdaptiveCards class to enable fluent style registration of handlers related to Adaptive Cards.
Constructors
Adaptive |
Creates a new instance of the AdaptiveCards class. |
Methods
action |
Adds a route to the application for handling Adaptive Card Action.Execute events. |
action |
Adds a route to the application for handling Adaptive Card Action.Submit events. |
search(string | Reg |
Adds a route to the application for handling the |
Constructor Details
AdaptiveCards<TState>(Application<TState>)
Creates a new instance of the AdaptiveCards class.
new AdaptiveCards(app: Application<TState>)
Parameters
- app
-
Application<TState>
The top level application class to register handlers with.
Method Details
actionExecute<TData>(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => Promise<string | AdaptiveCard>)
Adds a route to the application for handling Adaptive Card Action.Execute events.
function actionExecute<TData>(verb: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise<string | AdaptiveCard>): Application<TState>
Parameters
- handler
-
(context: TurnContext, state: TState, data: TData) => Promise<string | AdaptiveCard>
The code to execute when the action is triggered.
Returns
Application<TState>
The application for chaining purposes.
actionSubmit<TData>(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => Promise<void>)
Adds a route to the application for handling Adaptive Card Action.Submit events.
function actionSubmit<TData>(verb: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise<void>): Application<TState>
Parameters
- handler
-
(context: TurnContext, state: TState, data: TData) => Promise<void>
The code to execute when the action is triggered.
Returns
Application<TState>
The application for chaining purposes.
Remarks
The route will be added for the specified verb(s) and will be filtered using the
actionSubmitFilter
option. The default filter is to use the verb
field.
For outgoing AdaptiveCards you will need to include the verb's name in the cards Action.Submit. For example:
{
"type": "Action.Submit",
"title": "OK",
"data": {
"verb": "ok"
}
}
search(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, query: Query<AdaptiveCardsSearchParams>) => Promise<AdaptiveCardSearchResult[]>)
Adds a route to the application for handling the Data.Query
request for an Input.ChoiceSet
.
function search(dataset: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, query: Query<AdaptiveCardsSearchParams>) => Promise<AdaptiveCardSearchResult[]>): Application<TState>
Parameters
The named dataset(s) to be handled.
- handler
-
(context: TurnContext, state: TState, query: Query<AdaptiveCardsSearchParams>) => Promise<AdaptiveCardSearchResult[]>
The code to execute when the query is triggered.
Returns
Application<TState>
The application for chaining purposes.