diff --git a/packages/types/src/block-kit/block-elements.ts b/packages/types/src/block-kit/block-elements.ts index c99a412a5..6080ffb2f 100644 --- a/packages/types/src/block-kit/block-elements.ts +++ b/packages/types/src/block-kit/block-elements.ts @@ -121,6 +121,29 @@ export interface EmailInput extends Actionable, Dispatchable, Focusable, Placeho initial_value?: string; } +/** + * @description Allows user to upload files. In order to use the `file_input` element within your app, + * your app must have the `files:read` scope. + * @see {@link https://api.slack.com/reference/block-kit/block-elements#file_input File input element reference}. + */ +export interface FileInput extends Actionable { + /** + * @description The type of element. In this case `type` is always `file_input`. + */ + type: 'file_input'; + /** + * @description An array of valid {@link https://api.slack.com/types/file#types file extensions} that will be accepted + * for this element. All file extensions will be accepted if `filetypes` is not specified. This validation is provided + * for convenience only, and you should perform your own file type validation based on what you expect to receive. + */ + filetypes?: string[]; + /** + * @description Maximum number of files that can be uploaded for this `file_input` element. Minimum of `1`, maximum of + * `10`. Defaults to `10` if not specified. + */ + max_files?: number; +} + /** * @description Displays an image as part of a larger block of content. Use this `image` block if you want a block with * only an image in it. diff --git a/packages/types/src/block-kit/blocks.ts b/packages/types/src/block-kit/blocks.ts index 8f55d323c..9a8b434d7 100644 --- a/packages/types/src/block-kit/blocks.ts +++ b/packages/types/src/block-kit/blocks.ts @@ -2,7 +2,7 @@ import { PlainTextElement, MrkdwnElement } from './composition-objects'; import { Actionable } from './extensions'; -import { Button, Checkboxes, Datepicker, DateTimepicker, EmailInput, ImageElement, MultiSelect, NumberInput, Overflow, PlainTextInput, RadioButtons, Select, Timepicker, URLInput, WorkflowButton, RichTextSection, RichTextList, RichTextQuote, RichTextPreformatted, RichTextInput } from './block-elements'; +import { Button, Checkboxes, Datepicker, DateTimepicker, EmailInput, FileInput, ImageElement, MultiSelect, NumberInput, Overflow, PlainTextInput, RadioButtons, Select, Timepicker, URLInput, WorkflowButton, RichTextSection, RichTextList, RichTextQuote, RichTextPreformatted, RichTextInput } from './block-elements'; export interface Block { type: string; @@ -159,7 +159,7 @@ export interface InputBlock extends Block { * @description A block element. */ element: Select | MultiSelect | Datepicker | Timepicker | DateTimepicker | PlainTextInput | URLInput | EmailInput - | NumberInput | RadioButtons | Checkboxes | RichTextInput; + | NumberInput | RadioButtons | Checkboxes | RichTextInput | FileInput; /** * @description A boolean that indicates whether or not the use of elements in this block should dispatch a * {@link https://api.slack.com/reference/interaction-payloads/block-actions block_actions payload}. Defaults to `false`.