aboutsummaryrefslogtreecommitdiffstats
path: root/typings/slack_api/slack_users_info.pyi
blob: 433255ec021f529f09b8bdcdf53372d67108b957 (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
86
87
88
89
90
91
92
93
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
)