aboutsummaryrefslogtreecommitdiffstats
path: root/typings
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-01-15 18:04:51 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commitce70ee11a3e49b14a3943ca1f2eda250dc49b989 (patch)
tree7ceb7b4e1b14aa4ef48f31dfb09ec95d23c64169 /typings
parent51299ef5b42b75794096c4ecc10bc101dca2d400 (diff)
downloadwee-slack-ce70ee11a3e49b14a3943ca1f2eda250dc49b989.tar.gz
Combine error response types
Diffstat (limited to 'typings')
-rw-r--r--typings/slack_api/slack_bots_info.pyi10
-rw-r--r--typings/slack_api/slack_conversations_history.pyi8
-rw-r--r--typings/slack_api/slack_conversations_info.pyi20
-rw-r--r--typings/slack_api/slack_error.pyi6
-rw-r--r--typings/slack_api/slack_rtm_connect.pyi8
-rw-r--r--typings/slack_api/slack_users_conversations.pyi20
-rw-r--r--typings/slack_api/slack_users_info.pyi14
7 files changed, 33 insertions, 53 deletions
diff --git a/typings/slack_api/slack_bots_info.pyi b/typings/slack_api/slack_bots_info.pyi
index 845ef00..4072975 100644
--- a/typings/slack_api/slack_bots_info.pyi
+++ b/typings/slack_api/slack_bots_info.pyi
@@ -1,5 +1,6 @@
-from typing import Dict, Literal, TypedDict, final
+from typing import Dict, List, Literal, TypedDict, final
+from slack_api.slack_error import SlackErrorResponse
from typing_extensions import NotRequired
class SlackBotInfo(TypedDict):
@@ -12,13 +13,8 @@ class SlackBotInfo(TypedDict):
icons: Dict[str, str]
@final
-class SlackBotInfoErrorResponse(TypedDict):
- ok: Literal[False]
- error: str
-
-@final
class SlackBotInfoSuccessResponse(TypedDict):
ok: Literal[True]
bot: SlackBotInfo
-SlackBotInfoResponse = SlackBotInfoSuccessResponse | SlackBotInfoErrorResponse
+SlackBotInfoResponse = SlackBotInfoSuccessResponse | SlackErrorResponse
diff --git a/typings/slack_api/slack_conversations_history.pyi b/typings/slack_api/slack_conversations_history.pyi
index b0220e3..c50c038 100644
--- a/typings/slack_api/slack_conversations_history.pyi
+++ b/typings/slack_api/slack_conversations_history.pyi
@@ -2,6 +2,7 @@ from __future__ import annotations
from typing import Dict, List, Literal, TypedDict, final
+from slack_api.slack_error import SlackErrorResponse
from typing_extensions import NotRequired
@final
@@ -141,11 +142,6 @@ class SlackMessageSubtypeBotAdd(SlackMessageCommon):
bot_id: str
bot_link: str
-@final
-class SlackConversationsHistoryErrorResponse(TypedDict):
- ok: Literal[False]
- error: str
-
SlackMessage = (
SlackMessageStandard
| SlackMessageThreadParentNotSubscribed
@@ -167,5 +163,5 @@ class SlackConversationsHistorySuccessResponse(TypedDict):
channel_actions_count: int
SlackConversationsHistoryResponse = (
- SlackConversationsHistorySuccessResponse | SlackConversationsHistoryErrorResponse
+ SlackConversationsHistorySuccessResponse | SlackErrorResponse
)
diff --git a/typings/slack_api/slack_conversations_info.pyi b/typings/slack_api/slack_conversations_info.pyi
index c01bae3..0c0a74c 100644
--- a/typings/slack_api/slack_conversations_info.pyi
+++ b/typings/slack_api/slack_conversations_info.pyi
@@ -3,6 +3,7 @@ from __future__ import annotations
from typing import Generic, List, Literal, TypedDict, TypeVar, final
from slack_api.slack_conversations_history import SlackMessage
+from slack_api.slack_error import SlackErrorResponse
T = TypeVar("T")
@@ -83,36 +84,29 @@ SlackConversationsInfoNotIm = (
SlackConversationsInfo = SlackConversationsInfoNotIm | SlackConversationsInfoIm
@final
-class SlackConversationsInfoErrorResponse(TypedDict):
- ok: Literal[False]
- error: str
-
-@final
class SlackConversationsInfoSuccessResponse(TypedDict, Generic[T]):
ok: Literal[True]
channel: T
SlackConversationsInfoPublicResponse = (
SlackConversationsInfoSuccessResponse[SlackConversationsInfoPublic]
- | SlackConversationsInfoErrorResponse
+ | SlackErrorResponse
)
SlackConversationsInfoPrivateResponse = (
SlackConversationsInfoSuccessResponse[SlackConversationsInfoPrivate]
- | SlackConversationsInfoErrorResponse
+ | SlackErrorResponse
)
SlackConversationsInfoMpimResponse = (
SlackConversationsInfoSuccessResponse[SlackConversationsInfoMpim]
- | SlackConversationsInfoErrorResponse
+ | SlackErrorResponse
)
SlackConversationsInfoImResponse = (
- SlackConversationsInfoSuccessResponse[SlackConversationsInfoIm]
- | SlackConversationsInfoErrorResponse
+ SlackConversationsInfoSuccessResponse[SlackConversationsInfoIm] | SlackErrorResponse
)
SlackConversationsInfoNotImResponse = (
SlackConversationsInfoSuccessResponse[SlackConversationsInfoNotIm]
- | SlackConversationsInfoErrorResponse
+ | SlackErrorResponse
)
SlackConversationsInfoResponse = (
- SlackConversationsInfoSuccessResponse[SlackConversationsInfo]
- | SlackConversationsInfoErrorResponse
+ SlackConversationsInfoSuccessResponse[SlackConversationsInfo] | SlackErrorResponse
)
diff --git a/typings/slack_api/slack_error.pyi b/typings/slack_api/slack_error.pyi
new file mode 100644
index 0000000..0c84bfc
--- /dev/null
+++ b/typings/slack_api/slack_error.pyi
@@ -0,0 +1,6 @@
+from typing import Literal, TypedDict, final
+
+@final
+class SlackErrorResponse(TypedDict):
+ ok: Literal[False]
+ error: str
diff --git a/typings/slack_api/slack_rtm_connect.pyi b/typings/slack_api/slack_rtm_connect.pyi
index 7fce94f..c499426 100644
--- a/typings/slack_api/slack_rtm_connect.pyi
+++ b/typings/slack_api/slack_rtm_connect.pyi
@@ -2,6 +2,8 @@ from __future__ import annotations
from typing import Literal, TypedDict
+from slack_api.slack_error import SlackErrorResponse
+
class SlackRtmConnectTeam(TypedDict):
id: str
name: str
@@ -11,14 +13,10 @@ class SlackRtmConnectSelf(TypedDict):
id: str
name: str
-class SlackRtmConnectErrorResponse(TypedDict):
- ok: Literal[False]
- error: str
-
class SlackRtmConnectSuccessResponse(TypedDict):
ok: Literal[True]
url: str
team: SlackRtmConnectTeam
self: SlackRtmConnectSelf
-SlackRtmConnectResponse = SlackRtmConnectSuccessResponse | SlackRtmConnectErrorResponse
+SlackRtmConnectResponse = SlackRtmConnectSuccessResponse | SlackErrorResponse
diff --git a/typings/slack_api/slack_users_conversations.pyi b/typings/slack_api/slack_users_conversations.pyi
index ec394a0..5bfbe62 100644
--- a/typings/slack_api/slack_users_conversations.pyi
+++ b/typings/slack_api/slack_users_conversations.pyi
@@ -2,6 +2,8 @@ from __future__ import annotations
from typing import Generic, List, Literal, TypedDict, TypeVar, final
+from slack_api.slack_error import SlackErrorResponse
+
T = TypeVar("T")
@final
@@ -74,11 +76,6 @@ SlackUsersConversationsNotIm = (
SlackUsersConversations = SlackUsersConversationsNotIm | SlackUsersConversationsIm
@final
-class SlackUsersConversationsErrorResponse(TypedDict):
- ok: Literal[False]
- error: str
-
-@final
class SlackResponseMetadata(TypedDict):
next_cursor: str
@@ -90,25 +87,24 @@ class SlackUsersConversationsSuccessResponse(TypedDict, Generic[T]):
SlackUsersConversationsPublicResponse = (
SlackUsersConversationsSuccessResponse[SlackUsersConversationsPublic]
- | SlackUsersConversationsErrorResponse
+ | SlackErrorResponse
)
SlackUsersConversationsPrivateResponse = (
SlackUsersConversationsSuccessResponse[SlackUsersConversationsPrivate]
- | SlackUsersConversationsErrorResponse
+ | SlackErrorResponse
)
SlackUsersConversationsMpimResponse = (
SlackUsersConversationsSuccessResponse[SlackUsersConversationsMpim]
- | SlackUsersConversationsErrorResponse
+ | SlackErrorResponse
)
SlackUsersConversationsImResponse = (
SlackUsersConversationsSuccessResponse[SlackUsersConversationsIm]
- | SlackUsersConversationsErrorResponse
+ | SlackErrorResponse
)
SlackUsersConversationsNotImResponse = (
SlackUsersConversationsSuccessResponse[SlackUsersConversationsNotIm]
- | SlackUsersConversationsErrorResponse
+ | SlackErrorResponse
)
SlackUsersConversationsResponse = (
- SlackUsersConversationsSuccessResponse[SlackUsersConversations]
- | SlackUsersConversationsErrorResponse
+ SlackUsersConversationsSuccessResponse[SlackUsersConversations] | SlackErrorResponse
)
diff --git a/typings/slack_api/slack_users_info.pyi b/typings/slack_api/slack_users_info.pyi
index e07353b..086dbb4 100644
--- a/typings/slack_api/slack_users_info.pyi
+++ b/typings/slack_api/slack_users_info.pyi
@@ -2,6 +2,7 @@ from __future__ import annotations
from typing import Dict, Generic, List, Literal, Optional, TypedDict, TypeVar, final
+from slack_api.slack_error import SlackErrorResponse
from typing_extensions import NotRequired
T = TypeVar("T")
@@ -106,21 +107,14 @@ class SlackUserInfoBot(SlackUserInfoCommon):
SlackUserInfo = SlackUserInfoPerson | SlackUserInfoBot
@final
-class SlackUserInfoErrorResponse(TypedDict):
- ok: Literal[False]
- error: str
-
-@final
class SlackUserInfoSuccessResponse(TypedDict, Generic[T]):
ok: Literal[True]
user: T
SlackUserInfoPersonResponse = (
- SlackUserInfoSuccessResponse[SlackUserInfoPerson] | SlackUserInfoErrorResponse
+ SlackUserInfoSuccessResponse[SlackUserInfoPerson] | SlackErrorResponse
)
SlackUserInfoBotResponse = (
- SlackUserInfoSuccessResponse[SlackUserInfoBot] | SlackUserInfoErrorResponse
-)
-SlackUserInfoResponse = (
- SlackUserInfoSuccessResponse[SlackUserInfo] | SlackUserInfoErrorResponse
+ SlackUserInfoSuccessResponse[SlackUserInfoBot] | SlackErrorResponse
)
+SlackUserInfoResponse = SlackUserInfoSuccessResponse[SlackUserInfo] | SlackErrorResponse