UNPKG

1.3 kBTypeScriptView Raw
1import { HandleCommand } from "./HandleCommand";
2import { HandlerContext } from "./HandlerContext";
3import { HandlerResult } from "./HandlerResult";
4import { CommandHandlerMetadata } from "./metadata/automationMetadata";
5import { Maker } from "./util/constructionUtils";
6export declare enum QuestionStyle {
7 Dialog = "dialog",
8 Threaded = "threaded",
9 Unthreaded = "unthreaded",
10 DialogAction = "dialog_action"
11}
12/**
13 * Handle the given command. Parameters will have been set on a fresh
14 * parameters instance before invocation
15 * @param {HandlerContext} ctx context from which GraphQL client can be obtained,
16 * messages can be sent etc.
17 * @return a Promise of a HandlerResult, containing a status code, or anything else representing
18 * success.
19 */
20export declare type OnCommand<P = undefined> = (ctx: HandlerContext, parameters: P) => Promise<HandlerResult> | Promise<any>;
21/**
22 * Create a HandleCommand instance with the appropriate metadata wrapping
23 * the given function
24 */
25export declare function commandHandlerFrom<P>(h: OnCommand<P>, factory: Maker<P>, name?: string, description?: string, intent?: string | string[], tags?: string | string[], autoSubmit?: boolean, question?: QuestionStyle): HandleCommand<P> & CommandHandlerMetadata;
26//# sourceMappingURL=onCommand.d.ts.map
\No newline at end of file