@atomist/automation-client
Version:
Atomist API for software low-level client
27 lines • 1.35 kB
TypeScript
import { EventFired, HandleEvent } from "./HandleEvent";
import { HandlerContext } from "./HandlerContext";
import { HandlerResult } from "./HandlerResult";
import { EventHandlerMetadata } from "./metadata/automationMetadata";
import { Maker } from "./util/constructionUtils";
/**
* Handle the given event.
* @param e event we're matching on
* @param {HandlerContext} ctx context from which GraphQL client can be obtained if it's
* necessary to run further queries.
* @param params secrets and mapped parameters are available through this
* @return {Promise<HandlerResult>} result containing status and any command-specific data
*/
export declare type OnEvent<T = any, P = any> = (e: EventFired<T>, ctx: HandlerContext, params: P) => Promise<HandlerResult>;
/**
* Create a HandleEvent instance with the appropriate metadata wrapping
* the given function
* @param {OnEvent<T, P>} h
* @param {Maker<P>} factory
* @param {string} subscription
* @param {string} name
* @param {string} description
* @param {string | string[]} tags
* @returns {HandleEvent<T, P> & EventHandlerMetadata}
*/
export declare function eventHandlerFrom<T, P>(h: OnEvent<T, P>, factory: Maker<P>, subscription: string, name?: string, description?: string, tags?: string | string[]): HandleEvent<T, P> & EventHandlerMetadata;
//# sourceMappingURL=onEvent.d.ts.map