aboutsummaryrefslogtreecommitdiffstats
path: root/typings/slack_api
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2024-01-18 22:45:03 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 12:56:59 +0100
commit15cabf8ba1b9daa7e28475ea46cc5a8fd478e174 (patch)
treef65e557a115b0f83d13cb6d4b9943ddbd273268c /typings/slack_api
parentbb80ee68763233930a6f4169b07a029cd99b589d (diff)
downloadwee-slack-15cabf8ba1b9daa7e28475ea46cc5a8fd478e174.tar.gz
Support files in Slack Connect channels
Files uploaded in Slack Connect channels doesn't contain any information, so we have to make a request to files.info in order to get the information to render it. See https://api.slack.com/apis/channels-between-orgs#check_file_info for more info.
Diffstat (limited to 'typings/slack_api')
-rw-r--r--typings/slack_api/slack_conversations_history.pyi38
-rw-r--r--typings/slack_api/slack_files_info.pyi57
2 files changed, 59 insertions, 36 deletions
diff --git a/typings/slack_api/slack_conversations_history.pyi b/typings/slack_api/slack_conversations_history.pyi
index af1c97d..228d824 100644
--- a/typings/slack_api/slack_conversations_history.pyi
+++ b/typings/slack_api/slack_conversations_history.pyi
@@ -4,6 +4,7 @@ from typing import Dict, List
from slack_api.slack_common import SlackErrorResponse
from slack_api.slack_conversations_replies import SlackMessageThreadCommon
+from slack_api.slack_files_info import SlackFile
from slack_rtm.slack_rtm_message import SlackMessageRtm
from typing_extensions import Literal, NotRequired, TypedDict, final
@@ -269,41 +270,6 @@ class SlackMessageEdited(TypedDict):
ts: str
@final
-class SlackMessageFile(TypedDict):
- id: str
- created: int
- timestamp: int
- name: NotRequired[str]
- title: NotRequired[str]
- mimetype: NotRequired[str]
- filetype: str
- pretty_type: NotRequired[str]
- user: str
- user_team: NotRequired[str]
- editable: NotRequired[bool]
- size: NotRequired[int]
- mode: NotRequired[str]
- is_external: NotRequired[bool]
- external_type: NotRequired[str]
- is_public: NotRequired[bool]
- public_url_shared: NotRequired[bool]
- display_as_bot: NotRequired[bool]
- username: NotRequired[str]
- url_private: NotRequired[str]
- url_private_download: NotRequired[str]
- permalink: NotRequired[str]
- permalink_public: NotRequired[str]
- preview: NotRequired[str]
- editor: NotRequired[None]
- last_editor: NotRequired[str]
- non_owner_editable: NotRequired[bool]
- updated: NotRequired[int]
- is_starred: NotRequired[bool]
- has_rich_preview: NotRequired[bool]
- file_access: str
- media_progress: NotRequired[None]
-
-@final
class SlackMessageUserProfile(TypedDict):
avatar_hash: str
image_72: str
@@ -376,7 +342,7 @@ class SlackMessageThreadBroadcastFinal(SlackMessageThreadBroadcast):
class SlackMessageWithFiles(SlackMessageCommon):
user: NotRequired[str]
user_profile: NotRequired[SlackMessageUserProfile]
- files: List[SlackMessageFile]
+ files: List[SlackFile]
upload: bool
display_as_bot: bool
diff --git a/typings/slack_api/slack_files_info.pyi b/typings/slack_api/slack_files_info.pyi
new file mode 100644
index 0000000..119f0b9
--- /dev/null
+++ b/typings/slack_api/slack_files_info.pyi
@@ -0,0 +1,57 @@
+from __future__ import annotations
+
+from slack_api.slack_common import SlackErrorResponse
+from typing_extensions import Literal, NotRequired, TypedDict, final
+
+@final
+class SlackFile(TypedDict):
+ id: str
+ created: int
+ timestamp: int
+ name: NotRequired[str]
+ title: NotRequired[str]
+ mimetype: NotRequired[str]
+ filetype: str
+ pretty_type: NotRequired[str]
+ user: str
+ user_team: NotRequired[str]
+ editable: NotRequired[bool]
+ size: NotRequired[int]
+ mode: NotRequired[str]
+ is_external: NotRequired[bool]
+ external_type: NotRequired[str]
+ is_public: NotRequired[bool]
+ public_url_shared: NotRequired[bool]
+ display_as_bot: NotRequired[bool]
+ username: NotRequired[str]
+ url_private: NotRequired[str]
+ url_private_download: NotRequired[str]
+ permalink: NotRequired[str]
+ permalink_public: NotRequired[str]
+ preview: NotRequired[str]
+ editor: NotRequired[None]
+ last_editor: NotRequired[str]
+ non_owner_editable: NotRequired[bool]
+ updated: NotRequired[int]
+ is_starred: NotRequired[bool]
+ has_rich_preview: NotRequired[bool]
+ file_access: Literal["visible", "check_file_info", "file_not_found"]
+
+ # only from files.info, not in conversations.history:
+ # update_notification
+ # shares
+ # channels
+ # groups
+ # ims
+ # has_more_shares
+ # comments_count
+
+@final
+class SlackFilesInfoSuccessResponse(TypedDict):
+ ok: Literal[True]
+ content_html: str
+ file: SlackFile
+ # comments
+ comments_count: int
+
+SlackFilesInfoResponse = SlackFilesInfoSuccessResponse | SlackErrorResponse