aboutsummaryrefslogtreecommitdiffstats
path: root/typings/slack_api/slack_conversations_info.pyi
blob: 9dc721b9ba7dac99a4c4831a90bbca2114701eeb (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
108
109
110
111
112
113
from __future__ import annotations

from typing import Generic, List

from slack_api.slack_conversations_history import SlackMessage
from slack_api.slack_error import SlackErrorResponse
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 SlackConversationsInfoCommon(TypedDict):
    id: str
    created: int
    is_archived: bool
    is_org_shared: bool
    context_team_id: str
    updated: int
    last_read: str

class SlackConversationsInfoCommonNotIm(SlackConversationsInfoCommon):
    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]
    is_member: bool
    topic: SlackTopic
    purpose: SlackPurpose

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

@final
class SlackConversationsInfoPrivate(SlackConversationsInfoCommonNotIm):
    is_mpim: Literal[False]
    is_private: Literal[True]
    is_open: bool

@final
class SlackConversationsInfoMpim(SlackConversationsInfoCommonNotIm):
    is_mpim: Literal[True]
    is_private: Literal[True]
    is_open: bool

@final
class SlackConversationsInfoIm(SlackConversationsInfoCommon):
    is_im: Literal[True]
    user: str
    latest: SlackMessage
    unread_count: int
    unread_count_display: int
    is_open: bool
    priority: int

SlackConversationsInfoNotIm = (
    SlackConversationsInfoPublic
    | SlackConversationsInfoPrivate
    | SlackConversationsInfoMpim
)
SlackConversationsInfo = SlackConversationsInfoNotIm | SlackConversationsInfoIm

@final
class SlackConversationsInfoSuccessResponse(TypedDict, Generic[T]):
    ok: Literal[True]
    channel: T

SlackConversationsInfoPublicResponse = (
    SlackConversationsInfoSuccessResponse[SlackConversationsInfoPublic]
    | SlackErrorResponse
)
SlackConversationsInfoPrivateResponse = (
    SlackConversationsInfoSuccessResponse[SlackConversationsInfoPrivate]
    | SlackErrorResponse
)
SlackConversationsInfoMpimResponse = (
    SlackConversationsInfoSuccessResponse[SlackConversationsInfoMpim]
    | SlackErrorResponse
)
SlackConversationsInfoImResponse = (
    SlackConversationsInfoSuccessResponse[SlackConversationsInfoIm] | SlackErrorResponse
)
SlackConversationsInfoNotImResponse = (
    SlackConversationsInfoSuccessResponse[SlackConversationsInfoNotIm]
    | SlackErrorResponse
)
SlackConversationsInfoResponse = (
    SlackConversationsInfoSuccessResponse[SlackConversationsInfo] | SlackErrorResponse
)