aboutsummaryrefslogtreecommitdiffstats
path: root/typings/slack_api
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-01-14 14:35:11 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commite28f556f476cbba7a0d70e1f145d8daa728b28be (patch)
tree787be6c0a635791772f60d43e452164cf89d75ee /typings/slack_api
parent7f6d7cd6029bb751732654cfd170432b0034ed03 (diff)
downloadwee-slack-e28f556f476cbba7a0d70e1f145d8daa728b28be.tar.gz
Add typing for slack conversations history
Diffstat (limited to 'typings/slack_api')
-rw-r--r--typings/slack_api/slack_conversations_history.pyi153
1 files changed, 153 insertions, 0 deletions
diff --git a/typings/slack_api/slack_conversations_history.pyi b/typings/slack_api/slack_conversations_history.pyi
new file mode 100644
index 0000000..0c486ed
--- /dev/null
+++ b/typings/slack_api/slack_conversations_history.pyi
@@ -0,0 +1,153 @@
+from __future__ import annotations
+
+from typing import List, Literal, NotRequired, TypedDict, final
+
+@final
+class SlackMessageBlockElement(TypedDict):
+ type: str
+ url: NotRequired[str]
+ text: str
+
+@final
+class SlackMessageBlockElementParent(TypedDict):
+ type: str
+ elements: List[SlackMessageBlockElement]
+
+@final
+class SlackMessageBlock(TypedDict):
+ type: str
+ block_id: str
+ elements: List[SlackMessageBlockElementParent]
+
+@final
+class SlackMessageAttachment(TypedDict):
+ from_url: str
+ image_url: str
+ image_width: int
+ image_height: int
+ image_bytes: int
+ service_icon: str
+ id: int
+ original_url: str
+ fallback: str
+ text: str
+ title: str
+ title_link: str
+ service_name: str
+
+@final
+class SlackMessageReaction(TypedDict):
+ name: str
+ users: List[str]
+ count: int
+
+@final
+class SlackMessageFile(TypedDict):
+ id: str
+ created: int
+ timestamp: int
+ name: str
+ title: str
+ mimetype: str
+ filetype: str
+ pretty_type: str
+ user: str
+ user_team: str
+ editable: bool
+ size: int
+ mode: str
+ is_external: bool
+ external_type: str
+ is_public: bool
+ public_url_shared: bool
+ display_as_bot: bool
+ username: str
+ url_private: str
+ url_private_download: str
+ permalink: str
+ permalink_public: str
+ preview: str
+ editor: None
+ last_editor: str
+ non_owner_editable: bool
+ updated: int
+ is_starred: bool
+ has_rich_preview: bool
+ file_access: str
+ media_progress: None
+
+class SlackMessageCommon(TypedDict):
+ type: Literal["message"]
+ text: str
+ user: str
+ ts: str
+ reactions: List[SlackMessageReaction]
+
+class SlackMessageStandard(SlackMessageCommon):
+ client_msg_id: NotRequired[str]
+ blocks: List[SlackMessageBlock]
+ attachments: List[SlackMessageAttachment]
+ team: str
+
+class SlackMessageThreadParentCommon(SlackMessageStandard):
+ thread_ts: str
+ reply_count: int
+ reply_users_count: int
+ latest_reply: str
+ reply_users: List[str]
+ is_locked: bool
+
+@final
+class SlackMessageThreadParentNotSubscribed(SlackMessageThreadParentCommon):
+ subscribed: Literal[False]
+
+@final
+class SlackMessageThreadParentSubscribed(SlackMessageThreadParentCommon):
+ subscribed: Literal[True]
+ last_read: str
+
+class SlackMessageWithFiles(SlackMessageCommon):
+ files: List[SlackMessageFile]
+ upload: bool
+ display_as_bot: bool
+
+# TODO: Add other subtypes
+@final
+class SlackMessageSubtypeBotRemove(SlackMessageCommon):
+ subtype: Literal["bot_remove"]
+ bot_id: str
+ bot_link: str
+
+@final
+class SlackMessageSubtypeBotAdd(SlackMessageCommon):
+ subtype: Literal["bot_add"]
+ bot_id: str
+ bot_link: str
+
+@final
+class SlackConversationsHistoryErrorResponse(TypedDict):
+ ok: Literal[False]
+ error: str
+
+SlackMessage = (
+ SlackMessageStandard
+ | SlackMessageThreadParentNotSubscribed
+ | SlackMessageThreadParentSubscribed
+ | SlackMessageWithFiles
+ | SlackMessageSubtypeBotRemove
+ | SlackMessageSubtypeBotAdd
+)
+
+@final
+class SlackConversationsHistorySuccessResponse(TypedDict):
+ ok: Literal[True]
+ messages: List[SlackMessage]
+ has_more: bool
+ is_limited: NotRequired[bool]
+ pin_count: int
+ channel_actions_ts: None
+ channel_actions_count: int
+
+SlackConversationsHistoryResponse = (
+ SlackConversationsHistorySuccessResponse | SlackConversationsHistoryErrorResponse
+)