UNPKG

2.25 kBTypeScriptView Raw
1import { CommandMessageClient } from "./message";
2import { ParametersObjectValue } from "./parameters";
3import { CommandIncoming } from "./payload";
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/**
9 * Different strategies to ask for parameters in chat or web
10 */
11export declare enum ParameterStyle {
12 /** Parameter questions will be prompted in a dialog */
13 Dialog = "dialog",
14 /** Parameter questions will be prompted in a thread */
15 Threaded = "threaded",
16 /**
17 * Parameter questions will be prompted in the channel where the
18 * command is being run
19 */
20 Unthreaded = "unthreaded",
21 /**
22 * Parameter questions will be prompted in a dialog if the command
23 * is triggered from a button or menu
24 */
25 DialogAction = "dialog_action"
26}
27/**
28 * Options to configure the parameter prompt
29 */
30export interface ParameterPromptOptions {
31 /** Optional thread identifier to send this message to or true to send
32 * this to the message that triggered this command.
33 */
34 thread?: boolean | string;
35 /**
36 * Configure strategy on how to ask for parameters in chat or web
37 */
38 parameterStyle?: ParameterStyle;
39 /**
40 * Configure auto submit strategy for when all required parameters are collected
41 */
42 autoSubmit?: boolean;
43}
44/**
45 * ParameterPrompts let the caller prompt for the provided parameters
46 */
47export declare type ParameterPrompt<PARAMS> = (parameters: ParametersPromptObject<PARAMS>, options?: ParameterPromptOptions) => Promise<PARAMS>;
48export declare const AtomistContinuationMimeType = "application/x-atomist-continuation+json";
49/**
50 * Default ParameterPromptFactory that uses the WebSocket connection to send parameter prompts to the backend.
51 * @param ctx
52 */
53export declare function commandRequestParameterPromptFactory<T>(messageClient: CommandMessageClient, payload: CommandIncoming): ParameterPrompt<T>;
54export declare class CommandListenerExecutionInterruptError extends Error {
55 readonly message: string;
56 constructor(message: string);
57}
58//# sourceMappingURL=parameter_prompt.d.ts.map
\No newline at end of file