Skip to content

Commit 88feb15

Browse files
committed
add enum value for thread chat type
1 parent 45f072b commit 88feb15

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pybotx/models/enums.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class AutoName(Enum):
66
def _generate_next_value_( # type: ignore
7-
name, # noqa: N805 (copied from official python docs)
7+
name,
88
start,
99
count,
1010
last_values,
@@ -59,6 +59,7 @@ class ChatTypes(AutoName):
5959
PERSONAL_CHAT = auto()
6060
GROUP_CHAT = auto()
6161
CHANNEL = auto()
62+
THREAD = auto()
6263

6364

6465
class SyncSourceTypes(AutoName):
@@ -81,7 +82,7 @@ class ConferenceLinkTypes(AutoName):
8182
IncomingSyncSourceTypes = Union[SyncSourceTypes, UNSUPPORTED]
8283

8384

84-
class StrEnum(str, Enum): # noqa: WPS600 (pydantic needs this inheritance)
85+
class StrEnum(str, Enum):
8586
"""Enum base for API models."""
8687

8788
# https://github.com/pydantic/pydantic/issues/3850
@@ -92,6 +93,7 @@ class APIChatTypes(Enum):
9293
CHAT = "chat"
9394
GROUP_CHAT = "group_chat"
9495
CHANNEL = "channel"
96+
THREAD = "thread"
9597

9698

9799
class BotAPICommandTypes(StrEnum):
@@ -295,6 +297,7 @@ def convert_chat_type_from_domain(chat_type: ChatTypes) -> APIChatTypes:
295297
ChatTypes.PERSONAL_CHAT: APIChatTypes.CHAT,
296298
ChatTypes.GROUP_CHAT: APIChatTypes.GROUP_CHAT,
297299
ChatTypes.CHANNEL: APIChatTypes.CHANNEL,
300+
ChatTypes.THREAD: APIChatTypes.THREAD,
298301
}
299302

300303
converted_type = chat_types_mapping.get(chat_type)
@@ -307,13 +310,13 @@ def convert_chat_type_from_domain(chat_type: ChatTypes) -> APIChatTypes:
307310
@overload
308311
def convert_chat_type_to_domain(
309312
chat_type: APIChatTypes,
310-
) -> ChatTypes: ... # noqa: WPS428, E704
313+
) -> ChatTypes: ...
311314

312315

313316
@overload
314317
def convert_chat_type_to_domain(
315318
chat_type: str,
316-
) -> UNSUPPORTED: ... # noqa: WPS428, E704
319+
) -> UNSUPPORTED: ...
317320

318321

319322
def convert_chat_type_to_domain(
@@ -323,6 +326,7 @@ def convert_chat_type_to_domain(
323326
APIChatTypes.CHAT: ChatTypes.PERSONAL_CHAT,
324327
APIChatTypes.GROUP_CHAT: ChatTypes.GROUP_CHAT,
325328
APIChatTypes.CHANNEL: ChatTypes.CHANNEL,
329+
APIChatTypes.THREAD: ChatTypes.THREAD,
326330
}
327331

328332
converted_type: Optional[IncomingChatTypes]
@@ -340,13 +344,13 @@ def convert_chat_type_to_domain(
340344
@overload
341345
def convert_sync_source_type_to_domain(
342346
sync_type: APISyncSourceTypes,
343-
) -> SyncSourceTypes: ... # noqa: WPS428, E704
347+
) -> SyncSourceTypes: ...
344348

345349

346350
@overload
347351
def convert_sync_source_type_to_domain(
348352
sync_type: str,
349-
) -> UNSUPPORTED: ... # noqa: WPS428, E704
353+
) -> UNSUPPORTED: ...
350354

351355

352356
def convert_sync_source_type_to_domain(

0 commit comments

Comments
 (0)