@@ -39,7 +39,7 @@ <h1 class="title">Module <code>slack_sdk.models.blocks.block_elements</code></h1
3939 JsonValidator,
4040 EnumValidator,
4141)
42- from .basic_components import ButtonStyles, Workflow
42+ from .basic_components import ButtonStyles, Workflow, SlackFile
4343from .basic_components import ConfirmObject
4444from .basic_components import DispatchActionConfig
4545from .basic_components import MarkdownTextObject
@@ -579,13 +579,14 @@ <h1 class="title">Module <code>slack_sdk.models.blocks.block_elements</code></h1
579579
580580 @property
581581 def attributes(self) -> Set[str]:
582- return super().attributes.union({"alt_text", "image_url"})
582+ return super().attributes.union({"alt_text", "image_url", "slack_file" })
583583
584584 def __init__(
585585 self,
586586 *,
587- image_url: Optional[str] = None,
588587 alt_text: Optional[str] = None,
588+ image_url: Optional[str] = None,
589+ slack_file: Optional[Union[Dict[str, Any], SlackFile]] = None,
589590 **others: dict,
590591 ):
591592 """An element to insert an image - this element can be used in section and
@@ -594,18 +595,20 @@ <h1 class="title">Module <code>slack_sdk.models.blocks.block_elements</code></h1
594595 https://api.slack.com/reference/block-kit/block-elements#image
595596
596597 Args:
597- image_url (required): The URL of the image to be displayed.
598598 alt_text (required): A plain-text summary of the image. This should not contain any markup.
599+ image_url: The URL of the image to be displayed.
600+ slack_file: A Slack image file object that defines the source of the image.
599601 """
600602 super().__init__(type=self.type)
601603 show_unknown_key_warning(self, others)
602604
603605 self.image_url = image_url
604606 self.alt_text = alt_text
607+ self.slack_file = slack_file if slack_file is None or isinstance(slack_file, SlackFile) else SlackFile(**slack_file)
605608
606609 @JsonValidator(f"image_url attribute cannot exceed {image_url_max_length} characters")
607610 def _validate_image_url_length(self) -> bool:
608- return len(self.image_url) <= self.image_url_max_length
611+ return self.image_url is None or len(self.image_url) <= self.image_url_max_length
609612
610613 @JsonValidator(f"alt_text attribute cannot exceed {alt_text_max_length} characters")
611614 def _validate_alt_text_length(self) -> bool:
@@ -3974,7 +3977,7 @@ <h3>Inherited members</h3>
39743977</ dd >
39753978< dt id ="slack_sdk.models.blocks.block_elements.ImageElement "> < code class ="flex name class ">
39763979< span > class < span class ="ident "> ImageElement</ span > </ span >
3977- < span > (</ span > < span > *, image_url : Optional[str] = None, alt_text : Optional[str] = None, **others: dict)</ span >
3980+ < span > (</ span > < span > *, alt_text : Optional[str] = None, image_url : Optional[str] = None, slack_file: Union[Dict[str, Any], < a title =" slack_sdk.models.blocks.basic_components.SlackFile " href =" basic_components.html#slack_sdk.models.blocks.basic_components.SlackFile " > SlackFile </ a > , ForwardRef(None) ] = None, **others: dict)</ span >
39783981</ code > </ dt >
39793982< dd >
39803983< div class ="desc "> < p > Block Elements are things that exists inside of your Blocks.
@@ -3985,10 +3988,12 @@ <h3>Inherited members</h3>
39853988< a href ="https://api.slack.com/reference/block-kit/block-elements#image "> https://api.slack.com/reference/block-kit/block-elements#image</ a > </ p >
39863989< h2 id ="args "> Args</ h2 >
39873990< dl >
3988- < dt > < strong > < code > image_url</ code > </ strong > : < code > required</ code > </ dt >
3989- < dd > The URL of the image to be displayed.</ dd >
39903991< dt > < strong > < code > alt_text</ code > </ strong > : < code > required</ code > </ dt >
39913992< dd > A plain-text summary of the image. This should not contain any markup.</ dd >
3993+ < dt > < strong > < code > image_url</ code > </ strong > </ dt >
3994+ < dd > The URL of the image to be displayed.</ dd >
3995+ < dt > < strong > < code > slack_file</ code > </ strong > </ dt >
3996+ < dd > A Slack image file object that defines the source of the image.</ dd >
39923997</ dl > </ div >
39933998< details class ="source ">
39943999< summary >
@@ -4001,13 +4006,14 @@ <h2 id="args">Args</h2>
40014006
40024007 @property
40034008 def attributes(self) -> Set[str]:
4004- return super().attributes.union({"alt_text", "image_url"})
4009+ return super().attributes.union({"alt_text", "image_url", "slack_file" })
40054010
40064011 def __init__(
40074012 self,
40084013 *,
4009- image_url: Optional[str] = None,
40104014 alt_text: Optional[str] = None,
4015+ image_url: Optional[str] = None,
4016+ slack_file: Optional[Union[Dict[str, Any], SlackFile]] = None,
40114017 **others: dict,
40124018 ):
40134019 """An element to insert an image - this element can be used in section and
@@ -4016,18 +4022,20 @@ <h2 id="args">Args</h2>
40164022 https://api.slack.com/reference/block-kit/block-elements#image
40174023
40184024 Args:
4019- image_url (required): The URL of the image to be displayed.
40204025 alt_text (required): A plain-text summary of the image. This should not contain any markup.
4026+ image_url: The URL of the image to be displayed.
4027+ slack_file: A Slack image file object that defines the source of the image.
40214028 """
40224029 super().__init__(type=self.type)
40234030 show_unknown_key_warning(self, others)
40244031
40254032 self.image_url = image_url
40264033 self.alt_text = alt_text
4034+ self.slack_file = slack_file if slack_file is None or isinstance(slack_file, SlackFile) else SlackFile(**slack_file)
40274035
40284036 @JsonValidator(f"image_url attribute cannot exceed {image_url_max_length} characters")
40294037 def _validate_image_url_length(self) -> bool:
4030- return len(self.image_url) <= self.image_url_max_length
4038+ return self.image_url is None or len(self.image_url) <= self.image_url_max_length
40314039
40324040 @JsonValidator(f"alt_text attribute cannot exceed {alt_text_max_length} characters")
40334041 def _validate_alt_text_length(self) -> bool:
@@ -4067,7 +4075,7 @@ <h3>Instance variables</h3>
40674075</ summary >
40684076< pre > < code class ="python "> @property
40694077def attributes(self) -> Set[str]:
4070- return super().attributes.union({"alt_text", "image_url"})</ code > </ pre >
4078+ return super().attributes.union({"alt_text", "image_url", "slack_file" })</ code > </ pre >
40714079</ details >
40724080</ dd >
40734081</ dl >
0 commit comments