diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-01-14 13:25:49 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:53 +0100 |
commit | 7d4673e21d227819d2b86dab37b5201cf31067e5 (patch) | |
tree | cc8cf3729ffb33e54786c9ed3ec43783ae2e9a67 /typings | |
parent | ec751c8ae53dbadf74ad1d34ee79df3ffd841bea (diff) | |
download | wee-slack-7d4673e21d227819d2b86dab37b5201cf31067e5.tar.gz |
Add type for users.info
Diffstat (limited to 'typings')
-rw-r--r-- | typings/slack_api/slack_users_info.pyi | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/typings/slack_api/slack_users_info.pyi b/typings/slack_api/slack_users_info.pyi new file mode 100644 index 0000000..433255e --- /dev/null +++ b/typings/slack_api/slack_users_info.pyi @@ -0,0 +1,94 @@ +from __future__ import annotations + +from typing import Dict, Generic, List, Literal, TypedDict, TypeVar, final + +T = TypeVar("T") + +class SlackProfileCommon(TypedDict): + title: str + phone: str + skype: str + real_name: str + real_name_normalized: str + display_name: str + display_name_normalized: str + fields: Dict # pyright: ignore [reportMissingTypeArgument] + status_text: str + status_emoji: str + status_emoji_display_info: List # pyright: ignore [reportMissingTypeArgument] + status_expiration: int + avatar_hash: str + image_24: str + image_32: str + image_48: str + image_72: str + image_192: str + image_512: str + status_text_canonical: str + team: str + +@final +class SlackProfilePerson(SlackProfileCommon): + email: str + +@final +class SlackProfileBot(SlackProfileCommon): + api_app_id: str + always_active: bool + image_original: str + is_custom_image: bool + bot_id: str + image_1024: str + +class SlackUsersInfoCommon(TypedDict): + id: str + team_id: str + name: str + deleted: bool + color: str + real_name: str + tz: str + tz_label: str + tz_offset: int + is_admin: bool + is_owner: bool + is_primary_owner: bool + is_restricted: bool + is_ultra_restricted: bool + is_app_user: bool + updated: int + is_email_confirmed: bool + who_can_share_contact_card: str + +@final +class SlackUsersInfoPerson(SlackUsersInfoCommon): + profile: SlackProfilePerson + is_bot: Literal[False] + has_2fa: bool + +@final +class SlackUsersInfoBot(SlackUsersInfoCommon): + profile: SlackProfileBot + is_bot: Literal[True] + +SlackUsersInfo = SlackUsersInfoPerson | SlackUsersInfoBot + +@final +class SlackUsersInfoErrorResponse(TypedDict): + ok: Literal[False] + error: str + +@final +class SlackUsersInfoSuccessResponse(TypedDict, Generic[T]): + ok: Literal[True] + user: T + +SlackUsersInfoPersonResponse = ( + SlackUsersInfoSuccessResponse[SlackUsersInfoPerson] | SlackUsersInfoErrorResponse +) +SlackUsersInfoBotResponse = ( + SlackUsersInfoSuccessResponse[SlackUsersInfoBot] | SlackUsersInfoErrorResponse +) +SlackUsersInfoResponse = ( + SlackUsersInfoSuccessResponse[SlackUsersInfo] | SlackUsersInfoErrorResponse +) |