aboutsummaryrefslogtreecommitdiffstats
path: root/typings/slack_api/slack_users_info.pyi
blob: 776e334e3a3f2afb95005901e942325da5ee55e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
from __future__ import annotations

from typing import Generic, List, TypeVar

from slack_api.slack_common import SlackErrorResponse
from slack_api.slack_profile import SlackProfileBot, SlackProfilePerson
from typing_extensions import Literal, NotRequired, TypedDict, final

T = TypeVar("T")

@final
class SlackEnterpriseUser(TypedDict):
    id: str
    enterprise_id: str
    enterprise_name: str
    is_admin: bool
    is_owner: bool
    is_primary_owner: bool
    teams: List[str]

class SlackUserInfoCommon(TypedDict):
    id: str
    team_id: NotRequired[str]
    name: str
    deleted: NotRequired[bool]
    color: str
    real_name: NotRequired[str]
    tz: NotRequired[str]
    tz_label: NotRequired[str]
    tz_offset: NotRequired[int]
    is_admin: NotRequired[bool]
    is_owner: NotRequired[bool]
    is_primary_owner: NotRequired[bool]
    is_restricted: NotRequired[bool]
    is_ultra_restricted: NotRequired[bool]
    is_app_user: bool
    updated: int
    is_email_confirmed: NotRequired[bool]
    who_can_share_contact_card: str
    enterprise_user: NotRequired[SlackEnterpriseUser]
    enterprise_id: NotRequired[str]
    presence: NotRequired[Literal["active"]]

@final
class SlackUserInfoPerson(SlackUserInfoCommon):
    profile: SlackProfilePerson
    is_bot: Literal[False]
    is_stranger: NotRequired[bool]
    has_2fa: NotRequired[bool]

@final
class SlackUserInfoBot(SlackUserInfoCommon):
    profile: SlackProfileBot
    is_bot: Literal[True]
    is_workflow_bot: NotRequired[bool]

SlackUserInfo = SlackUserInfoPerson | SlackUserInfoBot

@final
class SlackUserInfoSuccessResponse(TypedDict, Generic[T]):
    ok: Literal[True]
    user: T

SlackUserInfoPersonResponse = (
    SlackUserInfoSuccessResponse[SlackUserInfoPerson] | SlackErrorResponse
)
SlackUserInfoBotResponse = (
    SlackUserInfoSuccessResponse[SlackUserInfoBot] | SlackErrorResponse
)
SlackUserInfoResponse = SlackUserInfoSuccessResponse[SlackUserInfo] | SlackErrorResponse

@final
class SlackUsersInfoSuccessResponse(TypedDict, Generic[T]):
    ok: Literal[True]
    users: List[T]

SlackUsersInfoPersonResponse = (
    SlackUsersInfoSuccessResponse[SlackUserInfoPerson] | SlackErrorResponse
)
SlackUsersInfoBotResponse = (
    SlackUsersInfoSuccessResponse[SlackUserInfoBot] | SlackErrorResponse
)
SlackUsersInfoResponse = (
    SlackUsersInfoSuccessResponse[SlackUserInfo] | SlackErrorResponse
)