forked from microsoft/BotBuilder-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
72 lines (62 loc) · 2.02 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { Session, IntentDialog, UniversalBot } from "botbuilder";
// CONSTS
export namespace Status {
export const NoActionRecognized: string;
export const Fulfilled: string;
export const MissingParameters: string;
export const ContextSwitch: string;
}
// API
export function evaluate(
modelUrl: string,
actions: Array<IAction>,
currentActionModel?: IActionModel,
userInput?: string,
onContextCreationHandler?: onContextCreationHandler): PromiseLike<IActionModel>;
declare type onContextCreationHandler = (action: IAction, actionModel: IActionModel, next: () => void) => void
export function bindToBotDialog(
bot: UniversalBot,
intentDialog: IntentDialog,
modelUrl: string,
actions: Array<IAction>,
options: IBindToDialogOptions
)
declare type onDialogContextCreationHandler = (action: IAction, actionModel: IActionModel, next: () => void, session: Session) => void
declare type replyHandler = (session: Session) => void
declare type fulfillHandler = (session: Session, actionModel: IActionModel) => void
export interface IBindToDialogOptions {
defaultReply: replyHandler,
fulfillReply: fulfillHandler,
onContextCreation: onDialogContextCreationHandler
}
// TYPES
export interface IAction {
intentName: string;
friendlyName: string;
confirmOnContextSwitch?: boolean;
canExecuteWithoutContext?: boolean;
parentAction?: IAction,
schema: { [key: string]: ISchemaParameter };
fulfill: (parameters: any, callback: (result: any) => void) => void;
}
export interface ISchemaParameter {
type: string;
builtInType?: string;
message: string;
}
export interface IActionModel {
status: string;
intentName: string;
result?: any;
userInput?: string;
currentParameter?: string;
parameters: { [key: string]: any };
parameterErrors: Array<IParameterError>;
contextSwitchPrompt?: string,
confirmSwitch?: boolean;
subcontextResult?: any;
}
export interface IParameterError {
parameterName: string;
message: string;
}