From da22bdc0351637c8da7b121167208882fd97ebaa Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Mon, 18 May 2026 09:54:18 -0700 Subject: [PATCH] chore(release): version 3.42.0 --- docs/reference/index.html | 84 +++- .../models/blocks/basic_components.html | 12 +- .../models/blocks/block_elements.html | 8 +- docs/reference/models/blocks/blocks.html | 412 ++++++++++++++++- docs/reference/models/blocks/index.html | 430 +++++++++++++++++- docs/reference/models/messages/chunk.html | 89 +++- docs/reference/models/views/index.html | 4 +- .../installation_store/amazon_s3/index.html | 10 +- .../async_cacheable_installation_store.html | 3 +- .../oauth/installation_store/file/index.html | 2 +- .../oauth/installation_store/index.html | 2 +- .../installation_store/sqlite3/index.html | 50 +- .../oauth/state_store/sqlite3/index.html | 12 +- docs/reference/signature/index.html | 22 +- docs/reference/socket_mode/aiohttp/index.html | 4 +- docs/reference/socket_mode/client.html | 16 +- docs/reference/socket_mode/index.html | 4 +- docs/reference/socket_mode/request.html | 4 +- .../socket_mode/websocket_client/index.html | 6 +- .../socket_mode/websockets/index.html | 4 +- docs/reference/web/async_chat_stream.html | 17 +- docs/reference/web/async_client.html | 84 +++- docs/reference/web/chat_stream.html | 17 +- docs/reference/web/client.html | 84 +++- docs/reference/web/index.html | 84 +++- docs/reference/web/legacy_client.html | 58 ++- slack_sdk/version.py | 2 +- 27 files changed, 1362 insertions(+), 162 deletions(-) diff --git a/docs/reference/index.html b/docs/reference/index.html index c76fd04c3..d56fafd29 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -2215,13 +2215,24 @@

Classes

thread_ts: str, status: str, loading_messages: Optional[List[str]] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, **kwargs, ) -> SlackResponse: """Set the status for an AI assistant thread. https://docs.slack.dev/reference/methods/assistant.threads.setStatus """ kwargs.update( - {"channel_id": channel_id, "thread_ts": thread_ts, "status": status, "loading_messages": loading_messages} + { + "channel_id": channel_id, + "thread_ts": thread_ts, + "status": status, + "loading_messages": loading_messages, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } ) kwargs = _remove_none_values(kwargs) return self.api_call("assistant.threads.setStatus", json=kwargs) @@ -3027,6 +3038,9 @@

Classes

recipient_user_id: Optional[str] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, task_display_mode: Optional[str] = None, # timeline, plan + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, **kwargs, ) -> SlackResponse: """Starts a new streaming conversation. @@ -3041,6 +3055,9 @@

Classes

"recipient_user_id": recipient_user_id, "chunks": chunks, "task_display_mode": task_display_mode, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, } ) _parse_web_class_objects(kwargs) @@ -3084,6 +3101,9 @@

Classes

recipient_team_id: Optional[str] = None, recipient_user_id: Optional[str] = None, task_display_mode: Optional[str] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, **kwargs, ) -> ChatStream: """Stream markdown text into a conversation. @@ -3112,6 +3132,9 @@

Classes

recipient_user_id: The encoded ID of the user to receive the streaming text. Required when streaming to channels. task_display_mode: Specifies how tasks are displayed in the message. A "timeline" displays individual tasks with text and "plan" displays all tasks together. + icon_emoji: Emoji to use as the icon for this message. Overrides icon_url. + icon_url: Image URL to use as the icon for this message. + username: The bot's username to display. **kwargs: Additional arguments passed to the underlying API calls. Returns: @@ -3138,6 +3161,9 @@

Classes

recipient_team_id=recipient_team_id, recipient_user_id=recipient_user_id, task_display_mode=task_display_mode, + icon_emoji=icon_emoji, + icon_url=icon_url, + username=username, buffer_size=buffer_size, **kwargs, ) @@ -4134,6 +4160,7 @@

Classes

content: Optional[Union[str, bytes]] = None, title: Optional[str] = None, alt_txt: Optional[str] = None, + highlight_type: Optional[str] = None, snippet_type: Optional[str] = None, # To upload multiple files at a time file_uploads: Optional[List[Dict[str, Any]]] = None, @@ -4178,6 +4205,7 @@

Classes

"content": content, "title": title, "alt_txt": alt_txt, + "highlight_type": highlight_type, "snippet_type": snippet_type, } ) @@ -4216,7 +4244,7 @@

Classes

# step3: files.completeUploadExternal with all the sets of (file_id + title) completion = self.files_completeUploadExternal( - files=[{"id": f["file_id"], "title": f["title"]} for f in files], + files=[{"id": f["file_id"], "title": f["title"], "highlight_type": f.get("highlight_type")} for f in files], channel_id=channel, channels=channels, initial_comment=initial_comment, @@ -4252,7 +4280,7 @@

Classes

def files_completeUploadExternal( self, *, - files: List[Dict[str, str]], + files: List[Dict[str, Optional[str]]], channel_id: Optional[str] = None, channels: Optional[List[str]] = None, initial_comment: Optional[str] = None, @@ -9349,7 +9377,7 @@

Methods

https://docs.slack.dev/reference/methods/apps.user.connection.update

-def assistant_threads_setStatus(self,
*,
channel_id: str,
thread_ts: str,
status: str,
loading_messages: List[str] | None = None,
**kwargs) ‑> SlackResponse
+def assistant_threads_setStatus(self,
*,
channel_id: str,
thread_ts: str,
status: str,
loading_messages: List[str] | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> SlackResponse
@@ -9363,13 +9391,24 @@

Methods

thread_ts: str, status: str, loading_messages: Optional[List[str]] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, **kwargs, ) -> SlackResponse: """Set the status for an AI assistant thread. https://docs.slack.dev/reference/methods/assistant.threads.setStatus """ kwargs.update( - {"channel_id": channel_id, "thread_ts": thread_ts, "status": status, "loading_messages": loading_messages} + { + "channel_id": channel_id, + "thread_ts": thread_ts, + "status": status, + "loading_messages": loading_messages, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } ) kwargs = _remove_none_values(kwargs) return self.api_call("assistant.threads.setStatus", json=kwargs) @@ -10652,7 +10691,7 @@

Methods

https://docs.slack.dev/reference/methods/chat.scheduledMessages.list

-def chat_startStream(self,
*,
channel: str,
thread_ts: str,
markdown_text: str | None = None,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
task_display_mode: str | None = None,
**kwargs) ‑> SlackResponse
+def chat_startStream(self,
*,
channel: str,
thread_ts: str,
markdown_text: str | None = None,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
task_display_mode: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> SlackResponse
@@ -10669,6 +10708,9 @@

Methods

recipient_user_id: Optional[str] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, task_display_mode: Optional[str] = None, # timeline, plan + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, **kwargs, ) -> SlackResponse: """Starts a new streaming conversation. @@ -10683,6 +10725,9 @@

Methods

"recipient_user_id": recipient_user_id, "chunks": chunks, "task_display_mode": task_display_mode, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, } ) _parse_web_class_objects(kwargs) @@ -10732,7 +10777,7 @@

Methods

https://docs.slack.dev/reference/methods/chat.stopStream

-def chat_stream(self,
*,
buffer_size: int = 256,
channel: str,
thread_ts: str,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
**kwargs) ‑> ChatStream
+def chat_stream(self,
*,
buffer_size: int = 256,
channel: str,
thread_ts: str,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> ChatStream
@@ -10748,6 +10793,9 @@

Methods

recipient_team_id: Optional[str] = None, recipient_user_id: Optional[str] = None, task_display_mode: Optional[str] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, **kwargs, ) -> ChatStream: """Stream markdown text into a conversation. @@ -10776,6 +10824,9 @@

Methods

recipient_user_id: The encoded ID of the user to receive the streaming text. Required when streaming to channels. task_display_mode: Specifies how tasks are displayed in the message. A "timeline" displays individual tasks with text and "plan" displays all tasks together. + icon_emoji: Emoji to use as the icon for this message. Overrides icon_url. + icon_url: Image URL to use as the icon for this message. + username: The bot's username to display. **kwargs: Additional arguments passed to the underlying API calls. Returns: @@ -10802,6 +10853,9 @@

Methods

recipient_team_id=recipient_team_id, recipient_user_id=recipient_user_id, task_display_mode=task_display_mode, + icon_emoji=icon_emoji, + icon_url=icon_url, + username=username, buffer_size=buffer_size, **kwargs, ) @@ -10837,6 +10891,12 @@

Args

task_display_mode
Specifies how tasks are displayed in the message. A "timeline" displays individual tasks with text and "plan" displays all tasks together.
+
icon_emoji
+
Emoji to use as the icon for this message. Overrides icon_url.
+
icon_url
+
Image URL to use as the icon for this message.
+
username
+
The bot's username to display.
**kwargs
Additional arguments passed to the underlying API calls.
@@ -11979,7 +12039,7 @@

Example

https://docs.slack.dev/reference/methods/files.comments.delete

-def files_completeUploadExternal(self,
*,
files: List[Dict[str, str]],
channel_id: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
**kwargs) ‑> SlackResponse
+def files_completeUploadExternal(self,
*,
files: List[Dict[str, str | None]],
channel_id: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
**kwargs) ‑> SlackResponse
@@ -11989,7 +12049,7 @@

Example

def files_completeUploadExternal(
     self,
     *,
-    files: List[Dict[str, str]],
+    files: List[Dict[str, Optional[str]]],
     channel_id: Optional[str] = None,
     channels: Optional[List[str]] = None,
     initial_comment: Optional[str] = None,
@@ -12470,7 +12530,7 @@ 

Example

https://docs.slack.dev/reference/methods/files.upload

-def files_upload_v2(self,
*,
filename: str | None = None,
file: str | bytes | io.IOBase | os.PathLike | None = None,
content: str | bytes | None = None,
title: str | None = None,
alt_txt: str | None = None,
snippet_type: str | None = None,
file_uploads: List[Dict[str, Any]] | None = None,
channel: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
request_file_info: bool = True,
**kwargs) ‑> SlackResponse
+def files_upload_v2(self,
*,
filename: str | None = None,
file: str | bytes | io.IOBase | os.PathLike | None = None,
content: str | bytes | None = None,
title: str | None = None,
alt_txt: str | None = None,
highlight_type: str | None = None,
snippet_type: str | None = None,
file_uploads: List[Dict[str, Any]] | None = None,
channel: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
request_file_info: bool = True,
**kwargs) ‑> SlackResponse
@@ -12486,6 +12546,7 @@

Example

content: Optional[Union[str, bytes]] = None, title: Optional[str] = None, alt_txt: Optional[str] = None, + highlight_type: Optional[str] = None, snippet_type: Optional[str] = None, # To upload multiple files at a time file_uploads: Optional[List[Dict[str, Any]]] = None, @@ -12530,6 +12591,7 @@

Example

"content": content, "title": title, "alt_txt": alt_txt, + "highlight_type": highlight_type, "snippet_type": snippet_type, } ) @@ -12568,7 +12630,7 @@

Example

# step3: files.completeUploadExternal with all the sets of (file_id + title) completion = self.files_completeUploadExternal( - files=[{"id": f["file_id"], "title": f["title"]} for f in files], + files=[{"id": f["file_id"], "title": f["title"], "highlight_type": f.get("highlight_type")} for f in files], channel_id=channel, channels=channels, initial_comment=initial_comment, diff --git a/docs/reference/models/blocks/basic_components.html b/docs/reference/models/blocks/basic_components.html index 50554265d..2821b6a4b 100644 --- a/docs/reference/models/blocks/basic_components.html +++ b/docs/reference/models/blocks/basic_components.html @@ -188,7 +188,7 @@

Class variables

Static methods

-def parse(confirm: ConfirmObject | Dict[str, Any]) +def parse(confirm: ForwardRef('ConfirmObject') | Dict[str, Any])
@@ -324,7 +324,7 @@

Class variables

Static methods

-def parse(config: DispatchActionConfig | Dict[str, Any]) +def parse(config: ForwardRef('DispatchActionConfig') | Dict[str, Any])
@@ -446,7 +446,7 @@

Class variables

Static methods

-def parse(feedback_button: FeedbackButtonObject | Dict[str, Any]) +def parse(feedback_button: ForwardRef('FeedbackButtonObject') | Dict[str, Any])
@@ -907,7 +907,7 @@

Static methods

Creates a simple Option instance with the same value and label

-def parse_all(options: Sequence[Dict[str, Any] | Option] | None) ‑> List[Option] | None +def parse_all(options: Sequence[Dict[str, Any] | ForwardRef('Option')] | None) ‑> List[Option] | None
@@ -1105,7 +1105,7 @@

Class variables

Static methods

-def parse_all(option_groups: Sequence[Dict[str, Any] | OptionGroup] | None) ‑> List[OptionGroup] | None +def parse_all(option_groups: Sequence[Dict[str, Any] | ForwardRef('OptionGroup')] | None) ‑> List[OptionGroup] | None
@@ -1536,7 +1536,7 @@

Class variables

Static methods

-def parse(text: str | Dict[str, Any] | TextObject,
default_type: str = 'mrkdwn') ‑> TextObject | None
+def parse(text: str | Dict[str, Any] | ForwardRef('TextObject'),
default_type: str = 'mrkdwn') ‑> TextObject | None
diff --git a/docs/reference/models/blocks/block_elements.html b/docs/reference/models/blocks/block_elements.html index e79ac10d1..880573706 100644 --- a/docs/reference/models/blocks/block_elements.html +++ b/docs/reference/models/blocks/block_elements.html @@ -146,13 +146,13 @@

Class variables

Static methods

-def parse(block_element: dict | BlockElement) ‑> BlockElement | TextObject | None +def parse(block_element: dict | ForwardRef('BlockElement')) ‑> BlockElement | TextObject | None
-def parse_all(block_elements: Sequence[dict | BlockElement | TextObject]) ‑> List[BlockElement | TextObject] +def parse_all(block_elements: Sequence[dict | ForwardRef('BlockElement') | TextObject]) ‑> List[BlockElement | TextObject]
@@ -829,7 +829,7 @@

Class variables

Static methods

-def parse(filter: dict | ConversationFilter) +def parse(filter: dict | ForwardRef('ConversationFilter'))
@@ -3505,7 +3505,7 @@

Class variables

class RichTextInputElement -(*,
action_id: str | None = None,
placeholder: str | dict | TextObject | None = None,
initial_value: Dict[str, Any] | RichTextBlock | None = None,
dispatch_action_config: dict | DispatchActionConfig | None = None,
focus_on_load: bool | None = None,
**others: dict)
+(*,
action_id: str | None = None,
placeholder: str | dict | TextObject | None = None,
initial_value: Dict[str, Any] | ForwardRef('RichTextBlock') | None = None,
dispatch_action_config: dict | DispatchActionConfig | None = None,
focus_on_load: bool | None = None,
**others: dict)
diff --git a/docs/reference/models/blocks/blocks.html b/docs/reference/models/blocks/blocks.html index daa7ef267..8fa86d646 100644 --- a/docs/reference/models/blocks/blocks.html +++ b/docs/reference/models/blocks/blocks.html @@ -155,6 +155,114 @@

Inherited members

+
+class AlertBlock +(*,
text: str | dict | TextObject,
level: str | None = None,
block_id: str | None = None,
**others: dict)
+
+
+
+ +Expand source code + +
class AlertBlock(Block):
+    type = "alert"
+    valid_levels = {"default", "info", "warning", "error", "success"}
+
+    @property
+    def attributes(self) -> Set[str]:  # type: ignore[override]
+        return super().attributes.union({"text", "level"})
+
+    def __init__(
+        self,
+        *,
+        text: Union[str, dict, TextObject],
+        level: Optional[str] = None,
+        block_id: Optional[str] = None,
+        **others: dict,
+    ):
+        """Displays alerts, warnings, and informational messages.
+        https://docs.slack.dev/reference/block-kit/blocks/alert-block
+
+        Args:
+            text (required): The alert message, using plain_text or mrkdwn formatting.
+            level: One of "default", "info", "warning", "error", or "success".
+                Will be "default" if omitted.
+            block_id: A unique identifier for a block. If not specified, a block_id will be generated.
+        """
+        super().__init__(type=self.type, block_id=block_id)
+        show_unknown_key_warning(self, others)
+
+        self.text = TextObject.parse(text)
+        self.level = level
+
+    @JsonValidator("text attribute must be specified")
+    def _validate_text(self):
+        return self.text is not None
+
+    @JsonValidator("level must be a valid value (default, info, warning, error, success)")
+    def _validate_level(self):
+        return self.level is None or self.level in self.valid_levels
+
+

Blocks are a series of components that can be combined +to create visually rich and compellingly interactive messages. +https://docs.slack.dev/reference/block-kit/blocks

+

Displays alerts, warnings, and informational messages. +https://docs.slack.dev/reference/block-kit/blocks/alert-block

+

Args

+
+
text : required
+
The alert message, using plain_text or mrkdwn formatting.
+
level
+
One of "default", "info", "warning", "error", or "success". +Will be "default" if omitted.
+
block_id
+
A unique identifier for a block. If not specified, a block_id will be generated.
+
+

Ancestors

+ +

Class variables

+
+
var type
+
+

The type of the None singleton.

+
+
var valid_levels
+
+

The type of the None singleton.

+
+
+

Instance variables

+
+
prop attributes : Set[str]
+
+
+ +Expand source code + +
@property
+def attributes(self) -> Set[str]:  # type: ignore[override]
+    return super().attributes.union({"text", "level"})
+
+

Build an unordered collection of unique elements.

+
+
+

Inherited members

+ +
class Block (*,
type: str | None = None,
subtype: str | None = None,
block_id: str | None = None)
@@ -242,6 +350,12 @@

Inherited members

return TaskCardBlock(**block) elif type == PlanBlock.type: return PlanBlock(**block) + elif type == CardBlock.type: + return CardBlock(**block) + elif type == AlertBlock.type: + return AlertBlock(**block) + elif type == CarouselBlock.type: + return CarouselBlock(**block) else: cls.logger.warning(f"Unknown block detected and skipped ({block})") return None @@ -264,7 +378,10 @@

Ancestors

Subclasses

+
+class CardBlock +(*,
block_id: str | None = None,
hero_image: str | None = None,
icon: str | None = None,
title: str | dict | TextObject | None = None,
subtitle: str | dict | TextObject | None = None,
body: str | dict | TextObject | None = None,
actions: Sequence[dict | BlockElement] | None = None,
**others: dict)
+
+
+
+ +Expand source code + +
class CardBlock(Block):
+    type = "card"
+    title_max_length = 150
+    subtitle_max_length = 150
+    body_max_length = 200
+
+    @property
+    def attributes(self) -> Set[str]:  # type: ignore[override]
+        return super().attributes.union(
+            {
+                "hero_image",
+                "icon",
+                "title",
+                "subtitle",
+                "body",
+                "actions",
+            }
+        )
+
+    def __init__(
+        self,
+        *,
+        block_id: Optional[str] = None,
+        hero_image: Optional[str] = None,
+        icon: Optional[str] = None,
+        title: Optional[Union[str, dict, TextObject]] = None,
+        subtitle: Optional[Union[str, dict, TextObject]] = None,
+        body: Optional[Union[str, dict, TextObject]] = None,
+        actions: Optional[Sequence[Union[dict, BlockElement]]] = None,
+        **others: dict,
+    ):
+        """Displays content in a card.
+        https://docs.slack.dev/reference/block-kit/blocks/card-block
+
+        Args:
+            block_id: A unique identifier for a block. If not specified, a block_id will be generated.
+            hero_image: Link to the top image used on the card.
+            icon: Link to the small image used next to the card's title and subtitle.
+            title: Title of the card. 150 characters max.
+            subtitle: Subtitle of the card. 150 characters max.
+            body: Content of the card. 200 characters max.
+            actions: Action buttons shown at the bottom of the card.
+        """
+        super().__init__(type=self.type, block_id=block_id)
+        show_unknown_key_warning(self, others)
+
+        self.hero_image = hero_image
+        self.icon = icon
+        self.title = TextObject.parse(title, default_type=MarkdownTextObject.type)  # type: ignore[arg-type]
+        self.subtitle = TextObject.parse(subtitle, default_type=MarkdownTextObject.type)  # type: ignore[arg-type]
+        self.body = TextObject.parse(body, default_type=MarkdownTextObject.type)  # type: ignore[arg-type]
+        self.actions = BlockElement.parse_all(actions) if actions else None
+
+    @JsonValidator("At least one of hero_image, title, actions, or body is required")
+    def _validate_content(self):
+        return self.hero_image is not None or self.title is not None or self.actions is not None or self.body is not None
+
+    @JsonValidator(f"title attribute cannot exceed {title_max_length} characters")
+    def _validate_title_length(self):
+        return self.title is None or self.title.text is None or len(self.title.text) <= self.title_max_length
+
+    @JsonValidator(f"subtitle attribute cannot exceed {subtitle_max_length} characters")
+    def _validate_subtitle_length(self):
+        return self.subtitle is None or self.subtitle.text is None or len(self.subtitle.text) <= self.subtitle_max_length
+
+    @JsonValidator(f"body attribute cannot exceed {body_max_length} characters")
+    def _validate_body_length(self):
+        return self.body is None or self.body.text is None or len(self.body.text) <= self.body_max_length
+
+

Blocks are a series of components that can be combined +to create visually rich and compellingly interactive messages. +https://docs.slack.dev/reference/block-kit/blocks

+

Displays content in a card. +https://docs.slack.dev/reference/block-kit/blocks/card-block

+

Args

+
+
block_id
+
A unique identifier for a block. If not specified, a block_id will be generated.
+
hero_image
+
Link to the top image used on the card.
+
icon
+
Link to the small image used next to the card's title and subtitle.
+
title
+
Title of the card. 150 characters max.
+
subtitle
+
Subtitle of the card. 150 characters max.
+
body
+
Content of the card. 200 characters max.
+
actions
+
Action buttons shown at the bottom of the card.
+
+

Ancestors

+ +

Class variables

+
+
var body_max_length
+
+

The type of the None singleton.

+
+
var subtitle_max_length
+
+

The type of the None singleton.

+
+
var title_max_length
+
+

The type of the None singleton.

+
+
var type
+
+

The type of the None singleton.

+
+
+

Instance variables

+
+
prop attributes : Set[str]
+
+
+ +Expand source code + +
@property
+def attributes(self) -> Set[str]:  # type: ignore[override]
+    return super().attributes.union(
+        {
+            "hero_image",
+            "icon",
+            "title",
+            "subtitle",
+            "body",
+            "actions",
+        }
+    )
+
+

Build an unordered collection of unique elements.

+
+
+

Inherited members

+ +
+
+class CarouselBlock +(*,
elements: Sequence[dict | CardBlock],
block_id: str | None = None,
**others: dict)
+
+
+
+ +Expand source code + +
class CarouselBlock(Block):
+    type = "carousel"
+    elements_max_length = 10
+
+    @property
+    def attributes(self) -> Set[str]:  # type: ignore[override]
+        return super().attributes.union({"elements"})
+
+    def __init__(
+        self,
+        *,
+        elements: Sequence[Union[dict, CardBlock]],
+        block_id: Optional[str] = None,
+        **others: dict,
+    ):
+        """Displays related card blocks in a horizontally-scrolling container.
+        https://docs.slack.dev/reference/block-kit/blocks/carousel-block
+
+        Args:
+            elements (required): A list of cards. Minimum 1, maximum 10 cards.
+            block_id: A unique identifier for a block. If not specified, a block_id will be generated.
+        """
+        super().__init__(type=self.type, block_id=block_id)
+        show_unknown_key_warning(self, others)
+
+        self.elements = Block.parse_all(elements)
+
+    @JsonValidator("elements attribute must contain at least 1 card")
+    def _validate_elements_present(self):
+        return self.elements is not None and len(self.elements) >= 1
+
+    @JsonValidator(f"elements attribute cannot exceed {elements_max_length} cards")
+    def _validate_elements_length(self):
+        return self.elements is None or len(self.elements) <= self.elements_max_length
+
+

Blocks are a series of components that can be combined +to create visually rich and compellingly interactive messages. +https://docs.slack.dev/reference/block-kit/blocks

+

Displays related card blocks in a horizontally-scrolling container. +https://docs.slack.dev/reference/block-kit/blocks/carousel-block

+

Args

+
+
elements : required
+
A list of cards. Minimum 1, maximum 10 cards.
+
block_id
+
A unique identifier for a block. If not specified, a block_id will be generated.
+
+

Ancestors

+ +

Class variables

+
+
var elements_max_length
+
+

The type of the None singleton.

+
+
var type
+
+

The type of the None singleton.

+
+
+

Instance variables

+
+
prop attributes : Set[str]
+
+
+ +Expand source code + +
@property
+def attributes(self) -> Set[str]:  # type: ignore[override]
+    return super().attributes.union({"elements"})
+
+

Build an unordered collection of unique elements.

+
+
+

Inherited members

+ +
class ContextActionsBlock (*,
elements: Sequence[dict | FeedbackButtonsElement | IconButtonElement],
block_id: str | None = None,
**others: dict)
@@ -1601,7 +1981,7 @@

Inherited members

else: field_objects.append(PlainTextObject(**d)) # type: ignore[arg-type] else: - self.logger.warning(f"Unsupported field detected and skipped {f}") + self.logger.warning(f"Unsupported field detected and skipped: {f}") self.fields = field_objects self.accessory = BlockElement.parse(accessory) # type: ignore[arg-type] self.expand = expand @@ -2182,6 +2562,14 @@

AlertBlock

+ + +
  • Block

  • +
    +class AlertBlock +(*,
    text: str | dict | TextObject,
    level: str | None = None,
    block_id: str | None = None,
    **others: dict)
    +
    +
    +
    + +Expand source code + +
    class AlertBlock(Block):
    +    type = "alert"
    +    valid_levels = {"default", "info", "warning", "error", "success"}
    +
    +    @property
    +    def attributes(self) -> Set[str]:  # type: ignore[override]
    +        return super().attributes.union({"text", "level"})
    +
    +    def __init__(
    +        self,
    +        *,
    +        text: Union[str, dict, TextObject],
    +        level: Optional[str] = None,
    +        block_id: Optional[str] = None,
    +        **others: dict,
    +    ):
    +        """Displays alerts, warnings, and informational messages.
    +        https://docs.slack.dev/reference/block-kit/blocks/alert-block
    +
    +        Args:
    +            text (required): The alert message, using plain_text or mrkdwn formatting.
    +            level: One of "default", "info", "warning", "error", or "success".
    +                Will be "default" if omitted.
    +            block_id: A unique identifier for a block. If not specified, a block_id will be generated.
    +        """
    +        super().__init__(type=self.type, block_id=block_id)
    +        show_unknown_key_warning(self, others)
    +
    +        self.text = TextObject.parse(text)
    +        self.level = level
    +
    +    @JsonValidator("text attribute must be specified")
    +    def _validate_text(self):
    +        return self.text is not None
    +
    +    @JsonValidator("level must be a valid value (default, info, warning, error, success)")
    +    def _validate_level(self):
    +        return self.level is None or self.level in self.valid_levels
    +
    +

    Blocks are a series of components that can be combined +to create visually rich and compellingly interactive messages. +https://docs.slack.dev/reference/block-kit/blocks

    +

    Displays alerts, warnings, and informational messages. +https://docs.slack.dev/reference/block-kit/blocks/alert-block

    +

    Args

    +
    +
    text : required
    +
    The alert message, using plain_text or mrkdwn formatting.
    +
    level
    +
    One of "default", "info", "warning", "error", or "success". +Will be "default" if omitted.
    +
    block_id
    +
    A unique identifier for a block. If not specified, a block_id will be generated.
    +
    +

    Ancestors

    + +

    Class variables

    +
    +
    var type
    +
    +

    The type of the None singleton.

    +
    +
    var valid_levels
    +
    +

    The type of the None singleton.

    +
    +
    +

    Instance variables

    +
    +
    prop attributes : Set[str]
    +
    +
    + +Expand source code + +
    @property
    +def attributes(self) -> Set[str]:  # type: ignore[override]
    +    return super().attributes.union({"text", "level"})
    +
    +

    Build an unordered collection of unique elements.

    +
    +
    +

    Inherited members

    + +
    class Block (*,
    type: str | None = None,
    subtype: str | None = None,
    block_id: str | None = None)
    @@ -264,6 +372,12 @@

    Inherited members

    return TaskCardBlock(**block) elif type == PlanBlock.type: return PlanBlock(**block) + elif type == CardBlock.type: + return CardBlock(**block) + elif type == AlertBlock.type: + return AlertBlock(**block) + elif type == CarouselBlock.type: + return CarouselBlock(**block) else: cls.logger.warning(f"Unknown block detected and skipped ({block})") return None @@ -286,7 +400,10 @@

    Ancestors

    Subclasses

    +
    +class CardBlock +(*,
    block_id: str | None = None,
    hero_image: str | None = None,
    icon: str | None = None,
    title: str | dict | TextObject | None = None,
    subtitle: str | dict | TextObject | None = None,
    body: str | dict | TextObject | None = None,
    actions: Sequence[dict | BlockElement] | None = None,
    **others: dict)
    +
    +
    +
    + +Expand source code + +
    class CardBlock(Block):
    +    type = "card"
    +    title_max_length = 150
    +    subtitle_max_length = 150
    +    body_max_length = 200
    +
    +    @property
    +    def attributes(self) -> Set[str]:  # type: ignore[override]
    +        return super().attributes.union(
    +            {
    +                "hero_image",
    +                "icon",
    +                "title",
    +                "subtitle",
    +                "body",
    +                "actions",
    +            }
    +        )
    +
    +    def __init__(
    +        self,
    +        *,
    +        block_id: Optional[str] = None,
    +        hero_image: Optional[str] = None,
    +        icon: Optional[str] = None,
    +        title: Optional[Union[str, dict, TextObject]] = None,
    +        subtitle: Optional[Union[str, dict, TextObject]] = None,
    +        body: Optional[Union[str, dict, TextObject]] = None,
    +        actions: Optional[Sequence[Union[dict, BlockElement]]] = None,
    +        **others: dict,
    +    ):
    +        """Displays content in a card.
    +        https://docs.slack.dev/reference/block-kit/blocks/card-block
    +
    +        Args:
    +            block_id: A unique identifier for a block. If not specified, a block_id will be generated.
    +            hero_image: Link to the top image used on the card.
    +            icon: Link to the small image used next to the card's title and subtitle.
    +            title: Title of the card. 150 characters max.
    +            subtitle: Subtitle of the card. 150 characters max.
    +            body: Content of the card. 200 characters max.
    +            actions: Action buttons shown at the bottom of the card.
    +        """
    +        super().__init__(type=self.type, block_id=block_id)
    +        show_unknown_key_warning(self, others)
    +
    +        self.hero_image = hero_image
    +        self.icon = icon
    +        self.title = TextObject.parse(title, default_type=MarkdownTextObject.type)  # type: ignore[arg-type]
    +        self.subtitle = TextObject.parse(subtitle, default_type=MarkdownTextObject.type)  # type: ignore[arg-type]
    +        self.body = TextObject.parse(body, default_type=MarkdownTextObject.type)  # type: ignore[arg-type]
    +        self.actions = BlockElement.parse_all(actions) if actions else None
    +
    +    @JsonValidator("At least one of hero_image, title, actions, or body is required")
    +    def _validate_content(self):
    +        return self.hero_image is not None or self.title is not None or self.actions is not None or self.body is not None
    +
    +    @JsonValidator(f"title attribute cannot exceed {title_max_length} characters")
    +    def _validate_title_length(self):
    +        return self.title is None or self.title.text is None or len(self.title.text) <= self.title_max_length
    +
    +    @JsonValidator(f"subtitle attribute cannot exceed {subtitle_max_length} characters")
    +    def _validate_subtitle_length(self):
    +        return self.subtitle is None or self.subtitle.text is None or len(self.subtitle.text) <= self.subtitle_max_length
    +
    +    @JsonValidator(f"body attribute cannot exceed {body_max_length} characters")
    +    def _validate_body_length(self):
    +        return self.body is None or self.body.text is None or len(self.body.text) <= self.body_max_length
    +
    +

    Blocks are a series of components that can be combined +to create visually rich and compellingly interactive messages. +https://docs.slack.dev/reference/block-kit/blocks

    +

    Displays content in a card. +https://docs.slack.dev/reference/block-kit/blocks/card-block

    +

    Args

    +
    +
    block_id
    +
    A unique identifier for a block. If not specified, a block_id will be generated.
    +
    hero_image
    +
    Link to the top image used on the card.
    +
    icon
    +
    Link to the small image used next to the card's title and subtitle.
    +
    title
    +
    Title of the card. 150 characters max.
    +
    subtitle
    +
    Subtitle of the card. 150 characters max.
    +
    body
    +
    Content of the card. 200 characters max.
    +
    actions
    +
    Action buttons shown at the bottom of the card.
    +
    +

    Ancestors

    + +

    Class variables

    +
    +
    var body_max_length
    +
    +

    The type of the None singleton.

    +
    +
    var subtitle_max_length
    +
    +

    The type of the None singleton.

    +
    +
    var title_max_length
    +
    +

    The type of the None singleton.

    +
    +
    var type
    +
    +

    The type of the None singleton.

    +
    +
    +

    Instance variables

    +
    +
    prop attributes : Set[str]
    +
    +
    + +Expand source code + +
    @property
    +def attributes(self) -> Set[str]:  # type: ignore[override]
    +    return super().attributes.union(
    +        {
    +            "hero_image",
    +            "icon",
    +            "title",
    +            "subtitle",
    +            "body",
    +            "actions",
    +        }
    +    )
    +
    +

    Build an unordered collection of unique elements.

    +
    +
    +

    Inherited members

    + +
    +
    +class CarouselBlock +(*,
    elements: Sequence[dict | CardBlock],
    block_id: str | None = None,
    **others: dict)
    +
    +
    +
    + +Expand source code + +
    class CarouselBlock(Block):
    +    type = "carousel"
    +    elements_max_length = 10
    +
    +    @property
    +    def attributes(self) -> Set[str]:  # type: ignore[override]
    +        return super().attributes.union({"elements"})
    +
    +    def __init__(
    +        self,
    +        *,
    +        elements: Sequence[Union[dict, CardBlock]],
    +        block_id: Optional[str] = None,
    +        **others: dict,
    +    ):
    +        """Displays related card blocks in a horizontally-scrolling container.
    +        https://docs.slack.dev/reference/block-kit/blocks/carousel-block
    +
    +        Args:
    +            elements (required): A list of cards. Minimum 1, maximum 10 cards.
    +            block_id: A unique identifier for a block. If not specified, a block_id will be generated.
    +        """
    +        super().__init__(type=self.type, block_id=block_id)
    +        show_unknown_key_warning(self, others)
    +
    +        self.elements = Block.parse_all(elements)
    +
    +    @JsonValidator("elements attribute must contain at least 1 card")
    +    def _validate_elements_present(self):
    +        return self.elements is not None and len(self.elements) >= 1
    +
    +    @JsonValidator(f"elements attribute cannot exceed {elements_max_length} cards")
    +    def _validate_elements_length(self):
    +        return self.elements is None or len(self.elements) <= self.elements_max_length
    +
    +

    Blocks are a series of components that can be combined +to create visually rich and compellingly interactive messages. +https://docs.slack.dev/reference/block-kit/blocks

    +

    Displays related card blocks in a horizontally-scrolling container. +https://docs.slack.dev/reference/block-kit/blocks/carousel-block

    +

    Args

    +
    +
    elements : required
    +
    A list of cards. Minimum 1, maximum 10 cards.
    +
    block_id
    +
    A unique identifier for a block. If not specified, a block_id will be generated.
    +
    +

    Ancestors

    + +

    Class variables

    +
    +
    var elements_max_length
    +
    +

    The type of the None singleton.

    +
    +
    var type
    +
    +

    The type of the None singleton.

    +
    +
    +

    Instance variables

    +
    +
    prop attributes : Set[str]
    +
    +
    + +Expand source code + +
    @property
    +def attributes(self) -> Set[str]:  # type: ignore[override]
    +    return super().attributes.union({"elements"})
    +
    +

    Build an unordered collection of unique elements.

    +
    +
    +

    Inherited members

    + +
    class ChannelMultiSelectElement (*,
    placeholder: str | dict | TextObject | None = None,
    action_id: str | None = None,
    initial_channels: Sequence[str] | None = None,
    confirm: dict | ConfirmObject | None = None,
    max_selected_items: int | None = None,
    focus_on_load: bool | None = None,
    **others: dict)
    @@ -1278,7 +1658,7 @@

    Class variables

    Static methods

    -def parse(confirm: ConfirmObject | Dict[str, Any]) +def parse(confirm: ForwardRef('ConfirmObject') | Dict[str, Any])
    @@ -1650,7 +2030,7 @@

    Class variables

    Static methods

    -def parse(filter: dict | ConversationFilter) +def parse(filter: dict | ForwardRef('ConversationFilter'))
    @@ -2842,7 +3222,7 @@

    Class variables

    Static methods

    -def parse(feedback_button: FeedbackButtonObject | Dict[str, Any]) +def parse(feedback_button: ForwardRef('FeedbackButtonObject') | Dict[str, Any])
    @@ -4727,7 +5107,7 @@

    Static methods

    Creates a simple Option instance with the same value and label

    -def parse_all(options: Sequence[Dict[str, Any] | Option] | None) ‑> List[Option] | None +def parse_all(options: Sequence[Dict[str, Any] | ForwardRef('Option')] | None) ‑> List[Option] | None
    @@ -4925,7 +5305,7 @@

    Class variables

    Static methods

    -def parse_all(option_groups: Sequence[Dict[str, Any] | OptionGroup] | None) ‑> List[OptionGroup] | None +def parse_all(option_groups: Sequence[Dict[str, Any] | ForwardRef('OptionGroup')] | None) ‑> List[OptionGroup] | None
    @@ -6143,7 +6523,7 @@

    Class variables

    class RichTextInputElement -(*,
    action_id: str | None = None,
    placeholder: str | dict | TextObject | None = None,
    initial_value: Dict[str, Any] | RichTextBlock | None = None,
    dispatch_action_config: dict | DispatchActionConfig | None = None,
    focus_on_load: bool | None = None,
    **others: dict)
    +(*,
    action_id: str | None = None,
    placeholder: str | dict | TextObject | None = None,
    initial_value: Dict[str, Any] | ForwardRef('RichTextBlock') | None = None,
    dispatch_action_config: dict | DispatchActionConfig | None = None,
    focus_on_load: bool | None = None,
    **others: dict)
    @@ -6592,7 +6972,7 @@

    Inherited members

    else: field_objects.append(PlainTextObject(**d)) # type: ignore[arg-type] else: - self.logger.warning(f"Unsupported field detected and skipped {f}") + self.logger.warning(f"Unsupported field detected and skipped: {f}") self.fields = field_objects self.accessory = BlockElement.parse(accessory) # type: ignore[arg-type] self.expand = expand @@ -7547,7 +7927,7 @@

    Class variables

    Static methods

    -def parse(text: str | Dict[str, Any] | TextObject,
    default_type: str = 'mrkdwn') ‑> TextObject | None
    +def parse(text: str | Dict[str, Any] | ForwardRef('TextObject'),
    default_type: str = 'mrkdwn') ‑> TextObject | None
    @@ -8435,6 +8815,14 @@

    AlertBlock

    + + +
  • Block

    • attributes
    • @@ -8472,6 +8860,24 @@

      CardBlock

      + + +
    • +

      CarouselBlock

      + +
    • +
    • ChannelMultiSelectElement

      • attributes
      • diff --git a/docs/reference/models/messages/chunk.html b/docs/reference/models/messages/chunk.html index 49c1ef1bc..00c5d1e30 100644 --- a/docs/reference/models/messages/chunk.html +++ b/docs/reference/models/messages/chunk.html @@ -46,6 +46,81 @@

        Module slack_sdk.models.messages.chunk

        Classes

        +
        +class BlocksChunk +(*,
        blocks: Sequence[Dict | Block],
        **others: Dict)
        +
        +
        +
        + +Expand source code + +
        class BlocksChunk(Chunk):
        +    type = "blocks"
        +
        +    @property
        +    def attributes(self) -> Set[str]:  # type: ignore[override]
        +        return super().attributes.union({"blocks"})
        +
        +    def __init__(
        +        self,
        +        *,
        +        blocks: Sequence[Union[Dict, Block]],
        +        **others: Dict,
        +    ):
        +        """Used for passing an array of blocks within a streaming message.
        +
        +        https://docs.slack.dev/messaging/sending-and-scheduling-messages#text-streaming
        +        """
        +        super().__init__(type=self.type)
        +        show_unknown_key_warning(self, others)
        +
        +        self.blocks = blocks
        +
        + +

        Ancestors

        + +

        Class variables

        +
        +
        var type
        +
        +

        The type of the None singleton.

        +
        +
        +

        Instance variables

        +
        +
        prop attributes : Set[str]
        +
        +
        + +Expand source code + +
        @property
        +def attributes(self) -> Set[str]:  # type: ignore[override]
        +    return super().attributes.union({"blocks"})
        +
        +

        Build an unordered collection of unique elements.

        +
        +
        +

        Inherited members

        + +
        class Chunk (*, type: str | None = None) @@ -81,7 +156,9 @@

        Classes

        else: if "type" in chunk: type = chunk["type"] - if type == MarkdownTextChunk.type: + if type == BlocksChunk.type: + return BlocksChunk(**chunk) + elif type == MarkdownTextChunk.type: return MarkdownTextChunk(**chunk) elif type == PlanUpdateChunk.type: return PlanUpdateChunk(**chunk) @@ -103,6 +180,7 @@

        Ancestors

      Subclasses

        +
      • BlocksChunk
      • MarkdownTextChunk
      • PlanUpdateChunk
      • TaskUpdateChunk
      • @@ -121,7 +199,7 @@

        Class variables

        Static methods

        -def parse(chunk: Dict | Chunk) ‑> Chunk | None +def parse(chunk: Dict | ForwardRef('Chunk')) ‑> Chunk | None
        @@ -407,6 +485,13 @@

        Inherited members

      • Classes

        • +

          BlocksChunk

          + +
        • +
        • Chunk

          • attributes
          • diff --git a/docs/reference/models/views/index.html b/docs/reference/models/views/index.html index b7bad66bc..d9e60359b 100644 --- a/docs/reference/models/views/index.html +++ b/docs/reference/models/views/index.html @@ -48,7 +48,7 @@

            Classes

            class View -(type: str,
            id: str | None = None,
            callback_id: str | None = None,
            external_id: str | None = None,
            team_id: str | None = None,
            bot_id: str | None = None,
            app_id: str | None = None,
            root_view_id: str | None = None,
            previous_view_id: str | None = None,
            title: str | dict | PlainTextObject | None = None,
            submit: str | dict | PlainTextObject | None = None,
            close: str | dict | PlainTextObject | None = None,
            blocks: Sequence[dict | Block] | None = None,
            private_metadata: str | None = None,
            state: dict | ViewState | None = None,
            hash: str | None = None,
            clear_on_close: bool | None = None,
            notify_on_close: bool | None = None,
            **kwargs)
            +(type: str,
            id: str | None = None,
            callback_id: str | None = None,
            external_id: str | None = None,
            team_id: str | None = None,
            bot_id: str | None = None,
            app_id: str | None = None,
            root_view_id: str | None = None,
            previous_view_id: str | None = None,
            title: str | dict | PlainTextObject | None = None,
            submit: str | dict | PlainTextObject | None = None,
            close: str | dict | PlainTextObject | None = None,
            blocks: Sequence[dict | Block] | None = None,
            private_metadata: str | None = None,
            state: dict | ForwardRef('ViewState') | None = None,
            hash: str | None = None,
            clear_on_close: bool | None = None,
            notify_on_close: bool | None = None,
            **kwargs)
            @@ -229,7 +229,7 @@

            Inherited members

            class ViewState -(*,
            values: Dict[str, Dict[str, dict | ViewStateValue]])
            +(*,
            values: Dict[str, Dict[str, dict | ForwardRef('ViewStateValue')]])
            diff --git a/docs/reference/oauth/installation_store/amazon_s3/index.html b/docs/reference/oauth/installation_store/amazon_s3/index.html index 0b3afe30a..9b6531ecb 100644 --- a/docs/reference/oauth/installation_store/amazon_s3/index.html +++ b/docs/reference/oauth/installation_store/amazon_s3/index.html @@ -147,7 +147,7 @@

            Classes

            def save_bot(self, bot: Bot): if bot.bot_token is None: - self.logger.debug("Skipped saving a new row because of the absense of bot token in it") + self.logger.debug("Skipped saving a new row because of the absence of bot token in it") return none = "none" @@ -314,7 +314,7 @@

            Classes

            Key=content.get("Key"), ) except Exception as e: - message = f"Failed to find bot installation data for enterprise: {e_id}, team: {t_id}: {e}" + message = f"Failed to delete bot installation data for enterprise: {e_id}, team: {t_id}: {e}" raise SlackClientConfigurationError(message) async def async_delete_installation( @@ -357,7 +357,7 @@

            Classes

            ) deleted_keys.append(key) except Exception as e: - message = f"Failed to find bot installation data for enterprise: {e_id}, team: {t_id}: {e}" + message = f"Failed to delete installation data for enterprise: {e_id}, team: {t_id}: {e}" raise SlackClientConfigurationError(message) try: @@ -369,7 +369,7 @@

            Classes

            ) deleted_keys.append(no_user_id_key) except Exception as e: - message = f"Failed to find bot installation data for enterprise: {e_id}, team: {t_id}: {e}" + message = f"Failed to delete installation data for enterprise: {e_id}, team: {t_id}: {e}" raise SlackClientConfigurationError(message) # Check the remaining installation data @@ -388,7 +388,7 @@

            Classes

            Key=content.get("Key"), ) except Exception as e: - message = f"Failed to find bot installation data for enterprise: {e_id}, team: {t_id}: {e}" + message = f"Failed to delete installation data for enterprise: {e_id}, team: {t_id}: {e}" raise SlackClientConfigurationError(message)

            The installation store interface.

            diff --git a/docs/reference/oauth/installation_store/async_cacheable_installation_store.html b/docs/reference/oauth/installation_store/async_cacheable_installation_store.html index a38205174..aba88128a 100644 --- a/docs/reference/oauth/installation_store/async_cacheable_installation_store.html +++ b/docs/reference/oauth/installation_store/async_cacheable_installation_store.html @@ -146,7 +146,8 @@

            Classes

            team_id=team_id, ) key = f"{enterprise_id or ''}-{team_id or ''}" - self.cached_bots.pop(key) + if key in self.cached_bots: + self.cached_bots.pop(key) async def async_delete_installation( self, diff --git a/docs/reference/oauth/installation_store/file/index.html b/docs/reference/oauth/installation_store/file/index.html index db77a087c..2c488761a 100644 --- a/docs/reference/oauth/installation_store/file/index.html +++ b/docs/reference/oauth/installation_store/file/index.html @@ -119,7 +119,7 @@

            Classes

            def save_bot(self, bot: Bot): if bot.bot_token is None: - self.logger.debug("Skipped saving a new row because of the absense of bot token in it") + self.logger.debug("Skipped saving a new row because of the absence of bot token in it") return none = "none" diff --git a/docs/reference/oauth/installation_store/index.html b/docs/reference/oauth/installation_store/index.html index 8d95802d0..c7ffb4d38 100644 --- a/docs/reference/oauth/installation_store/index.html +++ b/docs/reference/oauth/installation_store/index.html @@ -400,7 +400,7 @@

            Methods

            def save_bot(self, bot: Bot): if bot.bot_token is None: - self.logger.debug("Skipped saving a new row because of the absense of bot token in it") + self.logger.debug("Skipped saving a new row because of the absence of bot token in it") return none = "none" diff --git a/docs/reference/oauth/installation_store/sqlite3/index.html b/docs/reference/oauth/installation_store/sqlite3/index.html index 8fc6c563e..b5e1b9dab 100644 --- a/docs/reference/oauth/installation_store/sqlite3/index.html +++ b/docs/reference/oauth/installation_store/sqlite3/index.html @@ -91,8 +91,7 @@

            Classes

            def create_tables(self): with sqlite3.connect(database=self.database) as conn: - conn.execute( - """ + conn.execute(""" create table slack_installations ( id integer primary key autoincrement, client_id text not null, @@ -121,10 +120,8 @@

            Classes

            token_type text, installed_at datetime not null default current_timestamp ); - """ - ) - conn.execute( - """ + """) + conn.execute(""" create index slack_installations_idx on slack_installations ( client_id, enterprise_id, @@ -132,10 +129,8 @@

            Classes

            user_id, installed_at ); - """ - ) - conn.execute( - """ + """) + conn.execute(""" create table slack_bots ( id integer primary key autoincrement, client_id text not null, @@ -153,18 +148,15 @@

            Classes

            is_enterprise_install boolean not null default 0, installed_at datetime not null default current_timestamp ); - """ - ) - conn.execute( - """ + """) + conn.execute(""" create index slack_bots_idx on slack_bots ( client_id, enterprise_id, team_id, installed_at ); - """ - ) + """) self.logger.debug(f"Tables have been created (database: {self.database})") conn.commit() @@ -268,7 +260,7 @@

            Classes

            def save_bot(self, bot: Bot): if bot.bot_token is None: - self.logger.debug("Skipped saving a new row because of the absense of bot token in it") + self.logger.debug("Skipped saving a new row because of the absence of bot token in it") return with self.connect() as conn: @@ -725,8 +717,7 @@

            Methods

            def create_tables(self):
                 with sqlite3.connect(database=self.database) as conn:
            -        conn.execute(
            -            """
            +        conn.execute("""
                     create table slack_installations (
                         id integer primary key autoincrement,
                         client_id text not null,
            @@ -755,10 +746,8 @@ 

            Methods

            token_type text, installed_at datetime not null default current_timestamp ); - """ - ) - conn.execute( - """ + """) + conn.execute(""" create index slack_installations_idx on slack_installations ( client_id, enterprise_id, @@ -766,10 +755,8 @@

            Methods

            user_id, installed_at ); - """ - ) - conn.execute( - """ + """) + conn.execute(""" create table slack_bots ( id integer primary key autoincrement, client_id text not null, @@ -787,18 +774,15 @@

            Methods

            is_enterprise_install boolean not null default 0, installed_at datetime not null default current_timestamp ); - """ - ) - conn.execute( - """ + """) + conn.execute(""" create index slack_bots_idx on slack_bots ( client_id, enterprise_id, team_id, installed_at ); - """ - ) + """) self.logger.debug(f"Tables have been created (database: {self.database})") conn.commit()
  • diff --git a/docs/reference/oauth/state_store/sqlite3/index.html b/docs/reference/oauth/state_store/sqlite3/index.html index cd0b75b8b..e1e1d0b1f 100644 --- a/docs/reference/oauth/state_store/sqlite3/index.html +++ b/docs/reference/oauth/state_store/sqlite3/index.html @@ -91,15 +91,13 @@

    Classes

    def create_tables(self): with sqlite3.connect(database=self.database) as conn: - conn.execute( - """ + conn.execute(""" create table oauth_states ( id integer primary key autoincrement, state text not null, expire_at datetime not null ); - """ - ) + """) self.logger.debug(f"Tables have been created (database: {self.database})") conn.commit() @@ -247,15 +245,13 @@

    Methods

    def create_tables(self):
         with sqlite3.connect(database=self.database) as conn:
    -        conn.execute(
    -            """
    +        conn.execute("""
             create table oauth_states (
                 id integer primary key autoincrement,
                 state text not null,
                 expire_at datetime not null
             );
    -        """
    -        )
    +        """)
             self.logger.debug(f"Tables have been created (database: {self.database})")
             conn.commit()
    diff --git a/docs/reference/signature/index.html b/docs/reference/signature/index.html index ecc1f0831..f1c87b3c1 100644 --- a/docs/reference/signature/index.html +++ b/docs/reference/signature/index.html @@ -101,7 +101,7 @@

    Methods

    def is_valid_request( self, body: Union[str, bytes], - headers: Dict[str, str], + headers: Mapping[str, str], ) -> bool: """Verifies if the given signature is valid""" if headers is None: @@ -109,15 +109,15 @@

    Methods

    normalized_headers = {k.lower(): v for k, v in headers.items()} return self.is_valid( body=body, - timestamp=normalized_headers.get("x-slack-request-timestamp", None), # type: ignore[arg-type] - signature=normalized_headers.get("x-slack-signature", None), # type: ignore[arg-type] + timestamp=normalized_headers.get("x-slack-request-timestamp", None), + signature=normalized_headers.get("x-slack-signature", None), ) def is_valid( self, body: Union[str, bytes], - timestamp: str, - signature: str, + timestamp: Optional[str], + signature: Optional[str], ) -> bool: """Verifies if the given signature is valid""" if timestamp is None or signature is None: @@ -179,7 +179,7 @@

    Methods

    Generates a signature

    -def is_valid(self, body: str | bytes, timestamp: str, signature: str) ‑> bool +def is_valid(self, body: str | bytes, timestamp: str | None, signature: str | None) ‑> bool
    @@ -189,8 +189,8 @@

    Methods

    def is_valid(
         self,
         body: Union[str, bytes],
    -    timestamp: str,
    -    signature: str,
    +    timestamp: Optional[str],
    +    signature: Optional[str],
     ) -> bool:
         """Verifies if the given signature is valid"""
         if timestamp is None or signature is None:
    @@ -217,7 +217,7 @@ 

    Methods

    def is_valid_request(
         self,
         body: Union[str, bytes],
    -    headers: Dict[str, str],
    +    headers: Mapping[str, str],
     ) -> bool:
         """Verifies if the given signature is valid"""
         if headers is None:
    @@ -225,8 +225,8 @@ 

    Methods

    normalized_headers = {k.lower(): v for k, v in headers.items()} return self.is_valid( body=body, - timestamp=normalized_headers.get("x-slack-request-timestamp", None), # type: ignore[arg-type] - signature=normalized_headers.get("x-slack-signature", None), # type: ignore[arg-type] + timestamp=normalized_headers.get("x-slack-request-timestamp", None), + signature=normalized_headers.get("x-slack-signature", None), )

    Verifies if the given signature is valid

    diff --git a/docs/reference/socket_mode/aiohttp/index.html b/docs/reference/socket_mode/aiohttp/index.html index 92c6225c1..2568e6291 100644 --- a/docs/reference/socket_mode/aiohttp/index.html +++ b/docs/reference/socket_mode/aiohttp/index.html @@ -412,7 +412,7 @@

    Classes

    autoping=False, heartbeat=self.ping_interval, proxy=self.proxy, - ssl=self.web_client.ssl, + ssl=self.web_client.ssl if self.web_client.ssl is not None else True, ) session_id: str = await self.session_id() self.auto_reconnect_enabled = self.default_auto_reconnect_enabled @@ -653,7 +653,7 @@

    Methods

    autoping=False, heartbeat=self.ping_interval, proxy=self.proxy, - ssl=self.web_client.ssl, + ssl=self.web_client.ssl if self.web_client.ssl is not None else True, ) session_id: str = await self.session_id() self.auto_reconnect_enabled = self.default_auto_reconnect_enabled diff --git a/docs/reference/socket_mode/client.html b/docs/reference/socket_mode/client.html index 3c8c615f9..f7807a985 100644 --- a/docs/reference/socket_mode/client.html +++ b/docs/reference/socket_mode/client.html @@ -106,15 +106,17 @@

    Classes

    raise NotImplementedError() def connect_to_new_endpoint(self, force: bool = False): + acquired = False try: - self.connect_operation_lock.acquire(blocking=True, timeout=5) - if force or not self.is_connected(): + acquired = self.connect_operation_lock.acquire(blocking=True, timeout=5) + if force or (acquired and not self.is_connected()): self.logger.info("Connecting to a new endpoint...") self.wss_uri = self.issue_new_wss_url() self.connect() self.logger.info("Connected to a new endpoint...") finally: - self.connect_operation_lock.release() + if acquired: + self.connect_operation_lock.release() def close(self) -> None: self.closed = True @@ -283,15 +285,17 @@

    Methods

    Expand source code
    def connect_to_new_endpoint(self, force: bool = False):
    +    acquired = False
         try:
    -        self.connect_operation_lock.acquire(blocking=True, timeout=5)
    -        if force or not self.is_connected():
    +        acquired = self.connect_operation_lock.acquire(blocking=True, timeout=5)
    +        if force or (acquired and not self.is_connected()):
                 self.logger.info("Connecting to a new endpoint...")
                 self.wss_uri = self.issue_new_wss_url()
                 self.connect()
                 self.logger.info("Connected to a new endpoint...")
         finally:
    -        self.connect_operation_lock.release()
    + if acquired: + self.connect_operation_lock.release()
    diff --git a/docs/reference/socket_mode/index.html b/docs/reference/socket_mode/index.html index 381e969e5..770181ab5 100644 --- a/docs/reference/socket_mode/index.html +++ b/docs/reference/socket_mode/index.html @@ -87,11 +87,11 @@

    Sub-modules

    slack_sdk.socket_mode.websocket_client
    -

    websocket-client bassd Socket Mode client …

    +

    websocket-client based Socket Mode client …

    slack_sdk.socket_mode.websockets
    -

    websockets bassd Socket Mode client …

    +

    websockets based Socket Mode client …

    diff --git a/docs/reference/socket_mode/request.html b/docs/reference/socket_mode/request.html index 75945aa40..82d019f1f 100644 --- a/docs/reference/socket_mode/request.html +++ b/docs/reference/socket_mode/request.html @@ -103,7 +103,7 @@

    Classes

    return None def to_dict(self) -> dict: - d = {"envelope_id": self.envelope_id} + d = {"type": self.type, "envelope_id": self.envelope_id} if self.payload is not None: d["payload"] = self.payload # type: ignore[assignment] return d
    @@ -156,7 +156,7 @@

    Methods

    Expand source code
    def to_dict(self) -> dict:
    -    d = {"envelope_id": self.envelope_id}
    +    d = {"type": self.type, "envelope_id": self.envelope_id}
         if self.payload is not None:
             d["payload"] = self.payload  # type: ignore[assignment]
         return d
    diff --git a/docs/reference/socket_mode/websocket_client/index.html b/docs/reference/socket_mode/websocket_client/index.html index b90aa9137..09cfb4424 100644 --- a/docs/reference/socket_mode/websocket_client/index.html +++ b/docs/reference/socket_mode/websocket_client/index.html @@ -5,7 +5,7 @@ slack_sdk.socket_mode.websocket_client API documentation - + @@ -36,7 +36,7 @@

    Module slack_sdk.socket_mode.websocket_client

    -

    websocket-client bassd Socket Mode client

    +

    websocket-client based Socket Mode client