UNPKG

1.91 kBTypeScriptView Raw
1import { HandlerContext } from "@atomist/automation-client/lib/HandlerContext";
2import { ParameterStyle } from "../registration/CommandRegistration";
3import { ParametersObjectValue } from "../registration/ParametersDefinition";
4/**
5 * Object with properties defining parameters. Useful for combination via spreads.
6 */
7export declare type ParametersPromptObject<PARAMS, K extends keyof PARAMS = keyof PARAMS> = Record<K, ParametersObjectValue & {
8 force?: boolean;
9}>;
10/**
11 * Factory to create a ParameterPrompt
12 */
13export declare type ParameterPromptFactory<PARAMS> = (ctx: HandlerContext) => ParameterPrompt<PARAMS>;
14/**
15 * Options to configure the parameter prompt
16 */
17export interface ParameterPromptOptions {
18 /** Optional thread identifier to send this message to or true to send
19 * this to the message that triggered this command.
20 */
21 thread?: boolean | string;
22 /**
23 * Configure strategy on how to ask for parameters in chat or web
24 */
25 parameterStyle?: ParameterStyle;
26 /**
27 * Configure auto submit strategy for when all required parameters are collected
28 */
29 autoSubmit?: boolean;
30}
31/**
32 * ParameterPrompts let the caller prompt for the provided parameters
33 */
34export declare type ParameterPrompt<PARAMS> = (parameters: ParametersPromptObject<PARAMS>, options?: ParameterPromptOptions) => Promise<PARAMS>;
35/**
36 * No-op NoParameterPrompt implementation that never prompts for new parameters
37 * @constructor
38 */
39export declare const NoParameterPrompt: ParameterPrompt<any>;
40export declare const AtomistContinuationMimeType = "application/x-atomist-continuation+json";
41/**
42 * Default ParameterPromptFactory that uses the WebSocket connection to send parameter prompts to the backend.
43 * @param ctx
44 */
45export declare function commandRequestParameterPromptFactory<T>(ctx: HandlerContext): ParameterPrompt<T>;
46//# sourceMappingURL=parameterPrompt.d.ts.map
\No newline at end of file