aboutsummaryrefslogtreecommitdiffstats
path: root/typings/slack_api/slack_users_conversations.pyi
blob: 391bca04a558be67441f4a9a61f56646f285fe14 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
from __future__ import annotations

from typing import Generic, List

from slack_api.slack_common import SlackErrorResponse, SlackResponseMetadata
from typing_extensions import Literal, TypedDict, TypeVar, final

T = TypeVar("T")

@final
class SlackTopic(TypedDict):
    value: str
    creator: str
    last_set: int

@final
class SlackPurpose(TypedDict):
    value: str
    creator: str
    last_set: int

class SlackUsersConversationsCommon(TypedDict):
    id: str
    created: int
    is_archived: bool
    is_org_shared: bool
    context_team_id: str
    updated: int

class SlackUsersConversationsCommonNotIm(SlackUsersConversationsCommon):
    name: str
    is_channel: bool
    is_group: bool
    is_im: Literal[False]
    is_general: bool
    unlinked: int
    name_normalized: str
    is_shared: bool
    is_pending_ext_shared: bool
    pending_shared: List  # pyright: ignore [reportMissingTypeArgument]
    parent_conversation: None
    creator: str
    is_ext_shared: bool
    shared_team_ids: List[str]
    pending_connected_team_ids: List  # pyright: ignore [reportMissingTypeArgument]
    topic: SlackTopic
    purpose: SlackPurpose

@final
class SlackUsersConversationsPublic(SlackUsersConversationsCommonNotIm):
    is_mpim: Literal[False]
    is_private: Literal[False]
    previous_names: List[str]  # TODO: Check if private and mpim has this

@final
class SlackUsersConversationsPrivate(SlackUsersConversationsCommonNotIm):
    is_mpim: Literal[False]
    is_private: Literal[True]

@final
class SlackUsersConversationsMpim(SlackUsersConversationsCommonNotIm):
    is_mpim: Literal[True]
    is_private: Literal[True]

@final
class SlackUsersConversationsIm(SlackUsersConversationsCommon):
    is_im: Literal[True]
    user: str
    is_user_deleted: bool
    priority: int

SlackUsersConversationsNotIm = (
    SlackUsersConversationsPublic
    | SlackUsersConversationsPrivate
    | SlackUsersConversationsMpim
)
SlackUsersConversations = SlackUsersConversationsNotIm | SlackUsersConversationsIm

@final
class SlackUsersConversationsSuccessResponse(TypedDict, Generic[T]):
    ok: Literal[True]
    channels: List[T]
    response_metadata: SlackResponseMetadata

SlackUsersConversationsPublicResponse = (
    SlackUsersConversationsSuccessResponse[SlackUsersConversationsPublic]
    | SlackErrorResponse
)
SlackUsersConversationsPrivateResponse = (
    SlackUsersConversationsSuccessResponse[SlackUsersConversationsPrivate]
    | SlackErrorResponse
)
SlackUsersConversationsMpimResponse = (
    SlackUsersConversationsSuccessResponse[SlackUsersConversationsMpim]
    | SlackErrorResponse
)
SlackUsersConversationsImResponse = (
    SlackUsersConversationsSuccessResponse[SlackUsersConversationsIm]
    | SlackErrorResponse
)
SlackUsersConversationsNotImResponse = (
    SlackUsersConversationsSuccessResponse[SlackUsersConversationsNotIm]
    | SlackErrorResponse
)
SlackUsersConversationsResponse = (
    SlackUsersConversationsSuccessResponse[SlackUsersConversations] | SlackErrorResponse
)