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