UNPKG

2.55 kBTypeScriptView Raw
1import { RepoFinder } from "@atomist/automation-client/lib/operations/common/repoFinder";
2import { RepoLoader } from "@atomist/automation-client/lib/operations/common/repoLoader";
3import { Maker } from "@atomist/automation-client/lib/util/constructionUtils";
4import { SoftwareDeliveryMachineConfiguration } from "../machine/SoftwareDeliveryMachineOptions";
5import { ParametersDefinition } from "./ParametersDefinition";
6/**
7 * Different strategies to ask for parameters in chat or web
8 */
9export declare enum ParameterStyle {
10 /** Parameter questions will be prompted in a dialog */
11 Dialog = "dialog",
12 /** Parameter questions will be prompted in a thread */
13 Threaded = "threaded",
14 /**
15 * Parameter questions will be prompted in the channel where the
16 * command is being run
17 */
18 Unthreaded = "unthreaded",
19 /**
20 * Parameter questions will be prompted in a dialog if the command
21 * is triggered from a button or menu
22 */
23 DialogAction = "dialog_action"
24}
25/**
26 * Common supertype for all command registrations.
27 */
28export interface CommandRegistration<PARAMS> {
29 /** Name of the command */
30 name: string;
31 /** Description of the command */
32 description?: string;
33 /**
34 * Function to create a parameters object used by this command.
35 * Empty parameters will be returned by default.
36 */
37 paramsMaker?: Maker<PARAMS>;
38 /**
39 * Define parameters used by this command.
40 */
41 parameters?: ParametersDefinition<PARAMS>;
42 /**
43 * Intent or list of intents. What you need to type to invoke the
44 * command, for example via the bot.
45 */
46 intent?: string | string[] | RegExp;
47 /**
48 * Tags associated with this command. Useful in searching.
49 */
50 tags?: string | string[];
51 /**
52 * Configure command to submit without confirmation
53 */
54 autoSubmit?: boolean;
55 /**
56 * Configure strategy on how to prompt for parameters in chat or web
57 */
58 parameterStyle?: ParameterStyle;
59 repoFinder?: RepoFinder;
60 repoLoader?: (p: PARAMS) => RepoLoader;
61 /**
62 * If provided, select when this command is registered.
63 * Enables conditional registration on SDM startup, based on
64 * configuration, environment variables etc.
65 * This method is invoked during SDM startup.
66 * @param {SoftwareDeliveryMachineConfiguration} sdmConfiguration
67 * @return {boolean}
68 */
69 registerWhen?: (sdmConfiguration: SoftwareDeliveryMachineConfiguration) => boolean;
70}
71//# sourceMappingURL=CommandRegistration.d.ts.map
\No newline at end of file