@atomist/automation-client
Version:
Atomist API for software low-level client
27 lines • 1.35 kB
TypeScript
import { HandleCommand } from "./HandleCommand";
import { HandlerContext } from "./HandlerContext";
import { HandlerResult } from "./HandlerResult";
import { CommandHandlerMetadata } from "./metadata/automationMetadata";
import { Maker } from "./util/constructionUtils";
/**
* Handle the given command. Parameters will have been set on a fresh
* parameters instance before invocation
* @param {HandlerContext} ctx context from which GraphQL client can be obtained,
* messages can be sent etc.
* @return a Promise of a HandlerResult, containing a status code, or anything else representing
* success.
*/
export declare type OnCommand<P = undefined> = (ctx: HandlerContext, parameters: P) => Promise<HandlerResult> | Promise<any>;
/**
* Create a HandleCommand instance with the appropriate metadata wrapping
* the given function
* @param h handle function
* @param factory construction function
* @param {string} name can be omitted if the function isn't exported
* @param {string} description
* @param {string[]} intent
* @param {Tag[]} tags
* @return {HandleCommand<P>}
*/
export declare function commandHandlerFrom<P>(h: OnCommand<P>, factory: Maker<P>, name?: string, description?: string, intent?: string | string[], tags?: string | string[]): HandleCommand<P> & CommandHandlerMetadata;
//# sourceMappingURL=onCommand.d.ts.map