From 010605fc142ab15523211100006ec9530ea7ff5d Mon Sep 17 00:00:00 2001 From: Kazuhiro Sera Date: Wed, 24 Nov 2021 17:26:19 +0900 Subject: [PATCH] version 3.12.0 --- .../slack_sdk/audit_logs/v1/async_client.html | 38 +- .../slack_sdk/audit_logs/v1/client.html | 98 +- .../slack_sdk/audit_logs/v1/logs.html | 100 +- .../slack_sdk/audit_logs/v1/response.html | 38 +- .../http_retry/builtin_async_handlers.html | 12 +- .../http_retry/builtin_handlers.html | 8 +- .../slack_sdk/models/attachments/index.html | 90 +- .../slack_sdk/models/basic_objects.html | 12 +- .../models/blocks/basic_components.html | 94 +- .../models/blocks/block_elements.html | 1285 +++++++++++++++-- .../slack_sdk/models/blocks/blocks.html | 319 +++- .../slack_sdk/models/dialogs/index.html | 248 ++-- docs/api-docs/slack_sdk/models/index.html | 12 +- .../slack_sdk/models/messages/index.html | 6 +- .../slack_sdk/models/views/index.html | 14 +- .../async_cacheable_installation_store.html | 24 +- .../cacheable_installation_store.html | 24 +- .../oauth/installation_store/internals.html | 2 +- .../oauth/installation_store/models/bot.html | 14 +- .../models/installation.html | 30 +- .../installation_store/sqlalchemy/index.html | 20 +- .../oauth/state_store/sqlalchemy/index.html | 2 +- .../oauth/token_rotation/async_rotator.html | 78 +- .../oauth/token_rotation/rotator.html | 56 +- docs/api-docs/slack_sdk/rtm/index.html | 8 +- docs/api-docs/slack_sdk/rtm_v2/index.html | 6 +- .../slack_sdk/scim/v1/async_client.html | 32 +- docs/api-docs/slack_sdk/scim/v1/client.html | 72 +- .../slack_sdk/scim/v1/internal_utils.html | 5 +- docs/api-docs/slack_sdk/scim/v1/response.html | 128 +- docs/api-docs/slack_sdk/scim/v1/user.html | 32 +- .../slack_sdk/socket_mode/aiohttp/index.html | 317 ++-- .../slack_sdk/socket_mode/async_client.html | 12 +- .../socket_mode/async_listeners.html | 8 +- .../socket_mode/builtin/connection.html | 6 +- .../socket_mode/builtin/internals.html | 16 +- .../slack_sdk/socket_mode/client.html | 12 +- .../slack_sdk/socket_mode/listeners.html | 8 +- .../slack_sdk/socket_mode/request.html | 10 +- .../socket_mode/websocket_client/index.html | 20 +- .../socket_mode/websockets/index.html | 6 +- docs/api-docs/slack_sdk/version.html | 2 +- .../slack_sdk/web/async_base_client.html | 32 +- docs/api-docs/slack_sdk/web/async_client.html | 159 ++ .../slack_sdk/web/async_internal_utils.html | 9 +- docs/api-docs/slack_sdk/web/base_client.html | 128 +- docs/api-docs/slack_sdk/web/client.html | 159 ++ .../slack_sdk/web/legacy_base_client.html | 167 ++- .../api-docs/slack_sdk/web/legacy_client.html | 159 ++ .../slack_sdk/webhook/async_client.html | 12 +- docs/api-docs/slack_sdk/webhook/client.html | 82 +- slack_sdk/version.py | 2 +- 52 files changed, 3203 insertions(+), 1030 deletions(-) diff --git a/docs/api-docs/slack_sdk/audit_logs/v1/async_client.html b/docs/api-docs/slack_sdk/audit_logs/v1/async_client.html index 1a8759cb7..179b449fc 100644 --- a/docs/api-docs/slack_sdk/audit_logs/v1/async_client.html +++ b/docs/api-docs/slack_sdk/audit_logs/v1/async_client.html @@ -130,7 +130,7 @@

Module slack_sdk.audit_logs.v1.async_client

async def schemas( self, *, - query_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """Returns information about the kind of objects which the Audit Logs API @@ -152,7 +152,7 @@

Module slack_sdk.audit_logs.v1.async_client

async def actions( self, *, - query_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """Returns information about the kind of actions that the Audit Logs API @@ -181,7 +181,7 @@

Module slack_sdk.audit_logs.v1.async_client

action: Optional[str] = None, actor: Optional[str] = None, entity: Optional[str] = None, - additional_query_params: Optional[Dict[str, any]] = None, + additional_query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """This is the primary endpoint for retrieving actual audit events from your organization. @@ -229,8 +229,8 @@

Module slack_sdk.audit_logs.v1.async_client

*, http_verb: str = "GET", path: str, - query_params: Optional[Dict[str, any]] = None, - body_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, + body_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: url = f"{self.base_url}{path}" @@ -516,7 +516,7 @@

Args

async def schemas( self, *, - query_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """Returns information about the kind of objects which the Audit Logs API @@ -538,7 +538,7 @@

Args

async def actions( self, *, - query_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """Returns information about the kind of actions that the Audit Logs API @@ -567,7 +567,7 @@

Args

action: Optional[str] = None, actor: Optional[str] = None, entity: Optional[str] = None, - additional_query_params: Optional[Dict[str, any]] = None, + additional_query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """This is the primary endpoint for retrieving actual audit events from your organization. @@ -615,8 +615,8 @@

Args

*, http_verb: str = "GET", path: str, - query_params: Optional[Dict[str, any]] = None, - body_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, + body_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: url = f"{self.base_url}{path}" @@ -832,7 +832,7 @@

Class variables

Methods

-async def actions(self, *, query_params: Optional[Dict[str, ]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse +async def actions(self, *, query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse

Returns information about the kind of actions that the Audit Logs API @@ -854,7 +854,7 @@

Returns

async def actions(
     self,
     *,
-    query_params: Optional[Dict[str, any]] = None,
+    query_params: Optional[Dict[str, Any]] = None,
     headers: Optional[Dict[str, str]] = None,
 ) -> AuditLogsResponse:
     """Returns information about the kind of actions that the Audit Logs API
@@ -876,7 +876,7 @@ 

Returns

-async def api_call(self, *, http_verb: str = 'GET', path: str, query_params: Optional[Dict[str, ]] = None, body_params: Optional[Dict[str, ]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse +async def api_call(self, *, http_verb: str = 'GET', path: str, query_params: Optional[Dict[str, Any]] = None, body_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse
@@ -889,8 +889,8 @@

Returns

*, http_verb: str = "GET", path: str, - query_params: Optional[Dict[str, any]] = None, - body_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, + body_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: url = f"{self.base_url}{path}" @@ -908,7 +908,7 @@

Returns

-async def logs(self, *, latest: Optional[int] = None, oldest: Optional[int] = None, limit: Optional[int] = None, action: Optional[str] = None, actor: Optional[str] = None, entity: Optional[str] = None, additional_query_params: Optional[Dict[str, ]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse +async def logs(self, *, latest: Optional[int] = None, oldest: Optional[int] = None, limit: Optional[int] = None, action: Optional[str] = None, actor: Optional[str] = None, entity: Optional[str] = None, additional_query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse

This is the primary endpoint for retrieving actual audit events from your organization. @@ -953,7 +953,7 @@

Returns

action: Optional[str] = None, actor: Optional[str] = None, entity: Optional[str] = None, - additional_query_params: Optional[Dict[str, any]] = None, + additional_query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """This is the primary endpoint for retrieving actual audit events from your organization. @@ -998,7 +998,7 @@

Returns

-async def schemas(self, *, query_params: Optional[Dict[str, ]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse +async def schemas(self, *, query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse

Returns information about the kind of objects which the Audit Logs API @@ -1020,7 +1020,7 @@

Returns

async def schemas(
     self,
     *,
-    query_params: Optional[Dict[str, any]] = None,
+    query_params: Optional[Dict[str, Any]] = None,
     headers: Optional[Dict[str, str]] = None,
 ) -> AuditLogsResponse:
     """Returns information about the kind of objects which the Audit Logs API
diff --git a/docs/api-docs/slack_sdk/audit_logs/v1/client.html b/docs/api-docs/slack_sdk/audit_logs/v1/client.html
index ae6f88060..ae5a6f5ed 100644
--- a/docs/api-docs/slack_sdk/audit_logs/v1/client.html
+++ b/docs/api-docs/slack_sdk/audit_logs/v1/client.html
@@ -37,7 +37,7 @@ 

Module slack_sdk.audit_logs.v1.client

import urllib from http.client import HTTPResponse from ssl import SSLContext -from typing import Dict, Optional, List +from typing import Dict, Optional, List, Any from urllib.error import HTTPError from urllib.request import Request, urlopen, OpenerDirector, ProxyHandler, HTTPSHandler @@ -119,7 +119,7 @@

Module slack_sdk.audit_logs.v1.client

def schemas( self, *, - query_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """Returns information about the kind of objects which the Audit Logs API @@ -141,7 +141,7 @@

Module slack_sdk.audit_logs.v1.client

def actions( self, *, - query_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """Returns information about the kind of actions that the Audit Logs API @@ -170,7 +170,7 @@

Module slack_sdk.audit_logs.v1.client

action: Optional[str] = None, actor: Optional[str] = None, entity: Optional[str] = None, - additional_query_params: Optional[Dict[str, any]] = None, + additional_query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """This is the primary endpoint for retrieving actual audit events from your organization. @@ -218,8 +218,8 @@

Module slack_sdk.audit_logs.v1.client

*, http_verb: str = "GET", path: str, - query_params: Optional[Dict[str, any]] = None, - body_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, + body_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """Performs a Slack API request and returns the result.""" @@ -244,7 +244,7 @@

Module slack_sdk.audit_logs.v1.client

*, http_verb: str = "GET", url: str, - body: Optional[Dict[str, any]] = None, + body: Optional[Dict[str, Any]] = None, headers: Dict[str, str], ) -> AuditLogsResponse: if body is not None: @@ -291,11 +291,20 @@

Module slack_sdk.audit_logs.v1.client

url=url, status_code=e.code, raw_body=response_body, - headers=e.headers, + headers=dict(e.headers.items()), ) if e.code == 429: # for backward-compatibility with WebClient (v.2.5.0 or older) - resp.headers["Retry-After"] = resp.headers["retry-after"] + if ( + "retry-after" not in resp.headers + and "Retry-After" in resp.headers + ): + resp.headers["retry-after"] = resp.headers["Retry-After"] + if ( + "Retry-After" not in resp.headers + and "retry-after" in resp.headers + ): + resp.headers["Retry-After"] = resp.headers["retry-after"] _debug_log_response(self.logger, resp) # Try to find a retry handler for this error @@ -386,20 +395,20 @@

Module slack_sdk.audit_logs.v1.client

raise SlackRequestError(f"Invalid URL detected: {url}") # NOTE: BAN-B310 is already checked above - resp: Optional[HTTPResponse] = None + http_resp: Optional[HTTPResponse] = None if opener: - resp = opener.open(req, timeout=self.timeout) # skipcq: BAN-B310 + http_resp = opener.open(req, timeout=self.timeout) # skipcq: BAN-B310 else: - resp = urlopen( # skipcq: BAN-B310 + http_resp = urlopen( # skipcq: BAN-B310 req, context=self.ssl, timeout=self.timeout ) - charset: str = resp.headers.get_content_charset() or "utf-8" - response_body: str = resp.read().decode(charset) + charset: str = http_resp.headers.get_content_charset() or "utf-8" + response_body: str = http_resp.read().decode(charset) resp = AuditLogsResponse( url=url, - status_code=resp.status, + status_code=http_resp.status, raw_body=response_body, - headers=resp.headers, + headers=http_resp.headers, ) _debug_log_response(self.logger, resp) return resp
@@ -510,7 +519,7 @@

Args

def schemas( self, *, - query_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """Returns information about the kind of objects which the Audit Logs API @@ -532,7 +541,7 @@

Args

def actions( self, *, - query_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """Returns information about the kind of actions that the Audit Logs API @@ -561,7 +570,7 @@

Args

action: Optional[str] = None, actor: Optional[str] = None, entity: Optional[str] = None, - additional_query_params: Optional[Dict[str, any]] = None, + additional_query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """This is the primary endpoint for retrieving actual audit events from your organization. @@ -609,8 +618,8 @@

Args

*, http_verb: str = "GET", path: str, - query_params: Optional[Dict[str, any]] = None, - body_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, + body_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """Performs a Slack API request and returns the result.""" @@ -635,7 +644,7 @@

Args

*, http_verb: str = "GET", url: str, - body: Optional[Dict[str, any]] = None, + body: Optional[Dict[str, Any]] = None, headers: Dict[str, str], ) -> AuditLogsResponse: if body is not None: @@ -682,11 +691,20 @@

Args

url=url, status_code=e.code, raw_body=response_body, - headers=e.headers, + headers=dict(e.headers.items()), ) if e.code == 429: # for backward-compatibility with WebClient (v.2.5.0 or older) - resp.headers["Retry-After"] = resp.headers["retry-after"] + if ( + "retry-after" not in resp.headers + and "Retry-After" in resp.headers + ): + resp.headers["retry-after"] = resp.headers["Retry-After"] + if ( + "Retry-After" not in resp.headers + and "retry-after" in resp.headers + ): + resp.headers["Retry-After"] = resp.headers["retry-after"] _debug_log_response(self.logger, resp) # Try to find a retry handler for this error @@ -777,20 +795,20 @@

Args

raise SlackRequestError(f"Invalid URL detected: {url}") # NOTE: BAN-B310 is already checked above - resp: Optional[HTTPResponse] = None + http_resp: Optional[HTTPResponse] = None if opener: - resp = opener.open(req, timeout=self.timeout) # skipcq: BAN-B310 + http_resp = opener.open(req, timeout=self.timeout) # skipcq: BAN-B310 else: - resp = urlopen( # skipcq: BAN-B310 + http_resp = urlopen( # skipcq: BAN-B310 req, context=self.ssl, timeout=self.timeout ) - charset: str = resp.headers.get_content_charset() or "utf-8" - response_body: str = resp.read().decode(charset) + charset: str = http_resp.headers.get_content_charset() or "utf-8" + response_body: str = http_resp.read().decode(charset) resp = AuditLogsResponse( url=url, - status_code=resp.status, + status_code=http_resp.status, raw_body=response_body, - headers=resp.headers, + headers=http_resp.headers, ) _debug_log_response(self.logger, resp) return resp
@@ -837,7 +855,7 @@

Class variables

Methods

-def actions(self, *, query_params: Optional[Dict[str, ]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse +def actions(self, *, query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse

Returns information about the kind of actions that the Audit Logs API @@ -859,7 +877,7 @@

Returns

def actions(
     self,
     *,
-    query_params: Optional[Dict[str, any]] = None,
+    query_params: Optional[Dict[str, Any]] = None,
     headers: Optional[Dict[str, str]] = None,
 ) -> AuditLogsResponse:
     """Returns information about the kind of actions that the Audit Logs API
@@ -881,7 +899,7 @@ 

Returns

-def api_call(self, *, http_verb: str = 'GET', path: str, query_params: Optional[Dict[str, ]] = None, body_params: Optional[Dict[str, ]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse +def api_call(self, *, http_verb: str = 'GET', path: str, query_params: Optional[Dict[str, Any]] = None, body_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse

Performs a Slack API request and returns the result.

@@ -894,8 +912,8 @@

Returns

*, http_verb: str = "GET", path: str, - query_params: Optional[Dict[str, any]] = None, - body_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, + body_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """Performs a Slack API request and returns the result.""" @@ -917,7 +935,7 @@

Returns

-def logs(self, *, latest: Optional[int] = None, oldest: Optional[int] = None, limit: Optional[int] = None, action: Optional[str] = None, actor: Optional[str] = None, entity: Optional[str] = None, additional_query_params: Optional[Dict[str, ]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse +def logs(self, *, latest: Optional[int] = None, oldest: Optional[int] = None, limit: Optional[int] = None, action: Optional[str] = None, actor: Optional[str] = None, entity: Optional[str] = None, additional_query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse

This is the primary endpoint for retrieving actual audit events from your organization. @@ -962,7 +980,7 @@

Returns

action: Optional[str] = None, actor: Optional[str] = None, entity: Optional[str] = None, - additional_query_params: Optional[Dict[str, any]] = None, + additional_query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> AuditLogsResponse: """This is the primary endpoint for retrieving actual audit events from your organization. @@ -1007,7 +1025,7 @@

Returns

-def schemas(self, *, query_params: Optional[Dict[str, ]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse +def schemas(self, *, query_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None) ‑> AuditLogsResponse

Returns information about the kind of objects which the Audit Logs API @@ -1029,7 +1047,7 @@

Returns

def schemas(
     self,
     *,
-    query_params: Optional[Dict[str, any]] = None,
+    query_params: Optional[Dict[str, Any]] = None,
     headers: Optional[Dict[str, str]] = None,
 ) -> AuditLogsResponse:
     """Returns information about the kind of objects which the Audit Logs API
diff --git a/docs/api-docs/slack_sdk/audit_logs/v1/logs.html b/docs/api-docs/slack_sdk/audit_logs/v1/logs.html
index 28e49fd1a..df5b8f0bb 100644
--- a/docs/api-docs/slack_sdk/audit_logs/v1/logs.html
+++ b/docs/api-docs/slack_sdk/audit_logs/v1/logs.html
@@ -130,6 +130,22 @@ 

Module slack_sdk.audit_logs.v1.logs

self.unknown_fields = kwargs +class ConversationPref: + type: Optional[List[str]] + user: Optional[List[str]] + + def __init__( + self, + *, + type: Optional[List[str]] = None, + user: Optional[List[str]] = None, + **kwargs, + ) -> None: + self.type = type + self.user = user + self.unknown_fields = kwargs + + class Details: name: Optional[str] new_value: Optional[Union[str, List[str], Dict[str, Any]]] @@ -187,6 +203,8 @@

Module slack_sdk.audit_logs.v1.logs

is_token_rotation_enabled_app: Optional[bool] old_retention_policy: Optional[RetentionPolicy] new_retention_policy: Optional[RetentionPolicy] + who_can_post: Optional[ConversationPref] + can_thread: Optional[ConversationPref] def __init__( self, @@ -246,6 +264,8 @@

Module slack_sdk.audit_logs.v1.logs

is_token_rotation_enabled_app: Optional[bool] = None, old_retention_policy: Optional[Union[Dict[str, Any], RetentionPolicy]] = None, new_retention_policy: Optional[Union[Dict[str, Any], RetentionPolicy]] = None, + who_can_post: Optional[Union[Dict[str, List[str]], ConversationPref]] = None, + can_thread: Optional[Union[Dict[str, List[str]], ConversationPref]] = None, **kwargs, ) -> None: self.name = name @@ -312,6 +332,16 @@

Module slack_sdk.audit_logs.v1.logs

if isinstance(new_retention_policy, RetentionPolicy) else RetentionPolicy(**new_retention_policy) ) + self.who_can_post = ( + who_can_post + if isinstance(who_can_post, ConversationPref) + else ConversationPref(**who_can_post) + ) + self.can_thread = ( + can_thread + if isinstance(can_thread, ConversationPref) + else ConversationPref(**can_thread) + ) class App: @@ -839,9 +869,46 @@

Class variables

+
+class ConversationPref +(*, type: Optional[List[str]] = None, user: Optional[List[str]] = None, **kwargs) +
+
+
+
+ +Expand source code + +
class ConversationPref:
+    type: Optional[List[str]]
+    user: Optional[List[str]]
+
+    def __init__(
+        self,
+        *,
+        type: Optional[List[str]] = None,
+        user: Optional[List[str]] = None,
+        **kwargs,
+    ) -> None:
+        self.type = type
+        self.user = user
+        self.unknown_fields = kwargs
+
+

Class variables

+
+
var type : Optional[List[str]]
+
+
+
+
var user : Optional[List[str]]
+
+
+
+
+
class Details -(*, name: Optional[str] = None, new_value: Union[str, List[str], Dict[str, Any], ForwardRef(None)] = None, previous_value: Union[str, List[str], Dict[str, Any], ForwardRef(None)] = None, expires_on: Optional[int] = None, mobile_only: Optional[bool] = None, web_only: Optional[bool] = None, non_sso_only: Optional[bool] = None, type: Optional[str] = None, is_workflow: Optional[bool] = None, inviter: Union[Dict[str, Any], User, ForwardRef(None)] = None, kicker: Union[Dict[str, Any], User, ForwardRef(None)] = None, shared_to: Optional[str] = None, reason: Optional[str] = None, origin_team: Optional[str] = None, target_team: Optional[str] = None, is_internal_integration: Optional[bool] = None, cleared_resolution: Optional[str] = None, app_owner_id: Optional[str] = None, bot_scopes: Optional[List[str]] = None, new_scopes: Optional[List[str]] = None, previous_scopes: Optional[List[str]] = None, granular_bot_token: Optional[bool] = None, scopes: Optional[List[str]] = None, resolution: Optional[str] = None, app_previously_resolved: Optional[bool] = None, admin_app_id: Optional[str] = None, bot_id: Optional[str] = None, installer_user_id: Optional[str] = None, approver_id: Optional[str] = None, approval_type: Optional[str] = None, app_previously_approved: Optional[bool] = None, old_scopes: Optional[List[str]] = None, channels: Optional[List[str]] = None, permissions: Optional[List[Dict[str, Any]]] = None, new_version_id: Optional[str] = None, trigger: Optional[str] = None, export_type: Optional[str] = None, export_start_ts: Optional[str] = None, export_end_ts: Optional[str] = None, barrier_id: Optional[str] = None, primary_usergroup_id: Optional[str] = None, barriered_from_usergroup_ids: Optional[List[str]] = None, restricted_subjects: Optional[List[str]] = None, duration: Optional[int] = None, desktop_app_browser_quit: Optional[bool] = None, invite_id: Optional[str] = None, external_organization_id: Optional[str] = None, external_organization_name: Optional[str] = None, external_user_id: Optional[str] = None, external_user_email: Optional[str] = None, channel_id: Optional[str] = None, added_team_id: Optional[str] = None, is_token_rotation_enabled_app: Optional[bool] = None, old_retention_policy: Union[Dict[str, Any], RetentionPolicy, ForwardRef(None)] = None, new_retention_policy: Union[Dict[str, Any], RetentionPolicy, ForwardRef(None)] = None, **kwargs) +(*, name: Optional[str] = None, new_value: Union[str, List[str], Dict[str, Any], ForwardRef(None)] = None, previous_value: Union[str, List[str], Dict[str, Any], ForwardRef(None)] = None, expires_on: Optional[int] = None, mobile_only: Optional[bool] = None, web_only: Optional[bool] = None, non_sso_only: Optional[bool] = None, type: Optional[str] = None, is_workflow: Optional[bool] = None, inviter: Union[Dict[str, Any], User, ForwardRef(None)] = None, kicker: Union[Dict[str, Any], User, ForwardRef(None)] = None, shared_to: Optional[str] = None, reason: Optional[str] = None, origin_team: Optional[str] = None, target_team: Optional[str] = None, is_internal_integration: Optional[bool] = None, cleared_resolution: Optional[str] = None, app_owner_id: Optional[str] = None, bot_scopes: Optional[List[str]] = None, new_scopes: Optional[List[str]] = None, previous_scopes: Optional[List[str]] = None, granular_bot_token: Optional[bool] = None, scopes: Optional[List[str]] = None, resolution: Optional[str] = None, app_previously_resolved: Optional[bool] = None, admin_app_id: Optional[str] = None, bot_id: Optional[str] = None, installer_user_id: Optional[str] = None, approver_id: Optional[str] = None, approval_type: Optional[str] = None, app_previously_approved: Optional[bool] = None, old_scopes: Optional[List[str]] = None, channels: Optional[List[str]] = None, permissions: Optional[List[Dict[str, Any]]] = None, new_version_id: Optional[str] = None, trigger: Optional[str] = None, export_type: Optional[str] = None, export_start_ts: Optional[str] = None, export_end_ts: Optional[str] = None, barrier_id: Optional[str] = None, primary_usergroup_id: Optional[str] = None, barriered_from_usergroup_ids: Optional[List[str]] = None, restricted_subjects: Optional[List[str]] = None, duration: Optional[int] = None, desktop_app_browser_quit: Optional[bool] = None, invite_id: Optional[str] = None, external_organization_id: Optional[str] = None, external_organization_name: Optional[str] = None, external_user_id: Optional[str] = None, external_user_email: Optional[str] = None, channel_id: Optional[str] = None, added_team_id: Optional[str] = None, is_token_rotation_enabled_app: Optional[bool] = None, old_retention_policy: Union[Dict[str, Any], RetentionPolicy, ForwardRef(None)] = None, new_retention_policy: Union[Dict[str, Any], RetentionPolicy, ForwardRef(None)] = None, who_can_post: Union[Dict[str, List[str]], ConversationPref, ForwardRef(None)] = None, can_thread: Union[Dict[str, List[str]], ConversationPref, ForwardRef(None)] = None, **kwargs)
@@ -906,6 +973,8 @@

Class variables

is_token_rotation_enabled_app: Optional[bool] old_retention_policy: Optional[RetentionPolicy] new_retention_policy: Optional[RetentionPolicy] + who_can_post: Optional[ConversationPref] + can_thread: Optional[ConversationPref] def __init__( self, @@ -965,6 +1034,8 @@

Class variables

is_token_rotation_enabled_app: Optional[bool] = None, old_retention_policy: Optional[Union[Dict[str, Any], RetentionPolicy]] = None, new_retention_policy: Optional[Union[Dict[str, Any], RetentionPolicy]] = None, + who_can_post: Optional[Union[Dict[str, List[str]], ConversationPref]] = None, + can_thread: Optional[Union[Dict[str, List[str]], ConversationPref]] = None, **kwargs, ) -> None: self.name = name @@ -1030,6 +1101,16 @@

Class variables

new_retention_policy if isinstance(new_retention_policy, RetentionPolicy) else RetentionPolicy(**new_retention_policy) + ) + self.who_can_post = ( + who_can_post + if isinstance(who_can_post, ConversationPref) + else ConversationPref(**who_can_post) + ) + self.can_thread = ( + can_thread + if isinstance(can_thread, ConversationPref) + else ConversationPref(**can_thread) )

Class variables

@@ -1078,6 +1159,10 @@

Class variables

+
var can_thread : Optional[ConversationPref]
+
+
+
var channel_id : Optional[str]
@@ -1258,6 +1343,10 @@

Class variables

+
var who_can_post : Optional[ConversationPref]
+
+
+
@@ -1964,6 +2053,13 @@

ConversationPref

+ + +
  • Details

  • diff --git a/docs/api-docs/slack_sdk/audit_logs/v1/response.html b/docs/api-docs/slack_sdk/audit_logs/v1/response.html index 0ba82c6b6..7a07671d1 100644 --- a/docs/api-docs/slack_sdk/audit_logs/v1/response.html +++ b/docs/api-docs/slack_sdk/audit_logs/v1/response.html @@ -27,7 +27,7 @@

    Module slack_sdk.audit_logs.v1.response

    Expand source code
    import json
    -from typing import Dict, Any
    +from typing import Dict, Any, Optional
     
     from slack_sdk.audit_logs.v1.logs import LogsResponse
     
    @@ -36,12 +36,14 @@ 

    Module slack_sdk.audit_logs.v1.response

    url: str status_code: int headers: Dict[str, Any] - raw_body: str - body: Dict[str, Any] - typed_body: LogsResponse + raw_body: Optional[str] + body: Optional[Dict[str, Any]] + typed_body: Optional[LogsResponse] @property - def typed_body(self) -> LogsResponse: + def typed_body(self) -> Optional[LogsResponse]: # type: ignore + if self.body is None: + return None return LogsResponse(**self.body) def __init__( @@ -49,7 +51,7 @@

    Module slack_sdk.audit_logs.v1.response

    *, url: str, status_code: int, - raw_body: str, + raw_body: Optional[str], headers: dict, ): self.url = url @@ -74,7 +76,7 @@

    Classes

    class AuditLogsResponse -(*, url: str, status_code: int, raw_body: str, headers: dict) +(*, url: str, status_code: int, raw_body: Optional[str], headers: dict)
    @@ -86,12 +88,14 @@

    Classes

    url: str status_code: int headers: Dict[str, Any] - raw_body: str - body: Dict[str, Any] - typed_body: LogsResponse + raw_body: Optional[str] + body: Optional[Dict[str, Any]] + typed_body: Optional[LogsResponse] @property - def typed_body(self) -> LogsResponse: + def typed_body(self) -> Optional[LogsResponse]: # type: ignore + if self.body is None: + return None return LogsResponse(**self.body) def __init__( @@ -99,7 +103,7 @@

    Classes

    *, url: str, status_code: int, - raw_body: str, + raw_body: Optional[str], headers: dict, ): self.url = url @@ -114,7 +118,7 @@

    Classes

    Class variables

    -
    var body : Dict[str, Any]
    +
    var body : Optional[Dict[str, Any]]
    @@ -122,7 +126,7 @@

    Class variables

    -
    var raw_body : str
    +
    var raw_body : Optional[str]
    @@ -137,7 +141,7 @@

    Class variables

    Instance variables

    -
    var typed_bodyLogsResponse
    +
    var typed_body : Optional[LogsResponse]
    @@ -145,7 +149,9 @@

    Instance variables

    Expand source code
    @property
    -def typed_body(self) -> LogsResponse:
    +def typed_body(self) -> Optional[LogsResponse]:  # type: ignore
    +    if self.body is None:
    +        return None
         return LogsResponse(**self.body)
    diff --git a/docs/api-docs/slack_sdk/http_retry/builtin_async_handlers.html b/docs/api-docs/slack_sdk/http_retry/builtin_async_handlers.html index 4c179133f..05f986b2f 100644 --- a/docs/api-docs/slack_sdk/http_retry/builtin_async_handlers.html +++ b/docs/api-docs/slack_sdk/http_retry/builtin_async_handlers.html @@ -28,7 +28,7 @@

    Module slack_sdk.http_retry.builtin_async_handlers
    import asyncio
     import random
    -from typing import Optional, List
    +from typing import Optional, List, Type
     
     from aiohttp import ServerDisconnectedError, ServerConnectionError, ClientOSError
     
    @@ -47,7 +47,7 @@ 

    Module slack_sdk.http_retry.builtin_async_handlersModule slack_sdk.http_retry.builtin_async_handlersClasses

    class AsyncConnectionErrorRetryHandler -(max_retry_count: int = 1, interval_calculator: RetryIntervalCalculator = <slack_sdk.http_retry.builtin_interval_calculators.BackoffRetryIntervalCalculator object>, error_types: List[Exception] = [<class 'aiohttp.client_exceptions.ServerConnectionError'>, <class 'aiohttp.client_exceptions.ServerDisconnectedError'>, <class 'aiohttp.client_exceptions.ClientOSError'>]) +(max_retry_count: int = 1, interval_calculator: RetryIntervalCalculator = <slack_sdk.http_retry.builtin_interval_calculators.BackoffRetryIntervalCalculator object>, error_types: List[Type[Exception]] = [<class 'aiohttp.client_exceptions.ServerConnectionError'>, <class 'aiohttp.client_exceptions.ServerDisconnectedError'>, <class 'aiohttp.client_exceptions.ClientOSError'>])

    RetryHandler that does retries for connectivity issues.

    @@ -170,7 +170,7 @@

    Args

    self, max_retry_count: int = 1, interval_calculator: RetryIntervalCalculator = default_interval_calculator, - error_types: List[Exception] = [ + error_types: List[Type[Exception]] = [ ServerConnectionError, ServerDisconnectedError, # ClientOSError: [Errno 104] Connection reset by peer @@ -241,7 +241,7 @@

    Args

    response: Optional[HttpResponse], error: Optional[Exception], ) -> bool: - return response.status_code == 429 + return response is not None and response.status_code == 429 async def prepare_for_next_attempt_async( self, diff --git a/docs/api-docs/slack_sdk/http_retry/builtin_handlers.html b/docs/api-docs/slack_sdk/http_retry/builtin_handlers.html index c5f4a3a82..b51902504 100644 --- a/docs/api-docs/slack_sdk/http_retry/builtin_handlers.html +++ b/docs/api-docs/slack_sdk/http_retry/builtin_handlers.html @@ -29,7 +29,7 @@

    Module slack_sdk.http_retry.builtin_handlers

    import random
     import time
     from http.client import RemoteDisconnected
    -from typing import Optional, List
    +from typing import Optional, List, Type
     from urllib.error import URLError
     
     from slack_sdk.http_retry.interval_calculator import RetryIntervalCalculator
    @@ -46,7 +46,7 @@ 

    Module slack_sdk.http_retry.builtin_handlers

    self, max_retry_count: int = 1, interval_calculator: RetryIntervalCalculator = default_interval_calculator, - error_types: List[Exception] = [ + error_types: List[Type[Exception]] = [ # To cover URLError: <urlopen error [Errno 104] Connection reset by peer> URLError, ConnectionResetError, @@ -130,7 +130,7 @@

    Classes

    class ConnectionErrorRetryHandler -(max_retry_count: int = 1, interval_calculator: RetryIntervalCalculator = <slack_sdk.http_retry.builtin_interval_calculators.BackoffRetryIntervalCalculator object>, error_types: List[Exception] = [<class 'urllib.error.URLError'>, <class 'ConnectionResetError'>, <class 'http.client.RemoteDisconnected'>]) +(max_retry_count: int = 1, interval_calculator: RetryIntervalCalculator = <slack_sdk.http_retry.builtin_interval_calculators.BackoffRetryIntervalCalculator object>, error_types: List[Type[Exception]] = [<class 'urllib.error.URLError'>, <class 'ConnectionResetError'>, <class 'http.client.RemoteDisconnected'>])

    RetryHandler that does retries for connectivity issues.

    @@ -153,7 +153,7 @@

    Args

    self, max_retry_count: int = 1, interval_calculator: RetryIntervalCalculator = default_interval_calculator, - error_types: List[Exception] = [ + error_types: List[Type[Exception]] = [ # To cover URLError: <urlopen error [Errno 104] Connection reset by peer> URLError, ConnectionResetError, diff --git a/docs/api-docs/slack_sdk/models/attachments/index.html b/docs/api-docs/slack_sdk/models/attachments/index.html index bfea3725b..dff362783 100644 --- a/docs/api-docs/slack_sdk/models/attachments/index.html +++ b/docs/api-docs/slack_sdk/models/attachments/index.html @@ -312,8 +312,7 @@

    Module slack_sdk.models.attachments

    "ts", } - fields: List[AttachmentField] - actions: List[Action] + fields: Sequence[AttachmentField] MarkdownFields = {"fields", "pretext", "text"} @@ -416,11 +415,11 @@

    Module slack_sdk.models.attachments

    self.markdown_in = markdown_in or [] @JsonValidator(f"footer attribute cannot exceed {footer_max_length} characters") - def footer_length(self): + def footer_length(self) -> bool: return self.footer is None or len(self.footer) <= self.footer_max_length @JsonValidator("ts attribute cannot be present if footer attribute is absent") - def ts_without_footer(self): + def ts_without_footer(self) -> bool: return self.ts is None or self.footer is not None @EnumValidator("markdown_in", MarkdownFields) @@ -432,23 +431,23 @@

    Module slack_sdk.models.attachments

    @JsonValidator( "color attribute must be 'good', 'warning', 'danger', or a hex color code" ) - def color_valid(self): + def color_valid(self) -> bool: return ( self.color is None or self.color in SeededColors - or re.match("^#(?:[0-9A-F]{2}){3}$", self.color, re.IGNORECASE) + or re.match("^#(?:[0-9A-F]{2}){3}$", self.color, re.IGNORECASE) is not None ) @JsonValidator("image_url attribute cannot be present if thumb_url is populated") - def image_url_and_thumb_url_populated(self): + def image_url_and_thumb_url_populated(self) -> bool: return self.image_url is None or self.thumb_url is None @JsonValidator("name must be present if link is present") - def author_link_without_author_name(self): + def author_link_without_author_name(self) -> bool: return self.author_link is None or self.author_name is not None @JsonValidator("icon must be present if link is present") - def author_link_without_author_icon(self): + def author_link_without_author_icon(self) -> bool: return self.author_link is None or self.author_icon is not None def to_dict(self) -> dict: # skipcq: PYL-W0221 @@ -491,7 +490,7 @@

    Module slack_sdk.models.attachments

    self.blocks = list(blocks) @JsonValidator("fields attribute cannot be populated on BlockAttachment") - def fields_attribute_absent(self): + def fields_attribute_absent(self) -> bool: return not self.fields def to_dict(self) -> dict: @@ -616,7 +615,7 @@

    Module slack_sdk.models.attachments

    self.actions = actions or [] @JsonValidator(f"actions attribute cannot exceed {actions_max_length} elements") - def actions_length(self): + def actions_length(self) -> bool: return len(self.actions) <= self.actions_max_length def to_dict(self) -> dict: @@ -1488,8 +1487,7 @@

    Args

    "ts", } - fields: List[AttachmentField] - actions: List[Action] + fields: Sequence[AttachmentField] MarkdownFields = {"fields", "pretext", "text"} @@ -1592,11 +1590,11 @@

    Args

    self.markdown_in = markdown_in or [] @JsonValidator(f"footer attribute cannot exceed {footer_max_length} characters") - def footer_length(self): + def footer_length(self) -> bool: return self.footer is None or len(self.footer) <= self.footer_max_length @JsonValidator("ts attribute cannot be present if footer attribute is absent") - def ts_without_footer(self): + def ts_without_footer(self) -> bool: return self.ts is None or self.footer is not None @EnumValidator("markdown_in", MarkdownFields) @@ -1608,23 +1606,23 @@

    Args

    @JsonValidator( "color attribute must be 'good', 'warning', 'danger', or a hex color code" ) - def color_valid(self): + def color_valid(self) -> bool: return ( self.color is None or self.color in SeededColors - or re.match("^#(?:[0-9A-F]{2}){3}$", self.color, re.IGNORECASE) + or re.match("^#(?:[0-9A-F]{2}){3}$", self.color, re.IGNORECASE) is not None ) @JsonValidator("image_url attribute cannot be present if thumb_url is populated") - def image_url_and_thumb_url_populated(self): + def image_url_and_thumb_url_populated(self) -> bool: return self.image_url is None or self.thumb_url is None @JsonValidator("name must be present if link is present") - def author_link_without_author_name(self): + def author_link_without_author_name(self) -> bool: return self.author_link is None or self.author_name is not None @JsonValidator("icon must be present if link is present") - def author_link_without_author_icon(self): + def author_link_without_author_icon(self) -> bool: return self.author_link is None or self.author_icon is not None def to_dict(self) -> dict: # skipcq: PYL-W0221 @@ -1651,11 +1649,7 @@

    Class variables

    -
    var actions : List[Action]
    -
    -
    -
    -
    var fields : List[AttachmentField]
    +
    var fields : Sequence[AttachmentField]
    @@ -1667,7 +1661,7 @@

    Class variables

    Methods

    @@ -1676,12 +1670,12 @@

    Methods

    Expand source code
    @JsonValidator("icon must be present if link is present")
    -def author_link_without_author_icon(self):
    +def author_link_without_author_icon(self) -> bool:
         return self.author_link is None or self.author_icon is not None
    @@ -1690,12 +1684,12 @@

    Methods

    Expand source code
    @JsonValidator("name must be present if link is present")
    -def author_link_without_author_name(self):
    +def author_link_without_author_name(self) -> bool:
         return self.author_link is None or self.author_name is not None
    -def color_valid(self) +def color_valid(self) ‑> bool
    @@ -1706,16 +1700,16 @@

    Methods

    @JsonValidator(
         "color attribute must be 'good', 'warning', 'danger', or a hex color code"
     )
    -def color_valid(self):
    +def color_valid(self) -> bool:
         return (
             self.color is None
             or self.color in SeededColors
    -        or re.match("^#(?:[0-9A-F]{2}){3}$", self.color, re.IGNORECASE)
    +        or re.match("^#(?:[0-9A-F]{2}){3}$", self.color, re.IGNORECASE) is not None
         )
    -def footer_length(self) +def footer_length(self) ‑> bool
    @@ -1724,12 +1718,12 @@

    Methods

    Expand source code
    @JsonValidator(f"footer attribute cannot exceed {footer_max_length} characters")
    -def footer_length(self):
    +def footer_length(self) -> bool:
         return self.footer is None or len(self.footer) <= self.footer_max_length
    -def image_url_and_thumb_url_populated(self) +def image_url_and_thumb_url_populated(self) ‑> bool
    @@ -1738,7 +1732,7 @@

    Methods

    Expand source code
    @JsonValidator("image_url attribute cannot be present if thumb_url is populated")
    -def image_url_and_thumb_url_populated(self):
    +def image_url_and_thumb_url_populated(self) -> bool:
         return self.image_url is None or self.thumb_url is None
    @@ -1759,7 +1753,7 @@

    Methods

    @@ -1768,7 +1762,7 @@

    Methods

    Expand source code
    @JsonValidator("ts attribute cannot be present if footer attribute is absent")
    -def ts_without_footer(self):
    +def ts_without_footer(self) -> bool:
         return self.ts is None or self.footer is not None
    @@ -1881,7 +1875,7 @@

    Args

    self.blocks = list(blocks) @JsonValidator("fields attribute cannot be populated on BlockAttachment") - def fields_attribute_absent(self): + def fields_attribute_absent(self) -> bool: return not self.fields def to_dict(self) -> dict: @@ -1923,7 +1917,7 @@

    Instance variables

    Methods

    -def fields_attribute_absent(self) +def fields_attribute_absent(self) ‑> bool
    @@ -1932,7 +1926,7 @@

    Methods

    Expand source code
    @JsonValidator("fields attribute cannot be populated on BlockAttachment")
    -def fields_attribute_absent(self):
    +def fields_attribute_absent(self) -> bool:
         return not self.fields
    @@ -2153,7 +2147,7 @@

    Args

    self.actions = actions or [] @JsonValidator(f"actions attribute cannot exceed {actions_max_length} elements") - def actions_length(self): + def actions_length(self) -> bool: return len(self.actions) <= self.actions_max_length def to_dict(self) -> dict: @@ -2169,15 +2163,11 @@

    Ancestors

    Class variables

    -
    var actions : List[Action]
    -
    -
    -
    var actions_max_length
    -
    var fields : List[AttachmentField]
    +
    var fields : Sequence[AttachmentField]
    @@ -2202,7 +2192,7 @@

    Instance variables

    Methods

    -def actions_length(self) +def actions_length(self) ‑> bool
    @@ -2211,7 +2201,7 @@

    Methods

    Expand source code
    @JsonValidator(f"actions attribute cannot exceed {actions_max_length} elements")
    -def actions_length(self):
    +def actions_length(self) -> bool:
         return len(self.actions) <= self.actions_max_length
    @@ -2298,7 +2288,6 @@

    Attachment

    • MarkdownFields
    • -
    • actions
    • author_link_without_author_icon
    • author_link_without_author_name
    • color_valid
    • @@ -2324,7 +2313,6 @@

      InteractiveAttachment

        -
      • actions
      • actions_length
      • actions_max_length
      • attributes
      • diff --git a/docs/api-docs/slack_sdk/models/basic_objects.html b/docs/api-docs/slack_sdk/models/basic_objects.html index c360bf471..5bf28bd85 100644 --- a/docs/api-docs/slack_sdk/models/basic_objects.html +++ b/docs/api-docs/slack_sdk/models/basic_objects.html @@ -115,6 +115,11 @@

        Module slack_sdk.models.basic_objects

        else: return self.__str__() + def __eq__(self, other: Any) -> bool: + if not isinstance(other, JsonObject): + return False + return self.to_dict() == other.to_dict() + class JsonValidator: def __init__(self, message: str): @@ -285,7 +290,12 @@

        Ancestors

        if dict_value: # skipcq: PYL-R1705 return f"<slack_sdk.{self.__class__.__name__}: {dict_value}>" else: - return self.__str__()
    + return self.__str__() + + def __eq__(self, other: Any) -> bool: + if not isinstance(other, JsonObject): + return False + return self.to_dict() == other.to_dict()

    Ancestors

      diff --git a/docs/api-docs/slack_sdk/models/blocks/basic_components.html b/docs/api-docs/slack_sdk/models/blocks/basic_components.html index 014073990..0cada43a9 100644 --- a/docs/api-docs/slack_sdk/models/blocks/basic_components.html +++ b/docs/api-docs/slack_sdk/models/blocks/basic_components.html @@ -114,6 +114,12 @@

      Module slack_sdk.models.blocks.basic_componentsModule slack_sdk.models.blocks.basic_componentsModule slack_sdk.models.blocks.basic_componentsModule slack_sdk.models.blocks.basic_componentsClasses

      class ConfirmObject -(*, title: Union[str, dict, PlainTextObject], text: Union[str, dict, TextObject], confirm: Union[str, dict, PlainTextObject] = 'Yes', deny: Union[str, dict, PlainTextObject] = 'No', style: str = None) +(*, title: Union[str, dict, PlainTextObject], text: Union[str, dict, TextObject], confirm: Union[str, dict, PlainTextObject] = 'Yes', deny: Union[str, dict, PlainTextObject] = 'No', style: Optional[str] = None)

      The base class for JSON serializable class objects

      @@ -606,7 +620,7 @@

      Classes

      text: Union[str, dict, TextObject], confirm: Union[str, dict, PlainTextObject] = "Yes", deny: Union[str, dict, PlainTextObject] = "No", - style: str = None, + style: Optional[str] = None, ): """ An object that defines a dialog that provides a confirmation step to any @@ -628,25 +642,25 @@

      Classes

      self.style = self._style @JsonValidator(f"title attribute cannot exceed {title_max_length} characters") - def title_length(self): + def title_length(self) -> bool: return self._title is None or len(self._title.text) <= self.title_max_length @JsonValidator(f"text attribute cannot exceed {text_max_length} characters") - def text_length(self): + def text_length(self) -> bool: return self._text is None or len(self._text.text) <= self.text_max_length @JsonValidator(f"confirm attribute cannot exceed {confirm_max_length} characters") - def confirm_length(self): + def confirm_length(self) -> bool: return ( self._confirm is None or len(self._confirm.text) <= self.confirm_max_length ) @JsonValidator(f"deny attribute cannot exceed {deny_max_length} characters") - def deny_length(self): + def deny_length(self) -> bool: return self._deny is None or len(self._deny.text) <= self.deny_max_length @JsonValidator('style for confirm must be either "primary" or "danger"') - def _validate_confirm_style(self): + def _validate_confirm_style(self) -> bool: return self._style is None or self._style in ["primary", "danger"] def to_dict(self, option_type: str = "block") -> dict: # skipcq: PYL-W0221 @@ -734,7 +748,7 @@

      Static methods

      Methods

      -def confirm_length(self) +def confirm_length(self) ‑> bool
      @@ -743,14 +757,14 @@

      Methods

      Expand source code
      @JsonValidator(f"confirm attribute cannot exceed {confirm_max_length} characters")
      -def confirm_length(self):
      +def confirm_length(self) -> bool:
           return (
               self._confirm is None or len(self._confirm.text) <= self.confirm_max_length
           )
      -def deny_length(self) +def deny_length(self) ‑> bool
      @@ -759,12 +773,12 @@

      Methods

      Expand source code
      @JsonValidator(f"deny attribute cannot exceed {deny_max_length} characters")
      -def deny_length(self):
      +def deny_length(self) -> bool:
           return self._deny is None or len(self._deny.text) <= self.deny_max_length
      -def text_length(self) +def text_length(self) ‑> bool
      @@ -773,12 +787,12 @@

      Methods

      Expand source code
      @JsonValidator(f"text attribute cannot exceed {text_max_length} characters")
      -def text_length(self):
      +def text_length(self) -> bool:
           return self._text is None or len(self._text.text) <= self.text_max_length
      -def title_length(self) +def title_length(self) ‑> bool
      @@ -787,7 +801,7 @@

      Methods

      Expand source code
      @JsonValidator(f"title attribute cannot exceed {title_max_length} characters")
      -def title_length(self):
      +def title_length(self) -> bool:
           return self._title is None or len(self._title.text) <= self.title_max_length
      @@ -899,7 +913,18 @@

      Inherited members

      mrkdwn typed text object

      A Markdown text object, meaning markdown characters will be parsed as formatting information. -https://api.slack.com/reference/block-kit/composition-objects#text

      +https://api.slack.com/reference/block-kit/composition-objects#text

      +

      Args

      +
      +
      text : required
      +
      The text for the block. This field accepts any of the standard text formatting markup +when type is mrkdwn.
      +
      verbatim
      +
      When set to false (as is default) URLs will be auto-converted into links, +conversation names will be link-ified, and certain mentions will be automatically parsed. +Using a value of true will skip any preprocessing of this nature, +although you can still include manual parsing strings. This field is only usable when type is mrkdwn.
      +
      Expand source code @@ -917,6 +942,14 @@

      Inherited members

      """A Markdown text object, meaning markdown characters will be parsed as formatting information. https://api.slack.com/reference/block-kit/composition-objects#text + + Args: + text (required): The text for the block. This field accepts any of the standard text formatting markup + when type is mrkdwn. + verbatim: When set to false (as is default) URLs will be auto-converted into links, + conversation names will be link-ified, and certain mentions will be automatically parsed. + Using a value of true will skip any preprocessing of this nature, + although you can still include manual parsing strings. This field is only usable when type is mrkdwn. """ super().__init__(text=text, type=self.type) self.verbatim = verbatim @@ -1557,7 +1590,16 @@

      Inherited members

      plain_text typed text object

      A plain text object, meaning markdown characters will not be parsed as formatting information. -https://api.slack.com/reference/block-kit/composition-objects#text

      +https://api.slack.com/reference/block-kit/composition-objects#text

      +

      Args

      +
      +
      text : required
      +
      The text for the block. This field accepts any of the standard text formatting markup +when type is mrkdwn.
      +
      emoji
      +
      Indicates whether emojis in a text field should be escaped into the colon emoji format. +This field is only usable when type is plain_text.
      +
      Expand source code @@ -1575,6 +1617,12 @@

      Inherited members

      """A plain text object, meaning markdown characters will not be parsed as formatting information. https://api.slack.com/reference/block-kit/composition-objects#text + + Args: + text (required): The text for the block. This field accepts any of the standard text formatting markup + when type is mrkdwn. + emoji: Indicates whether emojis in a text field should be escaped into the colon emoji format. + This field is only usable when type is plain_text. """ super().__init__(text=text, type=self.type) self.emoji = emoji diff --git a/docs/api-docs/slack_sdk/models/blocks/block_elements.html b/docs/api-docs/slack_sdk/models/blocks/block_elements.html index 67104ab5f..1f078937c 100644 --- a/docs/api-docs/slack_sdk/models/blocks/block_elements.html +++ b/docs/api-docs/slack_sdk/models/blocks/block_elements.html @@ -161,7 +161,7 @@

      Module slack_sdk.models.blocks.block_elements

      Module slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elementsModule slack_sdk.models.blocks.block_elements
      @@ -1443,7 +1756,36 @@

      Inherited members

      https://api.slack.com/reference/block-kit/block-elements

      An interactive element that inserts a button. The button can be a trigger for anything from opening a simple link to starting a complex workflow. -https://api.slack.com/reference/block-kit/block-elements#button

      +https://api.slack.com/reference/block-kit/block-elements#button

      +

      Args

      +
      +
      text : required
      +
      A text object that defines the button's text. +Can only be of type: plain_text. +Maximum length for the text in this field is 75 characters.
      +
      action_id : required
      +
      An identifier for this action. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
      +
      url
      +
      A URL to load in the user's browser when the button is clicked. +Maximum length for this field is 3000 characters. +If you're using url, you'll still receive an interaction payload +and will need to send an acknowledgement response.
      +
      value
      +
      The value to send along with the interaction payload. +Maximum length for this field is 2000 characters.
      +
      style
      +
      Decorates buttons with alternative visual color schemes. Use this option with restraint. +"primary" gives buttons a green outline and text, ideal for affirmation or confirmation actions. +"primary" should only be used for one button within a set. +"danger" gives buttons a red outline and text, and should be used when the action is destructive. +Use "danger" even more sparingly than "primary". +If you don't include this field, the default button style will be used.
      +
      confirm
      +
      A confirm object that defines an optional confirmation dialog after the button is clicked.
      +
      Expand source code @@ -1472,6 +1814,28 @@

      Inherited members

      """An interactive element that inserts a button. The button can be a trigger for anything from opening a simple link to starting a complex workflow. https://api.slack.com/reference/block-kit/block-elements#button + + Args: + text (required): A text object that defines the button's text. + Can only be of type: plain_text. + Maximum length for the text in this field is 75 characters. + action_id (required): An identifier for this action. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + url: A URL to load in the user's browser when the button is clicked. + Maximum length for this field is 3000 characters. + If you're using url, you'll still receive an interaction payload + and will need to send an acknowledgement response. + value: The value to send along with the interaction payload. + Maximum length for this field is 2000 characters. + style: Decorates buttons with alternative visual color schemes. Use this option with restraint. + "primary" gives buttons a green outline and text, ideal for affirmation or confirmation actions. + "primary" should only be used for one button within a set. + "danger" gives buttons a red outline and text, and should be used when the action is destructive. + Use "danger" even more sparingly than "primary". + If you don't include this field, the default button style will be used. + confirm: A confirm object that defines an optional confirmation dialog after the button is clicked. """ super().__init__(action_id=action_id, type=self.type) show_unknown_key_warning(self, others) @@ -1484,7 +1848,7 @@

      Inherited members

      self.confirm = ConfirmObject.parse(confirm) @JsonValidator(f"text attribute cannot exceed {text_max_length} characters") - def _validate_text_length(self): + def _validate_text_length(self) -> bool: return ( self.text is None or self.text.text is None @@ -1492,11 +1856,11 @@

      Inherited members

      ) @JsonValidator(f"url attribute cannot exceed {url_max_length} characters") - def _validate_url_length(self): + def _validate_url_length(self) -> bool: return self.url is None or len(self.url) <= self.url_max_length @JsonValidator(f"value attribute cannot exceed {value_max_length} characters") - def _validate_value_length(self): + def _validate_value_length(self) -> bool: return self.value is None or len(self.value) <= self.value_max_length @EnumValidator("style", ButtonStyles) @@ -1554,7 +1918,27 @@

      Inherited members

      https://api.slack.com/reference/block-kit/block-elements

      This multi-select menu will populate its options with a list of public channels visible to the current user in the active workspace. -https://api.slack.com/reference/block-kit/block-elements#channel_multi_select

      +https://api.slack.com/reference/block-kit/block-elements#channel_multi_select

      +

      Args

      +
      +
      placeholder : required
      +
      A plain_text only text object that defines the placeholder text shown on the menu. +Maximum length for the text in this field is 150 characters.
      +
      action_id : required
      +
      An identifier for the action triggered when a menu option is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
      +
      initial_channels
      +
      An array of one or more IDs of any valid public channel +to be pre-selected when the menu loads.
      +
      confirm
      +
      A confirm object that defines an optional confirmation dialog that appears +before the multi-select choices are submitted.
      +
      max_selected_items
      +
      Specifies the maximum number of items that can be selected in the menu. +Minimum number is 1.
      +
      Expand source code @@ -1580,6 +1964,20 @@

      Inherited members

      This multi-select menu will populate its options with a list of public channels visible to the current user in the active workspace. https://api.slack.com/reference/block-kit/block-elements#channel_multi_select + + Args: + placeholder (required): A plain_text only text object that defines the placeholder text shown on the menu. + Maximum length for the text in this field is 150 characters. + action_id (required): An identifier for the action triggered when a menu option is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + initial_channels: An array of one or more IDs of any valid public channel + to be pre-selected when the menu loads. + confirm: A confirm object that defines an optional confirmation dialog that appears + before the multi-select choices are submitted. + max_selected_items: Specifies the maximum number of items that can be selected in the menu. + Minimum number is 1. """ super().__init__( type=self.type, @@ -1632,7 +2030,28 @@

      Inherited members

      https://api.slack.com/reference/block-kit/block-elements

      This select menu will populate its options with a list of public channels visible to the current user in the active workspace. -https://api.slack.com/reference/block-kit/block-elements#channel_select

      +https://api.slack.com/reference/block-kit/block-elements#channel_select

      +

      Args

      +
      +
      placeholder : required
      +
      A plain_text only text object that defines the placeholder text shown on the menu. +Maximum length for the text in this field is 150 characters.
      +
      action_id : required
      +
      An identifier for the action triggered when a menu option is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
      +
      initial_channel
      +
      The ID of any valid public channel to be pre-selected when the menu loads.
      +
      confirm
      +
      A confirm object that defines an optional confirmation dialog that appears +after a menu item is selected.
      +
      response_url_enabled
      +
      This field only works with menus in input blocks in modals. +When set to true, the view_submission payload from the menu's parent view will contain a response_url. +This response_url can be used for message responses. +The target channel for the message will be determined by the value of this select menu
      +
      Expand source code @@ -1658,6 +2077,21 @@

      Inherited members

      This select menu will populate its options with a list of public channels visible to the current user in the active workspace. https://api.slack.com/reference/block-kit/block-elements#channel_select + + Args: + placeholder (required): A plain_text only text object that defines the placeholder text shown on the menu. + Maximum length for the text in this field is 150 characters. + action_id (required): An identifier for the action triggered when a menu option is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + initial_channel: The ID of any valid public channel to be pre-selected when the menu loads. + confirm: A confirm object that defines an optional confirmation dialog that appears + after a menu item is selected. + response_url_enabled: This field only works with menus in input blocks in modals. + When set to true, the view_submission payload from the menu's parent view will contain a response_url. + This response_url can be used for message responses. + The target channel for the message will be determined by the value of this select menu """ super().__init__( type=self.type, @@ -1703,13 +2137,29 @@

      Inherited members

      class CheckboxesElement -(*, action_id: Optional[str] = None, placeholder: Optional[str] = None, options: Optional[Sequence[Union[dict, Option]]] = None, initial_options: Optional[Sequence[Union[dict, Option]]] = None, confirm: Union[dict, ConfirmObject, ForwardRef(None)] = None, **others: dict) +(*, action_id: Optional[str] = None, options: Optional[Sequence[Union[dict, Option]]] = None, initial_options: Optional[Sequence[Union[dict, Option]]] = None, confirm: Union[dict, ConfirmObject, ForwardRef(None)] = None, **others: dict)

      Block Elements are things that exists inside of your Blocks. https://api.slack.com/reference/block-kit/block-elements

      A checkbox group that allows a user to choose multiple items from a list of possible options. -https://api.slack.com/reference/block-kit/block-elements#checkboxes

      +https://api.slack.com/reference/block-kit/block-elements#checkboxes

      +

      Args

      +
      +
      action_id : required
      +
      An identifier for the action triggered when the checkbox group is changed. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
      +
      options : required
      +
      An array of option objects. A maximum of 10 options are allowed.
      +
      initial_options
      +
      An array of option objects that exactly matches one or more of the options. +These options will be selected when the checkbox group initially loads.
      +
      confirm
      +
      A confirm object that defines an optional confirmation dialog that appears +after clicking one of the checkboxes in this element.
      +
      Expand source code @@ -1725,7 +2175,6 @@

      Inherited members

      self, *, action_id: Optional[str] = None, - placeholder: Optional[str] = None, options: Optional[Sequence[Union[dict, Option]]] = None, initial_options: Optional[Sequence[Union[dict, Option]]] = None, confirm: Optional[Union[dict, ConfirmObject]] = None, @@ -1733,11 +2182,21 @@

      Inherited members

      ): """A checkbox group that allows a user to choose multiple items from a list of possible options. https://api.slack.com/reference/block-kit/block-elements#checkboxes + + Args: + action_id (required): An identifier for the action triggered when the checkbox group is changed. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + options (required): An array of option objects. A maximum of 10 options are allowed. + initial_options: An array of option objects that exactly matches one or more of the options. + These options will be selected when the checkbox group initially loads. + confirm: A confirm object that defines an optional confirmation dialog that appears + after clicking one of the checkboxes in this element. """ super().__init__( type=self.type, action_id=action_id, - placeholder=TextObject.parse(placeholder, PlainTextObject.type), confirm=ConfirmObject.parse(confirm), ) show_unknown_key_warning(self, others) @@ -1781,7 +2240,23 @@

      Inherited members

      (*, include: Optional[Sequence[str]] = None, exclude_bot_users: Optional[bool] = None, exclude_external_shared_channels: Optional[bool] = None)
  • -

    The base class for JSON serializable class objects

    +

    The base class for JSON serializable class objects

    +

    Provides a way to filter the list of options in a conversations select menu +or conversations multi-select menu. +https://api.slack.com/reference/block-kit/composition-objects#filter_conversations

    +

    Args

    +
    +
    include
    +
    Indicates which type of conversations should be included in the list. +When this field is provided, any conversations that do not match will be excluded. +You should provide an array of strings from the following options: +"im", "mpim", "private", and "public". The array cannot be empty.
    +
    exclude_bot_users
    +
    Indicates whether to exclude bot users from conversation lists. Defaults to false.
    +
    exclude_external_shared_channels
    +
    Indicates whether to exclude external shared channels +from conversation lists. Defaults to false.
    +
    Expand source code @@ -1797,6 +2272,19 @@

    Inherited members

    exclude_bot_users: Optional[bool] = None, exclude_external_shared_channels: Optional[bool] = None, ): + """Provides a way to filter the list of options in a conversations select menu + or conversations multi-select menu. + https://api.slack.com/reference/block-kit/composition-objects#filter_conversations + + Args: + include: Indicates which type of conversations should be included in the list. + When this field is provided, any conversations that do not match will be excluded. + You should provide an array of strings from the following options: + "im", "mpim", "private", and "public". The array cannot be empty. + exclude_bot_users: Indicates whether to exclude bot users from conversation lists. Defaults to false. + exclude_external_shared_channels: Indicates whether to exclude external shared channels + from conversation lists. Defaults to false. + """ self.include = include self.exclude_bot_users = exclude_bot_users self.exclude_external_shared_channels = exclude_external_shared_channels @@ -1877,7 +2365,33 @@

    Inherited members

    https://api.slack.com/reference/block-kit/block-elements

    This multi-select menu will populate its options with a list of public and private channels, DMs, and MPIMs visible to the current user in the active workspace. -https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select

    +https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select

    +

    Args

    +
    +
    placeholder : required
    +
    A plain_text only text object that defines the placeholder text shown on the menu. +Maximum length for the text in this field is 150 characters.
    +
    action_id : required
    +
    An identifier for the action triggered when a menu option is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    initial_conversations
    +
    An array of one or more IDs of any valid conversations to be pre-selected +when the menu loads. If default_to_current_conversation is also supplied, +initial_conversations will be ignored.
    +
    confirm
    +
    A confirm object that defines an optional confirmation dialog that appears +before the multi-select choices are submitted.
    +
    max_selected_items
    +
    Specifies the maximum number of items that can be selected in the menu. +Minimum number is 1.
    +
    default_to_current_conversation
    +
    Pre-populates the select menu with the conversation that +the user was viewing when they opened the modal, if available. Default is false.
    +
    filter
    +
    A filter object that reduces the list of available conversations using the specified criteria.
    +
    Expand source code @@ -1912,6 +2426,24 @@

    Inherited members

    This multi-select menu will populate its options with a list of public and private channels, DMs, and MPIMs visible to the current user in the active workspace. https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select + + Args: + placeholder (required): A plain_text only text object that defines the placeholder text shown on the menu. + Maximum length for the text in this field is 150 characters. + action_id (required): An identifier for the action triggered when a menu option is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + initial_conversations: An array of one or more IDs of any valid conversations to be pre-selected + when the menu loads. If default_to_current_conversation is also supplied, + initial_conversations will be ignored. + confirm: A confirm object that defines an optional confirmation dialog that appears + before the multi-select choices are submitted. + max_selected_items: Specifies the maximum number of items that can be selected in the menu. + Minimum number is 1. + default_to_current_conversation: Pre-populates the select menu with the conversation that + the user was viewing when they opened the modal, if available. Default is false. + filter: A filter object that reduces the list of available conversations using the specified criteria. """ super().__init__( type=self.type, @@ -1966,7 +2498,34 @@

    Inherited members

    https://api.slack.com/reference/block-kit/block-elements

    This select menu will populate its options with a list of public and private channels, DMs, and MPIMs visible to the current user in the active workspace. -https://api.slack.com/reference/block-kit/block-elements#conversation_select

    +https://api.slack.com/reference/block-kit/block-elements#conversation_select

    +

    Args

    +
    +
    placeholder : required
    +
    A plain_text only text object that defines the placeholder text shown on the menu. +Maximum length for the text in this field is 150 characters.
    +
    action_id : required
    +
    An identifier for the action triggered when a menu option is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    initial_conversation
    +
    The ID of any valid conversation to be pre-selected when the menu loads. +If default_to_current_conversation is also supplied, initial_conversation will take precedence.
    +
    confirm
    +
    A confirm object that defines an optional confirmation dialog +that appears after a menu item is selected.
    +
    response_url_enabled
    +
    This field only works with menus in input blocks in modals. +When set to true, the view_submission payload from the menu's parent view will contain a response_url. +This response_url can be used for message responses. The target conversation for the message +will be determined by the value of this select menu.
    +
    default_to_current_conversation
    +
    Pre-populates the select menu with the conversation +that the user was viewing when they opened the modal, if available. Default is false.
    +
    filter
    +
    A filter object that reduces the list of available conversations using the specified criteria.
    +
    Expand source code @@ -2001,6 +2560,25 @@

    Inherited members

    This select menu will populate its options with a list of public and private channels, DMs, and MPIMs visible to the current user in the active workspace. https://api.slack.com/reference/block-kit/block-elements#conversation_select + + Args: + placeholder (required): A plain_text only text object that defines the placeholder text shown on the menu. + Maximum length for the text in this field is 150 characters. + action_id (required): An identifier for the action triggered when a menu option is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + initial_conversation: The ID of any valid conversation to be pre-selected when the menu loads. + If default_to_current_conversation is also supplied, initial_conversation will take precedence. + confirm: A confirm object that defines an optional confirmation dialog + that appears after a menu item is selected. + response_url_enabled: This field only works with menus in input blocks in modals. + When set to true, the view_submission payload from the menu's parent view will contain a response_url. + This response_url can be used for message responses. The target conversation for the message + will be determined by the value of this select menu. + default_to_current_conversation: Pre-populates the select menu with the conversation + that the user was viewing when they opened the modal, if available. Default is false. + filter: A filter object that reduces the list of available conversations using the specified criteria. """ super().__init__( type=self.type, @@ -2055,7 +2633,24 @@

    Inherited members

    https://api.slack.com/reference/block-kit/block-elements

    An element which lets users easily select a date from a calendar style UI. Date picker elements can be used inside of SectionBlocks and ActionsBlocks. -https://api.slack.com/reference/block-kit/block-elements#datepicker

    +https://api.slack.com/reference/block-kit/block-elements#datepicker

    +

    Args

    +
    +
    action_id : required
    +
    An identifier for the action triggered when a menu option is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    placeholder
    +
    A plain_text only text object that defines the placeholder text shown on the datepicker. +Maximum length for the text in this field is 150 characters.
    +
    initial_date
    +
    The initial date that is selected when the element is loaded. +This should be in the format YYYY-MM-DD.
    +
    confirm
    +
    A confirm object that defines an optional confirmation dialog +that appears after a date is selected.
    +
    Expand source code @@ -2080,6 +2675,18 @@

    Inherited members

    An element which lets users easily select a date from a calendar style UI. Date picker elements can be used inside of SectionBlocks and ActionsBlocks. https://api.slack.com/reference/block-kit/block-elements#datepicker + + Args: + action_id (required): An identifier for the action triggered when a menu option is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + placeholder: A plain_text only text object that defines the placeholder text shown on the datepicker. + Maximum length for the text in this field is 150 characters. + initial_date: The initial date that is selected when the element is loaded. + This should be in the format YYYY-MM-DD. + confirm: A confirm object that defines an optional confirmation dialog + that appears after a date is selected. """ super().__init__( type=self.type, @@ -2092,9 +2699,13 @@

    Inherited members

    self.initial_date = initial_date @JsonValidator("initial_date attribute must be in format 'YYYY-MM-DD'") - def _validate_initial_date_valid(self): - return self.initial_date is None or re.match( - r"\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])", self.initial_date + def _validate_initial_date_valid(self) -> bool: + return ( + self.initial_date is None + or re.match( + r"\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])", self.initial_date + ) + is not None )

    Ancestors

    @@ -2137,7 +2748,33 @@

    Inherited members

    https://api.slack.com/reference/block-kit/block-elements

    This select menu will load its options from an external data source, allowing for a dynamic list of options. -https://api.slack.com/reference/block-kit/block-elements#external-select

    +https://api.slack.com/reference/block-kit/block-elements#external_multi_select

    +

    Args

    +
    +
    placeholder : required
    +
    A plain_text only text object that defines the placeholder text shown on the menu. +Maximum length for the text in this field is 150 characters.
    +
    action_id : required
    +
    An identifier for the action triggered when a menu option is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    min_query_length
    +
    When the typeahead field is used, a request will be sent on every character change. +If you prefer fewer requests or more fully ideated queries, +use the min_query_length attribute to tell Slack +the fewest number of typed characters required before dispatch. +The default value is 3
    +
    initial_options
    +
    An array of option objects that exactly match one or more of the options +within options or option_groups. These options will be selected when the menu initially loads.
    +
    confirm
    +
    A confirm object that defines an optional confirmation dialog that appears +before the multi-select choices are submitted.
    +
    max_selected_items
    +
    Specifies the maximum number of items that can be selected in the menu. +Minimum number is 1.
    +
    Expand source code @@ -2165,7 +2802,26 @@

    Inherited members

    """ This select menu will load its options from an external data source, allowing for a dynamic list of options. - https://api.slack.com/reference/block-kit/block-elements#external-select + https://api.slack.com/reference/block-kit/block-elements#external_multi_select + + Args: + placeholder (required): A plain_text only text object that defines the placeholder text shown on the menu. + Maximum length for the text in this field is 150 characters. + action_id (required): An identifier for the action triggered when a menu option is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + min_query_length: When the typeahead field is used, a request will be sent on every character change. + If you prefer fewer requests or more fully ideated queries, + use the min_query_length attribute to tell Slack + the fewest number of typed characters required before dispatch. + The default value is 3 + initial_options: An array of option objects that exactly match one or more of the options + within options or option_groups. These options will be selected when the menu initially loads. + confirm: A confirm object that defines an optional confirmation dialog that appears + before the multi-select choices are submitted. + max_selected_items: Specifies the maximum number of items that can be selected in the menu. + Minimum number is 1. """ super().__init__( type=self.type, @@ -2212,14 +2868,38 @@

    Inherited members

    class ExternalDataSelectElement -(*, action_id: Optional[str] = None, placeholder: Union[str, TextObject] = None, initial_option: Union[Option, ForwardRef(None), OptionGroup] = None, min_query_length: Optional[int] = None, confirm: Union[dict, ConfirmObject, ForwardRef(None)] = None, **others: dict) +(*, action_id: Optional[str] = None, placeholder: Union[str, TextObject, ForwardRef(None)] = None, initial_option: Union[Option, ForwardRef(None), OptionGroup] = None, min_query_length: Optional[int] = None, confirm: Union[dict, ConfirmObject, ForwardRef(None)] = None, **others: dict)

    Block Elements are things that exists inside of your Blocks. https://api.slack.com/reference/block-kit/block-elements

    This select menu will load its options from an external data source, allowing for a dynamic list of options. -https://api.slack.com/reference/block-kit/block-elements#external_select

    +https://api.slack.com/reference/block-kit/block-elements#external_select

    +

    Args

    +
    +
    action_id : required
    +
    An identifier for the action triggered when a menu option is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    placeholder : required
    +
    A plain_text only text object that defines the placeholder text shown on the menu. +Maximum length for the text in this field is 150 characters.
    +
    initial_option
    +
    A single option that exactly matches one of the options +within the options or option_groups loaded from the external data source. +This option will be selected when the menu initially loads.
    +
    min_query_length
    +
    When the typeahead field is used, a request will be sent on every character change. +If you prefer fewer requests or more fully ideated queries, +use the min_query_length attribute to tell Slack +the fewest number of typed characters required before dispatch. +The default value is 3.
    +
    confirm
    +
    A confirm object that defines an optional confirmation dialog +that appears after a menu item is selected.
    +
    Expand source code @@ -2235,7 +2915,7 @@

    Inherited members

    self, *, action_id: Optional[str] = None, - placeholder: Union[str, TextObject] = None, + placeholder: Optional[Union[str, TextObject]] = None, initial_option: Union[Optional[Option], Optional[OptionGroup]] = None, min_query_length: Optional[int] = None, confirm: Optional[Union[dict, ConfirmObject]] = None, @@ -2245,6 +2925,24 @@

    Inherited members

    This select menu will load its options from an external data source, allowing for a dynamic list of options. https://api.slack.com/reference/block-kit/block-elements#external_select + + Args: + action_id (required): An identifier for the action triggered when a menu option is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + placeholder (required): A plain_text only text object that defines the placeholder text shown on the menu. + Maximum length for the text in this field is 150 characters. + initial_option: A single option that exactly matches one of the options + within the options or option_groups loaded from the external data source. + This option will be selected when the menu initially loads. + min_query_length: When the typeahead field is used, a request will be sent on every character change. + If you prefer fewer requests or more fully ideated queries, + use the min_query_length attribute to tell Slack + the fewest number of typed characters required before dispatch. + The default value is 3. + confirm: A confirm object that defines an optional confirmation dialog + that appears after a menu item is selected. """ super().__init__( type=self.type, @@ -2298,7 +2996,14 @@

    Inherited members

    An element to insert an image - this element can be used in section and context blocks only. If you want a block with only an image in it, you're looking for the image block. -https://api.slack.com/reference/block-kit/block-elements#image

    +https://api.slack.com/reference/block-kit/block-elements#image

    +

    Args

    +
    +
    image_url : required
    +
    The URL of the image to be displayed.
    +
    alt_text : required
    +
    A plain-text summary of the image. This should not contain any markup.
    +
    Expand source code @@ -2323,6 +3028,10 @@

    Inherited members

    context blocks only. If you want a block with only an image in it, you're looking for the image block. https://api.slack.com/reference/block-kit/block-elements#image + + Args: + image_url (required): The URL of the image to be displayed. + alt_text (required): A plain-text summary of the image. This should not contain any markup. """ super().__init__(type=self.type) show_unknown_key_warning(self, others) @@ -2333,11 +3042,11 @@

    Inherited members

    @JsonValidator( f"image_url attribute cannot exceed {image_url_max_length} characters" ) - def _validate_image_url_length(self): + def _validate_image_url_length(self) -> bool: return len(self.image_url) <= self.image_url_max_length @JsonValidator(f"alt_text attribute cannot exceed {alt_text_max_length} characters") - def _validate_alt_text_length(self): + def _validate_alt_text_length(self) -> bool: return len(self.alt_text) <= self.alt_text_max_length

    Ancestors

    @@ -2391,7 +3100,7 @@

    Inherited members

    class InputInteractiveElement -(*, action_id: Optional[str] = None, placeholder: Union[str, TextObject] = None, type: Optional[str] = None, subtype: Optional[str] = None, confirm: Union[dict, ConfirmObject, ForwardRef(None)] = None, **others: dict) +(*, action_id: Optional[str] = None, placeholder: Union[str, TextObject, ForwardRef(None)] = None, type: Optional[str] = None, subtype: Optional[str] = None, confirm: Union[dict, ConfirmObject, ForwardRef(None)] = None, **others: dict)

    Block Elements are things that exists inside of your Blocks. @@ -2407,12 +3116,6 @@

    Inherited members

    attributes = {"type", "action_id", "placeholder", "confirm"} - def _subtype_warning(self): - warnings.warn( - "subtype is deprecated since slackclient 2.6.0, use type instead", - DeprecationWarning, - ) - @property def subtype(self) -> Optional[str]: return self.type @@ -2421,7 +3124,7 @@

    Inherited members

    self, *, action_id: Optional[str] = None, - placeholder: Union[str, TextObject] = None, + placeholder: Optional[Union[str, TextObject]] = None, type: Optional[str] = None, # skipcq: PYL-W0622 subtype: Optional[str] = None, confirm: Optional[Union[dict, ConfirmObject]] = None, @@ -2445,7 +3148,7 @@

    Inherited members

    @JsonValidator( f"placeholder attribute cannot exceed {placeholder_max_length} characters" ) - def _validate_placeholder_length(self): + def _validate_placeholder_length(self) -> bool: return ( self.placeholder is None or self.placeholder.text is None @@ -2557,7 +3260,7 @@

    Inherited members

    @JsonValidator( f"action_id attribute cannot exceed {action_id_max_length} characters" ) - def _validate_action_id_length(self): + def _validate_action_id_length(self) -> bool: return ( self.action_id is None or len(self.action_id) <= self.action_id_max_length ) @@ -2619,7 +3322,31 @@

    Inherited members

    A simple button that simply opens a given URL. You will still receive an interaction payload and will need to send an acknowledgement response. This is a helper class that makes creating links simpler. -https://api.slack.com/reference/block-kit/block-elements#button

    +https://api.slack.com/reference/block-kit/block-elements#button

    +

    Args

    +
    +
    text : required
    +
    A text object that defines the button's text. +Can only be of type: plain_text. +Maximum length for the text in this field is 75 characters.
    +
    url : required
    +
    A URL to load in the user's browser when the button is clicked. +Maximum length for this field is 3000 characters. +If you're using url, you'll still receive an interaction payload +and will need to send an acknowledgement response.
    +
    action_id : required
    +
    An identifier for this action. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    style
    +
    Decorates buttons with alternative visual color schemes. Use this option with restraint. +"primary" gives buttons a green outline and text, ideal for affirmation or confirmation actions. +"primary" should only be used for one button within a set. +"danger" gives buttons a red outline and text, and should be used when the action is destructive. +Use "danger" even more sparingly than "primary". +If you don't include this field, the default button style will be used.
    +
    Expand source code @@ -2638,6 +3365,25 @@

    Inherited members

    interaction payload and will need to send an acknowledgement response. This is a helper class that makes creating links simpler. https://api.slack.com/reference/block-kit/block-elements#button + + Args: + text (required): A text object that defines the button's text. + Can only be of type: plain_text. + Maximum length for the text in this field is 75 characters. + url (required): A URL to load in the user's browser when the button is clicked. + Maximum length for this field is 3000 characters. + If you're using url, you'll still receive an interaction payload + and will need to send an acknowledgement response. + action_id (required): An identifier for this action. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + style: Decorates buttons with alternative visual color schemes. Use this option with restraint. + "primary" gives buttons a green outline and text, ideal for affirmation or confirmation actions. + "primary" should only be used for one button within a set. + "danger" gives buttons a red outline and text, and should be used when the action is destructive. + Use "danger" even more sparingly than "primary". + If you don't include this field, the default button style will be used. """ super().__init__( # NOTE: value must be always absent @@ -2684,7 +3430,21 @@

    Inherited members

    menu, or to supply a list of less visually important actions after a row of buttons. You can also specify simple URL links as overflow menu options, instead of actions.

    -

    https://api.slack.com/reference/block-kit/block-elements#overflow

    +

    https://api.slack.com/reference/block-kit/block-elements#overflow

    +

    Args

    +
    +
    action_id : required
    +
    An identifier for the action triggered when a menu option is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    options : required
    +
    An array of option objects to display in the menu. +Maximum number of options is 5, minimum is 2.
    +
    confirm
    +
    A confirm object that defines an optional confirmation dialog that appears +after a menu item is selected.
    +
    Expand source code @@ -2718,6 +3478,16 @@

    Inherited members

    instead of actions. https://api.slack.com/reference/block-kit/block-elements#overflow + + Args: + action_id (required): An identifier for the action triggered when a menu option is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + options (required): An array of option objects to display in the menu. + Maximum number of options is 5, minimum is 2. + confirm: A confirm object that defines an optional confirmation dialog that appears + after a menu item is selected. """ super().__init__(action_id=action_id, type=self.type) show_unknown_key_warning(self, others) @@ -2729,7 +3499,7 @@

    Inherited members

    f"options attribute must have between {options_min_length} " f"and {options_max_length} items" ) - def _validate_options_length(self): + def _validate_options_length(self) -> bool: return self.options_min_length <= len(self.options) <= self.options_max_length

    Ancestors

    @@ -2768,7 +3538,7 @@

    Inherited members

    class PlainTextInputElement -(*, action_id: Optional[str] = None, placeholder: Union[str, dict, TextObject, ForwardRef(None)] = None, confirm: Union[dict, ConfirmObject, ForwardRef(None)] = None, initial_value: Optional[str] = None, multiline: Optional[bool] = None, min_length: Optional[int] = None, max_length: Optional[int] = None, dispatch_action_config: Union[dict, DispatchActionConfig, ForwardRef(None)] = None, **others: dict) +(*, action_id: Optional[str] = None, placeholder: Union[str, dict, TextObject, ForwardRef(None)] = None, initial_value: Optional[str] = None, multiline: Optional[bool] = None, min_length: Optional[int] = None, max_length: Optional[int] = None, dispatch_action_config: Union[dict, DispatchActionConfig, ForwardRef(None)] = None, **others: dict)

    Block Elements are things that exists inside of your Blocks. @@ -2777,7 +3547,32 @@

    Inherited members

    where a user can enter freeform data. It can appear as a single-line field or a larger textarea using the multiline flag. Plain-text input elements can be used inside of SectionBlocks and ActionsBlocks. -https://api.slack.com/reference/block-kit/block-elements#input

    +https://api.slack.com/reference/block-kit/block-elements#input

    +

    Args

    +
    +
    action_id : required
    +
    An identifier for the input value when the parent modal is submitted. +You can use this when you receive a view_submission payload to identify the value of the input element. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    placeholder
    +
    A plain_text only text object that defines the placeholder text shown +in the plain-text input. Maximum length for the text in this field is 150 characters.
    +
    initial_value
    +
    The initial value in the plain-text input when it is loaded.
    +
    multiline
    +
    Indicates whether the input will be a single line (false) or a larger textarea (true). +Defaults to false.
    +
    min_length
    +
    The minimum length of input that the user must provide. If the user provides less, +they will receive an error. Maximum value is 3000.
    +
    max_length
    +
    The maximum length of input that the user can provide. If the user provides more, +they will receive an error.
    +
    dispatch_action_config
    +
    A dispatch configuration object that determines when +during text input the element returns a block_actions payload.
    +
    Expand source code @@ -2802,7 +3597,6 @@

    Inherited members

    *, action_id: Optional[str] = None, placeholder: Optional[Union[str, dict, TextObject]] = None, - confirm: Optional[Union[dict, ConfirmObject]] = None, initial_value: Optional[str] = None, multiline: Optional[bool] = None, min_length: Optional[int] = None, @@ -2816,12 +3610,28 @@

    Inherited members

    field or a larger textarea using the multiline flag. Plain-text input elements can be used inside of SectionBlocks and ActionsBlocks. https://api.slack.com/reference/block-kit/block-elements#input + + Args: + action_id (required): An identifier for the input value when the parent modal is submitted. + You can use this when you receive a view_submission payload to identify the value of the input element. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + placeholder: A plain_text only text object that defines the placeholder text shown + in the plain-text input. Maximum length for the text in this field is 150 characters. + initial_value: The initial value in the plain-text input when it is loaded. + multiline: Indicates whether the input will be a single line (false) or a larger textarea (true). + Defaults to false. + min_length: The minimum length of input that the user must provide. If the user provides less, + they will receive an error. Maximum value is 3000. + max_length: The maximum length of input that the user can provide. If the user provides more, + they will receive an error. + dispatch_action_config: A dispatch configuration object that determines when + during text input the element returns a block_actions payload. """ super().__init__( type=self.type, action_id=action_id, placeholder=TextObject.parse(placeholder, PlainTextObject.type), - confirm=ConfirmObject.parse(confirm), ) show_unknown_key_warning(self, others) @@ -2864,13 +3674,29 @@

    Inherited members

    class RadioButtonsElement -(*, action_id: Optional[str] = None, placeholder: Union[str, dict, TextObject, ForwardRef(None)] = None, options: Optional[Sequence[Union[dict, Option]]] = None, initial_option: Union[dict, Option, ForwardRef(None)] = None, confirm: Union[dict, ConfirmObject, ForwardRef(None)] = None, **others: dict) +(*, action_id: Optional[str] = None, options: Optional[Sequence[Union[dict, Option]]] = None, initial_option: Union[dict, Option, ForwardRef(None)] = None, confirm: Union[dict, ConfirmObject, ForwardRef(None)] = None, **others: dict)

    Block Elements are things that exists inside of your Blocks. https://api.slack.com/reference/block-kit/block-elements

    A radio button group that allows a user to choose one item from a list of possible options. -https://api.slack.com/reference/block-kit/block-elements#radio

    +https://api.slack.com/reference/block-kit/block-elements#radio

    +

    Args

    +
    +
    action_id : required
    +
    An identifier for the action triggered when the radio button group is changed. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    options : required
    +
    An array of option objects. A maximum of 10 options are allowed.
    +
    initial_option
    +
    An option object that exactly matches one of the options. +This option will be selected when the radio button group initially loads.
    +
    confirm
    +
    A confirm object that defines an optional confirmation dialog that appears +after clicking one of the radio buttons in this element.
    +
    Expand source code @@ -2886,7 +3712,6 @@

    Inherited members

    self, *, action_id: Optional[str] = None, - placeholder: Optional[Union[str, dict, TextObject]] = None, options: Optional[Sequence[Union[dict, Option]]] = None, initial_option: Optional[Union[dict, Option]] = None, confirm: Optional[Union[dict, ConfirmObject]] = None, @@ -2894,11 +3719,21 @@

    Inherited members

    ): """A radio button group that allows a user to choose one item from a list of possible options. https://api.slack.com/reference/block-kit/block-elements#radio + + Args: + action_id (required): An identifier for the action triggered when the radio button group is changed. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + options (required): An array of option objects. A maximum of 10 options are allowed. + initial_option: An option object that exactly matches one of the options. + This option will be selected when the radio button group initially loads. + confirm: A confirm object that defines an optional confirmation dialog that appears + after clicking one of the radio buttons in this element. """ super().__init__( type=self.type, action_id=action_id, - placeholder=TextObject.parse(placeholder, PlainTextObject.type), confirm=ConfirmObject.parse(confirm), ) show_unknown_key_warning(self, others) @@ -2945,7 +3780,32 @@

    Inherited members

    Block Elements are things that exists inside of your Blocks. https://api.slack.com/reference/block-kit/block-elements

    This is the simplest form of select menu, with a static list of options passed in when defining the element. -https://api.slack.com/reference/block-kit/block-elements#static_select

    +https://api.slack.com/reference/block-kit/block-elements#static_select

    +

    Args

    +
    +
    action_id : required
    +
    An identifier for the action triggered when a menu option is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    placeholder : required
    +
    A plain_text only text object that defines the placeholder text shown on the menu. +Maximum length for the text in this field is 150 characters.
    +
    options : either options or option_groups is required
    +
    An array of option objects. +Maximum number of options is 100. +If option_groups is specified, this field should not be.
    +
    option_groups : either options or option_groups is required
    +
    An array of option group objects. +Maximum number of option groups is 100. +If options is specified, this field should not be.
    +
    initial_option
    +
    A single option that exactly matches one of the options or option_groups. +This option will be selected when the menu initially loads.
    +
    confirm
    +
    A confirm object that defines an optional confirmation dialog +that appears after a menu item is selected.
    +
    Expand source code @@ -2972,6 +3832,24 @@

    Inherited members

    ): """This is the simplest form of select menu, with a static list of options passed in when defining the element. https://api.slack.com/reference/block-kit/block-elements#static_select + + Args: + action_id (required): An identifier for the action triggered when a menu option is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + placeholder (required): A plain_text only text object that defines the placeholder text shown on the menu. + Maximum length for the text in this field is 150 characters. + options (either options or option_groups is required): An array of option objects. + Maximum number of options is 100. + If option_groups is specified, this field should not be. + option_groups (either options or option_groups is required): An array of option group objects. + Maximum number of option groups is 100. + If options is specified, this field should not be. + initial_option: A single option that exactly matches one of the options or option_groups. + This option will be selected when the menu initially loads. + confirm: A confirm object that defines an optional confirmation dialog + that appears after a menu item is selected. """ super().__init__( type=self.type, @@ -2986,24 +3864,24 @@

    Inherited members

    self.initial_option = initial_option @JsonValidator(f"options attribute cannot exceed {options_max_length} elements") - def _validate_options_length(self): + def _validate_options_length(self) -> bool: return self.options is None or len(self.options) <= self.options_max_length @JsonValidator( f"option_groups attribute cannot exceed {option_groups_max_length} elements" ) - def _validate_option_groups_length(self): + def _validate_option_groups_length(self) -> bool: return ( self.option_groups is None or len(self.option_groups) <= self.option_groups_max_length ) @JsonValidator("options and option_groups cannot both be specified") - def _validate_options_and_option_groups_both_specified(self): + def _validate_options_and_option_groups_both_specified(self) -> bool: return not (self.options is not None and self.option_groups is not None) @JsonValidator("options or option_groups must be specified") - def _validate_neither_options_or_option_groups_is_specified(self): + def _validate_neither_options_or_option_groups_is_specified(self) -> bool: return self.options is not None or self.option_groups is not None

    Ancestors

    @@ -3053,7 +3931,35 @@

    Inherited members

    Block Elements are things that exists inside of your Blocks. https://api.slack.com/reference/block-kit/block-elements

    This is the simplest form of select menu, with a static list of options passed in when defining the element. -https://api.slack.com/reference/block-kit/block-elements#static_multi_select

    +https://api.slack.com/reference/block-kit/block-elements#static_multi_select

    +

    Args

    +
    +
    placeholder : required
    +
    A plain_text only text object that defines the placeholder text shown on the menu. +Maximum length for the text in this field is 150 characters.
    +
    action_id : required
    +
    An identifier for the action triggered when a menu option is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    options : either options or option_groups is required
    +
    An array of option objects. +Maximum number of options is 100. +If option_groups is specified, this field should not be.
    +
    option_groups : either options or option_groups is required
    +
    An array of option group objects. +Maximum number of option groups is 100. +If options is specified, this field should not be.
    +
    initial_options
    +
    An array of option objects that exactly match one or more of the options +within options or option_groups. These options will be selected when the menu initially loads.
    +
    confirm
    +
    A confirm object that defines an optional confirmation dialog +that appears before the multi-select choices are submitted.
    +
    max_selected_items
    +
    Specifies the maximum number of items that can be selected in the menu. +Minimum number is 1.
    +
    Expand source code @@ -3084,6 +3990,26 @@

    Inherited members

    """ This is the simplest form of select menu, with a static list of options passed in when defining the element. https://api.slack.com/reference/block-kit/block-elements#static_multi_select + + Args: + placeholder (required): A plain_text only text object that defines the placeholder text shown on the menu. + Maximum length for the text in this field is 150 characters. + action_id (required): An identifier for the action triggered when a menu option is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + options (either options or option_groups is required): An array of option objects. + Maximum number of options is 100. + If option_groups is specified, this field should not be. + option_groups (either options or option_groups is required): An array of option group objects. + Maximum number of option groups is 100. + If options is specified, this field should not be. + initial_options: An array of option objects that exactly match one or more of the options + within options or option_groups. These options will be selected when the menu initially loads. + confirm: A confirm object that defines an optional confirmation dialog + that appears before the multi-select choices are submitted. + max_selected_items: Specifies the maximum number of items that can be selected in the menu. + Minimum number is 1. """ super().__init__( type=self.type, @@ -3099,24 +4025,24 @@

    Inherited members

    self.max_selected_items = max_selected_items @JsonValidator(f"options attribute cannot exceed {options_max_length} elements") - def _validate_options_length(self): + def _validate_options_length(self) -> bool: return self.options is None or len(self.options) <= self.options_max_length @JsonValidator( f"option_groups attribute cannot exceed {option_groups_max_length} elements" ) - def _validate_option_groups_length(self): + def _validate_option_groups_length(self) -> bool: return ( self.option_groups is None or len(self.option_groups) <= self.option_groups_max_length ) @JsonValidator("options and option_groups cannot both be specified") - def _validate_options_and_option_groups_both_specified(self): + def _validate_options_and_option_groups_both_specified(self) -> bool: return self.options is None or self.option_groups is None @JsonValidator("options or option_groups must be specified") - def _validate_neither_options_or_option_groups_is_specified(self): + def _validate_neither_options_or_option_groups_is_specified(self) -> bool: return self.options is not None or self.option_groups is not None

    Ancestors

    @@ -3166,7 +4092,32 @@

    Inherited members

    Block Elements are things that exists inside of your Blocks. https://api.slack.com/reference/block-kit/block-elements

    This is the simplest form of select menu, with a static list of options passed in when defining the element. -https://api.slack.com/reference/block-kit/block-elements#static_select

    +https://api.slack.com/reference/block-kit/block-elements#static_select

    +

    Args

    +
    +
    placeholder : required
    +
    A plain_text only text object that defines the placeholder text shown on the menu. +Maximum length for the text in this field is 150 characters.
    +
    action_id : required
    +
    An identifier for the action triggered when a menu option is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    options : either options or option_groups is required
    +
    An array of option objects. +Maximum number of options is 100. +If option_groups is specified, this field should not be.
    +
    option_groups : either options or option_groups is required
    +
    An array of option group objects. +Maximum number of option groups is 100. +If options is specified, this field should not be.
    +
    initial_option
    +
    A single option that exactly matches one of the options or option_groups. +This option will be selected when the menu initially loads.
    +
    confirm
    +
    A confirm object that defines an optional confirmation dialog +that appears after a menu item is selected.
    +
    Expand source code @@ -3193,6 +4144,24 @@

    Inherited members

    ): """This is the simplest form of select menu, with a static list of options passed in when defining the element. https://api.slack.com/reference/block-kit/block-elements#static_select + + Args: + placeholder (required): A plain_text only text object that defines the placeholder text shown on the menu. + Maximum length for the text in this field is 150 characters. + action_id (required): An identifier for the action triggered when a menu option is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + options (either options or option_groups is required): An array of option objects. + Maximum number of options is 100. + If option_groups is specified, this field should not be. + option_groups (either options or option_groups is required): An array of option group objects. + Maximum number of option groups is 100. + If options is specified, this field should not be. + initial_option: A single option that exactly matches one of the options or option_groups. + This option will be selected when the menu initially loads. + confirm: A confirm object that defines an optional confirmation dialog + that appears after a menu item is selected. """ super().__init__( type=self.type, @@ -3207,24 +4176,24 @@

    Inherited members

    self.initial_option = initial_option @JsonValidator(f"options attribute cannot exceed {options_max_length} elements") - def _validate_options_length(self): + def _validate_options_length(self) -> bool: return self.options is None or len(self.options) <= self.options_max_length @JsonValidator( f"option_groups attribute cannot exceed {option_groups_max_length} elements" ) - def _validate_option_groups_length(self): + def _validate_option_groups_length(self) -> bool: return ( self.option_groups is None or len(self.option_groups) <= self.option_groups_max_length ) @JsonValidator("options and option_groups cannot both be specified") - def _validate_options_and_option_groups_both_specified(self): + def _validate_options_and_option_groups_both_specified(self) -> bool: return not (self.options is not None and self.option_groups is not None) @JsonValidator("options or option_groups must be specified") - def _validate_neither_options_or_option_groups_is_specified(self): + def _validate_neither_options_or_option_groups_is_specified(self) -> bool: return self.options is not None or self.option_groups is not None

    Ancestors

    @@ -3274,7 +4243,28 @@

    Inherited members

    Block Elements are things that exists inside of your Blocks. https://api.slack.com/reference/block-kit/block-elements

    An element which allows selection of a time of day. -https://api.slack.com/reference/block-kit/block-elements#timepicker

    +On desktop clients, this time picker will take the form of a dropdown list +with free-text entry for precise choices. +On mobile clients, the time picker will use native time picker UIs. +https://api.slack.com/reference/block-kit/block-elements#timepicker

    +

    Args

    +
    +
    action_id : required
    +
    An identifier for the action triggered when a time is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    placeholder
    +
    A plain_text only text object that defines the placeholder text shown on the timepicker. +Maximum length for the text in this field is 150 characters.
    +
    initial_time
    +
    The initial time that is selected when the element is loaded. +This should be in the format HH:mm, where HH is the 24-hour format of an hour (00 to 23) +and mm is minutes with leading zeros (00 to 59), for example 22:25 for 10:25pm.
    +
    confirm
    +
    A confirm object that defines an optional confirmation dialog +that appears after a time is selected.
    +
    Expand source code @@ -3297,7 +4287,23 @@

    Inherited members

    ): """ An element which allows selection of a time of day. + On desktop clients, this time picker will take the form of a dropdown list + with free-text entry for precise choices. + On mobile clients, the time picker will use native time picker UIs. https://api.slack.com/reference/block-kit/block-elements#timepicker + + Args: + action_id (required): An identifier for the action triggered when a time is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + placeholder: A plain_text only text object that defines the placeholder text shown on the timepicker. + Maximum length for the text in this field is 150 characters. + initial_time: The initial time that is selected when the element is loaded. + This should be in the format HH:mm, where HH is the 24-hour format of an hour (00 to 23) + and mm is minutes with leading zeros (00 to 59), for example 22:25 for 10:25pm. + confirm: A confirm object that defines an optional confirmation dialog + that appears after a time is selected. """ super().__init__( type=self.type, @@ -3310,9 +4316,11 @@

    Inherited members

    self.initial_time = initial_time @JsonValidator("initial_time attribute must be in format 'HH:mm'") - def _validate_initial_time_valid(self): - return self.initial_time is None or re.match( - r"([0-1][0-9]|2[0-3]):([0-5][0-9])", self.initial_time + def _validate_initial_time_valid(self) -> bool: + return ( + self.initial_time is None + or re.match(r"([0-1][0-9]|2[0-3]):([0-5][0-9])", self.initial_time) + is not None )

    Ancestors

    @@ -3355,7 +4363,26 @@

    Inherited members

    https://api.slack.com/reference/block-kit/block-elements

    This select menu will populate its options with a list of Slack users visible to the current user in the active workspace. -https://api.slack.com/reference/block-kit/block-elements#users_multi_select

    +https://api.slack.com/reference/block-kit/block-elements#users_multi_select

    +

    Args

    +
    +
    action_id : required
    +
    An identifier for the action triggered when a menu option is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    placeholder : required
    +
    A plain_text only text object that defines the placeholder text shown on the menu. +Maximum length for the text in this field is 150 characters.
    +
    initial_users
    +
    An array of user IDs of any valid users to be pre-selected when the menu loads.
    +
    confirm
    +
    A confirm object that defines an optional confirmation dialog that appears +before the multi-select choices are submitted.
    +
    max_selected_items
    +
    Specifies the maximum number of items that can be selected in the menu. +Minimum number is 1.
    +
    Expand source code @@ -3381,6 +4408,19 @@

    Inherited members

    This select menu will populate its options with a list of Slack users visible to the current user in the active workspace. https://api.slack.com/reference/block-kit/block-elements#users_multi_select + + Args: + action_id (required): An identifier for the action triggered when a menu option is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + placeholder (required): A plain_text only text object that defines the placeholder text shown on the menu. + Maximum length for the text in this field is 150 characters. + initial_users: An array of user IDs of any valid users to be pre-selected when the menu loads. + confirm: A confirm object that defines an optional confirmation dialog that appears + before the multi-select choices are submitted. + max_selected_items: Specifies the maximum number of items that can be selected in the menu. + Minimum number is 1. """ super().__init__( type=self.type, @@ -3433,7 +4473,23 @@

    Inherited members

    https://api.slack.com/reference/block-kit/block-elements

    This select menu will populate its options with a list of Slack users visible to the current user in the active workspace. -https://api.slack.com/reference/block-kit/block-elements#users_select

    +https://api.slack.com/reference/block-kit/block-elements#users_select

    +

    Args

    +
    +
    placeholder : required
    +
    A plain_text only text object that defines the placeholder text shown on the menu. +Maximum length for the text in this field is 150 characters.
    +
    action_id : required
    +
    An identifier for the action triggered when a menu option is selected. +You can use this when you receive an interaction payload to identify the source of the action. +Should be unique among all other action_ids in the containing block. +Maximum length for this field is 255 characters.
    +
    initial_user
    +
    The user ID of any valid user to be pre-selected when the menu loads.
    +
    confirm
    +
    A confirm object that defines an optional confirmation dialog +that appears after a menu item is selected.
    +
    Expand source code @@ -3458,6 +4514,17 @@

    Inherited members

    This select menu will populate its options with a list of Slack users visible to the current user in the active workspace. https://api.slack.com/reference/block-kit/block-elements#users_select + + Args: + placeholder (required): A plain_text only text object that defines the placeholder text shown on the menu. + Maximum length for the text in this field is 150 characters. + action_id (required): An identifier for the action triggered when a menu option is selected. + You can use this when you receive an interaction payload to identify the source of the action. + Should be unique among all other action_ids in the containing block. + Maximum length for this field is 255 characters. + initial_user: The user ID of any valid user to be pre-selected when the menu loads. + confirm: A confirm object that defines an optional confirmation dialog + that appears after a menu item is selected. """ super().__init__( type=self.type, diff --git a/docs/api-docs/slack_sdk/models/blocks/blocks.html b/docs/api-docs/slack_sdk/models/blocks/blocks.html index 9cf335a32..9511b28e3 100644 --- a/docs/api-docs/slack_sdk/models/blocks/blocks.html +++ b/docs/api-docs/slack_sdk/models/blocks/blocks.html @@ -146,13 +146,29 @@

    Module slack_sdk.models.blocks.blocks

    self, *, block_id: Optional[str] = None, - text: Union[str, dict, TextObject] = None, - fields: Sequence[Union[str, dict, TextObject]] = None, + text: Optional[Union[str, dict, TextObject]] = None, + fields: Optional[Sequence[Union[str, dict, TextObject]]] = None, accessory: Optional[Union[dict, BlockElement]] = None, **others: dict, ): """A section is one of the most flexible blocks available. https://api.slack.com/reference/block-kit/blocks#section + + Args: + block_id (required): A string acting as a unique identifier for a block. + If not specified, one will be generated. + You can use this block_id when you receive an interaction payload to identify the source of the action. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. + text (preferred): The text for the block, in the form of a text object. + Maximum length for the text in this field is 3000 characters. + This field is not required if a valid array of fields objects is provided instead. + fields (required if no text is provided): Required if no text is provided. + An array of text objects. Any text objects included with fields will be rendered + in a compact format that allows for 2 columns of side-by-side text. + Maximum number of items is 10. Maximum length for the text in each item is 2000 characters. + accessory: One of the available element objects. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -200,6 +216,13 @@

    Module slack_sdk.models.blocks.blocks

    ): """A content divider, like an <hr>, to split up different blocks inside of a message. https://api.slack.com/reference/block-kit/blocks#divider + + Args: + block_id: A string acting as a unique identifier for a block. If not specified, one will be generated. + You can use this block_id when you receive an interaction payload to identify the source of the action. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -227,6 +250,18 @@

    Module slack_sdk.models.blocks.blocks

    ): """A simple image block, designed to make those cat photos really pop. https://api.slack.com/reference/block-kit/blocks#image + + Args: + image_url (required): The URL of the image to be displayed. + Maximum length for this field is 3000 characters. + alt_text (required): A plain-text summary of the image. This should not contain any markup. + Maximum length for this field is 2000 characters. + title: An optional title for the image in the form of a text object that can only be of type: plain_text. + Maximum length for the text in this field is 2000 characters. + block_id: A string acting as a unique identifier for a block. If not specified, one will be generated. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -271,6 +306,16 @@

    Module slack_sdk.models.blocks.blocks

    ): """A block that is used to hold interactive elements. https://api.slack.com/reference/block-kit/blocks#actions + + Args: + elements (required): An array of interactive element objects - buttons, select menus, overflow menus, + or date pickers. There is a maximum of 5 elements in each action block. + block_id: A string acting as a unique identifier for a block. + If not specified, a block_id will be generated. + You can use this block_id when you receive an interaction payload to identify the source of the action. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -299,6 +344,13 @@

    Module slack_sdk.models.blocks.blocks

    ): """Displays message context, which can include both images and text. https://api.slack.com/reference/block-kit/blocks#context + + Args: + elements (required): An array of image elements and text objects. Maximum number of items is 10. + block_id: A string acting as a unique identifier for a block. If not specified, one will be generated. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -335,6 +387,23 @@

    Module slack_sdk.models.blocks.blocks

    """A block that collects information from users - it can hold a plain-text input element, a select menu element, a multi-select menu element, or a datepicker. https://api.slack.com/reference/block-kit/blocks#input + + Args: + label (required): A label that appears above an input element in the form of a text object + that must have type of plain_text. Maximum length for the text in this field is 2000 characters. + element (required): An plain-text input element, a checkbox element, a radio button element, + a select menu element, a multi-select menu element, or a datepicker. + block_id: A string acting as a unique identifier for a block. If not specified, one will be generated. + Maximum length for this field is 255 characters. + block_id should be unique for each message or view and each iteration of a message or view. + If a message or view is updated, use a new block_id. + hint: An optional hint that appears below an input element in a lighter grey. + It must be a text object with a type of plain_text. + Maximum length for the text in this field is 2000 characters. + dispatch_action: A boolean that indicates whether or not the use of elements in this block + should dispatch a block_actions payload. Defaults to false. + optional: A boolean that indicates whether the input element may be empty when a user submits the modal. + Defaults to false. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -390,6 +459,14 @@

    Module slack_sdk.models.blocks.blocks

    ): """Displays a remote file. https://api.slack.com/reference/block-kit/blocks#file + + Args: + external_id (required): The external unique ID for this file. + source (required): At the moment, source will always be remote for a remote file. + block_id: A string acting as a unique identifier for a block. If not specified, one will be generated. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -437,11 +514,19 @@

    Module slack_sdk.models.blocks.blocks

    self, *, block_id: Optional[str] = None, - text: Union[str, dict, TextObject] = None, + text: Optional[Union[str, dict, TextObject]] = None, **others: dict, ): """A header is a plain-text block that displays in a larger, bold font. https://api.slack.com/reference/block-kit/blocks#header + + Args: + block_id: A string acting as a unique identifier for a block. If not specified, one will be generated. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. + text (required): The text for the block, in the form of a plain_text text object. + Maximum length for the text in this field is 150 characters. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -475,7 +560,20 @@

    Classes

    to create visually rich and compellingly interactive messages. https://api.slack.com/reference/block-kit/blocks

    A block that is used to hold interactive elements. -https://api.slack.com/reference/block-kit/blocks#actions

    +https://api.slack.com/reference/block-kit/blocks#actions

    +

    Args

    +
    +
    elements : required
    +
    An array of interactive element objects - buttons, select menus, overflow menus, +or date pickers. There is a maximum of 5 elements in each action block.
    +
    block_id
    +
    A string acting as a unique identifier for a block. +If not specified, a block_id will be generated. +You can use this block_id when you receive an interaction payload to identify the source of the action. +Maximum length for this field is 255 characters. +block_id should be unique for each message and each iteration of a message. +If a message is updated, use a new block_id.
    +
    Expand source code @@ -497,6 +595,16 @@

    Classes

    ): """A block that is used to hold interactive elements. https://api.slack.com/reference/block-kit/blocks#actions + + Args: + elements (required): An array of interactive element objects - buttons, select menus, overflow menus, + or date pickers. There is a maximum of 5 elements in each action block. + block_id: A string acting as a unique identifier for a block. + If not specified, a block_id will be generated. + You can use this block_id when you receive an interaction payload to identify the source of the action. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -849,7 +957,17 @@

    Inherited members

    to create visually rich and compellingly interactive messages. https://api.slack.com/reference/block-kit/blocks

    Displays message context, which can include both images and text. -https://api.slack.com/reference/block-kit/blocks#context

    +https://api.slack.com/reference/block-kit/blocks#context

    +

    Args

    +
    +
    elements : required
    +
    An array of image elements and text objects. Maximum number of items is 10.
    +
    block_id
    +
    A string acting as a unique identifier for a block. If not specified, one will be generated. +Maximum length for this field is 255 characters. +block_id should be unique for each message and each iteration of a message. +If a message is updated, use a new block_id.
    +
    Expand source code @@ -871,6 +989,13 @@

    Inherited members

    ): """Displays message context, which can include both images and text. https://api.slack.com/reference/block-kit/blocks#context + + Args: + elements (required): An array of image elements and text objects. Maximum number of items is 10. + block_id: A string acting as a unique identifier for a block. If not specified, one will be generated. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -935,7 +1060,16 @@

    Inherited members

    to create visually rich and compellingly interactive messages. https://api.slack.com/reference/block-kit/blocks

    A content divider, like an


    , to split up different blocks inside of a message. -https://api.slack.com/reference/block-kit/blocks#divider

    +https://api.slack.com/reference/block-kit/blocks#divider

    +

    Args

    +
    +
    block_id
    +
    A string acting as a unique identifier for a block. If not specified, one will be generated. +You can use this block_id when you receive an interaction payload to identify the source of the action. +Maximum length for this field is 255 characters. +block_id should be unique for each message and each iteration of a message. +If a message is updated, use a new block_id.
    +
    Expand source code @@ -951,6 +1085,13 @@

    Inherited members

    ): """A content divider, like an <hr>, to split up different blocks inside of a message. https://api.slack.com/reference/block-kit/blocks#divider + + Args: + block_id: A string acting as a unique identifier for a block. If not specified, one will be generated. + You can use this block_id when you receive an interaction payload to identify the source of the action. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -993,7 +1134,19 @@

    Inherited members

    to create visually rich and compellingly interactive messages. https://api.slack.com/reference/block-kit/blocks

    Displays a remote file. -https://api.slack.com/reference/block-kit/blocks#file

    +https://api.slack.com/reference/block-kit/blocks#file

    +

    Args

    +
    +
    external_id : required
    +
    The external unique ID for this file.
    +
    source : required
    +
    At the moment, source will always be remote for a remote file.
    +
    block_id
    +
    A string acting as a unique identifier for a block. If not specified, one will be generated. +Maximum length for this field is 255 characters. +block_id should be unique for each message and each iteration of a message. +If a message is updated, use a new block_id.
    +
    Expand source code @@ -1015,6 +1168,14 @@

    Inherited members

    ): """Displays a remote file. https://api.slack.com/reference/block-kit/blocks#file + + Args: + external_id (required): The external unique ID for this file. + source (required): At the moment, source will always be remote for a remote file. + block_id: A string acting as a unique identifier for a block. If not specified, one will be generated. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -1065,14 +1226,25 @@

    Inherited members

    class HeaderBlock -(*, block_id: Optional[str] = None, text: Union[str, dict, TextObject] = None, **others: dict) +(*, block_id: Optional[str] = None, text: Union[str, dict, TextObject, ForwardRef(None)] = None, **others: dict)

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

    A header is a plain-text block that displays in a larger, bold font. -https://api.slack.com/reference/block-kit/blocks#header

    +https://api.slack.com/reference/block-kit/blocks#header

    +

    Args

    +
    +
    block_id
    +
    A string acting as a unique identifier for a block. If not specified, one will be generated. +Maximum length for this field is 255 characters. +block_id should be unique for each message and each iteration of a message. +If a message is updated, use a new block_id.
    +
    text : required
    +
    The text for the block, in the form of a plain_text text object. +Maximum length for the text in this field is 150 characters.
    +
    Expand source code @@ -1089,11 +1261,19 @@

    Inherited members

    self, *, block_id: Optional[str] = None, - text: Union[str, dict, TextObject] = None, + text: Optional[Union[str, dict, TextObject]] = None, **others: dict, ): """A header is a plain-text block that displays in a larger, bold font. https://api.slack.com/reference/block-kit/blocks#header + + Args: + block_id: A string acting as a unique identifier for a block. If not specified, one will be generated. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. + text (required): The text for the block, in the form of a plain_text text object. + Maximum length for the text in this field is 150 characters. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -1162,7 +1342,24 @@

    Inherited members

    to create visually rich and compellingly interactive messages. https://api.slack.com/reference/block-kit/blocks

    A simple image block, designed to make those cat photos really pop. -https://api.slack.com/reference/block-kit/blocks#image

    +https://api.slack.com/reference/block-kit/blocks#image

    +

    Args

    +
    +
    image_url : required
    +
    The URL of the image to be displayed. +Maximum length for this field is 3000 characters.
    +
    alt_text : required
    +
    A plain-text summary of the image. This should not contain any markup. +Maximum length for this field is 2000 characters.
    +
    title
    +
    An optional title for the image in the form of a text object that can only be of type: plain_text. +Maximum length for the text in this field is 2000 characters.
    +
    block_id
    +
    A string acting as a unique identifier for a block. If not specified, one will be generated. +Maximum length for this field is 255 characters. +block_id should be unique for each message and each iteration of a message. +If a message is updated, use a new block_id.
    +
    Expand source code @@ -1189,6 +1386,18 @@

    Inherited members

    ): """A simple image block, designed to make those cat photos really pop. https://api.slack.com/reference/block-kit/blocks#image + + Args: + image_url (required): The URL of the image to be displayed. + Maximum length for this field is 3000 characters. + alt_text (required): A plain-text summary of the image. This should not contain any markup. + Maximum length for this field is 2000 characters. + title: An optional title for the image in the form of a text object that can only be of type: plain_text. + Maximum length for the text in this field is 2000 characters. + block_id: A string acting as a unique identifier for a block. If not specified, one will be generated. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -1278,7 +1487,31 @@

    Inherited members

    https://api.slack.com/reference/block-kit/blocks

    A block that collects information from users - it can hold a plain-text input element, a select menu element, a multi-select menu element, or a datepicker. -https://api.slack.com/reference/block-kit/blocks#input

    +https://api.slack.com/reference/block-kit/blocks#input

    +

    Args

    +
    +
    label : required
    +
    A label that appears above an input element in the form of a text object +that must have type of plain_text. Maximum length for the text in this field is 2000 characters.
    +
    element : required
    +
    An plain-text input element, a checkbox element, a radio button element, +a select menu element, a multi-select menu element, or a datepicker.
    +
    block_id
    +
    A string acting as a unique identifier for a block. If not specified, one will be generated. +Maximum length for this field is 255 characters. +block_id should be unique for each message or view and each iteration of a message or view. +If a message or view is updated, use a new block_id.
    +
    hint
    +
    An optional hint that appears below an input element in a lighter grey. +It must be a text object with a type of plain_text. +Maximum length for the text in this field is 2000 characters.
    +
    dispatch_action
    +
    A boolean that indicates whether or not the use of elements in this block +should dispatch a block_actions payload. Defaults to false.
    +
    optional
    +
    A boolean that indicates whether the input element may be empty when a user submits the modal. +Defaults to false.
    +
    Expand source code @@ -1308,6 +1541,23 @@

    Inherited members

    """A block that collects information from users - it can hold a plain-text input element, a select menu element, a multi-select menu element, or a datepicker. https://api.slack.com/reference/block-kit/blocks#input + + Args: + label (required): A label that appears above an input element in the form of a text object + that must have type of plain_text. Maximum length for the text in this field is 2000 characters. + element (required): An plain-text input element, a checkbox element, a radio button element, + a select menu element, a multi-select menu element, or a datepicker. + block_id: A string acting as a unique identifier for a block. If not specified, one will be generated. + Maximum length for this field is 255 characters. + block_id should be unique for each message or view and each iteration of a message or view. + If a message or view is updated, use a new block_id. + hint: An optional hint that appears below an input element in a lighter grey. + It must be a text object with a type of plain_text. + Maximum length for the text in this field is 2000 characters. + dispatch_action: A boolean that indicates whether or not the use of elements in this block + should dispatch a block_actions payload. Defaults to false. + optional: A boolean that indicates whether the input element may be empty when a user submits the modal. + Defaults to false. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) @@ -1398,14 +1648,35 @@

    Inherited members

    class SectionBlock -(*, block_id: Optional[str] = None, text: Union[str, dict, TextObject] = None, fields: Sequence[Union[str, dict, TextObject]] = None, accessory: Union[dict, BlockElement, ForwardRef(None)] = None, **others: dict) +(*, block_id: Optional[str] = None, text: Union[str, dict, TextObject, ForwardRef(None)] = None, fields: Optional[Sequence[Union[str, dict, TextObject]]] = None, accessory: Union[dict, BlockElement, ForwardRef(None)] = None, **others: dict)

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

    A section is one of the most flexible blocks available. -https://api.slack.com/reference/block-kit/blocks#section

    +https://api.slack.com/reference/block-kit/blocks#section

    +

    Args

    +
    +
    block_id : required
    +
    A string acting as a unique identifier for a block. +If not specified, one will be generated. +You can use this block_id when you receive an interaction payload to identify the source of the action. +Maximum length for this field is 255 characters. +block_id should be unique for each message and each iteration of a message. +If a message is updated, use a new block_id.
    +
    text : preferred
    +
    The text for the block, in the form of a text object. +Maximum length for the text in this field is 3000 characters. +This field is not required if a valid array of fields objects is provided instead.
    +
    fields : required if no text is provided
    +
    Required if no text is provided. +An array of text objects. Any text objects included with fields will be rendered +in a compact format that allows for 2 columns of side-by-side text. +Maximum number of items is 10. Maximum length for the text in each item is 2000 characters.
    +
    accessory
    +
    One of the available element objects.
    +
    Expand source code @@ -1423,13 +1694,29 @@

    Inherited members

    self, *, block_id: Optional[str] = None, - text: Union[str, dict, TextObject] = None, - fields: Sequence[Union[str, dict, TextObject]] = None, + text: Optional[Union[str, dict, TextObject]] = None, + fields: Optional[Sequence[Union[str, dict, TextObject]]] = None, accessory: Optional[Union[dict, BlockElement]] = None, **others: dict, ): """A section is one of the most flexible blocks available. https://api.slack.com/reference/block-kit/blocks#section + + Args: + block_id (required): A string acting as a unique identifier for a block. + If not specified, one will be generated. + You can use this block_id when you receive an interaction payload to identify the source of the action. + Maximum length for this field is 255 characters. + block_id should be unique for each message and each iteration of a message. + If a message is updated, use a new block_id. + text (preferred): The text for the block, in the form of a text object. + Maximum length for the text in this field is 3000 characters. + This field is not required if a valid array of fields objects is provided instead. + fields (required if no text is provided): Required if no text is provided. + An array of text objects. Any text objects included with fields will be rendered + in a compact format that allows for 2 columns of side-by-side text. + Maximum number of items is 10. Maximum length for the text in each item is 2000 characters. + accessory: One of the available element objects. """ super().__init__(type=self.type, block_id=block_id) show_unknown_key_warning(self, others) diff --git a/docs/api-docs/slack_sdk/models/dialogs/index.html b/docs/api-docs/slack_sdk/models/dialogs/index.html index 8c7022bef..eefed238a 100644 --- a/docs/api-docs/slack_sdk/models/dialogs/index.html +++ b/docs/api-docs/slack_sdk/models/dialogs/index.html @@ -91,52 +91,52 @@

    Module slack_sdk.models.dialogs

    self.subtype = subtype @JsonValidator(f"name attribute cannot exceed {name_max_length} characters") - def name_length(self): + def name_length(self) -> bool: return len(self.name) < self.name_max_length @JsonValidator(f"label attribute cannot exceed {label_max_length} characters") - def label_length(self): + def label_length(self) -> bool: return len(self.label) < self.label_max_length @JsonValidator( f"placeholder attribute cannot exceed {placeholder_max_length} characters" ) - def placeholder_length(self): + def placeholder_length(self) -> bool: return ( self.placeholder is None or len(self.placeholder) < self.placeholder_max_length ) @JsonValidator(f"hint attribute cannot exceed {hint_max_length} characters") - def hint_length(self): + def hint_length(self) -> bool: return self.hint is None or len(self.hint) < self.hint_max_length @JsonValidator("value attribute exceeded bounds") - def value_length(self): + def value_length(self) -> bool: return self.value is None or len(self.value) < self.max_value_length @JsonValidator("min_length attribute must be greater than or equal to 0") - def min_length_above_zero(self): + def min_length_above_zero(self) -> bool: return self.min_length is None or self.min_length >= 0 @JsonValidator("min_length attribute exceed bounds") - def min_length_length(self): + def min_length_length(self) -> bool: return self.min_length is None or self.min_length <= self.max_value_length @JsonValidator("min_length attribute must be less than max value attribute") - def min_length_below_max_length(self): + def min_length_below_max_length(self) -> bool: return self.min_length is None or self.min_length < self.max_length @JsonValidator("max_length attribute must be greater than or equal to 0") - def max_length_above_zero(self): + def max_length_above_zero(self) -> bool: return self.max_length is None or self.max_length > 0 @JsonValidator("max_length attribute exceeded bounds") - def max_length_length(self): + def max_length_length(self) -> bool: return self.max_length is None or self.max_length <= self.max_value_length @EnumValidator("subtype", TextElementSubtypes) - def subtype_valid(self): + def subtype_valid(self) -> bool: return self.subtype is None or self.subtype in TextElementSubtypes @@ -185,8 +185,8 @@

    Module slack_sdk.models.dialogs

    name: str, label: str, optional: bool = False, - value: Union[Option, str] = None, - placeholder: str = None, + value: Optional[Union[Option, str]] = None, + placeholder: Optional[str] = None, ): self.name = name self.label = label @@ -196,24 +196,24 @@

    Module slack_sdk.models.dialogs

    self.type = "select" @JsonValidator(f"name attribute cannot exceed {name_max_length} characters") - def name_length(self): + def name_length(self) -> bool: return len(self.name) < self.name_max_length @JsonValidator(f"label attribute cannot exceed {label_max_length} characters") - def label_length(self): + def label_length(self) -> bool: return len(self.label) < self.label_max_length @JsonValidator( f"placeholder attribute cannot exceed {placeholder_max_length} characters" ) - def placeholder_length(self): + def placeholder_length(self) -> bool: return ( self.placeholder is None or len(self.placeholder) < self.placeholder_max_length ) @EnumValidator("data_source", DataSourceTypes) - def data_source_valid(self): + def data_source_valid(self) -> bool: return self.data_source in self.DataSourceTypes def to_dict(self) -> dict: # skipcq: PYL-W0221 @@ -251,8 +251,8 @@

    Module slack_sdk.models.dialogs

    label: str, options: Union[Sequence[Option], Sequence[OptionGroup]], optional: bool = False, - value: Union[Option, str] = None, - placeholder: str = None, + value: Optional[Union[Option, str]] = None, + placeholder: Optional[str] = None, ): """ Use the select element for multiple choice selections allowing users to pick @@ -285,7 +285,7 @@

    Module slack_sdk.models.dialogs

    self.options = options @JsonValidator(f"options attribute cannot exceed {options_max_length} items") - def options_length(self): + def options_length(self) -> bool: return len(self.options) < self.options_max_length def to_dict(self) -> dict: @@ -306,8 +306,8 @@

    Module slack_sdk.models.dialogs

    name: str, label: str, optional: bool = False, - value: str = None, - placeholder: str = None, + value: Optional[str] = None, + placeholder: Optional[str] = None, ): """ Now you can easily populate a select menu with a list of users. For example, @@ -344,8 +344,8 @@

    Module slack_sdk.models.dialogs

    name: str, label: str, optional: bool = False, - value: str = None, - placeholder: str = None, + value: Optional[str] = None, + placeholder: Optional[str] = None, ): """ You can also provide a select menu with a list of channels. Specify your @@ -380,8 +380,8 @@

    Module slack_sdk.models.dialogs

    name: str, label: str, optional: bool = False, - value: str = None, - placeholder: str = None, + value: Optional[str] = None, + placeholder: Optional[str] = None, ): """ You can also provide a select menu with a list of conversations - including @@ -423,7 +423,7 @@

    Module slack_sdk.models.dialogs

    value: Optional[Option] = None, min_query_length: Optional[int] = None, optional: Optional[bool] = False, - placeholder: str = None, + placeholder: Optional[str] = None, ): """ Use the select element for multiple choice selections allowing users to pick @@ -848,34 +848,34 @@

    Module slack_sdk.models.dialogs

    return self @JsonValidator("title attribute is required") - def title_present(self): + def title_present(self) -> bool: return self._title is not None @JsonValidator(f"title attribute cannot exceed {title_max_length} characters") - def title_length(self): + def title_length(self) -> bool: return self._title is not None and len(self._title) <= self.title_max_length @JsonValidator("callback_id attribute is required") - def callback_id_present(self): + def callback_id_present(self) -> bool: return self._callback_id is not None @JsonValidator(f"dialogs must contain between 1 and {elements_max_length} elements") - def elements_length(self): + def elements_length(self) -> bool: return 0 < len(self._elements) <= self.elements_max_length @JsonValidator(f"submit_label cannot exceed {submit_label_max_length} characters") - def submit_label_length(self): + def submit_label_length(self) -> bool: return ( self._submit_label is None or len(self._submit_label) <= self.submit_label_max_length ) @JsonValidator("submit_label can only be one word") - def submit_label_valid(self): + def submit_label_valid(self) -> bool: return self._submit_label is None or " " not in self._submit_label @JsonValidator(f"state cannot exceed {state_max_length} characters") - def state_length(self): + def state_length(self) -> bool: return not self._state or len(self._state) <= self.state_max_length def to_dict(self) -> dict: # skipcq: PYL-W0221 @@ -934,7 +934,7 @@

    Module slack_sdk.models.dialogs

    self.options = options @JsonValidator(f"options attribute cannot exceed {options_max_length} items") - def options_length(self): + def options_length(self) -> bool: return len(self.options) < self.options_max_length def to_dict(self) -> dict: @@ -957,7 +957,7 @@

    Classes

    class AbstractDialogSelector -(*, name: str, label: str, optional: bool = False, value: Union[Option, str] = None, placeholder: str = None) +(*, name: str, label: str, optional: bool = False, value: Union[Option, str, ForwardRef(None)] = None, placeholder: Optional[str] = None)

    The base class for JSON serializable class objects

    @@ -985,8 +985,8 @@

    Classes

    name: str, label: str, optional: bool = False, - value: Union[Option, str] = None, - placeholder: str = None, + value: Optional[Union[Option, str]] = None, + placeholder: Optional[str] = None, ): self.name = name self.label = label @@ -996,24 +996,24 @@

    Classes

    self.type = "select" @JsonValidator(f"name attribute cannot exceed {name_max_length} characters") - def name_length(self): + def name_length(self) -> bool: return len(self.name) < self.name_max_length @JsonValidator(f"label attribute cannot exceed {label_max_length} characters") - def label_length(self): + def label_length(self) -> bool: return len(self.label) < self.label_max_length @JsonValidator( f"placeholder attribute cannot exceed {placeholder_max_length} characters" ) - def placeholder_length(self): + def placeholder_length(self) -> bool: return ( self.placeholder is None or len(self.placeholder) < self.placeholder_max_length ) @EnumValidator("data_source", DataSourceTypes) - def data_source_valid(self): + def data_source_valid(self) -> bool: return self.data_source in self.DataSourceTypes def to_dict(self) -> dict: # skipcq: PYL-W0221 @@ -1081,7 +1081,7 @@

    Instance variables

    Methods

    -def data_source_valid(self) +def data_source_valid(self) ‑> bool
    @@ -1090,12 +1090,12 @@

    Methods

    Expand source code
    @EnumValidator("data_source", DataSourceTypes)
    -def data_source_valid(self):
    +def data_source_valid(self) -> bool:
         return self.data_source in self.DataSourceTypes
    -def label_length(self) +def label_length(self) ‑> bool
    @@ -1104,12 +1104,12 @@

    Methods

    Expand source code
    @JsonValidator(f"label attribute cannot exceed {label_max_length} characters")
    -def label_length(self):
    +def label_length(self) -> bool:
         return len(self.label) < self.label_max_length
    -def name_length(self) +def name_length(self) ‑> bool
    @@ -1118,12 +1118,12 @@

    Methods

    Expand source code
    @JsonValidator(f"name attribute cannot exceed {name_max_length} characters")
    -def name_length(self):
    +def name_length(self) -> bool:
         return len(self.name) < self.name_max_length
    -def placeholder_length(self) +def placeholder_length(self) ‑> bool
    @@ -1134,7 +1134,7 @@

    Methods

    @JsonValidator(
         f"placeholder attribute cannot exceed {placeholder_max_length} characters"
     )
    -def placeholder_length(self):
    +def placeholder_length(self) -> bool:
         return (
             self.placeholder is None
             or len(self.placeholder) < self.placeholder_max_length
    @@ -1226,7 +1226,7 @@ 

    Args

    self.options = options @JsonValidator(f"options attribute cannot exceed {options_max_length} items") - def options_length(self): + def options_length(self) -> bool: return len(self.options) < self.options_max_length def to_dict(self) -> dict: @@ -1258,7 +1258,7 @@

    Class variables

    Methods

    -def options_length(self) +def options_length(self) ‑> bool
    @@ -1267,7 +1267,7 @@

    Methods

    Expand source code
    @JsonValidator(f"options attribute cannot exceed {options_max_length} items")
    -def options_length(self):
    +def options_length(self) -> bool:
         return len(self.options) < self.options_max_length
    @@ -1689,34 +1689,34 @@

    Inherited members

    return self @JsonValidator("title attribute is required") - def title_present(self): + def title_present(self) -> bool: return self._title is not None @JsonValidator(f"title attribute cannot exceed {title_max_length} characters") - def title_length(self): + def title_length(self) -> bool: return self._title is not None and len(self._title) <= self.title_max_length @JsonValidator("callback_id attribute is required") - def callback_id_present(self): + def callback_id_present(self) -> bool: return self._callback_id is not None @JsonValidator(f"dialogs must contain between 1 and {elements_max_length} elements") - def elements_length(self): + def elements_length(self) -> bool: return 0 < len(self._elements) <= self.elements_max_length @JsonValidator(f"submit_label cannot exceed {submit_label_max_length} characters") - def submit_label_length(self): + def submit_label_length(self) -> bool: return ( self._submit_label is None or len(self._submit_label) <= self.submit_label_max_length ) @JsonValidator("submit_label can only be one word") - def submit_label_valid(self): + def submit_label_valid(self) -> bool: return self._submit_label is None or " " not in self._submit_label @JsonValidator(f"state cannot exceed {state_max_length} characters") - def state_length(self): + def state_length(self) -> bool: return not self._state or len(self._state) <= self.state_max_length def to_dict(self) -> dict: # skipcq: PYL-W0221 @@ -1787,7 +1787,7 @@

    Args

    -def callback_id_present(self) +def callback_id_present(self) ‑> bool
    @@ -1796,7 +1796,7 @@

    Args

    Expand source code
    @JsonValidator("callback_id attribute is required")
    -def callback_id_present(self):
    +def callback_id_present(self) -> bool:
         return self._callback_id is not None
    @@ -1927,7 +1927,7 @@

    Args

    -def elements_length(self) +def elements_length(self) ‑> bool
    @@ -1936,7 +1936,7 @@

    Args

    Expand source code
    @JsonValidator(f"dialogs must contain between 1 and {elements_max_length} elements")
    -def elements_length(self):
    +def elements_length(self) -> bool:
         return 0 < len(self._elements) <= self.elements_max_length
    @@ -2084,7 +2084,7 @@

    Args

    -def state_length(self) +def state_length(self) ‑> bool
    @@ -2093,7 +2093,7 @@

    Args

    Expand source code
    @JsonValidator(f"state cannot exceed {state_max_length} characters")
    -def state_length(self):
    +def state_length(self) -> bool:
         return not self._state or len(self._state) <= self.state_max_length
    @@ -2203,7 +2203,7 @@

    Args

    -def submit_label_length(self) +def submit_label_length(self) ‑> bool
    @@ -2212,7 +2212,7 @@

    Args

    Expand source code
    @JsonValidator(f"submit_label cannot exceed {submit_label_max_length} characters")
    -def submit_label_length(self):
    +def submit_label_length(self) -> bool:
         return (
             self._submit_label is None
             or len(self._submit_label) <= self.submit_label_max_length
    @@ -2220,7 +2220,7 @@ 

    Args

    -def submit_label_valid(self) +def submit_label_valid(self) ‑> bool
    @@ -2229,7 +2229,7 @@

    Args

    Expand source code
    @JsonValidator("submit_label can only be one word")
    -def submit_label_valid(self):
    +def submit_label_valid(self) -> bool:
         return self._submit_label is None or " " not in self._submit_label
    @@ -2447,7 +2447,7 @@

    Args

    -def title_length(self) +def title_length(self) ‑> bool
    @@ -2456,12 +2456,12 @@

    Args

    Expand source code
    @JsonValidator(f"title attribute cannot exceed {title_max_length} characters")
    -def title_length(self):
    +def title_length(self) -> bool:
         return self._title is not None and len(self._title) <= self.title_max_length
    -def title_present(self) +def title_present(self) ‑> bool
    @@ -2470,7 +2470,7 @@

    Args

    Expand source code
    @JsonValidator("title attribute is required")
    -def title_present(self):
    +def title_present(self) -> bool:
         return self._title is not None
    @@ -2555,7 +2555,7 @@

    Inherited members

    class DialogChannelSelector -(*, name: str, label: str, optional: bool = False, value: str = None, placeholder: str = None) +(*, name: str, label: str, optional: bool = False, value: Optional[str] = None, placeholder: Optional[str] = None)

    The base class for JSON serializable class objects

    @@ -2590,8 +2590,8 @@

    Args

    name: str, label: str, optional: bool = False, - value: str = None, - placeholder: str = None, + value: Optional[str] = None, + placeholder: Optional[str] = None, ): """ You can also provide a select menu with a list of channels. Specify your @@ -2647,7 +2647,7 @@

    Inherited members

    class DialogConversationSelector -(*, name: str, label: str, optional: bool = False, value: str = None, placeholder: str = None) +(*, name: str, label: str, optional: bool = False, value: Optional[str] = None, placeholder: Optional[str] = None)

    The base class for JSON serializable class objects

    @@ -2683,8 +2683,8 @@

    Args

    name: str, label: str, optional: bool = False, - value: str = None, - placeholder: str = None, + value: Optional[str] = None, + placeholder: Optional[str] = None, ): """ You can also provide a select menu with a list of conversations - including @@ -2741,7 +2741,7 @@

    Inherited members

    class DialogExternalSelector -(*, name: str, label: str, value: Optional[Option] = None, min_query_length: Optional[int] = None, optional: Optional[bool] = False, placeholder: str = None) +(*, name: str, label: str, value: Optional[Option] = None, min_query_length: Optional[int] = None, optional: Optional[bool] = False, placeholder: Optional[str] = None)

    The base class for JSON serializable class objects

    @@ -2790,7 +2790,7 @@

    Args

    value: Optional[Option] = None, min_query_length: Optional[int] = None, optional: Optional[bool] = False, - placeholder: str = None, + placeholder: Optional[str] = None, ): """ Use the select element for multiple choice selections allowing users to pick @@ -2867,7 +2867,7 @@

    Inherited members

    class DialogStaticSelector -(*, name: str, label: str, options: Union[Sequence[Option], Sequence[OptionGroup]], optional: bool = False, value: Union[Option, str] = None, placeholder: str = None) +(*, name: str, label: str, options: Union[Sequence[Option], Sequence[OptionGroup]], optional: bool = False, value: Union[Option, str, ForwardRef(None)] = None, placeholder: Optional[str] = None)

    Use the select element for multiple choice selections allowing users to pick a @@ -2922,8 +2922,8 @@

    Args

    label: str, options: Union[Sequence[Option], Sequence[OptionGroup]], optional: bool = False, - value: Union[Option, str] = None, - placeholder: str = None, + value: Optional[Union[Option, str]] = None, + placeholder: Optional[str] = None, ): """ Use the select element for multiple choice selections allowing users to pick @@ -2956,7 +2956,7 @@

    Args

    self.options = options @JsonValidator(f"options attribute cannot exceed {options_max_length} items") - def options_length(self): + def options_length(self) -> bool: return len(self.options) < self.options_max_length def to_dict(self) -> dict: @@ -2987,7 +2987,7 @@

    Class variables

    Methods

    -def options_length(self) +def options_length(self) ‑> bool
    @@ -2996,7 +2996,7 @@

    Methods

    Expand source code
    @JsonValidator(f"options attribute cannot exceed {options_max_length} items")
    -def options_length(self):
    +def options_length(self) -> bool:
         return len(self.options) < self.options_max_length
    @@ -3140,52 +3140,52 @@

    Inherited members

    self.subtype = subtype @JsonValidator(f"name attribute cannot exceed {name_max_length} characters") - def name_length(self): + def name_length(self) -> bool: return len(self.name) < self.name_max_length @JsonValidator(f"label attribute cannot exceed {label_max_length} characters") - def label_length(self): + def label_length(self) -> bool: return len(self.label) < self.label_max_length @JsonValidator( f"placeholder attribute cannot exceed {placeholder_max_length} characters" ) - def placeholder_length(self): + def placeholder_length(self) -> bool: return ( self.placeholder is None or len(self.placeholder) < self.placeholder_max_length ) @JsonValidator(f"hint attribute cannot exceed {hint_max_length} characters") - def hint_length(self): + def hint_length(self) -> bool: return self.hint is None or len(self.hint) < self.hint_max_length @JsonValidator("value attribute exceeded bounds") - def value_length(self): + def value_length(self) -> bool: return self.value is None or len(self.value) < self.max_value_length @JsonValidator("min_length attribute must be greater than or equal to 0") - def min_length_above_zero(self): + def min_length_above_zero(self) -> bool: return self.min_length is None or self.min_length >= 0 @JsonValidator("min_length attribute exceed bounds") - def min_length_length(self): + def min_length_length(self) -> bool: return self.min_length is None or self.min_length <= self.max_value_length @JsonValidator("min_length attribute must be less than max value attribute") - def min_length_below_max_length(self): + def min_length_below_max_length(self) -> bool: return self.min_length is None or self.min_length < self.max_length @JsonValidator("max_length attribute must be greater than or equal to 0") - def max_length_above_zero(self): + def max_length_above_zero(self) -> bool: return self.max_length is None or self.max_length > 0 @JsonValidator("max_length attribute exceeded bounds") - def max_length_length(self): + def max_length_length(self) -> bool: return self.max_length is None or self.max_length <= self.max_value_length @EnumValidator("subtype", TextElementSubtypes) - def subtype_valid(self): + def subtype_valid(self) -> bool: return self.subtype is None or self.subtype in TextElementSubtypes

    Ancestors

    @@ -3249,7 +3249,7 @@

    Instance variables

    Methods

    -def hint_length(self) +def hint_length(self) ‑> bool
    @@ -3258,12 +3258,12 @@

    Methods

    Expand source code
    @JsonValidator(f"hint attribute cannot exceed {hint_max_length} characters")
    -def hint_length(self):
    +def hint_length(self) -> bool:
         return self.hint is None or len(self.hint) < self.hint_max_length
    -def label_length(self) +def label_length(self) ‑> bool
    @@ -3272,12 +3272,12 @@

    Methods

    Expand source code
    @JsonValidator(f"label attribute cannot exceed {label_max_length} characters")
    -def label_length(self):
    +def label_length(self) -> bool:
         return len(self.label) < self.label_max_length
    -def max_length_above_zero(self) +def max_length_above_zero(self) ‑> bool
    @@ -3286,12 +3286,12 @@

    Methods

    Expand source code
    @JsonValidator("max_length attribute must be greater than or equal to 0")
    -def max_length_above_zero(self):
    +def max_length_above_zero(self) -> bool:
         return self.max_length is None or self.max_length > 0
    -def max_length_length(self) +def max_length_length(self) ‑> bool
    @@ -3300,12 +3300,12 @@

    Methods

    Expand source code
    @JsonValidator("max_length attribute exceeded bounds")
    -def max_length_length(self):
    +def max_length_length(self) -> bool:
         return self.max_length is None or self.max_length <= self.max_value_length
    -def min_length_above_zero(self) +def min_length_above_zero(self) ‑> bool
    @@ -3314,12 +3314,12 @@

    Methods

    Expand source code
    @JsonValidator("min_length attribute must be greater than or equal to 0")
    -def min_length_above_zero(self):
    +def min_length_above_zero(self) -> bool:
         return self.min_length is None or self.min_length >= 0
    -def min_length_below_max_length(self) +def min_length_below_max_length(self) ‑> bool
    @@ -3328,12 +3328,12 @@

    Methods

    Expand source code
    @JsonValidator("min_length attribute must be less than max value attribute")
    -def min_length_below_max_length(self):
    +def min_length_below_max_length(self) -> bool:
         return self.min_length is None or self.min_length < self.max_length
    -def min_length_length(self) +def min_length_length(self) ‑> bool
    @@ -3342,12 +3342,12 @@

    Methods

    Expand source code
    @JsonValidator("min_length attribute exceed bounds")
    -def min_length_length(self):
    +def min_length_length(self) -> bool:
         return self.min_length is None or self.min_length <= self.max_value_length
    -def name_length(self) +def name_length(self) ‑> bool
    @@ -3356,12 +3356,12 @@

    Methods

    Expand source code
    @JsonValidator(f"name attribute cannot exceed {name_max_length} characters")
    -def name_length(self):
    +def name_length(self) -> bool:
         return len(self.name) < self.name_max_length
    -def placeholder_length(self) +def placeholder_length(self) ‑> bool
    @@ -3372,7 +3372,7 @@

    Methods

    @JsonValidator(
         f"placeholder attribute cannot exceed {placeholder_max_length} characters"
     )
    -def placeholder_length(self):
    +def placeholder_length(self) -> bool:
         return (
             self.placeholder is None
             or len(self.placeholder) < self.placeholder_max_length
    @@ -3380,7 +3380,7 @@ 

    Methods

    -def subtype_valid(self) +def subtype_valid(self) ‑> bool
    @@ -3389,12 +3389,12 @@

    Methods

    Expand source code
    @EnumValidator("subtype", TextElementSubtypes)
    -def subtype_valid(self):
    +def subtype_valid(self) -> bool:
         return self.subtype is None or self.subtype in TextElementSubtypes
    -def value_length(self) +def value_length(self) ‑> bool
    @@ -3403,7 +3403,7 @@

    Methods

    Expand source code
    @JsonValidator("value attribute exceeded bounds")
    -def value_length(self):
    +def value_length(self) -> bool:
         return self.value is None or len(self.value) < self.max_value_length
    @@ -3476,7 +3476,7 @@

    Inherited members

    class DialogUserSelector -(*, name: str, label: str, optional: bool = False, value: str = None, placeholder: str = None) +(*, name: str, label: str, optional: bool = False, value: Optional[str] = None, placeholder: Optional[str] = None)

    The base class for JSON serializable class objects

    @@ -3513,8 +3513,8 @@

    Args

    name: str, label: str, optional: bool = False, - value: str = None, - placeholder: str = None, + value: Optional[str] = None, + placeholder: Optional[str] = None, ): """ Now you can easily populate a select menu with a list of users. For example, diff --git a/docs/api-docs/slack_sdk/models/index.html b/docs/api-docs/slack_sdk/models/index.html index ec635c990..52865da47 100644 --- a/docs/api-docs/slack_sdk/models/index.html +++ b/docs/api-docs/slack_sdk/models/index.html @@ -41,7 +41,7 @@

    Module slack_sdk.models

    # NOTE: used only for legacy components - don't use this for Block Kit def extract_json( item_or_items: Union[JsonObject, Sequence[JsonObject]], *format_args -) -> Union[Dict[Any, Any], List[Dict[Any, Any]]]: +) -> Union[Dict[Any, Any], List[Dict[Any, Any]]]: # type: ignore """ Given a sequence (or single item), attempt to call the to_dict() method on each item and return a plain list. If item is not the expected type, return it @@ -53,12 +53,12 @@

    Module slack_sdk.models

    method """ try: - return [ + return [ # type: ignore elem.to_dict(*format_args) if isinstance(elem, JsonObject) else elem for elem in item_or_items ] except TypeError: # not iterable, so try returning it as a single item - return ( + return ( # type: ignore item_or_items.to_dict(*format_args) if isinstance(item_or_items, JsonObject) else item_or_items @@ -139,7 +139,7 @@

    Args

    def extract_json(
         item_or_items: Union[JsonObject, Sequence[JsonObject]], *format_args
    -) -> Union[Dict[Any, Any], List[Dict[Any, Any]]]:
    +) -> Union[Dict[Any, Any], List[Dict[Any, Any]]]:  # type: ignore
         """
         Given a sequence (or single item), attempt to call the to_dict() method on each
         item and return a plain list. If item is not the expected type, return it
    @@ -151,12 +151,12 @@ 

    Args

    method """ try: - return [ + return [ # type: ignore elem.to_dict(*format_args) if isinstance(elem, JsonObject) else elem for elem in item_or_items ] except TypeError: # not iterable, so try returning it as a single item - return ( + return ( # type: ignore item_or_items.to_dict(*format_args) if isinstance(item_or_items, JsonObject) else item_or_items diff --git a/docs/api-docs/slack_sdk/models/messages/index.html b/docs/api-docs/slack_sdk/models/messages/index.html index bbba8cf6a..a9e816d1a 100644 --- a/docs/api-docs/slack_sdk/models/messages/index.html +++ b/docs/api-docs/slack_sdk/models/messages/index.html @@ -26,7 +26,7 @@

    Module slack_sdk.models.messages

    Expand source code -
    from datetime import datetime
    +
    from datetime import datetime  # type: ignore
     from typing import Optional, Union
     
     from slack_sdk.models.basic_objects import BaseObject
    @@ -61,7 +61,7 @@ 

    Module slack_sdk.models.messages

    https://api.slack.com/reference/surfaces/formatting#date-formatting """ if isinstance(date, datetime): - epoch = int(date.timestamp()) + epoch = int(date.timestamp()) # type: ignore else: epoch = date if link is not None: @@ -178,7 +178,7 @@

    Ancestors

    https://api.slack.com/reference/surfaces/formatting#date-formatting """ if isinstance(date, datetime): - epoch = int(date.timestamp()) + epoch = int(date.timestamp()) # type: ignore else: epoch = date if link is not None: diff --git a/docs/api-docs/slack_sdk/models/views/index.html b/docs/api-docs/slack_sdk/models/views/index.html index 7c6a50595..053932968 100644 --- a/docs/api-docs/slack_sdk/models/views/index.html +++ b/docs/api-docs/slack_sdk/models/views/index.html @@ -75,7 +75,7 @@

    Module slack_sdk.models.views

    app_id: Optional[str] = None, root_view_id: Optional[str] = None, previous_view_id: Optional[str] = None, - title: Union[str, dict, PlainTextObject] = None, + title: Optional[Union[str, dict, PlainTextObject]] = None, submit: Optional[Union[str, dict, PlainTextObject]] = None, close: Optional[Union[str, dict, PlainTextObject]] = None, blocks: Optional[Sequence[Union[dict, Block]]] = None, @@ -190,7 +190,9 @@

    Module slack_sdk.models.views

    if actions is None: # skipcq: PYL-R1724 continue elif isinstance(actions, dict): - new_actions = copy.copy(actions) + new_actions: Dict[str, Union[ViewStateValue, dict]] = copy.copy( + actions + ) for action_id, v in actions.items(): if isinstance(v, dict): d = copy.copy(v) @@ -285,7 +287,7 @@

    Classes

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

    View object for modals and Home tabs.

    @@ -335,7 +337,7 @@

    Classes

    app_id: Optional[str] = None, root_view_id: Optional[str] = None, previous_view_id: Optional[str] = None, - title: Union[str, dict, PlainTextObject] = None, + title: Optional[Union[str, dict, PlainTextObject]] = None, submit: Optional[Union[str, dict, PlainTextObject]] = None, close: Optional[Union[str, dict, PlainTextObject]] = None, blocks: Optional[Sequence[Union[dict, Block]]] = None, @@ -507,7 +509,9 @@

    Inherited members

    if actions is None: # skipcq: PYL-R1724 continue elif isinstance(actions, dict): - new_actions = copy.copy(actions) + new_actions: Dict[str, Union[ViewStateValue, dict]] = copy.copy( + actions + ) for action_id, v in actions.items(): if isinstance(v, dict): d = copy.copy(v) diff --git a/docs/api-docs/slack_sdk/oauth/installation_store/async_cacheable_installation_store.html b/docs/api-docs/slack_sdk/oauth/installation_store/async_cacheable_installation_store.html index 225640b40..9beeaa0c0 100644 --- a/docs/api-docs/slack_sdk/oauth/installation_store/async_cacheable_installation_store.html +++ b/docs/api-docs/slack_sdk/oauth/installation_store/async_cacheable_installation_store.html @@ -37,8 +37,8 @@

    Module slack_sdk.oauth.installation_store.async_cacheabl class AsyncCacheableInstallationStore(AsyncInstallationStore): underlying: AsyncInstallationStore - cached_bots: Dict[str, Bot] - cached_installations: Dict[str, Installation] + cached_bots: Dict[str, Bot] # type: ignore + cached_installations: Dict[str, Installation] # type: ignore def __init__(self, installation_store: AsyncInstallationStore): """A simple memory cache wrapper for any installation stores. @@ -54,7 +54,7 @@

    Module slack_sdk.oauth.installation_store.async_cacheabl def logger(self) -> Logger: return self.underlying.logger - async def async_save(self, installation: Installation): + async def async_save(self, installation: Installation): # type: ignore # Invalidate cache data for update operations key = f"{installation.enterprise_id or ''}-{installation.team_id or ''}" if key in self.cached_bots: @@ -64,14 +64,14 @@

    Module slack_sdk.oauth.installation_store.async_cacheabl self.cached_installations.pop(key) return await self.underlying.async_save(installation) - async def async_save_bot(self, bot: Bot): + async def async_save_bot(self, bot: Bot): # type: ignore # Invalidate cache data for update operations key = f"{bot.enterprise_id or ''}-{bot.team_id or ''}" if key in self.cached_bots: self.cached_bots.pop(key) return await self.underlying.async_save_bot(bot) - async def async_find_bot( + async def async_find_bot( # type: ignore self, *, enterprise_id: Optional[str], @@ -92,7 +92,7 @@

    Module slack_sdk.oauth.installation_store.async_cacheabl self.cached_bots[key] = bot return bot - async def async_find_installation( + async def async_find_installation( # type: ignore self, *, enterprise_id: Optional[str], @@ -209,8 +209,8 @@

    Args

    class AsyncCacheableInstallationStore(AsyncInstallationStore):
         underlying: AsyncInstallationStore
    -    cached_bots: Dict[str, Bot]
    -    cached_installations: Dict[str, Installation]
    +    cached_bots: Dict[str, Bot]  # type: ignore
    +    cached_installations: Dict[str, Installation]  # type: ignore
     
         def __init__(self, installation_store: AsyncInstallationStore):
             """A simple memory cache wrapper for any installation stores.
    @@ -226,7 +226,7 @@ 

    Args

    def logger(self) -> Logger: return self.underlying.logger - async def async_save(self, installation: Installation): + async def async_save(self, installation: Installation): # type: ignore # Invalidate cache data for update operations key = f"{installation.enterprise_id or ''}-{installation.team_id or ''}" if key in self.cached_bots: @@ -236,14 +236,14 @@

    Args

    self.cached_installations.pop(key) return await self.underlying.async_save(installation) - async def async_save_bot(self, bot: Bot): + async def async_save_bot(self, bot: Bot): # type: ignore # Invalidate cache data for update operations key = f"{bot.enterprise_id or ''}-{bot.team_id or ''}" if key in self.cached_bots: self.cached_bots.pop(key) return await self.underlying.async_save_bot(bot) - async def async_find_bot( + async def async_find_bot( # type: ignore self, *, enterprise_id: Optional[str], @@ -264,7 +264,7 @@

    Args

    self.cached_bots[key] = bot return bot - async def async_find_installation( + async def async_find_installation( # type: ignore self, *, enterprise_id: Optional[str], diff --git a/docs/api-docs/slack_sdk/oauth/installation_store/cacheable_installation_store.html b/docs/api-docs/slack_sdk/oauth/installation_store/cacheable_installation_store.html index 39168a9c4..1d24162bb 100644 --- a/docs/api-docs/slack_sdk/oauth/installation_store/cacheable_installation_store.html +++ b/docs/api-docs/slack_sdk/oauth/installation_store/cacheable_installation_store.html @@ -35,8 +35,8 @@

    Module slack_sdk.oauth.installation_store.cacheable_inst class CacheableInstallationStore(InstallationStore): underlying: InstallationStore - cached_bots: Dict[str, Bot] - cached_installations: Dict[str, Installation] + cached_bots: Dict[str, Bot] # type: ignore + cached_installations: Dict[str, Installation] # type: ignore def __init__(self, installation_store: InstallationStore): """A simple memory cache wrapper for any installation stores. @@ -52,7 +52,7 @@

    Module slack_sdk.oauth.installation_store.cacheable_inst def logger(self) -> Logger: return self.underlying.logger - def save(self, installation: Installation): + def save(self, installation: Installation): # type: ignore # Invalidate cache data for update operations key = f"{installation.enterprise_id or ''}-{installation.team_id or ''}" if key in self.cached_bots: @@ -63,14 +63,14 @@

    Module slack_sdk.oauth.installation_store.cacheable_inst return self.underlying.save(installation) - def save_bot(self, bot: Bot): + def save_bot(self, bot: Bot): # type: ignore # Invalidate cache data for update operations key = f"{bot.enterprise_id or ''}-{bot.team_id or ''}" if key in self.cached_bots: self.cached_bots.pop(key) return self.underlying.save_bot(bot) - def find_bot( + def find_bot( # type: ignore self, *, enterprise_id: Optional[str], @@ -91,7 +91,7 @@

    Module slack_sdk.oauth.installation_store.cacheable_inst self.cached_bots[key] = bot return bot - def find_installation( + def find_installation( # type: ignore self, *, enterprise_id: Optional[str], @@ -209,8 +209,8 @@

    Args

    class CacheableInstallationStore(InstallationStore):
         underlying: InstallationStore
    -    cached_bots: Dict[str, Bot]
    -    cached_installations: Dict[str, Installation]
    +    cached_bots: Dict[str, Bot]  # type: ignore
    +    cached_installations: Dict[str, Installation]  # type: ignore
     
         def __init__(self, installation_store: InstallationStore):
             """A simple memory cache wrapper for any installation stores.
    @@ -226,7 +226,7 @@ 

    Args

    def logger(self) -> Logger: return self.underlying.logger - def save(self, installation: Installation): + def save(self, installation: Installation): # type: ignore # Invalidate cache data for update operations key = f"{installation.enterprise_id or ''}-{installation.team_id or ''}" if key in self.cached_bots: @@ -237,14 +237,14 @@

    Args

    return self.underlying.save(installation) - def save_bot(self, bot: Bot): + def save_bot(self, bot: Bot): # type: ignore # Invalidate cache data for update operations key = f"{bot.enterprise_id or ''}-{bot.team_id or ''}" if key in self.cached_bots: self.cached_bots.pop(key) return self.underlying.save_bot(bot) - def find_bot( + def find_bot( # type: ignore self, *, enterprise_id: Optional[str], @@ -265,7 +265,7 @@

    Args

    self.cached_bots[key] = bot return bot - def find_installation( + def find_installation( # type: ignore self, *, enterprise_id: Optional[str], diff --git a/docs/api-docs/slack_sdk/oauth/installation_store/internals.html b/docs/api-docs/slack_sdk/oauth/installation_store/internals.html index 8b246a6a3..016e80f51 100644 --- a/docs/api-docs/slack_sdk/oauth/installation_store/internals.html +++ b/docs/api-docs/slack_sdk/oauth/installation_store/internals.html @@ -35,7 +35,7 @@

    Module slack_sdk.oauth.installation_store.internalsModule slack_sdk.oauth.installation_store.models.botExpand source code
    import re
    -from datetime import datetime
    +from datetime import datetime  # type: ignore
     from time import time
     from typing import Optional, Union, Dict, Any, Sequence
     
    @@ -100,7 +100,7 @@ 

    Module slack_sdk.oauth.installation_store.models.botModule slack_sdk.oauth.installation_store.models.botClasses

    self.bot_refresh_token = bot_refresh_token if bot_token_expires_at is not None: if type(bot_token_expires_at) == datetime: - self.bot_token_expires_at = int(bot_token_expires_at.timestamp()) + self.bot_token_expires_at = int(bot_token_expires_at.timestamp()) # type: ignore elif type(bot_token_expires_at) == str and not re.match( "^\\d+$", bot_token_expires_at ): @@ -257,9 +257,9 @@

    Classes

    self.is_enterprise_install = is_enterprise_install or False if type(installed_at) == float: - self.installed_at = installed_at + self.installed_at = installed_at # type: ignore elif type(installed_at) == datetime: - self.installed_at = installed_at.timestamp() + self.installed_at = installed_at.timestamp() # type: ignore elif type(installed_at) == str: if re.match("^\\d+.\\d+$", installed_at): self.installed_at = float(installed_at) diff --git a/docs/api-docs/slack_sdk/oauth/installation_store/models/installation.html b/docs/api-docs/slack_sdk/oauth/installation_store/models/installation.html index da8191b5a..4a794df53 100644 --- a/docs/api-docs/slack_sdk/oauth/installation_store/models/installation.html +++ b/docs/api-docs/slack_sdk/oauth/installation_store/models/installation.html @@ -27,7 +27,7 @@

    Module slack_sdk.oauth.installation_store.models.install Expand source code
    import re
    -from datetime import datetime
    +from datetime import datetime  # type: ignore
     from time import time
     from typing import Optional, Union, Dict, Any, Sequence
     
    @@ -130,7 +130,8 @@ 

    Module slack_sdk.oauth.installation_store.models.install self.bot_refresh_token = bot_refresh_token if bot_token_expires_at is not None: if type(bot_token_expires_at) == datetime: - self.bot_token_expires_at = int(bot_token_expires_at.timestamp()) + ts: float = bot_token_expires_at.timestamp() # type: ignore + self.bot_token_expires_at = int(ts) elif type(bot_token_expires_at) == str and not re.match( "^\\d+$", bot_token_expires_at ): @@ -138,7 +139,7 @@

    Module slack_sdk.oauth.installation_store.models.install _from_iso_format_to_unix_timestamp(bot_token_expires_at) ) else: - self.bot_token_expires_at = bot_token_expires_at + self.bot_token_expires_at = bot_token_expires_at # type: ignore elif bot_token_expires_in is not None: self.bot_token_expires_at = int(time()) + bot_token_expires_in else: @@ -153,7 +154,8 @@

    Module slack_sdk.oauth.installation_store.models.install self.user_refresh_token = user_refresh_token if user_token_expires_at is not None: if type(user_token_expires_at) == datetime: - self.user_token_expires_at = int(user_token_expires_at.timestamp()) + ts: float = user_token_expires_at.timestamp() # type: ignore + self.user_token_expires_at = int(ts) elif type(user_token_expires_at) == str and not re.match( "^\\d+$", user_token_expires_at ): @@ -161,7 +163,7 @@

    Module slack_sdk.oauth.installation_store.models.install _from_iso_format_to_unix_timestamp(user_token_expires_at) ) else: - self.user_token_expires_at = user_token_expires_at + self.user_token_expires_at = user_token_expires_at # type: ignore elif user_token_expires_in is not None: self.user_token_expires_at = int(time()) + user_token_expires_in else: @@ -178,9 +180,9 @@

    Module slack_sdk.oauth.installation_store.models.install if installed_at is None: self.installed_at = datetime.now().timestamp() elif type(installed_at) == float: - self.installed_at = installed_at + self.installed_at = installed_at # type: ignore elif type(installed_at) == datetime: - self.installed_at = installed_at.timestamp() + self.installed_at = installed_at.timestamp() # type: ignore elif type(installed_at) == str: if re.match("^\\d+.\\d+$", installed_at): self.installed_at = float(installed_at) @@ -365,7 +367,8 @@

    Classes

    self.bot_refresh_token = bot_refresh_token if bot_token_expires_at is not None: if type(bot_token_expires_at) == datetime: - self.bot_token_expires_at = int(bot_token_expires_at.timestamp()) + ts: float = bot_token_expires_at.timestamp() # type: ignore + self.bot_token_expires_at = int(ts) elif type(bot_token_expires_at) == str and not re.match( "^\\d+$", bot_token_expires_at ): @@ -373,7 +376,7 @@

    Classes

    _from_iso_format_to_unix_timestamp(bot_token_expires_at) ) else: - self.bot_token_expires_at = bot_token_expires_at + self.bot_token_expires_at = bot_token_expires_at # type: ignore elif bot_token_expires_in is not None: self.bot_token_expires_at = int(time()) + bot_token_expires_in else: @@ -388,7 +391,8 @@

    Classes

    self.user_refresh_token = user_refresh_token if user_token_expires_at is not None: if type(user_token_expires_at) == datetime: - self.user_token_expires_at = int(user_token_expires_at.timestamp()) + ts: float = user_token_expires_at.timestamp() # type: ignore + self.user_token_expires_at = int(ts) elif type(user_token_expires_at) == str and not re.match( "^\\d+$", user_token_expires_at ): @@ -396,7 +400,7 @@

    Classes

    _from_iso_format_to_unix_timestamp(user_token_expires_at) ) else: - self.user_token_expires_at = user_token_expires_at + self.user_token_expires_at = user_token_expires_at # type: ignore elif user_token_expires_in is not None: self.user_token_expires_at = int(time()) + user_token_expires_in else: @@ -413,9 +417,9 @@

    Classes

    if installed_at is None: self.installed_at = datetime.now().timestamp() elif type(installed_at) == float: - self.installed_at = installed_at + self.installed_at = installed_at # type: ignore elif type(installed_at) == datetime: - self.installed_at = installed_at.timestamp() + self.installed_at = installed_at.timestamp() # type: ignore elif type(installed_at) == str: if re.match("^\\d+.\\d+$", installed_at): self.installed_at = float(installed_at) diff --git a/docs/api-docs/slack_sdk/oauth/installation_store/sqlalchemy/index.html b/docs/api-docs/slack_sdk/oauth/installation_store/sqlalchemy/index.html index 9bd3843ab..e38b21175 100644 --- a/docs/api-docs/slack_sdk/oauth/installation_store/sqlalchemy/index.html +++ b/docs/api-docs/slack_sdk/oauth/installation_store/sqlalchemy/index.html @@ -93,7 +93,7 @@

    Module slack_sdk.oauth.installation_store.sqlalchemyModule slack_sdk.oauth.installation_store.sqlalchemyModule slack_sdk.oauth.installation_store.sqlalchemyModule slack_sdk.oauth.installation_store.sqlalchemyClasses

    "installed_at", DateTime, nullable=False, - default=sqlalchemy.sql.func.now(), + default=sqlalchemy.sql.func.now(), # type: ignore ), Index( f"{table_name}_idx", @@ -496,7 +496,7 @@

    Classes

    "installed_at", DateTime, nullable=False, - default=sqlalchemy.sql.func.now(), + default=sqlalchemy.sql.func.now(), # type: ignore ), Index( f"{table_name}_idx", @@ -623,7 +623,7 @@

    Classes

    with self.engine.connect() as conn: result: object = conn.execute(query) - for row in result: + for row in result: # type: ignore return Bot( app_id=row["app_id"], enterprise_id=row["enterprise_id"], @@ -671,7 +671,7 @@

    Classes

    with self.engine.connect() as conn: result: object = conn.execute(query) - for row in result: + for row in result: # type: ignore return Installation( app_id=row["app_id"], enterprise_id=row["enterprise_id"], @@ -813,7 +813,7 @@

    Static methods

    "installed_at", DateTime, nullable=False, - default=sqlalchemy.sql.func.now(), + default=sqlalchemy.sql.func.now(), # type: ignore ), Index( f"{table_name}_idx", @@ -868,7 +868,7 @@

    Static methods

    "installed_at", DateTime, nullable=False, - default=sqlalchemy.sql.func.now(), + default=sqlalchemy.sql.func.now(), # type: ignore ), Index( f"{table_name}_idx", diff --git a/docs/api-docs/slack_sdk/oauth/state_store/sqlalchemy/index.html b/docs/api-docs/slack_sdk/oauth/state_store/sqlalchemy/index.html index 6711e3262..ac1ee60f9 100644 --- a/docs/api-docs/slack_sdk/oauth/state_store/sqlalchemy/index.html +++ b/docs/api-docs/slack_sdk/oauth/state_store/sqlalchemy/index.html @@ -28,7 +28,7 @@

    Module slack_sdk.oauth.state_store.sqlalchemy

    import logging
     import time
    -from datetime import datetime
    +from datetime import datetime  # type: ignore
     from logging import Logger
     from uuid import uuid4
     
    diff --git a/docs/api-docs/slack_sdk/oauth/token_rotation/async_rotator.html b/docs/api-docs/slack_sdk/oauth/token_rotation/async_rotator.html
    index b59515686..f6f18367c 100644
    --- a/docs/api-docs/slack_sdk/oauth/token_rotation/async_rotator.html
    +++ b/docs/api-docs/slack_sdk/oauth/token_rotation/async_rotator.html
    @@ -50,12 +50,12 @@ 

    Module slack_sdk.oauth.token_rotation.async_rotatorModule slack_sdk.oauth.token_rotation.async_rotatorModule slack_sdk.oauth.token_rotation.async_rotatorModule slack_sdk.oauth.token_rotation.async_rotatorModule slack_sdk.oauth.token_rotation.async_rotatorModule slack_sdk.oauth.token_rotation.async_rotator

    @@ -213,12 +211,12 @@

    Classes

    self.client_id = client_id self.client_secret = client_secret - async def perform_token_rotation( + async def perform_token_rotation( # type: ignore self, *, installation: Installation, minutes_before_expiration: int = 120, # 2 hours by default - ) -> Optional[Installation]: + ) -> Optional[Installation]: # type: ignore """Performs token rotation if the underlying tokens (bot / user) are expired / expiring. Args: @@ -232,29 +230,27 @@

    Classes

    # TODO: make the following two calls in parallel for better performance # bot - rotated_bot: Optional[Bot] = await self.perform_bot_token_rotation( + rotated_bot: Optional[Bot] = await self.perform_bot_token_rotation( # type: ignore bot=installation.to_bot(), minutes_before_expiration=minutes_before_expiration, ) # user - rotated_installation: Optional[ - Installation - ] = await self.perform_user_token_rotation( + rotated_installation = await self.perform_user_token_rotation( installation=installation, minutes_before_expiration=minutes_before_expiration, ) if rotated_bot is not None: if rotated_installation is None: - rotated_installation = Installation(**installation.to_dict()) + rotated_installation = Installation(**installation.to_dict()) # type: ignore rotated_installation.bot_token = rotated_bot.bot_token rotated_installation.bot_refresh_token = rotated_bot.bot_refresh_token rotated_installation.bot_token_expires_at = rotated_bot.bot_token_expires_at - return rotated_installation + return rotated_installation # type: ignore - async def perform_bot_token_rotation( + async def perform_bot_token_rotation( # type: ignore self, *, bot: Bot, @@ -286,7 +282,7 @@

    Classes

    if refresh_response.get("token_type") != "bot": return None - refreshed_bot = Bot(**bot.to_dict()) + refreshed_bot = Bot(**bot.to_dict()) # type: ignore refreshed_bot.bot_token = refresh_response.get("access_token") refreshed_bot.bot_refresh_token = refresh_response.get("refresh_token") refreshed_bot.bot_token_expires_at = int(time()) + int( @@ -297,12 +293,12 @@

    Classes

    except SlackApiError as e: raise SlackTokenRotationError(e) - async def perform_user_token_rotation( + async def perform_user_token_rotation( # type: ignore self, *, installation: Installation, minutes_before_expiration: int = 120, # 2 hours by default - ) -> Optional[Bot]: + ) -> Optional[Bot]: # type: ignore """Performs user token rotation if the underlying user token is expired / expiring. Args: @@ -327,7 +323,7 @@

    Classes

    if refresh_response.get("token_type") != "user": return None - refreshed_installation = Installation(**installation.to_dict()) + refreshed_installation = Installation(**installation.to_dict()) # type: ignore refreshed_installation.user_token = refresh_response.get("access_token") refreshed_installation.user_refresh_token = refresh_response.get( "refresh_token" @@ -335,7 +331,7 @@

    Classes

    refreshed_installation.user_token_expires_at = int(time()) + int( refresh_response.get("expires_in") ) - return refreshed_installation + return refreshed_installation # type: ignore except SlackApiError as e: raise SlackTokenRotationError(e)

    @@ -375,7 +371,7 @@

    Returns

    Expand source code -
    async def perform_bot_token_rotation(
    +
    async def perform_bot_token_rotation(  # type: ignore
         self,
         *,
         bot: Bot,
    @@ -407,7 +403,7 @@ 

    Returns

    if refresh_response.get("token_type") != "bot": return None - refreshed_bot = Bot(**bot.to_dict()) + refreshed_bot = Bot(**bot.to_dict()) # type: ignore refreshed_bot.bot_token = refresh_response.get("access_token") refreshed_bot.bot_refresh_token = refresh_response.get("refresh_token") refreshed_bot.bot_token_expires_at = int(time()) + int( @@ -437,12 +433,12 @@

    Returns

    Expand source code -
    async def perform_token_rotation(
    +
    async def perform_token_rotation(  # type: ignore
         self,
         *,
         installation: Installation,
         minutes_before_expiration: int = 120,  # 2 hours by default
    -) -> Optional[Installation]:
    +) -> Optional[Installation]:  # type: ignore
         """Performs token rotation if the underlying tokens (bot / user) are expired / expiring.
     
         Args:
    @@ -456,27 +452,25 @@ 

    Returns

    # TODO: make the following two calls in parallel for better performance # bot - rotated_bot: Optional[Bot] = await self.perform_bot_token_rotation( + rotated_bot: Optional[Bot] = await self.perform_bot_token_rotation( # type: ignore bot=installation.to_bot(), minutes_before_expiration=minutes_before_expiration, ) # user - rotated_installation: Optional[ - Installation - ] = await self.perform_user_token_rotation( + rotated_installation = await self.perform_user_token_rotation( installation=installation, minutes_before_expiration=minutes_before_expiration, ) if rotated_bot is not None: if rotated_installation is None: - rotated_installation = Installation(**installation.to_dict()) + rotated_installation = Installation(**installation.to_dict()) # type: ignore rotated_installation.bot_token = rotated_bot.bot_token rotated_installation.bot_refresh_token = rotated_bot.bot_refresh_token rotated_installation.bot_token_expires_at = rotated_bot.bot_token_expires_at - return rotated_installation
    + return rotated_installation # type: ignore

    @@ -497,12 +491,12 @@

    Returns

    Expand source code -
    async def perform_user_token_rotation(
    +
    async def perform_user_token_rotation(  # type: ignore
         self,
         *,
         installation: Installation,
         minutes_before_expiration: int = 120,  # 2 hours by default
    -) -> Optional[Bot]:
    +) -> Optional[Bot]:  # type: ignore
         """Performs user token rotation if the underlying user token is expired / expiring.
     
         Args:
    @@ -527,7 +521,7 @@ 

    Returns

    if refresh_response.get("token_type") != "user": return None - refreshed_installation = Installation(**installation.to_dict()) + refreshed_installation = Installation(**installation.to_dict()) # type: ignore refreshed_installation.user_token = refresh_response.get("access_token") refreshed_installation.user_refresh_token = refresh_response.get( "refresh_token" @@ -535,7 +529,7 @@

    Returns

    refreshed_installation.user_token_expires_at = int(time()) + int( refresh_response.get("expires_in") ) - return refreshed_installation + return refreshed_installation # type: ignore except SlackApiError as e: raise SlackTokenRotationError(e)
    diff --git a/docs/api-docs/slack_sdk/oauth/token_rotation/rotator.html b/docs/api-docs/slack_sdk/oauth/token_rotation/rotator.html index 96d2291c0..4f2370c5a 100644 --- a/docs/api-docs/slack_sdk/oauth/token_rotation/rotator.html +++ b/docs/api-docs/slack_sdk/oauth/token_rotation/rotator.html @@ -46,7 +46,7 @@

    Module slack_sdk.oauth.token_rotation.rotator

    Module slack_sdk.oauth.token_rotation.rotatorModule slack_sdk.oauth.token_rotation.rotatorModule slack_sdk.oauth.token_rotation.rotatorModule slack_sdk.oauth.token_rotation.rotatorClasses self.client_id = client_id self.client_secret = client_secret - def perform_token_rotation( + def perform_token_rotation( # type: ignore self, *, installation: Installation, @@ -221,27 +221,27 @@

    Classes

    # TODO: make the following two calls in parallel for better performance # bot - rotated_bot: Optional[Bot] = self.perform_bot_token_rotation( + rotated_bot: Optional[Bot] = self.perform_bot_token_rotation( # type: ignore bot=installation.to_bot(), minutes_before_expiration=minutes_before_expiration, ) # user - rotated_installation: Optional[Installation] = self.perform_user_token_rotation( + rotated_installation: Optional[Installation] = self.perform_user_token_rotation( # type: ignore installation=installation, minutes_before_expiration=minutes_before_expiration, ) if rotated_bot is not None: if rotated_installation is None: - rotated_installation = Installation(**installation.to_dict()) + rotated_installation = Installation(**installation.to_dict()) # type: ignore rotated_installation.bot_token = rotated_bot.bot_token rotated_installation.bot_refresh_token = rotated_bot.bot_refresh_token rotated_installation.bot_token_expires_at = rotated_bot.bot_token_expires_at return rotated_installation - def perform_bot_token_rotation( + def perform_bot_token_rotation( # type: ignore self, *, bot: Bot, @@ -271,7 +271,7 @@

    Classes

    if refresh_response.get("token_type") != "bot": return None - refreshed_bot = Bot(**bot.to_dict()) + refreshed_bot = Bot(**bot.to_dict()) # type: ignore refreshed_bot.bot_token = refresh_response.get("access_token") refreshed_bot.bot_refresh_token = refresh_response.get("refresh_token") refreshed_bot.bot_token_expires_at = int(time()) + int( @@ -282,12 +282,12 @@

    Classes

    except SlackApiError as e: raise SlackTokenRotationError(e) - def perform_user_token_rotation( + def perform_user_token_rotation( # type: ignore self, *, installation: Installation, minutes_before_expiration: int = 120, # 2 hours by default - ) -> Optional[Bot]: + ) -> Optional[Installation]: """Performs user token rotation if the underlying user token is expired / expiring. Args: @@ -313,7 +313,7 @@

    Classes

    if refresh_response.get("token_type") != "user": return None - refreshed_installation = Installation(**installation.to_dict()) + refreshed_installation = Installation(**installation.to_dict()) # type: ignore refreshed_installation.user_token = refresh_response.get("access_token") refreshed_installation.user_refresh_token = refresh_response.get( "refresh_token" @@ -361,7 +361,7 @@

    Returns

    Expand source code -
    def perform_bot_token_rotation(
    +
    def perform_bot_token_rotation(  # type: ignore
         self,
         *,
         bot: Bot,
    @@ -391,7 +391,7 @@ 

    Returns

    if refresh_response.get("token_type") != "bot": return None - refreshed_bot = Bot(**bot.to_dict()) + refreshed_bot = Bot(**bot.to_dict()) # type: ignore refreshed_bot.bot_token = refresh_response.get("access_token") refreshed_bot.bot_refresh_token = refresh_response.get("refresh_token") refreshed_bot.bot_token_expires_at = int(time()) + int( @@ -421,7 +421,7 @@

    Returns

    Expand source code -
    def perform_token_rotation(
    +
    def perform_token_rotation(  # type: ignore
         self,
         *,
         installation: Installation,
    @@ -440,20 +440,20 @@ 

    Returns

    # TODO: make the following two calls in parallel for better performance # bot - rotated_bot: Optional[Bot] = self.perform_bot_token_rotation( + rotated_bot: Optional[Bot] = self.perform_bot_token_rotation( # type: ignore bot=installation.to_bot(), minutes_before_expiration=minutes_before_expiration, ) # user - rotated_installation: Optional[Installation] = self.perform_user_token_rotation( + rotated_installation: Optional[Installation] = self.perform_user_token_rotation( # type: ignore installation=installation, minutes_before_expiration=minutes_before_expiration, ) if rotated_bot is not None: if rotated_installation is None: - rotated_installation = Installation(**installation.to_dict()) + rotated_installation = Installation(**installation.to_dict()) # type: ignore rotated_installation.bot_token = rotated_bot.bot_token rotated_installation.bot_refresh_token = rotated_bot.bot_refresh_token rotated_installation.bot_token_expires_at = rotated_bot.bot_token_expires_at @@ -462,7 +462,7 @@

    Returns

    -def perform_user_token_rotation(self, *, installation: Installation, minutes_before_expiration: int = 120) ‑> Optional[Bot] +def perform_user_token_rotation(self, *, installation: Installation, minutes_before_expiration: int = 120) ‑> Optional[Installation]

    Performs user token rotation if the underlying user token is expired / expiring.

    @@ -479,12 +479,12 @@

    Returns

    Expand source code -
    def perform_user_token_rotation(
    +
    def perform_user_token_rotation(  # type: ignore
         self,
         *,
         installation: Installation,
         minutes_before_expiration: int = 120,  # 2 hours by default
    -) -> Optional[Bot]:
    +) -> Optional[Installation]:
         """Performs user token rotation if the underlying user token is expired / expiring.
     
         Args:
    @@ -510,7 +510,7 @@ 

    Returns

    if refresh_response.get("token_type") != "user": return None - refreshed_installation = Installation(**installation.to_dict()) + refreshed_installation = Installation(**installation.to_dict()) # type: ignore refreshed_installation.user_token = refresh_response.get("access_token") refreshed_installation.user_refresh_token = refresh_response.get( "refresh_token" diff --git a/docs/api-docs/slack_sdk/rtm/index.html b/docs/api-docs/slack_sdk/rtm/index.html index 34125218c..5d1a08373 100644 --- a/docs/api-docs/slack_sdk/rtm/index.html +++ b/docs/api-docs/slack_sdk/rtm/index.html @@ -585,11 +585,11 @@

    Module slack_sdk.rtm

    else: resp = self._web_client.rtm_connect() - url = resp.get("url") + url = resp.get("url") # type: ignore if url is None: msg = "Unable to retrieve RTM URL from Slack." raise client_err.SlackApiError(message=msg, response=resp) - return url, resp.data + return url, resp.data # type: ignore async def _wait_exponentially(self, exception, max_wait_time=300): """Wait exponentially longer for each connection attempt. @@ -1264,11 +1264,11 @@

    Note

    else: resp = self._web_client.rtm_connect() - url = resp.get("url") + url = resp.get("url") # type: ignore if url is None: msg = "Unable to retrieve RTM URL from Slack." raise client_err.SlackApiError(message=msg, response=resp) - return url, resp.data + return url, resp.data # type: ignore async def _wait_exponentially(self, exception, max_wait_time=300): """Wait exponentially longer for each connection attempt. diff --git a/docs/api-docs/slack_sdk/rtm_v2/index.html b/docs/api-docs/slack_sdk/rtm_v2/index.html index 9bcf169cb..74e64b641 100644 --- a/docs/api-docs/slack_sdk/rtm_v2/index.html +++ b/docs/api-docs/slack_sdk/rtm_v2/index.html @@ -52,7 +52,7 @@

    Module slack_sdk.rtm_v2

    default_auto_reconnect_enabled: bool auto_reconnect_enabled: bool ssl: Optional[SSLContext] - proxy: str + proxy: Optional[str] timeout: int base_url: str ping_interval: int @@ -472,7 +472,7 @@

    Classes

    default_auto_reconnect_enabled: bool auto_reconnect_enabled: bool ssl: Optional[SSLContext] - proxy: str + proxy: Optional[str] timeout: int base_url: str ping_interval: int @@ -936,7 +936,7 @@

    Class variables

    -
    var proxy : str
    +
    var proxy : Optional[str]
    diff --git a/docs/api-docs/slack_sdk/scim/v1/async_client.html b/docs/api-docs/slack_sdk/scim/v1/async_client.html index d5b5efabf..0ba57d843 100644 --- a/docs/api-docs/slack_sdk/scim/v1/async_client.html +++ b/docs/api-docs/slack_sdk/scim/v1/async_client.html @@ -198,10 +198,11 @@

    Module slack_sdk.scim.v1.async_client

    async def update_user( self, user: Union[Dict[str, Any], User] ) -> UserUpdateResponse: + user_id = user.id if isinstance(user, User) else user["id"] return UserUpdateResponse( await self.api_call( http_verb="PUT", - path=f"Users/{quote(user.id)}", + path=f"Users/{quote(user_id)}", body_params=user.to_dict() if isinstance(user, User) else _to_dict_without_not_given(user), @@ -274,10 +275,11 @@

    Module slack_sdk.scim.v1.async_client

    async def update_group( self, group: Union[Dict[str, Any], Group] ) -> GroupUpdateResponse: + group_id = group.id if isinstance(group, Group) else group["id"] return GroupUpdateResponse( await self.api_call( http_verb="PUT", - path=f"Groups/{quote(group.id)}", + path=f"Groups/{quote(group_id)}", body_params=group.to_dict() if isinstance(group, Group) else _to_dict_without_not_given(group), @@ -299,8 +301,8 @@

    Module slack_sdk.scim.v1.async_client

    *, http_verb: str, path: str, - query_params: Optional[Dict[str, any]] = None, - body_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, + body_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> SCIMResponse: url = f"{self.base_url}{path}" @@ -636,10 +638,11 @@

    Args

    async def update_user( self, user: Union[Dict[str, Any], User] ) -> UserUpdateResponse: + user_id = user.id if isinstance(user, User) else user["id"] return UserUpdateResponse( await self.api_call( http_verb="PUT", - path=f"Users/{quote(user.id)}", + path=f"Users/{quote(user_id)}", body_params=user.to_dict() if isinstance(user, User) else _to_dict_without_not_given(user), @@ -712,10 +715,11 @@

    Args

    async def update_group( self, group: Union[Dict[str, Any], Group] ) -> GroupUpdateResponse: + group_id = group.id if isinstance(group, Group) else group["id"] return GroupUpdateResponse( await self.api_call( http_verb="PUT", - path=f"Groups/{quote(group.id)}", + path=f"Groups/{quote(group_id)}", body_params=group.to_dict() if isinstance(group, Group) else _to_dict_without_not_given(group), @@ -737,8 +741,8 @@

    Args

    *, http_verb: str, path: str, - query_params: Optional[Dict[str, any]] = None, - body_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, + body_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> SCIMResponse: url = f"{self.base_url}{path}" @@ -949,7 +953,7 @@

    Class variables

    Methods

    -async def api_call(self, *, http_verb: str, path: str, query_params: Optional[Dict[str, ]] = None, body_params: Optional[Dict[str, ]] = None, headers: Optional[Dict[str, str]] = None) ‑> SCIMResponse +async def api_call(self, *, http_verb: str, path: str, query_params: Optional[Dict[str, Any]] = None, body_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None) ‑> SCIMResponse
    @@ -962,8 +966,8 @@

    Methods

    *, http_verb: str, path: str, - query_params: Optional[Dict[str, any]] = None, - body_params: Optional[Dict[str, any]] = None, + query_params: Optional[Dict[str, Any]] = None, + body_params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> SCIMResponse: url = f"{self.base_url}{path}" @@ -1212,10 +1216,11 @@

    Methods

    async def update_group(
         self, group: Union[Dict[str, Any], Group]
     ) -> GroupUpdateResponse:
    +    group_id = group.id if isinstance(group, Group) else group["id"]
         return GroupUpdateResponse(
             await self.api_call(
                 http_verb="PUT",
    -            path=f"Groups/{quote(group.id)}",
    +            path=f"Groups/{quote(group_id)}",
                 body_params=group.to_dict()
                 if isinstance(group, Group)
                 else _to_dict_without_not_given(group),
    @@ -1235,10 +1240,11 @@ 

    Methods

    async def update_user(
         self, user: Union[Dict[str, Any], User]
     ) -> UserUpdateResponse:
    +    user_id = user.id if isinstance(user, User) else user["id"]
         return UserUpdateResponse(
             await self.api_call(
                 http_verb="PUT",
    -            path=f"Users/{quote(user.id)}",
    +            path=f"Users/{quote(user_id)}",
                 body_params=user.to_dict()
                 if isinstance(user, User)
                 else _to_dict_without_not_given(user),
    diff --git a/docs/api-docs/slack_sdk/scim/v1/client.html b/docs/api-docs/slack_sdk/scim/v1/client.html
    index be97e4254..84ab5f885 100644
    --- a/docs/api-docs/slack_sdk/scim/v1/client.html
    +++ b/docs/api-docs/slack_sdk/scim/v1/client.html
    @@ -195,10 +195,11 @@ 

    Module slack_sdk.scim.v1.client

    ) def update_user(self, user: Union[Dict[str, Any], User]) -> UserUpdateResponse: + user_id = user.id if isinstance(user, User) else user["id"] return UserUpdateResponse( self.api_call( http_verb="PUT", - path=f"Users/{quote(user.id)}", + path=f"Users/{quote(user_id)}", body_params=user.to_dict() if isinstance(user, User) else _to_dict_without_not_given(user), @@ -267,10 +268,11 @@

    Module slack_sdk.scim.v1.client

    ) def update_group(self, group: Union[Dict[str, Any], Group]) -> GroupUpdateResponse: + group_id = group.id if isinstance(group, Group) else group["id"] return GroupUpdateResponse( self.api_call( http_verb="PUT", - path=f"Groups/{quote(group.id)}", + path=f"Groups/{quote(group_id)}", body_params=group.to_dict() if isinstance(group, Group) else _to_dict_without_not_given(group), @@ -367,11 +369,20 @@

    Module slack_sdk.scim.v1.client

    url=url, status_code=e.code, raw_body=response_body, - headers=e.headers, + headers=dict(e.headers.items()), ) if e.code == 429: # for backward-compatibility with WebClient (v.2.5.0 or older) - resp.headers["Retry-After"] = resp.headers["retry-after"] + if ( + "retry-after" not in resp.headers + and "Retry-After" in resp.headers + ): + resp.headers["retry-after"] = resp.headers["Retry-After"] + if ( + "Retry-After" not in resp.headers + and "retry-after" in resp.headers + ): + resp.headers["Retry-After"] = resp.headers["retry-after"] _debug_log_response(self.logger, resp) # Try to find a retry handler for this error @@ -460,20 +471,20 @@

    Module slack_sdk.scim.v1.client

    raise SlackRequestError(f"Invalid URL detected: {url}") # NOTE: BAN-B310 is already checked above - resp: Optional[HTTPResponse] = None + http_resp: Optional[HTTPResponse] = None if opener: - resp = opener.open(req, timeout=self.timeout) # skipcq: BAN-B310 + http_resp = opener.open(req, timeout=self.timeout) # skipcq: BAN-B310 else: - resp = urlopen( # skipcq: BAN-B310 + http_resp = urlopen( # skipcq: BAN-B310 req, context=self.ssl, timeout=self.timeout ) - charset: str = resp.headers.get_content_charset() or "utf-8" - response_body: str = resp.read().decode(charset) + charset: str = http_resp.headers.get_content_charset() or "utf-8" + response_body: str = http_resp.read().decode(charset) resp = SCIMResponse( url=url, - status_code=resp.status, + status_code=http_resp.status, raw_body=response_body, - headers=resp.headers, + headers=http_resp.headers, ) _debug_log_response(self.logger, resp) return resp
    @@ -635,10 +646,11 @@

    Args

    ) def update_user(self, user: Union[Dict[str, Any], User]) -> UserUpdateResponse: + user_id = user.id if isinstance(user, User) else user["id"] return UserUpdateResponse( self.api_call( http_verb="PUT", - path=f"Users/{quote(user.id)}", + path=f"Users/{quote(user_id)}", body_params=user.to_dict() if isinstance(user, User) else _to_dict_without_not_given(user), @@ -707,10 +719,11 @@

    Args

    ) def update_group(self, group: Union[Dict[str, Any], Group]) -> GroupUpdateResponse: + group_id = group.id if isinstance(group, Group) else group["id"] return GroupUpdateResponse( self.api_call( http_verb="PUT", - path=f"Groups/{quote(group.id)}", + path=f"Groups/{quote(group_id)}", body_params=group.to_dict() if isinstance(group, Group) else _to_dict_without_not_given(group), @@ -807,11 +820,20 @@

    Args

    url=url, status_code=e.code, raw_body=response_body, - headers=e.headers, + headers=dict(e.headers.items()), ) if e.code == 429: # for backward-compatibility with WebClient (v.2.5.0 or older) - resp.headers["Retry-After"] = resp.headers["retry-after"] + if ( + "retry-after" not in resp.headers + and "Retry-After" in resp.headers + ): + resp.headers["retry-after"] = resp.headers["Retry-After"] + if ( + "Retry-After" not in resp.headers + and "retry-after" in resp.headers + ): + resp.headers["Retry-After"] = resp.headers["retry-after"] _debug_log_response(self.logger, resp) # Try to find a retry handler for this error @@ -900,20 +922,20 @@

    Args

    raise SlackRequestError(f"Invalid URL detected: {url}") # NOTE: BAN-B310 is already checked above - resp: Optional[HTTPResponse] = None + http_resp: Optional[HTTPResponse] = None if opener: - resp = opener.open(req, timeout=self.timeout) # skipcq: BAN-B310 + http_resp = opener.open(req, timeout=self.timeout) # skipcq: BAN-B310 else: - resp = urlopen( # skipcq: BAN-B310 + http_resp = urlopen( # skipcq: BAN-B310 req, context=self.ssl, timeout=self.timeout ) - charset: str = resp.headers.get_content_charset() or "utf-8" - response_body: str = resp.read().decode(charset) + charset: str = http_resp.headers.get_content_charset() or "utf-8" + response_body: str = http_resp.read().decode(charset) resp = SCIMResponse( url=url, - status_code=resp.status, + status_code=http_resp.status, raw_body=response_body, - headers=resp.headers, + headers=http_resp.headers, ) _debug_log_response(self.logger, resp) return resp
    @@ -1219,10 +1241,11 @@

    Methods

    Expand source code
    def update_group(self, group: Union[Dict[str, Any], Group]) -> GroupUpdateResponse:
    +    group_id = group.id if isinstance(group, Group) else group["id"]
         return GroupUpdateResponse(
             self.api_call(
                 http_verb="PUT",
    -            path=f"Groups/{quote(group.id)}",
    +            path=f"Groups/{quote(group_id)}",
                 body_params=group.to_dict()
                 if isinstance(group, Group)
                 else _to_dict_without_not_given(group),
    @@ -1240,10 +1263,11 @@ 

    Methods

    Expand source code
    def update_user(self, user: Union[Dict[str, Any], User]) -> UserUpdateResponse:
    +    user_id = user.id if isinstance(user, User) else user["id"]
         return UserUpdateResponse(
             self.api_call(
                 http_verb="PUT",
    -            path=f"Users/{quote(user.id)}",
    +            path=f"Users/{quote(user_id)}",
                 body_params=user.to_dict()
                 if isinstance(user, User)
                 else _to_dict_without_not_given(user),
    diff --git a/docs/api-docs/slack_sdk/scim/v1/internal_utils.html b/docs/api-docs/slack_sdk/scim/v1/internal_utils.html
    index 977a86f07..cc42cddd9 100644
    --- a/docs/api-docs/slack_sdk/scim/v1/internal_utils.html
    +++ b/docs/api-docs/slack_sdk/scim/v1/internal_utils.html
    @@ -176,7 +176,10 @@ 

    Module slack_sdk.scim.v1.internal_utils

    return request_headers -def _debug_log_response(logger, resp: "SCIMResponse") -> None: # noqa: F821 +def _debug_log_response( # type: ignore + logger, + resp: "SCIMResponse", # noqa: F821 +) -> None: if logger.level <= logging.DEBUG: logger.debug( "Received the following response - " diff --git a/docs/api-docs/slack_sdk/scim/v1/response.html b/docs/api-docs/slack_sdk/scim/v1/response.html index 70ec5aa45..6ae4f1f5e 100644 --- a/docs/api-docs/slack_sdk/scim/v1/response.html +++ b/docs/api-docs/slack_sdk/scim/v1/response.html @@ -50,20 +50,20 @@

    Module slack_sdk.scim.v1.response

    url: str status_code: int headers: Dict[str, Any] - raw_body: str - body: Dict[str, Any] - snake_cased_body: Dict[str, Any] + raw_body: Optional[str] + body: Optional[Dict[str, Any]] + snake_cased_body: Optional[Dict[str, Any]] errors: Optional[Errors] @property - def snake_cased_body(self) -> Dict[str, Any]: + def snake_cased_body(self) -> Optional[Dict[str, Any]]: # type: ignore if self._snake_cased_body is None: self._snake_cased_body = _to_snake_cased(self.body) return self._snake_cased_body @property - def errors(self) -> Optional[Errors]: + def errors(self) -> Optional[Errors]: # type: ignore errors = self.snake_cased_body.get("errors") if errors is None: return None @@ -74,7 +74,7 @@

    Module slack_sdk.scim.v1.response

    *, url: str, status_code: int, - raw_body: str, + raw_body: Optional[str], headers: dict, ): self.url = url @@ -86,7 +86,9 @@

    Module slack_sdk.scim.v1.response

    if raw_body is not None and raw_body.startswith("{") else None ) - self._snake_cased_body = None + self._snake_cased_body = ( + None # build this when it's accessed for the first time + ) def __repr__(self): dict_value = {} @@ -108,7 +110,7 @@

    Module slack_sdk.scim.v1.response

    users: List[User] @property - def users(self) -> List[User]: + def users(self) -> List[User]: # type: ignore return [User(**r) for r in self.snake_cased_body.get("resources")] def __init__(self, underlying: SCIMResponse): @@ -125,7 +127,7 @@

    Module slack_sdk.scim.v1.response

    user: User @property - def user(self) -> User: + def user(self) -> User: # type: ignore return User(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -142,7 +144,7 @@

    Module slack_sdk.scim.v1.response

    user: User @property - def user(self) -> User: + def user(self) -> User: # type: ignore return User(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -159,7 +161,7 @@

    Module slack_sdk.scim.v1.response

    user: User @property - def user(self) -> User: + def user(self) -> User: # type: ignore return User(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -176,7 +178,7 @@

    Module slack_sdk.scim.v1.response

    user: User @property - def user(self) -> User: + def user(self) -> User: # type: ignore return User(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -209,7 +211,7 @@

    Module slack_sdk.scim.v1.response

    groups: List[Group] @property - def groups(self) -> List[Group]: + def groups(self) -> List[Group]: # type: ignore return [Group(**r) for r in self.snake_cased_body.get("resources")] def __init__(self, underlying: SCIMResponse): @@ -226,7 +228,7 @@

    Module slack_sdk.scim.v1.response

    group: Group @property - def group(self) -> Group: + def group(self) -> Group: # type: ignore return Group(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -243,7 +245,7 @@

    Module slack_sdk.scim.v1.response

    group: Group @property - def group(self) -> Group: + def group(self) -> Group: # type: ignore return Group(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -271,7 +273,7 @@

    Module slack_sdk.scim.v1.response

    group: Group @property - def group(self) -> Group: + def group(self) -> Group: # type: ignore return Group(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -367,7 +369,7 @@

    Methods

    group: Group @property - def group(self) -> Group: + def group(self) -> Group: # type: ignore return Group(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -393,7 +395,7 @@

    Instance variables

    Expand source code
    @property
    -def group(self) -> Group:
    +def group(self) -> Group:  # type: ignore
         return Group(**self.snake_cased_body)
    @@ -425,7 +427,7 @@

    Ancestors

    Class variables

    -
    var body : Dict[str, Any]
    +
    var body : Optional[Dict[str, Any]]
    @@ -433,7 +435,7 @@

    Class variables

    -
    var raw_body : str
    +
    var raw_body : Optional[str]
    @@ -456,14 +458,14 @@

    Instance variables

    Expand source code
    @property
    -def errors(self) -> Optional[Errors]:
    +def errors(self) -> Optional[Errors]:  # type: ignore
         errors = self.snake_cased_body.get("errors")
         if errors is None:
             return None
         return Errors(**errors)
    -
    var snake_cased_body : Dict[str, Any]
    +
    var snake_cased_body : Optional[Dict[str, Any]]
    @@ -471,7 +473,7 @@

    Instance variables

    Expand source code
    @property
    -def snake_cased_body(self) -> Dict[str, Any]:
    +def snake_cased_body(self) -> Optional[Dict[str, Any]]:  # type: ignore
         if self._snake_cased_body is None:
             self._snake_cased_body = _to_snake_cased(self.body)
         return self._snake_cased_body
    @@ -505,7 +507,7 @@

    Ancestors

    Class variables

    -
    var body : Dict[str, Any]
    +
    var body : Optional[Dict[str, Any]]
    @@ -513,7 +515,7 @@

    Class variables

    -
    var raw_body : str
    +
    var raw_body : Optional[str]
    @@ -536,14 +538,14 @@

    Instance variables

    Expand source code
    @property
    -def errors(self) -> Optional[Errors]:
    +def errors(self) -> Optional[Errors]:  # type: ignore
         errors = self.snake_cased_body.get("errors")
         if errors is None:
             return None
         return Errors(**errors)
    -
    var snake_cased_body : Dict[str, Any]
    +
    var snake_cased_body : Optional[Dict[str, Any]]
    @@ -551,7 +553,7 @@

    Instance variables

    Expand source code
    @property
    -def snake_cased_body(self) -> Dict[str, Any]:
    +def snake_cased_body(self) -> Optional[Dict[str, Any]]:  # type: ignore
         if self._snake_cased_body is None:
             self._snake_cased_body = _to_snake_cased(self.body)
         return self._snake_cased_body
    @@ -573,7 +575,7 @@

    Instance variables

    group: Group @property - def group(self) -> Group: + def group(self) -> Group: # type: ignore return Group(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -599,7 +601,7 @@

    Instance variables

    Expand source code
    @property
    -def group(self) -> Group:
    +def group(self) -> Group:  # type: ignore
         return Group(**self.snake_cased_body)
    @@ -619,7 +621,7 @@

    Instance variables

    group: Group @property - def group(self) -> Group: + def group(self) -> Group: # type: ignore return Group(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -645,7 +647,7 @@

    Instance variables

    Expand source code
    @property
    -def group(self) -> Group:
    +def group(self) -> Group:  # type: ignore
         return Group(**self.snake_cased_body)
    @@ -665,7 +667,7 @@

    Instance variables

    user: User @property - def user(self) -> User: + def user(self) -> User: # type: ignore return User(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -691,7 +693,7 @@

    Instance variables

    Expand source code
    @property
    -def user(self) -> User:
    +def user(self) -> User:  # type: ignore
         return User(**self.snake_cased_body)
    @@ -699,7 +701,7 @@

    Instance variables

    class SCIMResponse -(*, url: str, status_code: int, raw_body: str, headers: dict) +(*, url: str, status_code: int, raw_body: Optional[str], headers: dict)
    @@ -711,20 +713,20 @@

    Instance variables

    url: str status_code: int headers: Dict[str, Any] - raw_body: str - body: Dict[str, Any] - snake_cased_body: Dict[str, Any] + raw_body: Optional[str] + body: Optional[Dict[str, Any]] + snake_cased_body: Optional[Dict[str, Any]] errors: Optional[Errors] @property - def snake_cased_body(self) -> Dict[str, Any]: + def snake_cased_body(self) -> Optional[Dict[str, Any]]: # type: ignore if self._snake_cased_body is None: self._snake_cased_body = _to_snake_cased(self.body) return self._snake_cased_body @property - def errors(self) -> Optional[Errors]: + def errors(self) -> Optional[Errors]: # type: ignore errors = self.snake_cased_body.get("errors") if errors is None: return None @@ -735,7 +737,7 @@

    Instance variables

    *, url: str, status_code: int, - raw_body: str, + raw_body: Optional[str], headers: dict, ): self.url = url @@ -747,7 +749,9 @@

    Instance variables

    if raw_body is not None and raw_body.startswith("{") else None ) - self._snake_cased_body = None + self._snake_cased_body = ( + None # build this when it's accessed for the first time + ) def __repr__(self): dict_value = {} @@ -776,7 +780,7 @@

    Subclasses

    Class variables

    -
    var body : Dict[str, Any]
    +
    var body : Optional[Dict[str, Any]]
    @@ -784,7 +788,7 @@

    Class variables

    -
    var raw_body : str
    +
    var raw_body : Optional[str]
    @@ -807,14 +811,14 @@

    Instance variables

    Expand source code
    @property
    -def errors(self) -> Optional[Errors]:
    +def errors(self) -> Optional[Errors]:  # type: ignore
         errors = self.snake_cased_body.get("errors")
         if errors is None:
             return None
         return Errors(**errors)
    -
    var snake_cased_body : Dict[str, Any]
    +
    var snake_cased_body : Optional[Dict[str, Any]]
    @@ -822,7 +826,7 @@

    Instance variables

    Expand source code
    @property
    -def snake_cased_body(self) -> Dict[str, Any]:
    +def snake_cased_body(self) -> Optional[Dict[str, Any]]:  # type: ignore
         if self._snake_cased_body is None:
             self._snake_cased_body = _to_snake_cased(self.body)
         return self._snake_cased_body
    @@ -844,7 +848,7 @@

    Instance variables

    groups: List[Group] @property - def groups(self) -> List[Group]: + def groups(self) -> List[Group]: # type: ignore return [Group(**r) for r in self.snake_cased_body.get("resources")] def __init__(self, underlying: SCIMResponse): @@ -870,7 +874,7 @@

    Instance variables

    Expand source code
    @property
    -def groups(self) -> List[Group]:
    +def groups(self) -> List[Group]:  # type: ignore
         return [Group(**r) for r in self.snake_cased_body.get("resources")]
    @@ -890,7 +894,7 @@

    Instance variables

    users: List[User] @property - def users(self) -> List[User]: + def users(self) -> List[User]: # type: ignore return [User(**r) for r in self.snake_cased_body.get("resources")] def __init__(self, underlying: SCIMResponse): @@ -916,7 +920,7 @@

    Instance variables

    Expand source code
    @property
    -def users(self) -> List[User]:
    +def users(self) -> List[User]:  # type: ignore
         return [User(**r) for r in self.snake_cased_body.get("resources")]
    @@ -936,7 +940,7 @@

    Instance variables

    user: User @property - def user(self) -> User: + def user(self) -> User: # type: ignore return User(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -962,7 +966,7 @@

    Instance variables

    Expand source code
    @property
    -def user(self) -> User:
    +def user(self) -> User:  # type: ignore
         return User(**self.snake_cased_body)
    @@ -994,7 +998,7 @@

    Ancestors

    Class variables

    -
    var body : Dict[str, Any]
    +
    var body : Optional[Dict[str, Any]]
    @@ -1002,7 +1006,7 @@

    Class variables

    -
    var raw_body : str
    +
    var raw_body : Optional[str]
    @@ -1025,14 +1029,14 @@

    Instance variables

    Expand source code
    @property
    -def errors(self) -> Optional[Errors]:
    +def errors(self) -> Optional[Errors]:  # type: ignore
         errors = self.snake_cased_body.get("errors")
         if errors is None:
             return None
         return Errors(**errors)
    -
    var snake_cased_body : Dict[str, Any]
    +
    var snake_cased_body : Optional[Dict[str, Any]]
    @@ -1040,7 +1044,7 @@

    Instance variables

    Expand source code
    @property
    -def snake_cased_body(self) -> Dict[str, Any]:
    +def snake_cased_body(self) -> Optional[Dict[str, Any]]:  # type: ignore
         if self._snake_cased_body is None:
             self._snake_cased_body = _to_snake_cased(self.body)
         return self._snake_cased_body
    @@ -1062,7 +1066,7 @@

    Instance variables

    user: User @property - def user(self) -> User: + def user(self) -> User: # type: ignore return User(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -1088,7 +1092,7 @@

    Instance variables

    Expand source code
    @property
    -def user(self) -> User:
    +def user(self) -> User:  # type: ignore
         return User(**self.snake_cased_body)
    @@ -1108,7 +1112,7 @@

    Instance variables

    user: User @property - def user(self) -> User: + def user(self) -> User: # type: ignore return User(**self.snake_cased_body) def __init__(self, underlying: SCIMResponse): @@ -1134,7 +1138,7 @@

    Instance variables

    Expand source code
    @property
    -def user(self) -> User:
    +def user(self) -> User:  # type: ignore
         return User(**self.snake_cased_body)
    diff --git a/docs/api-docs/slack_sdk/scim/v1/user.html b/docs/api-docs/slack_sdk/scim/v1/user.html index 743d1d7cd..03dcd349a 100644 --- a/docs/api-docs/slack_sdk/scim/v1/user.html +++ b/docs/api-docs/slack_sdk/scim/v1/user.html @@ -211,32 +211,32 @@

    Module slack_sdk.scim.v1.user

    **kwargs, ) -> None: self.active = active - self.addresses = ( + self.addresses = ( # type: ignore [a if isinstance(a, UserAddress) else UserAddress(**a) for a in addresses] if _is_iterable(addresses) else addresses ) self.display_name = display_name - self.emails = ( + self.emails = ( # type: ignore [a if isinstance(a, TypeAndValue) else TypeAndValue(**a) for a in emails] if _is_iterable(emails) else emails ) self.external_id = external_id - self.groups = ( + self.groups = ( # type: ignore [a if isinstance(a, UserGroup) else UserGroup(**a) for a in groups] if _is_iterable(groups) else groups ) self.id = id - self.meta = ( + self.meta = ( # type: ignore UserMeta(**meta) if meta is not None and isinstance(meta, dict) else meta ) - self.name = ( + self.name = ( # type: ignore UserName(**name) if name is not None and isinstance(name, dict) else name ) self.nick_name = nick_name - self.phone_numbers = ( + self.phone_numbers = ( # type: ignore [ a if isinstance(a, TypeAndValue) else TypeAndValue(**a) for a in phone_numbers @@ -244,13 +244,13 @@

    Module slack_sdk.scim.v1.user

    if _is_iterable(phone_numbers) else phone_numbers ) - self.photos = ( + self.photos = ( # type: ignore [a if isinstance(a, UserPhoto) else UserPhoto(**a) for a in photos] if _is_iterable(photos) else photos ) self.profile_url = profile_url - self.roles = ( + self.roles = ( # type: ignore [a if isinstance(a, TypeAndValue) else TypeAndValue(**a) for a in roles] if _is_iterable(roles) else roles @@ -345,32 +345,32 @@

    Classes

    **kwargs, ) -> None: self.active = active - self.addresses = ( + self.addresses = ( # type: ignore [a if isinstance(a, UserAddress) else UserAddress(**a) for a in addresses] if _is_iterable(addresses) else addresses ) self.display_name = display_name - self.emails = ( + self.emails = ( # type: ignore [a if isinstance(a, TypeAndValue) else TypeAndValue(**a) for a in emails] if _is_iterable(emails) else emails ) self.external_id = external_id - self.groups = ( + self.groups = ( # type: ignore [a if isinstance(a, UserGroup) else UserGroup(**a) for a in groups] if _is_iterable(groups) else groups ) self.id = id - self.meta = ( + self.meta = ( # type: ignore UserMeta(**meta) if meta is not None and isinstance(meta, dict) else meta ) - self.name = ( + self.name = ( # type: ignore UserName(**name) if name is not None and isinstance(name, dict) else name ) self.nick_name = nick_name - self.phone_numbers = ( + self.phone_numbers = ( # type: ignore [ a if isinstance(a, TypeAndValue) else TypeAndValue(**a) for a in phone_numbers @@ -378,13 +378,13 @@

    Classes

    if _is_iterable(phone_numbers) else phone_numbers ) - self.photos = ( + self.photos = ( # type: ignore [a if isinstance(a, UserPhoto) else UserPhoto(**a) for a in photos] if _is_iterable(photos) else photos ) self.profile_url = profile_url - self.roles = ( + self.roles = ( # type: ignore [a if isinstance(a, TypeAndValue) else TypeAndValue(**a) for a in roles] if _is_iterable(roles) else roles diff --git a/docs/api-docs/slack_sdk/socket_mode/aiohttp/index.html b/docs/api-docs/slack_sdk/socket_mode/aiohttp/index.html index dc9a33ad5..2fa945db6 100644 --- a/docs/api-docs/slack_sdk/socket_mode/aiohttp/index.html +++ b/docs/api-docs/slack_sdk/socket_mode/aiohttp/index.html @@ -112,9 +112,15 @@

    Module slack_sdk.socket_mode.aiohttp

    auto_reconnect_enabled: bool = True, ping_interval: float = 5, trace_enabled: bool = False, - on_message_listeners: Optional[List[Callable[[WSMessage], None]]] = None, - on_error_listeners: Optional[List[Callable[[WSMessage], None]]] = None, - on_close_listeners: Optional[List[Callable[[WSMessage], None]]] = None, + on_message_listeners: Optional[ + List[Callable[[WSMessage], Awaitable[None]]] + ] = None, + on_error_listeners: Optional[ + List[Callable[[WSMessage], Awaitable[None]]] + ] = None, + on_close_listeners: Optional[ + List[Callable[[WSMessage], Awaitable[None]]] + ] = None, ): """Socket Mode client @@ -192,16 +198,18 @@

    Module slack_sdk.socket_mode.aiohttp

    ) break try: - # The logging here is for detailed trouble shooting of potential issues in this client. - # If you don't see this log for a while, it means that - # this receive_messages execution is no longer working for some reason. - counter_for_logging = (counter_for_logging + 1) % logging_interval - if counter_for_logging == 0: - log_message = ( - f"{logging_interval} session verification executed after the previous same log" - f" ({session_id})" - ) - self.logger.debug(log_message) + if self.trace_enabled and self.logger.level <= logging.DEBUG: + # The logging here is for detailed investigation on potential issues in this client. + # If you don't see this log for a while, it means that + # this receive_messages execution is no longer working for some reason. + counter_for_logging += 1 + if counter_for_logging >= logging_interval: + counter_for_logging = 0 + log_message = ( + "#monitor_current_session method has been verifying if this session is active " + f"(session: {session_id}, logging interval: {logging_interval})" + ) + self.logger.debug(log_message) await asyncio.sleep(self.ping_interval) @@ -278,38 +286,41 @@

    Module slack_sdk.socket_mode.aiohttp

    break try: message: WSMessage = await session.receive() - if self.trace_enabled and self.logger.level <= logging.DEBUG: - # The following logging prints every single received message except empty message data ones. - type = WSMsgType(message.type) - message_type = type.name if type is not None else message.type - message_data = message.data - if isinstance(message_data, bytes): - message_data = message_data.decode("utf-8") - if len(message_data) > 0: - # To skip the empty message that Slack server-side often sends - self.logger.debug( - f"Received message " - f"(type: {message_type}, " - f"data: {message_data}, " - f"extra: {message.extra}, " - f"session: {session_id})" + # just in case, checking if the value is not None + if message is not None: + if self.logger.level <= logging.DEBUG: + # The following logging prints every single received message + # except empty message data ones. + type = WSMsgType(message.type) + message_type = ( + type.name if type is not None else message.type ) + message_data = message.data + if isinstance(message_data, bytes): + message_data = message_data.decode("utf-8") + if len(message_data) > 0: + # To skip the empty message that Slack server-side often sends + self.logger.debug( + f"Received message " + f"(type: {message_type}, " + f"data: {message_data}, " + f"extra: {message.extra}, " + f"session: {session_id})" + ) - # The logging here is for detailed trouble shooting of potential issues in this client. - # If you don't see this log for a while, it means that - # this receive_messages execution is no longer working for some reason. - if self.logger.level <= logging.DEBUG: - counter_for_logging = ( - counter_for_logging + 1 - ) % logging_interval - if counter_for_logging == 0: - log_message = ( - f"{logging_interval} WebSocket messages received " - f"after the previous same log ({session_id})" - ) - self.logger.debug(log_message) + if self.trace_enabled: + # The logging here is for detailed trouble shooting of potential issues in this client. + # If you don't see this log for a while, it can mean that + # this receive_messages execution is no longer working for some reason. + counter_for_logging += 1 + if counter_for_logging >= logging_interval: + counter_for_logging = 0 + log_message = ( + "#receive_messages method has been working without any issues " + f"(session: {session_id}, logging interval: {logging_interval})" + ) + self.logger.debug(log_message) - if message is not None: if message.type == WSMsgType.TEXT: message_data = message.data await self.enqueue_message(message_data) @@ -348,7 +359,9 @@

    Module slack_sdk.socket_mode.aiohttp

    f" - error : {e}, session: {session_id}" ) continue + consecutive_error_count = 0 + except Exception as e: consecutive_error_count += 1 self.logger.error( @@ -379,7 +392,8 @@

    Module slack_sdk.socket_mode.aiohttp

    and not self.current_session.closed and not await self.is_ping_pong_failing() ) - if connected is False and self.logger.level <= logging.DEBUG: + if self.logger.level <= logging.DEBUG and connected is False: + # Prints more detailed information about the inactive connection is_ping_pong_failing = await self.is_ping_pong_failing() session_id = await self.session_id() self.logger.debug( @@ -397,9 +411,14 @@

    Module slack_sdk.socket_mode.aiohttp

    return self.build_session_id(self.current_session) async def connect(self): - old_session = None if self.current_session is None else self.current_session + old_session: Optional[ClientWebSocketResponse] = ( + None if self.current_session is None else self.current_session + ) if self.wss_uri is None: + # If the underlying WSS URL does not exist, + # acquiring a new active WSS URL from the server-side first self.wss_uri = await self.issue_new_wss_url() + self.current_session = await self.aiohttp_client_session.ws_connect( self.wss_uri, autoping=False, @@ -500,7 +519,7 @@

    Module slack_sdk.socket_mode.aiohttp

    @classmethod def build_session_id(cls, session: ClientWebSocketResponse) -> str: if session is None: - return None + return "" return "s_" + str(hash(session))
    @@ -515,7 +534,7 @@

    Classes

    class SocketModeClient -(app_token: str, logger: Optional[logging.Logger] = None, web_client: Optional[AsyncWebClient] = None, proxy: Optional[str] = None, auto_reconnect_enabled: bool = True, ping_interval: float = 5, trace_enabled: bool = False, on_message_listeners: Optional[List[Callable[[aiohttp.http_websocket.WSMessage], None]]] = None, on_error_listeners: Optional[List[Callable[[aiohttp.http_websocket.WSMessage], None]]] = None, on_close_listeners: Optional[List[Callable[[aiohttp.http_websocket.WSMessage], None]]] = None) +(app_token: str, logger: Optional[logging.Logger] = None, web_client: Optional[AsyncWebClient] = None, proxy: Optional[str] = None, auto_reconnect_enabled: bool = True, ping_interval: float = 5, trace_enabled: bool = False, on_message_listeners: Optional[List[Callable[[aiohttp.http_websocket.WSMessage], Awaitable[None]]]] = None, on_error_listeners: Optional[List[Callable[[aiohttp.http_websocket.WSMessage], Awaitable[None]]]] = None, on_close_listeners: Optional[List[Callable[[aiohttp.http_websocket.WSMessage], Awaitable[None]]]] = None)

    Socket Mode client

    @@ -598,9 +617,15 @@

    Args

    auto_reconnect_enabled: bool = True, ping_interval: float = 5, trace_enabled: bool = False, - on_message_listeners: Optional[List[Callable[[WSMessage], None]]] = None, - on_error_listeners: Optional[List[Callable[[WSMessage], None]]] = None, - on_close_listeners: Optional[List[Callable[[WSMessage], None]]] = None, + on_message_listeners: Optional[ + List[Callable[[WSMessage], Awaitable[None]]] + ] = None, + on_error_listeners: Optional[ + List[Callable[[WSMessage], Awaitable[None]]] + ] = None, + on_close_listeners: Optional[ + List[Callable[[WSMessage], Awaitable[None]]] + ] = None, ): """Socket Mode client @@ -678,16 +703,18 @@

    Args

    ) break try: - # The logging here is for detailed trouble shooting of potential issues in this client. - # If you don't see this log for a while, it means that - # this receive_messages execution is no longer working for some reason. - counter_for_logging = (counter_for_logging + 1) % logging_interval - if counter_for_logging == 0: - log_message = ( - f"{logging_interval} session verification executed after the previous same log" - f" ({session_id})" - ) - self.logger.debug(log_message) + if self.trace_enabled and self.logger.level <= logging.DEBUG: + # The logging here is for detailed investigation on potential issues in this client. + # If you don't see this log for a while, it means that + # this receive_messages execution is no longer working for some reason. + counter_for_logging += 1 + if counter_for_logging >= logging_interval: + counter_for_logging = 0 + log_message = ( + "#monitor_current_session method has been verifying if this session is active " + f"(session: {session_id}, logging interval: {logging_interval})" + ) + self.logger.debug(log_message) await asyncio.sleep(self.ping_interval) @@ -764,38 +791,41 @@

    Args

    break try: message: WSMessage = await session.receive() - if self.trace_enabled and self.logger.level <= logging.DEBUG: - # The following logging prints every single received message except empty message data ones. - type = WSMsgType(message.type) - message_type = type.name if type is not None else message.type - message_data = message.data - if isinstance(message_data, bytes): - message_data = message_data.decode("utf-8") - if len(message_data) > 0: - # To skip the empty message that Slack server-side often sends - self.logger.debug( - f"Received message " - f"(type: {message_type}, " - f"data: {message_data}, " - f"extra: {message.extra}, " - f"session: {session_id})" + # just in case, checking if the value is not None + if message is not None: + if self.logger.level <= logging.DEBUG: + # The following logging prints every single received message + # except empty message data ones. + type = WSMsgType(message.type) + message_type = ( + type.name if type is not None else message.type ) + message_data = message.data + if isinstance(message_data, bytes): + message_data = message_data.decode("utf-8") + if len(message_data) > 0: + # To skip the empty message that Slack server-side often sends + self.logger.debug( + f"Received message " + f"(type: {message_type}, " + f"data: {message_data}, " + f"extra: {message.extra}, " + f"session: {session_id})" + ) - # The logging here is for detailed trouble shooting of potential issues in this client. - # If you don't see this log for a while, it means that - # this receive_messages execution is no longer working for some reason. - if self.logger.level <= logging.DEBUG: - counter_for_logging = ( - counter_for_logging + 1 - ) % logging_interval - if counter_for_logging == 0: - log_message = ( - f"{logging_interval} WebSocket messages received " - f"after the previous same log ({session_id})" - ) - self.logger.debug(log_message) + if self.trace_enabled: + # The logging here is for detailed trouble shooting of potential issues in this client. + # If you don't see this log for a while, it can mean that + # this receive_messages execution is no longer working for some reason. + counter_for_logging += 1 + if counter_for_logging >= logging_interval: + counter_for_logging = 0 + log_message = ( + "#receive_messages method has been working without any issues " + f"(session: {session_id}, logging interval: {logging_interval})" + ) + self.logger.debug(log_message) - if message is not None: if message.type == WSMsgType.TEXT: message_data = message.data await self.enqueue_message(message_data) @@ -834,7 +864,9 @@

    Args

    f" - error : {e}, session: {session_id}" ) continue + consecutive_error_count = 0 + except Exception as e: consecutive_error_count += 1 self.logger.error( @@ -865,7 +897,8 @@

    Args

    and not self.current_session.closed and not await self.is_ping_pong_failing() ) - if connected is False and self.logger.level <= logging.DEBUG: + if self.logger.level <= logging.DEBUG and connected is False: + # Prints more detailed information about the inactive connection is_ping_pong_failing = await self.is_ping_pong_failing() session_id = await self.session_id() self.logger.debug( @@ -883,9 +916,14 @@

    Args

    return self.build_session_id(self.current_session) async def connect(self): - old_session = None if self.current_session is None else self.current_session + old_session: Optional[ClientWebSocketResponse] = ( + None if self.current_session is None else self.current_session + ) if self.wss_uri is None: + # If the underlying WSS URL does not exist, + # acquiring a new active WSS URL from the server-side first self.wss_uri = await self.issue_new_wss_url() + self.current_session = await self.aiohttp_client_session.ws_connect( self.wss_uri, autoping=False, @@ -986,7 +1024,7 @@

    Args

    @classmethod def build_session_id(cls, session: ClientWebSocketResponse) -> str: if session is None: - return None + return "" return "s_" + str(hash(session))

    Ancestors

    @@ -1102,7 +1140,7 @@

    Static methods

    @classmethod
     def build_session_id(cls, session: ClientWebSocketResponse) -> str:
         if session is None:
    -        return None
    +        return ""
         return "s_" + str(hash(session))
    @@ -1142,9 +1180,14 @@

    Methods

    Expand source code
    async def connect(self):
    -    old_session = None if self.current_session is None else self.current_session
    +    old_session: Optional[ClientWebSocketResponse] = (
    +        None if self.current_session is None else self.current_session
    +    )
         if self.wss_uri is None:
    +        # If the underlying WSS URL does not exist,
    +        # acquiring a new active WSS URL from the server-side first
             self.wss_uri = await self.issue_new_wss_url()
    +
         self.current_session = await self.aiohttp_client_session.ws_connect(
             self.wss_uri,
             autoping=False,
    @@ -1225,7 +1268,8 @@ 

    Methods

    and not self.current_session.closed and not await self.is_ping_pong_failing() ) - if connected is False and self.logger.level <= logging.DEBUG: + if self.logger.level <= logging.DEBUG and connected is False: + # Prints more detailed information about the inactive connection is_ping_pong_failing = await self.is_ping_pong_failing() session_id = await self.session_id() self.logger.debug( @@ -1288,16 +1332,18 @@

    Methods

    ) break try: - # The logging here is for detailed trouble shooting of potential issues in this client. - # If you don't see this log for a while, it means that - # this receive_messages execution is no longer working for some reason. - counter_for_logging = (counter_for_logging + 1) % logging_interval - if counter_for_logging == 0: - log_message = ( - f"{logging_interval} session verification executed after the previous same log" - f" ({session_id})" - ) - self.logger.debug(log_message) + if self.trace_enabled and self.logger.level <= logging.DEBUG: + # The logging here is for detailed investigation on potential issues in this client. + # If you don't see this log for a while, it means that + # this receive_messages execution is no longer working for some reason. + counter_for_logging += 1 + if counter_for_logging >= logging_interval: + counter_for_logging = 0 + log_message = ( + "#monitor_current_session method has been verifying if this session is active " + f"(session: {session_id}, logging interval: {logging_interval})" + ) + self.logger.debug(log_message) await asyncio.sleep(self.ping_interval) @@ -1384,38 +1430,41 @@

    Methods

    break try: message: WSMessage = await session.receive() - if self.trace_enabled and self.logger.level <= logging.DEBUG: - # The following logging prints every single received message except empty message data ones. - type = WSMsgType(message.type) - message_type = type.name if type is not None else message.type - message_data = message.data - if isinstance(message_data, bytes): - message_data = message_data.decode("utf-8") - if len(message_data) > 0: - # To skip the empty message that Slack server-side often sends - self.logger.debug( - f"Received message " - f"(type: {message_type}, " - f"data: {message_data}, " - f"extra: {message.extra}, " - f"session: {session_id})" + # just in case, checking if the value is not None + if message is not None: + if self.logger.level <= logging.DEBUG: + # The following logging prints every single received message + # except empty message data ones. + type = WSMsgType(message.type) + message_type = ( + type.name if type is not None else message.type ) + message_data = message.data + if isinstance(message_data, bytes): + message_data = message_data.decode("utf-8") + if len(message_data) > 0: + # To skip the empty message that Slack server-side often sends + self.logger.debug( + f"Received message " + f"(type: {message_type}, " + f"data: {message_data}, " + f"extra: {message.extra}, " + f"session: {session_id})" + ) - # The logging here is for detailed trouble shooting of potential issues in this client. - # If you don't see this log for a while, it means that - # this receive_messages execution is no longer working for some reason. - if self.logger.level <= logging.DEBUG: - counter_for_logging = ( - counter_for_logging + 1 - ) % logging_interval - if counter_for_logging == 0: - log_message = ( - f"{logging_interval} WebSocket messages received " - f"after the previous same log ({session_id})" - ) - self.logger.debug(log_message) + if self.trace_enabled: + # The logging here is for detailed trouble shooting of potential issues in this client. + # If you don't see this log for a while, it can mean that + # this receive_messages execution is no longer working for some reason. + counter_for_logging += 1 + if counter_for_logging >= logging_interval: + counter_for_logging = 0 + log_message = ( + "#receive_messages method has been working without any issues " + f"(session: {session_id}, logging interval: {logging_interval})" + ) + self.logger.debug(log_message) - if message is not None: if message.type == WSMsgType.TEXT: message_data = message.data await self.enqueue_message(message_data) @@ -1454,7 +1503,9 @@

    Methods

    f" - error : {e}, session: {session_id}" ) continue + consecutive_error_count = 0 + except Exception as e: consecutive_error_count += 1 self.logger.error( diff --git a/docs/api-docs/slack_sdk/socket_mode/async_client.html b/docs/api-docs/slack_sdk/socket_mode/async_client.html index 9ee52beab..a72ac04eb 100644 --- a/docs/api-docs/slack_sdk/socket_mode/async_client.html +++ b/docs/api-docs/slack_sdk/socket_mode/async_client.html @@ -185,7 +185,7 @@

    Module slack_sdk.socket_mode.async_client

    for listener in self.message_listeners: try: - await listener(self, message, raw_message) + await listener(self, message, raw_message) # type: ignore except Exception as e: self.logger.exception( f"Failed to run a message listener: {e}, session: {session_id}" @@ -196,7 +196,7 @@

    Module slack_sdk.socket_mode.async_client

    if request is not None: for listener in self.socket_mode_request_listeners: try: - await listener(self, request) + await listener(self, request) # type: ignore except Exception as e: self.logger.exception( f"Failed to run a request listener: {e}, session: {session_id}" @@ -374,7 +374,7 @@

    Classes

    for listener in self.message_listeners: try: - await listener(self, message, raw_message) + await listener(self, message, raw_message) # type: ignore except Exception as e: self.logger.exception( f"Failed to run a message listener: {e}, session: {session_id}" @@ -385,7 +385,7 @@

    Classes

    if request is not None: for listener in self.socket_mode_request_listeners: try: - await listener(self, request) + await listener(self, request) # type: ignore except Exception as e: self.logger.exception( f"Failed to run a request listener: {e}, session: {session_id}" @@ -657,7 +657,7 @@

    Methods

    for listener in self.message_listeners: try: - await listener(self, message, raw_message) + await listener(self, message, raw_message) # type: ignore except Exception as e: self.logger.exception( f"Failed to run a message listener: {e}, session: {session_id}" @@ -668,7 +668,7 @@

    Methods

    if request is not None: for listener in self.socket_mode_request_listeners: try: - await listener(self, request) + await listener(self, request) # type: ignore except Exception as e: self.logger.exception( f"Failed to run a request listener: {e}, session: {session_id}" diff --git a/docs/api-docs/slack_sdk/socket_mode/async_listeners.html b/docs/api-docs/slack_sdk/socket_mode/async_listeners.html index 06799d296..16a4bcc98 100644 --- a/docs/api-docs/slack_sdk/socket_mode/async_listeners.html +++ b/docs/api-docs/slack_sdk/socket_mode/async_listeners.html @@ -32,7 +32,7 @@

    Module slack_sdk.socket_mode.async_listeners

    class AsyncWebSocketMessageListener(Callable): - async def __call__( + async def __call__( # type: ignore client: "AsyncBaseSocketModeClient", # noqa: F821 message: dict, raw_message: Optional[str] = None, @@ -41,7 +41,7 @@

    Module slack_sdk.socket_mode.async_listeners

    class AsyncSocketModeRequestListener(Callable): - async def __call__( + async def __call__( # type: ignore client: "AsyncBaseSocketModeClient", # noqa: F821 request: SocketModeRequest, ): # noqa: F821 @@ -80,7 +80,7 @@

    Classes

    Expand source code
    class AsyncSocketModeRequestListener(Callable):
    -    async def __call__(
    +    async def __call__(  # type: ignore
             client: "AsyncBaseSocketModeClient",  # noqa: F821
             request: SocketModeRequest,
         ):  # noqa: F821
    @@ -115,7 +115,7 @@ 

    Ancestors

    Expand source code
    class AsyncWebSocketMessageListener(Callable):
    -    async def __call__(
    +    async def __call__(  # type: ignore
             client: "AsyncBaseSocketModeClient",  # noqa: F821
             message: dict,
             raw_message: Optional[str] = None,
    diff --git a/docs/api-docs/slack_sdk/socket_mode/builtin/connection.html b/docs/api-docs/slack_sdk/socket_mode/builtin/connection.html
    index a226cd0ac..fedb383dc 100644
    --- a/docs/api-docs/slack_sdk/socket_mode/builtin/connection.html
    +++ b/docs/api-docs/slack_sdk/socket_mode/builtin/connection.html
    @@ -132,7 +132,7 @@ 

    Module slack_sdk.socket_mode.builtin.connectionClasses

    f"Connecting to the address for handshake: {hostname}:{port} " f"(session id: {self.session_id})" ) - sock: Union[ssl.SSLSocket, socket] = _establish_new_socket_connection( + sock: Union[ssl.SSLSocket, socket] = _establish_new_socket_connection( # type: ignore session_id=self.session_id, server_hostname=hostname, server_port=port, @@ -1095,7 +1095,7 @@

    Methods

    f"Connecting to the address for handshake: {hostname}:{port} " f"(session id: {self.session_id})" ) - sock: Union[ssl.SSLSocket, socket] = _establish_new_socket_connection( + sock: Union[ssl.SSLSocket, socket] = _establish_new_socket_connection( # type: ignore session_id=self.session_id, server_hostname=hostname, server_port=port, diff --git a/docs/api-docs/slack_sdk/socket_mode/builtin/internals.html b/docs/api-docs/slack_sdk/socket_mode/builtin/internals.html index 1954d3228..b9ba0d9ac 100644 --- a/docs/api-docs/slack_sdk/socket_mode/builtin/internals.html +++ b/docs/api-docs/slack_sdk/socket_mode/builtin/internals.html @@ -45,7 +45,7 @@

    Module slack_sdk.socket_mode.builtin.internalsModule slack_sdk.socket_mode.builtin.internalsModule slack_sdk.socket_mode.builtin.internalsModule slack_sdk.socket_mode.builtin.internalsModule slack_sdk.socket_mode.builtin.internalsModule slack_sdk.socket_mode.builtin.internalsModule slack_sdk.socket_mode.builtin.internalsModule slack_sdk.socket_mode.builtin.internalsModule slack_sdk.socket_mode.builtin.internalsModule slack_sdk.socket_mode.client

    for listener in self.message_listeners: try: - listener(self, message, raw_message) + listener(self, message, raw_message) # type: ignore except Exception as e: self.logger.exception(f"Failed to run a message listener: {e}") @@ -176,7 +176,7 @@

    Module slack_sdk.socket_mode.client

    if request is not None: for listener in self.socket_mode_request_listeners: try: - listener(self, request) + listener(self, request) # type: ignore except Exception as e: self.logger.exception( f"Failed to run a request listener: {e}" @@ -336,7 +336,7 @@

    Classes

    for listener in self.message_listeners: try: - listener(self, message, raw_message) + listener(self, message, raw_message) # type: ignore except Exception as e: self.logger.exception(f"Failed to run a message listener: {e}") @@ -345,7 +345,7 @@

    Classes

    if request is not None: for listener in self.socket_mode_request_listeners: try: - listener(self, request) + listener(self, request) # type: ignore except Exception as e: self.logger.exception( f"Failed to run a request listener: {e}" @@ -610,7 +610,7 @@

    Methods

    for listener in self.message_listeners: try: - listener(self, message, raw_message) + listener(self, message, raw_message) # type: ignore except Exception as e: self.logger.exception(f"Failed to run a message listener: {e}") @@ -619,7 +619,7 @@

    Methods

    if request is not None: for listener in self.socket_mode_request_listeners: try: - listener(self, request) + listener(self, request) # type: ignore except Exception as e: self.logger.exception( f"Failed to run a request listener: {e}" diff --git a/docs/api-docs/slack_sdk/socket_mode/listeners.html b/docs/api-docs/slack_sdk/socket_mode/listeners.html index a60e5753b..3873f6ce1 100644 --- a/docs/api-docs/slack_sdk/socket_mode/listeners.html +++ b/docs/api-docs/slack_sdk/socket_mode/listeners.html @@ -32,7 +32,7 @@

    Module slack_sdk.socket_mode.listeners

    class WebSocketMessageListener: - def __call__( + def __call__( # type: ignore client: "BaseSocketModeClient", # noqa: F821 message: dict, raw_message: Optional[str] = None, @@ -41,7 +41,7 @@

    Module slack_sdk.socket_mode.listeners

    class SocketModeRequestListener: - def __call__( + def __call__( # type: ignore client: "BaseSocketModeClient", request: SocketModeRequest # noqa: F821 ): # noqa: F821 raise NotImplementedError()
    @@ -66,7 +66,7 @@

    Classes

    Expand source code
    class SocketModeRequestListener:
    -    def __call__(
    +    def __call__(  # type: ignore
             client: "BaseSocketModeClient", request: SocketModeRequest  # noqa: F821
         ):  # noqa: F821
             raise NotImplementedError()
    @@ -82,7 +82,7 @@

    Classes

    Expand source code
    class WebSocketMessageListener:
    -    def __call__(
    +    def __call__(  # type: ignore
             client: "BaseSocketModeClient",  # noqa: F821
             message: dict,
             raw_message: Optional[str] = None,
    diff --git a/docs/api-docs/slack_sdk/socket_mode/request.html b/docs/api-docs/slack_sdk/socket_mode/request.html
    index e8ebb0298..fb8467c2a 100644
    --- a/docs/api-docs/slack_sdk/socket_mode/request.html
    +++ b/docs/api-docs/slack_sdk/socket_mode/request.html
    @@ -58,7 +58,10 @@ 

    Module slack_sdk.socket_mode.request

    elif isinstance(payload, str): self.payload = {"text": payload} else: - raise ValueError(f"Unsupported payload data type ({type(payload)})") + unexpected_payload_type = type(payload) # type: ignore + raise ValueError( + f"Unsupported payload data type ({unexpected_payload_type})" + ) self.accepts_response_payload = accepts_response_payload or False self.retry_attempt = retry_attempt @@ -131,7 +134,10 @@

    Classes

    elif isinstance(payload, str): self.payload = {"text": payload} else: - raise ValueError(f"Unsupported payload data type ({type(payload)})") + unexpected_payload_type = type(payload) # type: ignore + raise ValueError( + f"Unsupported payload data type ({unexpected_payload_type})" + ) self.accepts_response_payload = accepts_response_payload or False self.retry_attempt = retry_attempt diff --git a/docs/api-docs/slack_sdk/socket_mode/websocket_client/index.html b/docs/api-docs/slack_sdk/socket_mode/websocket_client/index.html index f1081cae9..c7cf92fe3 100644 --- a/docs/api-docs/slack_sdk/socket_mode/websocket_client/index.html +++ b/docs/api-docs/slack_sdk/socket_mode/websocket_client/index.html @@ -262,13 +262,13 @@

    Module slack_sdk.socket_mode.websocket_client

    Classes if self.is_connected(): self.current_session.send(message) else: - self.logger.warning( - f"The current session (session id: {self.session_id()}) is no longer active. " + self.logger.warning( # type: ignore + f"The current session (session id: {self.session_id()}) is no longer active. " # type: ignore "Failed to send a message" ) raise e - def close(self): + def close(self) -> None: # type: ignore self.closed = True self.auto_reconnect_enabled = False self.disconnect() @@ -699,7 +699,7 @@

    Class variables

    Methods

    -def close(self) ‑> bool +def close(self) ‑> None
    @@ -707,7 +707,7 @@

    Methods

    Expand source code -
    def close(self):
    +
    def close(self) -> None:  # type: ignore
         self.closed = True
         self.auto_reconnect_enabled = False
         self.disconnect()
    @@ -840,8 +840,8 @@ 

    Methods

    if self.is_connected(): self.current_session.send(message) else: - self.logger.warning( - f"The current session (session id: {self.session_id()}) is no longer active. " + self.logger.warning( # type: ignore + f"The current session (session id: {self.session_id()}) is no longer active. " # type: ignore "Failed to send a message" ) raise e
    diff --git a/docs/api-docs/slack_sdk/socket_mode/websockets/index.html b/docs/api-docs/slack_sdk/socket_mode/websockets/index.html index 7653289dc..d2da205fb 100644 --- a/docs/api-docs/slack_sdk/socket_mode/websockets/index.html +++ b/docs/api-docs/slack_sdk/socket_mode/websockets/index.html @@ -316,7 +316,7 @@

    Module slack_sdk.socket_mode.websockets

    @classmethod def build_session_id(cls, session: WebSocketClientProtocol) -> str: if session is None: - return None + return "" return "s_" + str(hash(session))
    @@ -609,7 +609,7 @@

    Args

    @classmethod def build_session_id(cls, session: WebSocketClientProtocol) -> str: if session is None: - return None + return "" return "s_" + str(hash(session))

    Ancestors

    @@ -701,7 +701,7 @@

    Static methods

    @classmethod
     def build_session_id(cls, session: WebSocketClientProtocol) -> str:
         if session is None:
    -        return None
    +        return ""
         return "s_" + str(hash(session))
    diff --git a/docs/api-docs/slack_sdk/version.html b/docs/api-docs/slack_sdk/version.html index 7bbdbba55..9fb871762 100644 --- a/docs/api-docs/slack_sdk/version.html +++ b/docs/api-docs/slack_sdk/version.html @@ -28,7 +28,7 @@

    Module slack_sdk.version

    Expand source code
    """Check the latest version at https://pypi.org/project/slack-sdk/"""
    -__version__ = "3.11.2"
    +__version__ = "3.12.0"
    diff --git a/docs/api-docs/slack_sdk/web/async_base_client.html b/docs/api-docs/slack_sdk/web/async_base_client.html index 2f73b1fe1..25f885792 100644 --- a/docs/api-docs/slack_sdk/web/async_base_client.html +++ b/docs/api-docs/slack_sdk/web/async_base_client.html @@ -101,12 +101,12 @@

    Module slack_sdk.web.async_base_client

    api_method: str, *, http_verb: str = "POST", - files: dict = None, + files: Optional[dict] = None, data: Union[dict, FormData] = None, - params: dict = None, - json: dict = None, # skipcq: PYL-W0621 - headers: dict = None, - auth: dict = None, + params: Optional[dict] = None, + json: Optional[dict] = None, # skipcq: PYL-W0621 + headers: Optional[dict] = None, + auth: Optional[dict] = None, ) -> AsyncSlackResponse: """Create a request and execute the API call to Slack. @@ -300,12 +300,12 @@

    Classes

    api_method: str, *, http_verb: str = "POST", - files: dict = None, + files: Optional[dict] = None, data: Union[dict, FormData] = None, - params: dict = None, - json: dict = None, # skipcq: PYL-W0621 - headers: dict = None, - auth: dict = None, + params: Optional[dict] = None, + json: Optional[dict] = None, # skipcq: PYL-W0621 + headers: Optional[dict] = None, + auth: Optional[dict] = None, ) -> AsyncSlackResponse: """Create a request and execute the API call to Slack. @@ -443,7 +443,7 @@

    Class variables

    Methods

    -async def api_call(self, api_method: str, *, http_verb: str = 'POST', files: dict = None, data: Union[dict, aiohttp.formdata.FormData] = None, params: dict = None, json: dict = None, headers: dict = None, auth: dict = None) ‑> AsyncSlackResponse +async def api_call(self, api_method: str, *, http_verb: str = 'POST', files: Optional[dict] = None, data: Union[dict, aiohttp.formdata.FormData] = None, params: Optional[dict] = None, json: Optional[dict] = None, headers: Optional[dict] = None, auth: Optional[dict] = None) ‑> AsyncSlackResponse

    Create a request and execute the API call to Slack.

    @@ -497,12 +497,12 @@

    Raises

    api_method: str, *, http_verb: str = "POST", - files: dict = None, + files: Optional[dict] = None, data: Union[dict, FormData] = None, - params: dict = None, - json: dict = None, # skipcq: PYL-W0621 - headers: dict = None, - auth: dict = None, + params: Optional[dict] = None, + json: Optional[dict] = None, # skipcq: PYL-W0621 + headers: Optional[dict] = None, + auth: Optional[dict] = None, ) -> AsyncSlackResponse: """Create a request and execute the API call to Slack. diff --git a/docs/api-docs/slack_sdk/web/async_client.html b/docs/api-docs/slack_sdk/web/async_client.html index 7198cc0e1..dc292014a 100644 --- a/docs/api-docs/slack_sdk/web/async_client.html +++ b/docs/api-docs/slack_sdk/web/async_client.html @@ -935,6 +935,29 @@

    Module slack_sdk.web.async_client

    ) return await self.api_call("admin.users.session.reset", params=kwargs) + async def admin_users_session_resetBulk( + self, + *, + user_ids: Union[str, Sequence[str]], + mobile_only: Optional[bool] = None, + web_only: Optional[bool] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users + https://api.slack.com/methods/admin.users.session.resetBulk + """ + if isinstance(user_ids, (list, Tuple)): + kwargs.update({"user_ids": ",".join(user_ids)}) + else: + kwargs.update({"user_ids": user_ids}) + kwargs.update( + { + "mobile_only": mobile_only, + "web_only": web_only, + } + ) + return await self.api_call("admin.users.session.resetBulk", params=kwargs) + async def admin_users_session_invalidate( self, *, @@ -3828,6 +3851,15 @@

    Module slack_sdk.web.async_client

    kwargs.update({"team_id": team_id, "user": user}) return await self.api_call("team.billableInfo", http_verb="GET", params=kwargs) + async def team_billing_info( + self, + **kwargs, + ) -> AsyncSlackResponse: + """Reads a workspace's billing plan information. + https://api.slack.com/methods/team.billing.info + """ + return await self.api_call("team.billing.info", params=kwargs) + async def team_info( self, *, @@ -3882,6 +3914,15 @@

    Module slack_sdk.web.async_client

    kwargs.update({"visibility": visibility}) return await self.api_call("team.profile.get", http_verb="GET", params=kwargs) + async def team_preferences_list( + self, + **kwargs, + ) -> AsyncSlackResponse: + """Retrieve a list of a workspace's team preferences. + https://api.slack.com/methods/team.preferences.list + """ + return await self.api_call("team.preferences.list", params=kwargs) + async def usergroups_create( self, *, @@ -5319,6 +5360,29 @@

    Note

    ) return await self.api_call("admin.users.session.reset", params=kwargs) + async def admin_users_session_resetBulk( + self, + *, + user_ids: Union[str, Sequence[str]], + mobile_only: Optional[bool] = None, + web_only: Optional[bool] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users + https://api.slack.com/methods/admin.users.session.resetBulk + """ + if isinstance(user_ids, (list, Tuple)): + kwargs.update({"user_ids": ",".join(user_ids)}) + else: + kwargs.update({"user_ids": user_ids}) + kwargs.update( + { + "mobile_only": mobile_only, + "web_only": web_only, + } + ) + return await self.api_call("admin.users.session.resetBulk", params=kwargs) + async def admin_users_session_invalidate( self, *, @@ -8212,6 +8276,15 @@

    Note

    kwargs.update({"team_id": team_id, "user": user}) return await self.api_call("team.billableInfo", http_verb="GET", params=kwargs) + async def team_billing_info( + self, + **kwargs, + ) -> AsyncSlackResponse: + """Reads a workspace's billing plan information. + https://api.slack.com/methods/team.billing.info + """ + return await self.api_call("team.billing.info", params=kwargs) + async def team_info( self, *, @@ -8266,6 +8339,15 @@

    Note

    kwargs.update({"visibility": visibility}) return await self.api_call("team.profile.get", http_verb="GET", params=kwargs) + async def team_preferences_list( + self, + **kwargs, + ) -> AsyncSlackResponse: + """Retrieve a list of a workspace's team preferences. + https://api.slack.com/methods/team.preferences.list + """ + return await self.api_call("team.preferences.list", params=kwargs) + async def usergroups_create( self, *, @@ -10818,6 +10900,40 @@

    Methods

    return await self.api_call("admin.users.session.reset", params=kwargs)
    +
    +async def admin_users_session_resetBulk(self, *, user_ids: Union[str, Sequence[str]], mobile_only: Optional[bool] = None, web_only: Optional[bool] = None, **kwargs) ‑> AsyncSlackResponse +
    +
    +

    Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users +https://api.slack.com/methods/admin.users.session.resetBulk

    +
    + +Expand source code + +
    async def admin_users_session_resetBulk(
    +    self,
    +    *,
    +    user_ids: Union[str, Sequence[str]],
    +    mobile_only: Optional[bool] = None,
    +    web_only: Optional[bool] = None,
    +    **kwargs,
    +) -> AsyncSlackResponse:
    +    """Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users
    +    https://api.slack.com/methods/admin.users.session.resetBulk
    +    """
    +    if isinstance(user_ids, (list, Tuple)):
    +        kwargs.update({"user_ids": ",".join(user_ids)})
    +    else:
    +        kwargs.update({"user_ids": user_ids})
    +    kwargs.update(
    +        {
    +            "mobile_only": mobile_only,
    +            "web_only": web_only,
    +        }
    +    )
    +    return await self.api_call("admin.users.session.resetBulk", params=kwargs)
    +
    +
    async def admin_users_session_setSettings(self, *, user_ids: Union[str, Sequence[str]], desktop_app_browser_quit: Optional[bool] = None, duration: Optional[int] = None, **kwargs) ‑> AsyncSlackResponse
    @@ -14733,6 +14849,26 @@

    Methods

    return await self.api_call("team.billableInfo", http_verb="GET", params=kwargs)
    +
    +async def team_billing_info(self, **kwargs) ‑> AsyncSlackResponse +
    +
    +

    Reads a workspace's billing plan information. +https://api.slack.com/methods/team.billing.info

    +
    + +Expand source code + +
    async def team_billing_info(
    +    self,
    +    **kwargs,
    +) -> AsyncSlackResponse:
    +    """Reads a workspace's billing plan information.
    +    https://api.slack.com/methods/team.billing.info
    +    """
    +    return await self.api_call("team.billing.info", params=kwargs)
    +
    +
    async def team_info(self, *, team: Optional[str] = None, **kwargs) ‑> AsyncSlackResponse
    @@ -14797,6 +14933,26 @@

    Methods

    )
    +
    +async def team_preferences_list(self, **kwargs) ‑> AsyncSlackResponse +
    +
    +

    Retrieve a list of a workspace's team preferences. +https://api.slack.com/methods/team.preferences.list

    +
    + +Expand source code + +
    async def team_preferences_list(
    +    self,
    +    **kwargs,
    +) -> AsyncSlackResponse:
    +    """Retrieve a list of a workspace's team preferences.
    +    https://api.slack.com/methods/team.preferences.list
    +    """
    +    return await self.api_call("team.preferences.list", params=kwargs)
    +
    +
    async def team_profile_get(self, *, visibility: Optional[str] = None, **kwargs) ‑> AsyncSlackResponse
    @@ -15695,6 +15851,7 @@

    admin_users_session_invalidate
  • admin_users_session_list
  • admin_users_session_reset
  • +
  • admin_users_session_resetBulk
  • admin_users_session_setSettings
  • admin_users_setAdmin
  • admin_users_setExpiration
  • @@ -15837,8 +15994,10 @@

    stars_remove
  • team_accessLogs
  • team_billableInfo
  • +
  • team_billing_info
  • team_info
  • team_integrationLogs
  • +
  • team_preferences_list
  • team_profile_get
  • usergroups_create
  • usergroups_disable
  • diff --git a/docs/api-docs/slack_sdk/web/async_internal_utils.html b/docs/api-docs/slack_sdk/web/async_internal_utils.html index 846c90148..2c31a2729 100644 --- a/docs/api-docs/slack_sdk/web/async_internal_utils.html +++ b/docs/api-docs/slack_sdk/web/async_internal_utils.html @@ -31,7 +31,7 @@

    Module slack_sdk.web.async_internal_utils

    import logging from asyncio import AbstractEventLoop from logging import Logger -from typing import Optional, BinaryIO, Dict, Sequence, Union, List +from typing import Optional, BinaryIO, Dict, Sequence, Union, List, Any import aiohttp from aiohttp import ClientSession @@ -78,12 +78,13 @@

    Module slack_sdk.web.async_internal_utils

    api_url: str, req_args: dict, # set the default to an empty array for legacy clients - retry_handlers: List[AsyncRetryHandler] = [], -) -> Dict[str, any]: + retry_handlers: Optional[List[AsyncRetryHandler]] = None, +) -> Dict[str, Any]: """Submit the HTTP request with the running session or a new session. Returns: A dictionary of the response data. """ + retry_handlers = retry_handlers if retry_handlers is not None else [] session = None use_running_session = current_session and not current_session.closed if use_running_session: @@ -95,7 +96,7 @@

    Module slack_sdk.web.async_internal_utils

    ) last_error: Optional[Exception] = None - resp: Optional[Dict[str, any]] = None + resp: Optional[Dict[str, Any]] = None try: retry_request = RetryHttpRequest( method=http_verb, diff --git a/docs/api-docs/slack_sdk/web/base_client.html b/docs/api-docs/slack_sdk/web/base_client.html index 26583be97..b97e9a62d 100644 --- a/docs/api-docs/slack_sdk/web/base_client.html +++ b/docs/api-docs/slack_sdk/web/base_client.html @@ -42,7 +42,7 @@

    Module slack_sdk.web.base_client

    from base64 import b64encode from http.client import HTTPResponse from ssl import SSLContext -from typing import BinaryIO, Dict, List +from typing import BinaryIO, Dict, List, Any from typing import Optional, Union from urllib.error import HTTPError from urllib.parse import urlencode @@ -113,12 +113,12 @@

    Module slack_sdk.web.base_client

    api_method: str, *, http_verb: str = "POST", - files: dict = None, - data: Union[dict] = None, - params: dict = None, - json: dict = None, # skipcq: PYL-W0621 - headers: dict = None, - auth: dict = None, + files: Optional[dict] = None, + data: Optional[dict] = None, + params: Optional[dict] = None, + json: Optional[dict] = None, # skipcq: PYL-W0621 + headers: Optional[dict] = None, + auth: Optional[dict] = None, ) -> SlackResponse: """Create a request and execute the API call to Slack. @@ -188,6 +188,7 @@

    Module slack_sdk.web.base_client

    req_args["auth"] if "auth" in req_args else None ) # Basic Auth for oauth.v2.access / oauth.access if auth is not None: + headers = {} if isinstance(auth, str): headers["Authorization"] = auth elif isinstance(auth, dict): @@ -217,7 +218,9 @@

    Module slack_sdk.web.base_client

    additional_headers=headers, ) - def _request_for_pagination(self, api_url, req_args) -> Dict[str, any]: + def _request_for_pagination( + self, api_url: str, req_args: Dict[str, Dict[str, Any]] + ) -> Dict[str, Any]: """This method is supposed to be used only for SlackResponse pagination You can paginate using Python's for iterator as below: @@ -235,13 +238,13 @@

    Module slack_sdk.web.base_client

    def _urllib_api_call( self, *, - token: str = None, + token: Optional[str] = None, url: str, - query_params: Dict[str, str] = {}, - json_body: Dict = {}, - body_params: Dict[str, str] = {}, - files: Dict[str, io.BytesIO] = {}, - additional_headers: Dict[str, str] = {}, + query_params: Dict[str, str], + json_body: Dict, + body_params: Dict[str, str], + files: Dict[str, io.BytesIO], + additional_headers: Dict[str, str], ) -> SlackResponse: """Performs a Slack API request and returns the result. @@ -332,11 +335,11 @@

    Module slack_sdk.web.base_client

    ) raise err.SlackApiError(message, response) + all_params: Dict[str, Any] = ( + copy.copy(body_params) if body_params is not None else {} + ) if query_params: - all_params = copy.copy(body_params) all_params.update(query_params) - else: - all_params = body_params request_args["params"] = all_params # for backward-compatibility return SlackResponse( @@ -354,17 +357,17 @@

    Module slack_sdk.web.base_client

    f.close() def _perform_urllib_http_request( - self, *, url: str, args: Dict[str, Dict[str, any]] - ) -> Dict[str, any]: + self, *, url: str, args: Dict[str, Dict[str, Any]] + ) -> Dict[str, Any]: """Performs an HTTP request and parses the response. Args: url: Complete URL (e.g., https://www.slack.com/api/chat.postMessage) args: args has "headers", "data", "params", and "json" "headers": Dict[str, str] - "data": Dict[str, any] + "data": Dict[str, Any] "params": Dict[str, str], - "json": Dict[str, any], + "json": Dict[str, Any], Returns: dict {status: int, headers: Headers, body: str} @@ -443,7 +446,16 @@

    Module slack_sdk.web.base_client

    resp = {"status": e.code, "headers": e.headers} if e.code == 429: # for compatibility with aiohttp - resp["headers"]["Retry-After"] = resp["headers"]["retry-after"] + if ( + "retry-after" not in resp["headers"] + and "Retry-After" in resp["headers"] + ): + resp["headers"]["retry-after"] = resp["headers"]["Retry-After"] + if ( + "Retry-After" not in resp["headers"] + and "retry-after" in resp["headers"] + ): + resp["headers"]["Retry-After"] = resp["headers"]["retry-after"] # read the response body here charset = e.headers.get_content_charset() or "utf-8" @@ -522,7 +534,7 @@

    Module slack_sdk.web.base_client

    self, url: str, req: Request, - ) -> Dict[str, any]: + ) -> Dict[str, Any]: # urllib not only opens http:// or https:// URLs, but also ftp:// and file://. # With this it might be possible to open local files on the executing machine # which might be a security risk if the URL to open can be manipulated by an external user. @@ -693,12 +705,12 @@

    Classes

    api_method: str, *, http_verb: str = "POST", - files: dict = None, - data: Union[dict] = None, - params: dict = None, - json: dict = None, # skipcq: PYL-W0621 - headers: dict = None, - auth: dict = None, + files: Optional[dict] = None, + data: Optional[dict] = None, + params: Optional[dict] = None, + json: Optional[dict] = None, # skipcq: PYL-W0621 + headers: Optional[dict] = None, + auth: Optional[dict] = None, ) -> SlackResponse: """Create a request and execute the API call to Slack. @@ -768,6 +780,7 @@

    Classes

    req_args["auth"] if "auth" in req_args else None ) # Basic Auth for oauth.v2.access / oauth.access if auth is not None: + headers = {} if isinstance(auth, str): headers["Authorization"] = auth elif isinstance(auth, dict): @@ -797,7 +810,9 @@

    Classes

    additional_headers=headers, ) - def _request_for_pagination(self, api_url, req_args) -> Dict[str, any]: + def _request_for_pagination( + self, api_url: str, req_args: Dict[str, Dict[str, Any]] + ) -> Dict[str, Any]: """This method is supposed to be used only for SlackResponse pagination You can paginate using Python's for iterator as below: @@ -815,13 +830,13 @@

    Classes

    def _urllib_api_call( self, *, - token: str = None, + token: Optional[str] = None, url: str, - query_params: Dict[str, str] = {}, - json_body: Dict = {}, - body_params: Dict[str, str] = {}, - files: Dict[str, io.BytesIO] = {}, - additional_headers: Dict[str, str] = {}, + query_params: Dict[str, str], + json_body: Dict, + body_params: Dict[str, str], + files: Dict[str, io.BytesIO], + additional_headers: Dict[str, str], ) -> SlackResponse: """Performs a Slack API request and returns the result. @@ -912,11 +927,11 @@

    Classes

    ) raise err.SlackApiError(message, response) + all_params: Dict[str, Any] = ( + copy.copy(body_params) if body_params is not None else {} + ) if query_params: - all_params = copy.copy(body_params) all_params.update(query_params) - else: - all_params = body_params request_args["params"] = all_params # for backward-compatibility return SlackResponse( @@ -934,17 +949,17 @@

    Classes

    f.close() def _perform_urllib_http_request( - self, *, url: str, args: Dict[str, Dict[str, any]] - ) -> Dict[str, any]: + self, *, url: str, args: Dict[str, Dict[str, Any]] + ) -> Dict[str, Any]: """Performs an HTTP request and parses the response. Args: url: Complete URL (e.g., https://www.slack.com/api/chat.postMessage) args: args has "headers", "data", "params", and "json" "headers": Dict[str, str] - "data": Dict[str, any] + "data": Dict[str, Any] "params": Dict[str, str], - "json": Dict[str, any], + "json": Dict[str, Any], Returns: dict {status: int, headers: Headers, body: str} @@ -1023,7 +1038,16 @@

    Classes

    resp = {"status": e.code, "headers": e.headers} if e.code == 429: # for compatibility with aiohttp - resp["headers"]["Retry-After"] = resp["headers"]["retry-after"] + if ( + "retry-after" not in resp["headers"] + and "Retry-After" in resp["headers"] + ): + resp["headers"]["retry-after"] = resp["headers"]["Retry-After"] + if ( + "Retry-After" not in resp["headers"] + and "retry-after" in resp["headers"] + ): + resp["headers"]["Retry-After"] = resp["headers"]["retry-after"] # read the response body here charset = e.headers.get_content_charset() or "utf-8" @@ -1102,7 +1126,7 @@

    Classes

    self, url: str, req: Request, - ) -> Dict[str, any]: + ) -> Dict[str, Any]: # urllib not only opens http:// or https:// URLs, but also ftp:// and file://. # With this it might be possible to open local files on the executing machine # which might be a security risk if the URL to open can be manipulated by an external user. @@ -1292,7 +1316,7 @@

    Returns

    Methods

    -def api_call(self, api_method: str, *, http_verb: str = 'POST', files: dict = None, data: dict = None, params: dict = None, json: dict = None, headers: dict = None, auth: dict = None) ‑> SlackResponse +def api_call(self, api_method: str, *, http_verb: str = 'POST', files: Optional[dict] = None, data: Optional[dict] = None, params: Optional[dict] = None, json: Optional[dict] = None, headers: Optional[dict] = None, auth: Optional[dict] = None) ‑> SlackResponse

    Create a request and execute the API call to Slack.

    @@ -1346,12 +1370,12 @@

    Raises

    api_method: str, *, http_verb: str = "POST", - files: dict = None, - data: Union[dict] = None, - params: dict = None, - json: dict = None, # skipcq: PYL-W0621 - headers: dict = None, - auth: dict = None, + files: Optional[dict] = None, + data: Optional[dict] = None, + params: Optional[dict] = None, + json: Optional[dict] = None, # skipcq: PYL-W0621 + headers: Optional[dict] = None, + auth: Optional[dict] = None, ) -> SlackResponse: """Create a request and execute the API call to Slack. diff --git a/docs/api-docs/slack_sdk/web/client.html b/docs/api-docs/slack_sdk/web/client.html index 02b813234..7a06ced06 100644 --- a/docs/api-docs/slack_sdk/web/client.html +++ b/docs/api-docs/slack_sdk/web/client.html @@ -896,6 +896,29 @@

    Module slack_sdk.web.client

    ) return self.api_call("admin.users.session.reset", params=kwargs) + def admin_users_session_resetBulk( + self, + *, + user_ids: Union[str, Sequence[str]], + mobile_only: Optional[bool] = None, + web_only: Optional[bool] = None, + **kwargs, + ) -> SlackResponse: + """Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users + https://api.slack.com/methods/admin.users.session.resetBulk + """ + if isinstance(user_ids, (list, Tuple)): + kwargs.update({"user_ids": ",".join(user_ids)}) + else: + kwargs.update({"user_ids": user_ids}) + kwargs.update( + { + "mobile_only": mobile_only, + "web_only": web_only, + } + ) + return self.api_call("admin.users.session.resetBulk", params=kwargs) + def admin_users_session_invalidate( self, *, @@ -3769,6 +3792,15 @@

    Module slack_sdk.web.client

    kwargs.update({"team_id": team_id, "user": user}) return self.api_call("team.billableInfo", http_verb="GET", params=kwargs) + def team_billing_info( + self, + **kwargs, + ) -> SlackResponse: + """Reads a workspace's billing plan information. + https://api.slack.com/methods/team.billing.info + """ + return self.api_call("team.billing.info", params=kwargs) + def team_info( self, *, @@ -3821,6 +3853,15 @@

    Module slack_sdk.web.client

    kwargs.update({"visibility": visibility}) return self.api_call("team.profile.get", http_verb="GET", params=kwargs) + def team_preferences_list( + self, + **kwargs, + ) -> SlackResponse: + """Retrieve a list of a workspace's team preferences. + https://api.slack.com/methods/team.preferences.list + """ + return self.api_call("team.preferences.list", params=kwargs) + def usergroups_create( self, *, @@ -5220,6 +5261,29 @@

    Note

    ) return self.api_call("admin.users.session.reset", params=kwargs) + def admin_users_session_resetBulk( + self, + *, + user_ids: Union[str, Sequence[str]], + mobile_only: Optional[bool] = None, + web_only: Optional[bool] = None, + **kwargs, + ) -> SlackResponse: + """Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users + https://api.slack.com/methods/admin.users.session.resetBulk + """ + if isinstance(user_ids, (list, Tuple)): + kwargs.update({"user_ids": ",".join(user_ids)}) + else: + kwargs.update({"user_ids": user_ids}) + kwargs.update( + { + "mobile_only": mobile_only, + "web_only": web_only, + } + ) + return self.api_call("admin.users.session.resetBulk", params=kwargs) + def admin_users_session_invalidate( self, *, @@ -8093,6 +8157,15 @@

    Note

    kwargs.update({"team_id": team_id, "user": user}) return self.api_call("team.billableInfo", http_verb="GET", params=kwargs) + def team_billing_info( + self, + **kwargs, + ) -> SlackResponse: + """Reads a workspace's billing plan information. + https://api.slack.com/methods/team.billing.info + """ + return self.api_call("team.billing.info", params=kwargs) + def team_info( self, *, @@ -8145,6 +8218,15 @@

    Note

    kwargs.update({"visibility": visibility}) return self.api_call("team.profile.get", http_verb="GET", params=kwargs) + def team_preferences_list( + self, + **kwargs, + ) -> SlackResponse: + """Retrieve a list of a workspace's team preferences. + https://api.slack.com/methods/team.preferences.list + """ + return self.api_call("team.preferences.list", params=kwargs) + def usergroups_create( self, *, @@ -10653,6 +10735,40 @@

    Methods

    return self.api_call("admin.users.session.reset", params=kwargs)
    +
    +def admin_users_session_resetBulk(self, *, user_ids: Union[str, Sequence[str]], mobile_only: Optional[bool] = None, web_only: Optional[bool] = None, **kwargs) ‑> SlackResponse +
    +
    +

    Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users +https://api.slack.com/methods/admin.users.session.resetBulk

    +
    + +Expand source code + +
    def admin_users_session_resetBulk(
    +    self,
    +    *,
    +    user_ids: Union[str, Sequence[str]],
    +    mobile_only: Optional[bool] = None,
    +    web_only: Optional[bool] = None,
    +    **kwargs,
    +) -> SlackResponse:
    +    """Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users
    +    https://api.slack.com/methods/admin.users.session.resetBulk
    +    """
    +    if isinstance(user_ids, (list, Tuple)):
    +        kwargs.update({"user_ids": ",".join(user_ids)})
    +    else:
    +        kwargs.update({"user_ids": user_ids})
    +    kwargs.update(
    +        {
    +            "mobile_only": mobile_only,
    +            "web_only": web_only,
    +        }
    +    )
    +    return self.api_call("admin.users.session.resetBulk", params=kwargs)
    +
    +
    def admin_users_session_setSettings(self, *, user_ids: Union[str, Sequence[str]], desktop_app_browser_quit: Optional[bool] = None, duration: Optional[int] = None, **kwargs) ‑> SlackResponse
    @@ -14554,6 +14670,26 @@

    Methods

    return self.api_call("team.billableInfo", http_verb="GET", params=kwargs) +
    +def team_billing_info(self, **kwargs) ‑> SlackResponse +
    +
    +

    Reads a workspace's billing plan information. +https://api.slack.com/methods/team.billing.info

    +
    + +Expand source code + +
    def team_billing_info(
    +    self,
    +    **kwargs,
    +) -> SlackResponse:
    +    """Reads a workspace's billing plan information.
    +    https://api.slack.com/methods/team.billing.info
    +    """
    +    return self.api_call("team.billing.info", params=kwargs)
    +
    +
    def team_info(self, *, team: Optional[str] = None, **kwargs) ‑> SlackResponse
    @@ -14616,6 +14752,26 @@

    Methods

    return self.api_call("team.integrationLogs", http_verb="GET", params=kwargs) +
    +def team_preferences_list(self, **kwargs) ‑> SlackResponse +
    +
    +

    Retrieve a list of a workspace's team preferences. +https://api.slack.com/methods/team.preferences.list

    +
    + +Expand source code + +
    def team_preferences_list(
    +    self,
    +    **kwargs,
    +) -> SlackResponse:
    +    """Retrieve a list of a workspace's team preferences.
    +    https://api.slack.com/methods/team.preferences.list
    +    """
    +    return self.api_call("team.preferences.list", params=kwargs)
    +
    +
    def team_profile_get(self, *, visibility: Optional[str] = None, **kwargs) ‑> SlackResponse
    @@ -15507,6 +15663,7 @@

    admin_users_session_invalidate
  • admin_users_session_list
  • admin_users_session_reset
  • +
  • admin_users_session_resetBulk
  • admin_users_session_setSettings
  • admin_users_setAdmin
  • admin_users_setExpiration
  • @@ -15649,8 +15806,10 @@

    stars_remove
  • team_accessLogs
  • team_billableInfo
  • +
  • team_billing_info
  • team_info
  • team_integrationLogs
  • +
  • team_preferences_list
  • team_profile_get
  • usergroups_create
  • usergroups_disable
  • diff --git a/docs/api-docs/slack_sdk/web/legacy_base_client.html b/docs/api-docs/slack_sdk/web/legacy_base_client.html index 23898f9df..75507d7fb 100644 --- a/docs/api-docs/slack_sdk/web/legacy_base_client.html +++ b/docs/api-docs/slack_sdk/web/legacy_base_client.html @@ -42,7 +42,7 @@

    Module slack_sdk.web.legacy_base_client

    import warnings from http.client import HTTPResponse from ssl import SSLContext -from typing import BinaryIO, Dict, List +from typing import BinaryIO, Dict, List, Any from typing import Optional, Union from urllib.error import HTTPError from urllib.parse import urlencode @@ -115,12 +115,12 @@

    Module slack_sdk.web.legacy_base_client

    api_method: str, *, http_verb: str = "POST", - files: dict = None, + files: Optional[dict] = None, data: Union[dict, FormData] = None, - params: dict = None, - json: dict = None, # skipcq: PYL-W0621 - headers: dict = None, - auth: dict = None, + params: Optional[dict] = None, + json: Optional[dict] = None, # skipcq: PYL-W0621 + headers: Optional[dict] = None, + auth: Optional[dict] = None, ) -> Union[asyncio.Future, SlackResponse]: """Create a request and execute the API call to Slack. Args: @@ -153,13 +153,16 @@

    Module slack_sdk.web.legacy_base_client

    """ api_url = _get_url(self.base_url, api_method) - if isinstance(auth, dict): - auth = BasicAuth(auth["client_id"], auth["client_secret"]) - elif isinstance(auth, BasicAuth): - headers["Authorization"] = auth.encode() headers = headers or {} headers.update(self.headers) + + if auth is not None: + if isinstance(auth, dict): + auth = BasicAuth(auth["client_id"], auth["client_secret"]) + elif isinstance(auth, BasicAuth): + headers["Authorization"] = auth.encode() + req_args = _build_req_args( token=self.token, http_verb=http_verb, @@ -189,8 +192,8 @@

    Module slack_sdk.web.legacy_base_client

    if self.use_sync_aiohttp: # Using this is no longer recommended - just keep this for backward-compatibility return self._event_loop.run_until_complete(future) - else: - return self._sync_send(api_url=api_url, req_args=req_args) + + return self._sync_send(api_url=api_url, req_args=req_args) # ================================================================= # aiohttp based async WebClient @@ -236,7 +239,7 @@

    Module slack_sdk.web.legacy_base_client

    } return SlackResponse(**{**data, **res}).validate() - async def _request(self, *, http_verb, api_url, req_args) -> Dict[str, any]: + async def _request(self, *, http_verb, api_url, req_args) -> Dict[str, Any]: """Submit the HTTP request with the running session or a new session. Returns: A dictionary of the response data. @@ -265,6 +268,7 @@

    Module slack_sdk.web.legacy_base_client

    req_args["auth"] if "auth" in req_args else None ) # Basic Auth for oauth.v2.access / oauth.access if auth is not None: + headers = {} if isinstance(auth, BasicAuth): headers["Authorization"] = auth.encode() elif isinstance(auth, str): @@ -290,7 +294,9 @@

    Module slack_sdk.web.legacy_base_client

    additional_headers=headers, ) - def _request_for_pagination(self, api_url, req_args) -> Dict[str, any]: + def _request_for_pagination( + self, api_url: str, req_args: Dict[str, Dict[str, Any]] + ) -> Dict[str, Any]: """This method is supposed to be used only for SlackResponse pagination You can paginate using Python's for iterator as below: for response in client.conversations_list(limit=100): @@ -306,13 +312,13 @@

    Module slack_sdk.web.legacy_base_client

    def _urllib_api_call( self, *, - token: str = None, + token: Optional[str] = None, url: str, - query_params: Dict[str, str] = {}, - json_body: Dict = {}, - body_params: Dict[str, str] = {}, - files: Dict[str, io.BytesIO] = {}, - additional_headers: Dict[str, str] = {}, + query_params: Dict[str, str], + json_body: Dict, + body_params: Dict[str, str], + files: Dict[str, io.BytesIO], + additional_headers: Dict[str, str], ) -> SlackResponse: """Performs a Slack API request and returns the result. @@ -402,11 +408,11 @@

    Module slack_sdk.web.legacy_base_client

    ) raise err.SlackApiError(message, response) + all_params: Dict[str, Any] = ( + copy.copy(body_params) if body_params is not None else {} + ) if query_params: - all_params = copy.copy(body_params) all_params.update(query_params) - else: - all_params = body_params request_args["params"] = all_params # for backward-compatibility return SlackResponse( @@ -425,17 +431,17 @@

    Module slack_sdk.web.legacy_base_client

    f.close() def _perform_urllib_http_request( - self, *, url: str, args: Dict[str, Dict[str, any]] - ) -> Dict[str, any]: + self, *, url: str, args: Dict[str, Dict[str, Any]] + ) -> Dict[str, Any]: """Performs an HTTP request and parses the response. Args: url: Complete URL (e.g., https://www.slack.com/api/chat.postMessage) args: args has "headers", "data", "params", and "json" "headers": Dict[str, str] - "data": Dict[str, any] + "data": Dict[str, Any] "params": Dict[str, str], - "json": Dict[str, any], + "json": Dict[str, Any], Returns: dict {status: int, headers: Headers, body: str} @@ -534,7 +540,16 @@

    Module slack_sdk.web.legacy_base_client

    resp = {"status": e.code, "headers": e.headers} if e.code == 429: # for compatibility with aiohttp - resp["headers"]["Retry-After"] = resp["headers"]["retry-after"] + if ( + "retry-after" not in resp["headers"] + and "Retry-After" in resp["headers"] + ): + resp["headers"]["retry-after"] = resp["headers"]["Retry-After"] + if ( + "Retry-After" not in resp["headers"] + and "retry-after" in resp["headers"] + ): + resp["headers"]["Retry-After"] = resp["headers"]["retry-after"] # read the response body here charset = e.headers.get_content_charset() or "utf-8" @@ -666,12 +681,12 @@

    Classes

    api_method: str, *, http_verb: str = "POST", - files: dict = None, + files: Optional[dict] = None, data: Union[dict, FormData] = None, - params: dict = None, - json: dict = None, # skipcq: PYL-W0621 - headers: dict = None, - auth: dict = None, + params: Optional[dict] = None, + json: Optional[dict] = None, # skipcq: PYL-W0621 + headers: Optional[dict] = None, + auth: Optional[dict] = None, ) -> Union[asyncio.Future, SlackResponse]: """Create a request and execute the API call to Slack. Args: @@ -704,13 +719,16 @@

    Classes

    """ api_url = _get_url(self.base_url, api_method) - if isinstance(auth, dict): - auth = BasicAuth(auth["client_id"], auth["client_secret"]) - elif isinstance(auth, BasicAuth): - headers["Authorization"] = auth.encode() headers = headers or {} headers.update(self.headers) + + if auth is not None: + if isinstance(auth, dict): + auth = BasicAuth(auth["client_id"], auth["client_secret"]) + elif isinstance(auth, BasicAuth): + headers["Authorization"] = auth.encode() + req_args = _build_req_args( token=self.token, http_verb=http_verb, @@ -740,8 +758,8 @@

    Classes

    if self.use_sync_aiohttp: # Using this is no longer recommended - just keep this for backward-compatibility return self._event_loop.run_until_complete(future) - else: - return self._sync_send(api_url=api_url, req_args=req_args) + + return self._sync_send(api_url=api_url, req_args=req_args) # ================================================================= # aiohttp based async WebClient @@ -787,7 +805,7 @@

    Classes

    } return SlackResponse(**{**data, **res}).validate() - async def _request(self, *, http_verb, api_url, req_args) -> Dict[str, any]: + async def _request(self, *, http_verb, api_url, req_args) -> Dict[str, Any]: """Submit the HTTP request with the running session or a new session. Returns: A dictionary of the response data. @@ -816,6 +834,7 @@

    Classes

    req_args["auth"] if "auth" in req_args else None ) # Basic Auth for oauth.v2.access / oauth.access if auth is not None: + headers = {} if isinstance(auth, BasicAuth): headers["Authorization"] = auth.encode() elif isinstance(auth, str): @@ -841,7 +860,9 @@

    Classes

    additional_headers=headers, ) - def _request_for_pagination(self, api_url, req_args) -> Dict[str, any]: + def _request_for_pagination( + self, api_url: str, req_args: Dict[str, Dict[str, Any]] + ) -> Dict[str, Any]: """This method is supposed to be used only for SlackResponse pagination You can paginate using Python's for iterator as below: for response in client.conversations_list(limit=100): @@ -857,13 +878,13 @@

    Classes

    def _urllib_api_call( self, *, - token: str = None, + token: Optional[str] = None, url: str, - query_params: Dict[str, str] = {}, - json_body: Dict = {}, - body_params: Dict[str, str] = {}, - files: Dict[str, io.BytesIO] = {}, - additional_headers: Dict[str, str] = {}, + query_params: Dict[str, str], + json_body: Dict, + body_params: Dict[str, str], + files: Dict[str, io.BytesIO], + additional_headers: Dict[str, str], ) -> SlackResponse: """Performs a Slack API request and returns the result. @@ -953,11 +974,11 @@

    Classes

    ) raise err.SlackApiError(message, response) + all_params: Dict[str, Any] = ( + copy.copy(body_params) if body_params is not None else {} + ) if query_params: - all_params = copy.copy(body_params) all_params.update(query_params) - else: - all_params = body_params request_args["params"] = all_params # for backward-compatibility return SlackResponse( @@ -976,17 +997,17 @@

    Classes

    f.close() def _perform_urllib_http_request( - self, *, url: str, args: Dict[str, Dict[str, any]] - ) -> Dict[str, any]: + self, *, url: str, args: Dict[str, Dict[str, Any]] + ) -> Dict[str, Any]: """Performs an HTTP request and parses the response. Args: url: Complete URL (e.g., https://www.slack.com/api/chat.postMessage) args: args has "headers", "data", "params", and "json" "headers": Dict[str, str] - "data": Dict[str, any] + "data": Dict[str, Any] "params": Dict[str, str], - "json": Dict[str, any], + "json": Dict[str, Any], Returns: dict {status: int, headers: Headers, body: str} @@ -1085,7 +1106,16 @@

    Classes

    resp = {"status": e.code, "headers": e.headers} if e.code == 429: # for compatibility with aiohttp - resp["headers"]["Retry-After"] = resp["headers"]["retry-after"] + if ( + "retry-after" not in resp["headers"] + and "Retry-After" in resp["headers"] + ): + resp["headers"]["retry-after"] = resp["headers"]["Retry-After"] + if ( + "Retry-After" not in resp["headers"] + and "retry-after" in resp["headers"] + ): + resp["headers"]["Retry-After"] = resp["headers"]["retry-after"] # read the response body here charset = e.headers.get_content_charset() or "utf-8" @@ -1229,7 +1259,7 @@

    Returns

    Methods

    -def api_call(self, api_method: str, *, http_verb: str = 'POST', files: dict = None, data: Union[dict, aiohttp.formdata.FormData] = None, params: dict = None, json: dict = None, headers: dict = None, auth: dict = None) ‑> Union[_asyncio.Future, LegacySlackResponse] +def api_call(self, api_method: str, *, http_verb: str = 'POST', files: Optional[dict] = None, data: Union[dict, aiohttp.formdata.FormData] = None, params: Optional[dict] = None, json: Optional[dict] = None, headers: Optional[dict] = None, auth: Optional[dict] = None) ‑> Union[_asyncio.Future, LegacySlackResponse]

    Create a request and execute the API call to Slack.

    @@ -1283,12 +1313,12 @@

    Raises

    api_method: str, *, http_verb: str = "POST", - files: dict = None, + files: Optional[dict] = None, data: Union[dict, FormData] = None, - params: dict = None, - json: dict = None, # skipcq: PYL-W0621 - headers: dict = None, - auth: dict = None, + params: Optional[dict] = None, + json: Optional[dict] = None, # skipcq: PYL-W0621 + headers: Optional[dict] = None, + auth: Optional[dict] = None, ) -> Union[asyncio.Future, SlackResponse]: """Create a request and execute the API call to Slack. Args: @@ -1321,13 +1351,16 @@

    Raises

    """ api_url = _get_url(self.base_url, api_method) - if isinstance(auth, dict): - auth = BasicAuth(auth["client_id"], auth["client_secret"]) - elif isinstance(auth, BasicAuth): - headers["Authorization"] = auth.encode() headers = headers or {} headers.update(self.headers) + + if auth is not None: + if isinstance(auth, dict): + auth = BasicAuth(auth["client_id"], auth["client_secret"]) + elif isinstance(auth, BasicAuth): + headers["Authorization"] = auth.encode() + req_args = _build_req_args( token=self.token, http_verb=http_verb, @@ -1357,8 +1390,8 @@

    Raises

    if self.use_sync_aiohttp: # Using this is no longer recommended - just keep this for backward-compatibility return self._event_loop.run_until_complete(future) - else: - return self._sync_send(api_url=api_url, req_args=req_args) + + return self._sync_send(api_url=api_url, req_args=req_args)
    diff --git a/docs/api-docs/slack_sdk/web/legacy_client.html b/docs/api-docs/slack_sdk/web/legacy_client.html index 5487e3614..81177c44d 100644 --- a/docs/api-docs/slack_sdk/web/legacy_client.html +++ b/docs/api-docs/slack_sdk/web/legacy_client.html @@ -906,6 +906,29 @@

    Module slack_sdk.web.legacy_client

    ) return self.api_call("admin.users.session.reset", params=kwargs) + def admin_users_session_resetBulk( + self, + *, + user_ids: Union[str, Sequence[str]], + mobile_only: Optional[bool] = None, + web_only: Optional[bool] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users + https://api.slack.com/methods/admin.users.session.resetBulk + """ + if isinstance(user_ids, (list, Tuple)): + kwargs.update({"user_ids": ",".join(user_ids)}) + else: + kwargs.update({"user_ids": user_ids}) + kwargs.update( + { + "mobile_only": mobile_only, + "web_only": web_only, + } + ) + return self.api_call("admin.users.session.resetBulk", params=kwargs) + def admin_users_session_invalidate( self, *, @@ -3779,6 +3802,15 @@

    Module slack_sdk.web.legacy_client

    kwargs.update({"team_id": team_id, "user": user}) return self.api_call("team.billableInfo", http_verb="GET", params=kwargs) + def team_billing_info( + self, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Reads a workspace's billing plan information. + https://api.slack.com/methods/team.billing.info + """ + return self.api_call("team.billing.info", params=kwargs) + def team_info( self, *, @@ -3831,6 +3863,15 @@

    Module slack_sdk.web.legacy_client

    kwargs.update({"visibility": visibility}) return self.api_call("team.profile.get", http_verb="GET", params=kwargs) + def team_preferences_list( + self, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Retrieve a list of a workspace's team preferences. + https://api.slack.com/methods/team.preferences.list + """ + return self.api_call("team.preferences.list", params=kwargs) + def usergroups_create( self, *, @@ -5230,6 +5271,29 @@

    Note

    ) return self.api_call("admin.users.session.reset", params=kwargs) + def admin_users_session_resetBulk( + self, + *, + user_ids: Union[str, Sequence[str]], + mobile_only: Optional[bool] = None, + web_only: Optional[bool] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users + https://api.slack.com/methods/admin.users.session.resetBulk + """ + if isinstance(user_ids, (list, Tuple)): + kwargs.update({"user_ids": ",".join(user_ids)}) + else: + kwargs.update({"user_ids": user_ids}) + kwargs.update( + { + "mobile_only": mobile_only, + "web_only": web_only, + } + ) + return self.api_call("admin.users.session.resetBulk", params=kwargs) + def admin_users_session_invalidate( self, *, @@ -8103,6 +8167,15 @@

    Note

    kwargs.update({"team_id": team_id, "user": user}) return self.api_call("team.billableInfo", http_verb="GET", params=kwargs) + def team_billing_info( + self, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Reads a workspace's billing plan information. + https://api.slack.com/methods/team.billing.info + """ + return self.api_call("team.billing.info", params=kwargs) + def team_info( self, *, @@ -8155,6 +8228,15 @@

    Note

    kwargs.update({"visibility": visibility}) return self.api_call("team.profile.get", http_verb="GET", params=kwargs) + def team_preferences_list( + self, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Retrieve a list of a workspace's team preferences. + https://api.slack.com/methods/team.preferences.list + """ + return self.api_call("team.preferences.list", params=kwargs) + def usergroups_create( self, *, @@ -10663,6 +10745,40 @@

    Methods

    return self.api_call("admin.users.session.reset", params=kwargs) +
    +def admin_users_session_resetBulk(self, *, user_ids: Union[str, Sequence[str]], mobile_only: Optional[bool] = None, web_only: Optional[bool] = None, **kwargs) ‑> Union[_asyncio.Future, LegacySlackResponse] +
    +
    +

    Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users +https://api.slack.com/methods/admin.users.session.resetBulk

    +
    + +Expand source code + +
    def admin_users_session_resetBulk(
    +    self,
    +    *,
    +    user_ids: Union[str, Sequence[str]],
    +    mobile_only: Optional[bool] = None,
    +    web_only: Optional[bool] = None,
    +    **kwargs,
    +) -> Union[Future, SlackResponse]:
    +    """Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users
    +    https://api.slack.com/methods/admin.users.session.resetBulk
    +    """
    +    if isinstance(user_ids, (list, Tuple)):
    +        kwargs.update({"user_ids": ",".join(user_ids)})
    +    else:
    +        kwargs.update({"user_ids": user_ids})
    +    kwargs.update(
    +        {
    +            "mobile_only": mobile_only,
    +            "web_only": web_only,
    +        }
    +    )
    +    return self.api_call("admin.users.session.resetBulk", params=kwargs)
    +
    +
    def admin_users_session_setSettings(self, *, user_ids: Union[str, Sequence[str]], desktop_app_browser_quit: Optional[bool] = None, duration: Optional[int] = None, **kwargs) ‑> Union[_asyncio.Future, LegacySlackResponse]
    @@ -14564,6 +14680,26 @@

    Methods

    return self.api_call("team.billableInfo", http_verb="GET", params=kwargs) +
    +def team_billing_info(self, **kwargs) ‑> Union[_asyncio.Future, LegacySlackResponse] +
    +
    +

    Reads a workspace's billing plan information. +https://api.slack.com/methods/team.billing.info

    +
    + +Expand source code + +
    def team_billing_info(
    +    self,
    +    **kwargs,
    +) -> Union[Future, SlackResponse]:
    +    """Reads a workspace's billing plan information.
    +    https://api.slack.com/methods/team.billing.info
    +    """
    +    return self.api_call("team.billing.info", params=kwargs)
    +
    +
    def team_info(self, *, team: Optional[str] = None, **kwargs) ‑> Union[_asyncio.Future, LegacySlackResponse]
    @@ -14626,6 +14762,26 @@

    Methods

    return self.api_call("team.integrationLogs", http_verb="GET", params=kwargs) +
    +def team_preferences_list(self, **kwargs) ‑> Union[_asyncio.Future, LegacySlackResponse] +
    +
    +

    Retrieve a list of a workspace's team preferences. +https://api.slack.com/methods/team.preferences.list

    +
    + +Expand source code + +
    def team_preferences_list(
    +    self,
    +    **kwargs,
    +) -> Union[Future, SlackResponse]:
    +    """Retrieve a list of a workspace's team preferences.
    +    https://api.slack.com/methods/team.preferences.list
    +    """
    +    return self.api_call("team.preferences.list", params=kwargs)
    +
    +
    def team_profile_get(self, *, visibility: Optional[str] = None, **kwargs) ‑> Union[_asyncio.Future, LegacySlackResponse]
    @@ -15517,6 +15673,7 @@

    admin_users_session_invalidate
  • admin_users_session_list
  • admin_users_session_reset
  • +
  • admin_users_session_resetBulk
  • admin_users_session_setSettings
  • admin_users_setAdmin
  • admin_users_setExpiration
  • @@ -15659,8 +15816,10 @@

    stars_remove
  • team_accessLogs
  • team_billableInfo
  • +
  • team_billing_info
  • team_info
  • team_integrationLogs
  • +
  • team_preferences_list
  • team_profile_get
  • usergroups_create
  • usergroups_disable
  • diff --git a/docs/api-docs/slack_sdk/webhook/async_client.html b/docs/api-docs/slack_sdk/webhook/async_client.html index c2091229e..a51ef2f73 100644 --- a/docs/api-docs/slack_sdk/webhook/async_client.html +++ b/docs/api-docs/slack_sdk/webhook/async_client.html @@ -182,7 +182,7 @@

    Module slack_sdk.webhook.async_client

    async def _perform_http_request( self, *, body: Dict[str, Any], headers: Dict[str, str] ) -> WebhookResponse: - body = json.dumps(body) + str_body: str = json.dumps(body) headers["Content-Type"] = "application/json;charset=utf-8" session: Optional[ClientSession] = None @@ -201,7 +201,7 @@

    Module slack_sdk.webhook.async_client

    try: request_kwargs = { "headers": headers, - "data": body, + "data": str_body, "ssl": self.ssl, "proxy": self.proxy, } @@ -223,7 +223,7 @@

    Module slack_sdk.webhook.async_client

    if self.logger.level <= logging.DEBUG: self.logger.debug( - f"Sending a request - url: {self.url}, body: {body}, headers: {headers}" + f"Sending a request - url: {self.url}, body: {str_body}, headers: {headers}" ) try: @@ -484,7 +484,7 @@

    Args

    async def _perform_http_request( self, *, body: Dict[str, Any], headers: Dict[str, str] ) -> WebhookResponse: - body = json.dumps(body) + str_body: str = json.dumps(body) headers["Content-Type"] = "application/json;charset=utf-8" session: Optional[ClientSession] = None @@ -503,7 +503,7 @@

    Args

    try: request_kwargs = { "headers": headers, - "data": body, + "data": str_body, "ssl": self.ssl, "proxy": self.proxy, } @@ -525,7 +525,7 @@

    Args

    if self.logger.level <= logging.DEBUG: self.logger.debug( - f"Sending a request - url: {self.url}, body: {body}, headers: {headers}" + f"Sending a request - url: {self.url}, body: {str_body}, headers: {headers}" ) try: diff --git a/docs/api-docs/slack_sdk/webhook/client.html b/docs/api-docs/slack_sdk/webhook/client.html index 2978d8229..7960bad58 100644 --- a/docs/api-docs/slack_sdk/webhook/client.html +++ b/docs/api-docs/slack_sdk/webhook/client.html @@ -31,7 +31,7 @@

    Module slack_sdk.webhook.client

    import urllib from http.client import HTTPResponse from ssl import SSLContext -from typing import Dict, Union, Sequence, Optional, List +from typing import Dict, Union, Sequence, Optional, List, Any from urllib.error import HTTPError from urllib.request import Request, urlopen, OpenerDirector, ProxyHandler, HTTPSHandler @@ -111,8 +111,8 @@

    Module slack_sdk.webhook.client

    self, *, text: Optional[str] = None, - attachments: Optional[Sequence[Union[Dict[str, any], Attachment]]] = None, - blocks: Optional[Sequence[Union[Dict[str, any], Block]]] = None, + attachments: Optional[Sequence[Union[Dict[str, Any], Attachment]]] = None, + blocks: Optional[Sequence[Union[Dict[str, Any], Block]]] = None, response_type: Optional[str] = None, replace_original: Optional[bool] = None, delete_original: Optional[bool] = None, @@ -154,7 +154,7 @@

    Module slack_sdk.webhook.client

    ) def send_dict( - self, body: Dict[str, any], headers: Optional[Dict[str, str]] = None + self, body: Dict[str, Any], headers: Optional[Dict[str, str]] = None ) -> WebhookResponse: """Performs a Slack API request and returns the result. @@ -171,7 +171,7 @@

    Module slack_sdk.webhook.client

    ) def _perform_http_request( - self, *, body: Dict[str, any], headers: Dict[str, str] + self, *, body: Dict[str, Any], headers: Dict[str, str] ) -> WebhookResponse: body = json.dumps(body) headers["Content-Type"] = "application/json;charset=utf-8" @@ -210,11 +210,20 @@

    Module slack_sdk.webhook.client

    url=url, status_code=e.code, body=response_body, - headers=e.headers, + headers=dict(e.headers.items()), ) if e.code == 429: # for backward-compatibility with WebClient (v.2.5.0 or older) - resp.headers["Retry-After"] = resp.headers["retry-after"] + if ( + "retry-after" not in resp.headers + and "Retry-After" in resp.headers + ): + resp.headers["retry-after"] = resp.headers["Retry-After"] + if ( + "Retry-After" not in resp.headers + and "retry-after" in resp.headers + ): + resp.headers["Retry-After"] = resp.headers["retry-after"] _debug_log_response(self.logger, resp) # Try to find a retry handler for this error @@ -303,20 +312,20 @@

    Module slack_sdk.webhook.client

    raise SlackRequestError(f"Invalid URL detected: {url}") # NOTE: BAN-B310 is already checked above - resp: Optional[HTTPResponse] = None + http_resp: Optional[HTTPResponse] = None if opener: - resp = opener.open(req, timeout=self.timeout) # skipcq: BAN-B310 + http_resp = opener.open(req, timeout=self.timeout) # skipcq: BAN-B310 else: - resp = urlopen( # skipcq: BAN-B310 + http_resp = urlopen( # skipcq: BAN-B310 req, context=self.ssl, timeout=self.timeout ) - charset: str = resp.headers.get_content_charset() or "utf-8" - response_body: str = resp.read().decode(charset) + charset: str = http_resp.headers.get_content_charset() or "utf-8" + response_body: str = http_resp.read().decode(charset) resp = WebhookResponse( url=url, - status_code=resp.status, + status_code=http_resp.status, body=response_body, - headers=resp.headers, + headers=http_resp.headers, ) _debug_log_response(self.logger, resp) return resp @@ -421,8 +430,8 @@

    Args

    self, *, text: Optional[str] = None, - attachments: Optional[Sequence[Union[Dict[str, any], Attachment]]] = None, - blocks: Optional[Sequence[Union[Dict[str, any], Block]]] = None, + attachments: Optional[Sequence[Union[Dict[str, Any], Attachment]]] = None, + blocks: Optional[Sequence[Union[Dict[str, Any], Block]]] = None, response_type: Optional[str] = None, replace_original: Optional[bool] = None, delete_original: Optional[bool] = None, @@ -464,7 +473,7 @@

    Args

    ) def send_dict( - self, body: Dict[str, any], headers: Optional[Dict[str, str]] = None + self, body: Dict[str, Any], headers: Optional[Dict[str, str]] = None ) -> WebhookResponse: """Performs a Slack API request and returns the result. @@ -481,7 +490,7 @@

    Args

    ) def _perform_http_request( - self, *, body: Dict[str, any], headers: Dict[str, str] + self, *, body: Dict[str, Any], headers: Dict[str, str] ) -> WebhookResponse: body = json.dumps(body) headers["Content-Type"] = "application/json;charset=utf-8" @@ -520,11 +529,20 @@

    Args

    url=url, status_code=e.code, body=response_body, - headers=e.headers, + headers=dict(e.headers.items()), ) if e.code == 429: # for backward-compatibility with WebClient (v.2.5.0 or older) - resp.headers["Retry-After"] = resp.headers["retry-after"] + if ( + "retry-after" not in resp.headers + and "Retry-After" in resp.headers + ): + resp.headers["retry-after"] = resp.headers["Retry-After"] + if ( + "Retry-After" not in resp.headers + and "retry-after" in resp.headers + ): + resp.headers["Retry-After"] = resp.headers["retry-after"] _debug_log_response(self.logger, resp) # Try to find a retry handler for this error @@ -613,20 +631,20 @@

    Args

    raise SlackRequestError(f"Invalid URL detected: {url}") # NOTE: BAN-B310 is already checked above - resp: Optional[HTTPResponse] = None + http_resp: Optional[HTTPResponse] = None if opener: - resp = opener.open(req, timeout=self.timeout) # skipcq: BAN-B310 + http_resp = opener.open(req, timeout=self.timeout) # skipcq: BAN-B310 else: - resp = urlopen( # skipcq: BAN-B310 + http_resp = urlopen( # skipcq: BAN-B310 req, context=self.ssl, timeout=self.timeout ) - charset: str = resp.headers.get_content_charset() or "utf-8" - response_body: str = resp.read().decode(charset) + charset: str = http_resp.headers.get_content_charset() or "utf-8" + response_body: str = http_resp.read().decode(charset) resp = WebhookResponse( url=url, - status_code=resp.status, + status_code=http_resp.status, body=response_body, - headers=resp.headers, + headers=http_resp.headers, ) _debug_log_response(self.logger, resp) return resp @@ -665,7 +683,7 @@

    Class variables

    Methods

    -def send(self, *, text: Optional[str] = None, attachments: Optional[Sequence[Union[Dict[str, ], Attachment]]] = None, blocks: Optional[Sequence[Union[Dict[str, ], Block]]] = None, response_type: Optional[str] = None, replace_original: Optional[bool] = None, delete_original: Optional[bool] = None, unfurl_links: Optional[bool] = None, unfurl_media: Optional[bool] = None, headers: Optional[Dict[str, str]] = None) ‑> WebhookResponse +def send(self, *, text: Optional[str] = None, attachments: Optional[Sequence[Union[Dict[str, Any], Attachment]]] = None, blocks: Optional[Sequence[Union[Dict[str, Any], Block]]] = None, response_type: Optional[str] = None, replace_original: Optional[bool] = None, delete_original: Optional[bool] = None, unfurl_links: Optional[bool] = None, unfurl_media: Optional[bool] = None, headers: Optional[Dict[str, str]] = None) ‑> WebhookResponse

    Performs a Slack API request and returns the result.

    @@ -701,8 +719,8 @@

    Returns

    self, *, text: Optional[str] = None, - attachments: Optional[Sequence[Union[Dict[str, any], Attachment]]] = None, - blocks: Optional[Sequence[Union[Dict[str, any], Block]]] = None, + attachments: Optional[Sequence[Union[Dict[str, Any], Attachment]]] = None, + blocks: Optional[Sequence[Union[Dict[str, Any], Block]]] = None, response_type: Optional[str] = None, replace_original: Optional[bool] = None, delete_original: Optional[bool] = None, @@ -745,7 +763,7 @@

    Returns

    -def send_dict(self, body: Dict[str, ], headers: Optional[Dict[str, str]] = None) ‑> WebhookResponse +def send_dict(self, body: Dict[str, Any], headers: Optional[Dict[str, str]] = None) ‑> WebhookResponse

    Performs a Slack API request and returns the result.

    @@ -764,7 +782,7 @@

    Returns

    Expand source code
    def send_dict(
    -    self, body: Dict[str, any], headers: Optional[Dict[str, str]] = None
    +    self, body: Dict[str, Any], headers: Optional[Dict[str, str]] = None
     ) -> WebhookResponse:
         """Performs a Slack API request and returns the result.
     
    diff --git a/slack_sdk/version.py b/slack_sdk/version.py
    index 5b3ce9797..ddecb4ff6 100644
    --- a/slack_sdk/version.py
    +++ b/slack_sdk/version.py
    @@ -1,2 +1,2 @@
     """Check the latest version at https://pypi.org/project/slack-sdk/"""
    -__version__ = "3.11.2"
    +__version__ = "3.12.0"