|
1 | 1 | from slack_sdk.models.blocks import InputBlock |
2 | 2 | from slack_sdk.models.blocks.basic_components import PlainTextObject |
3 | 3 | from slack_sdk.models.blocks.block_elements import FileInputElement |
| 4 | +from slack_sdk.models.views import View |
4 | 5 |
|
5 | 6 |
|
6 | | -def example01() -> InputBlock: |
| 7 | +def example01() -> View: |
7 | 8 | """ |
8 | 9 | Allows user to upload files. |
9 | 10 | https://docs.slack.dev/reference/block-kit/block-elements/file-input-element/ |
10 | 11 |
|
11 | | - An input block with a file input element. |
| 12 | + A modal view with an input block that has a file input element. |
12 | 13 | """ |
13 | | - block = InputBlock( |
14 | | - block_id="input_block_id", |
15 | | - label=PlainTextObject(text="Upload Files"), |
16 | | - element=FileInputElement( |
17 | | - action_id="file_input_action_id_1", |
18 | | - filetypes=["jpg", "png"], |
19 | | - max_files=5, |
20 | | - ), |
| 14 | + view = View( |
| 15 | + type="modal", |
| 16 | + title=PlainTextObject(text="My App", emoji=True), |
| 17 | + submit=PlainTextObject(text="Submit", emoji=True), |
| 18 | + close=PlainTextObject(text="Cancel", emoji=True), |
| 19 | + blocks=[ |
| 20 | + InputBlock( |
| 21 | + block_id="input_block_id", |
| 22 | + label=PlainTextObject(text="Upload Files"), |
| 23 | + element=FileInputElement( |
| 24 | + action_id="file_input_action_id_1", |
| 25 | + filetypes=["jpg", "png"], |
| 26 | + max_files=5, |
| 27 | + ), |
| 28 | + ), |
| 29 | + ], |
21 | 30 | ) |
22 | | - return block |
| 31 | + return view |
0 commit comments