python-trueconf-bot 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_trueconf_bot-1.0.0.dist-info/METADATA +115 -0
- python_trueconf_bot-1.0.0.dist-info/RECORD +120 -0
- python_trueconf_bot-1.0.0.dist-info/WHEEL +5 -0
- python_trueconf_bot-1.0.0.dist-info/licenses/LICENSE +32 -0
- python_trueconf_bot-1.0.0.dist-info/top_level.txt +1 -0
- trueconf/__init__.py +18 -0
- trueconf/_version.py +34 -0
- trueconf/client/__init__.py +0 -0
- trueconf/client/bot.py +1269 -0
- trueconf/client/context_controller.py +27 -0
- trueconf/client/session.py +60 -0
- trueconf/dispatcher/__init__.py +0 -0
- trueconf/dispatcher/dispatcher.py +56 -0
- trueconf/dispatcher/router.py +207 -0
- trueconf/enums/__init__.py +23 -0
- trueconf/enums/aouth_error.py +15 -0
- trueconf/enums/chat_participant_role.py +18 -0
- trueconf/enums/chat_type.py +17 -0
- trueconf/enums/envelope_author_type.py +13 -0
- trueconf/enums/file_ready_state.py +14 -0
- trueconf/enums/incoming_update_method.py +14 -0
- trueconf/enums/message_type.py +27 -0
- trueconf/enums/parse_mode.py +14 -0
- trueconf/enums/survey_type.py +6 -0
- trueconf/enums/update_type.py +14 -0
- trueconf/exceptions.py +17 -0
- trueconf/filters/__init__.py +11 -0
- trueconf/filters/base.py +8 -0
- trueconf/filters/command.py +32 -0
- trueconf/filters/instance_of.py +11 -0
- trueconf/filters/message.py +15 -0
- trueconf/filters/method.py +12 -0
- trueconf/loggers.py +4 -0
- trueconf/methods/__init__.py +59 -0
- trueconf/methods/add_participant_to_chat.py +22 -0
- trueconf/methods/auth.py +25 -0
- trueconf/methods/base.py +107 -0
- trueconf/methods/create_channel.py +20 -0
- trueconf/methods/create_group_chat.py +20 -0
- trueconf/methods/create_p2p_chat.py +20 -0
- trueconf/methods/edit_message.py +25 -0
- trueconf/methods/edit_survey.py +32 -0
- trueconf/methods/forward_message.py +22 -0
- trueconf/methods/get_chat_by_id.py +20 -0
- trueconf/methods/get_chat_history.py +24 -0
- trueconf/methods/get_chat_participants.py +24 -0
- trueconf/methods/get_chats.py +22 -0
- trueconf/methods/get_file_info.py +20 -0
- trueconf/methods/get_message_by_id.py +19 -0
- trueconf/methods/get_user_display_name.py +20 -0
- trueconf/methods/has_chat_participant.py +22 -0
- trueconf/methods/remove_chat.py +20 -0
- trueconf/methods/remove_message.py +23 -0
- trueconf/methods/remove_participant_from_chat.py +23 -0
- trueconf/methods/send_file.py +25 -0
- trueconf/methods/send_message.py +29 -0
- trueconf/methods/send_survey.py +40 -0
- trueconf/methods/subscribe_file_progress.py +21 -0
- trueconf/methods/unsubscribe_file_progress.py +21 -0
- trueconf/methods/upload_file.py +21 -0
- trueconf/py.typed +0 -0
- trueconf/types/__init__.py +25 -0
- trueconf/types/author_box.py +17 -0
- trueconf/types/chat_participant.py +11 -0
- trueconf/types/content/__init__.py +25 -0
- trueconf/types/content/attachment.py +14 -0
- trueconf/types/content/base.py +8 -0
- trueconf/types/content/chat_created.py +9 -0
- trueconf/types/content/document.py +71 -0
- trueconf/types/content/forward_message.py +21 -0
- trueconf/types/content/photo.py +70 -0
- trueconf/types/content/remove_participant.py +9 -0
- trueconf/types/content/sticker.py +70 -0
- trueconf/types/content/survey.py +19 -0
- trueconf/types/content/text.py +9 -0
- trueconf/types/content/video.py +71 -0
- trueconf/types/last_message.py +33 -0
- trueconf/types/message.py +411 -0
- trueconf/types/parser.py +90 -0
- trueconf/types/requests/__init__.py +21 -0
- trueconf/types/requests/added_chat_participant.py +40 -0
- trueconf/types/requests/created_channel.py +42 -0
- trueconf/types/requests/created_group_chat.py +42 -0
- trueconf/types/requests/created_personal_chat.py +42 -0
- trueconf/types/requests/edited_message.py +37 -0
- trueconf/types/requests/removed_chat.py +32 -0
- trueconf/types/requests/removed_chat_participant.py +39 -0
- trueconf/types/requests/removed_message.py +37 -0
- trueconf/types/requests/uploading_progress.py +34 -0
- trueconf/types/responses/__init__.py +57 -0
- trueconf/types/responses/add_chat_participant_response.py +8 -0
- trueconf/types/responses/api_error.py +38 -0
- trueconf/types/responses/auth_response_payload.py +9 -0
- trueconf/types/responses/create_channel_response.py +8 -0
- trueconf/types/responses/create_group_chat_response.py +8 -0
- trueconf/types/responses/create_p2p_chat_response.py +8 -0
- trueconf/types/responses/edit_message_response.py +9 -0
- trueconf/types/responses/edit_survey_response.py +9 -0
- trueconf/types/responses/forward_message_response.py +10 -0
- trueconf/types/responses/get_chat_by_id_response.py +13 -0
- trueconf/types/responses/get_chat_history_response.py +13 -0
- trueconf/types/responses/get_chat_participants_response.py +12 -0
- trueconf/types/responses/get_chats_response.py +12 -0
- trueconf/types/responses/get_file_info_response.py +24 -0
- trueconf/types/responses/get_message_by_id_response.py +26 -0
- trueconf/types/responses/get_user_display_name_response.py +8 -0
- trueconf/types/responses/has_chat_participant_response.py +8 -0
- trueconf/types/responses/remove_chat_participant_response.py +8 -0
- trueconf/types/responses/remove_chat_response.py +8 -0
- trueconf/types/responses/remove_message_response.py +8 -0
- trueconf/types/responses/send_file_response.py +10 -0
- trueconf/types/responses/send_message_response.py +10 -0
- trueconf/types/responses/send_survey_response.py +10 -0
- trueconf/types/responses/subscribe_file_progress_response.py +8 -0
- trueconf/types/responses/unsubscribe_file_progress_response.py +8 -0
- trueconf/types/responses/upload_file_response.py +8 -0
- trueconf/types/update.py +12 -0
- trueconf/utils/__init__.py +3 -0
- trueconf/utils/generate_secret_for_survey.py +10 -0
- trueconf/utils/token.py +78 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
from trueconf.client.context_controller import BoundToBot
|
|
5
|
+
from trueconf.enums.chat_type import ChatType
|
|
6
|
+
from trueconf.types.last_message import LastMessage
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class CreatedPersonalChat(BoundToBot, DataClassDictMixin):
|
|
11
|
+
"""
|
|
12
|
+
**Event type:** a new personal chat was created.
|
|
13
|
+
|
|
14
|
+
This object is received in the handler when a personal chat is created in TrueConf.
|
|
15
|
+
|
|
16
|
+
Notes:
|
|
17
|
+
This class is used as the event type in handler functions decorated with `@<router>.created_personal_chat()`.
|
|
18
|
+
|
|
19
|
+
Source:
|
|
20
|
+
https://trueconf.com/docs/chatbot-connector/en/server-requests/#createP2PChat
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
chat_id (str): Unique identifier of the personal chat.
|
|
24
|
+
title (str): Title of the chat (usually the participant’s name).
|
|
25
|
+
chat_type (ChatType): Type of the chat (should be `p2p`).
|
|
26
|
+
last_message (LastMessage | None): The last message in the chat, if available.
|
|
27
|
+
unread_messages (int): Number of unread messages in the personal chat.
|
|
28
|
+
|
|
29
|
+
Examples:
|
|
30
|
+
```python
|
|
31
|
+
from trueconf.types import CreatedPersonalChat
|
|
32
|
+
|
|
33
|
+
@<router>.created_personal_chat()
|
|
34
|
+
async def on_created(event: CreatedPersonalChat):
|
|
35
|
+
print(f"Personal chat created with id {event.chat_id}")
|
|
36
|
+
```
|
|
37
|
+
"""
|
|
38
|
+
chat_id: str = field(metadata={"alias": "chatId"})
|
|
39
|
+
title: str
|
|
40
|
+
chat_type: ChatType = field(metadata={"alias": "chatType"})
|
|
41
|
+
last_message: LastMessage | None = field(metadata={"alias": "lastMessage"})
|
|
42
|
+
unread_messages: int = field(metadata={"alias": "unreadMessages"})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
from trueconf.client.context_controller import BoundToBot
|
|
5
|
+
from trueconf.types.content.text import TextContent
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class EditedMessage(BoundToBot, DataClassDictMixin):
|
|
10
|
+
"""
|
|
11
|
+
**Event type:** a message was edited.
|
|
12
|
+
|
|
13
|
+
This object is received in the handler when a previously sent message is edited in a chat.
|
|
14
|
+
|
|
15
|
+
Notes:
|
|
16
|
+
This class is used as the event type in handler functions decorated with `@<router>.edited_message()`.
|
|
17
|
+
|
|
18
|
+
Source:
|
|
19
|
+
https://trueconf.com/docs/chatbot-connector/en/server-requests/#editMessage
|
|
20
|
+
|
|
21
|
+
Attributes:
|
|
22
|
+
timestamp (int): Unix timestamp (milliseconds) of when the edit occurred.
|
|
23
|
+
content (TextContent): The updated content of the edited message.
|
|
24
|
+
chat_id (str): Unique identifier of the chat where the message was edited.
|
|
25
|
+
|
|
26
|
+
Examples:
|
|
27
|
+
```python
|
|
28
|
+
from trueconf.types import EditedMessage
|
|
29
|
+
|
|
30
|
+
@<router>.edited_message()
|
|
31
|
+
async def on_edited(event: EditedMessage):
|
|
32
|
+
print(f"Message in chat {event.chat_id} was edited: {event.content.text}")
|
|
33
|
+
```
|
|
34
|
+
"""
|
|
35
|
+
timestamp: int
|
|
36
|
+
content: TextContent
|
|
37
|
+
chat_id: str = field(metadata={"alias": "chatId"})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
from trueconf.client.context_controller import BoundToBot
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class RemovedChat(BoundToBot, DataClassDictMixin):
|
|
9
|
+
"""
|
|
10
|
+
**Event type:** a chat was removed.
|
|
11
|
+
|
|
12
|
+
This object is received in the handler when a private, group, channel, or conference chat is deleted.
|
|
13
|
+
|
|
14
|
+
Notes:
|
|
15
|
+
This class is used as the event type in handler functions decorated with `@<router>.removed_chat()`.
|
|
16
|
+
|
|
17
|
+
Source:
|
|
18
|
+
https://trueconf.com/docs/chatbot-connector/en/server-requests/#removeChat
|
|
19
|
+
|
|
20
|
+
Attributes:
|
|
21
|
+
chat_id (str): Unique identifier of the chat that was removed.
|
|
22
|
+
|
|
23
|
+
Examples:
|
|
24
|
+
```python
|
|
25
|
+
from trueconf.types import RemovedChat
|
|
26
|
+
|
|
27
|
+
@<router>.removed_chat()
|
|
28
|
+
async def on_removed(event: RemovedChat):
|
|
29
|
+
print(f"Chat removed: {event.chat_id}")
|
|
30
|
+
```
|
|
31
|
+
"""
|
|
32
|
+
chat_id: str = field(metadata={"alias": "chatId"})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
from trueconf.client.context_controller import BoundToBot
|
|
5
|
+
from trueconf.types.author_box import EnvelopeAuthor
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class RemovedChatParticipant(BoundToBot, DataClassDictMixin):
|
|
10
|
+
"""
|
|
11
|
+
**Event type:** a participant was removed from a chat.
|
|
12
|
+
|
|
13
|
+
This object is received in the handler when a user is removed from a group, channel, or conference chat.
|
|
14
|
+
|
|
15
|
+
Notes:
|
|
16
|
+
This class is used as the event type in handler functions decorated with `@<router>.removed_chat_participant()`.
|
|
17
|
+
|
|
18
|
+
Source:
|
|
19
|
+
https://trueconf.com/docs/chatbot-connector/en/server-requests/#removeChatParticipant
|
|
20
|
+
|
|
21
|
+
Attributes:
|
|
22
|
+
timestamp (int): Unix timestamp (milliseconds) of when the event occurred.
|
|
23
|
+
chat_id (str): Unique identifier of the chat where the participant was removed.
|
|
24
|
+
user_id (str): TrueConf ID of the participant who was removed.
|
|
25
|
+
removed_by (EnvelopeAuthor): Information about the user who removed the participant.
|
|
26
|
+
|
|
27
|
+
Examples:
|
|
28
|
+
```python
|
|
29
|
+
from trueconf.types import RemovedChatParticipant
|
|
30
|
+
|
|
31
|
+
@<router>.removed_chat_participant()
|
|
32
|
+
async def on_removed(event: RemovedChatParticipant):
|
|
33
|
+
print(event.user_id)
|
|
34
|
+
```
|
|
35
|
+
"""
|
|
36
|
+
timestamp: int
|
|
37
|
+
chat_id: str = field(metadata={"alias": "chatId"})
|
|
38
|
+
user_id: str = field(metadata={"alias": "userId"})
|
|
39
|
+
removed_by: EnvelopeAuthor = field(metadata={"alias": "removedBy"})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
from trueconf.client.context_controller import BoundToBot
|
|
5
|
+
from trueconf.types.author_box import EnvelopeAuthor
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class RemovedMessage(BoundToBot, DataClassDictMixin):
|
|
10
|
+
"""
|
|
11
|
+
**Event type:** a message was removed.
|
|
12
|
+
|
|
13
|
+
This object is received in the handler when a message is deleted from a chat.
|
|
14
|
+
|
|
15
|
+
Notes:
|
|
16
|
+
This class is used as the event type in handler functions decorated with `@<router>.removed_message()`.
|
|
17
|
+
|
|
18
|
+
Source:
|
|
19
|
+
https://trueconf.com/docs/chatbot-connector/en/server-requests/#removeMessage
|
|
20
|
+
|
|
21
|
+
Attributes:
|
|
22
|
+
chat_id (str): Unique identifier of the chat from which the message was removed.
|
|
23
|
+
message_id (str): Unique identifier of the removed message.
|
|
24
|
+
removed_by (EnvelopeAuthor): Information about the user who removed the message.
|
|
25
|
+
|
|
26
|
+
Examples:
|
|
27
|
+
```python
|
|
28
|
+
from trueconf.types import RemovedMessage
|
|
29
|
+
|
|
30
|
+
@<router>.removed_message()
|
|
31
|
+
async def on_removed(event: RemovedMessage):
|
|
32
|
+
print(f"Message {event.message_id} removed from chat {event.chat_id}")
|
|
33
|
+
```
|
|
34
|
+
"""
|
|
35
|
+
chat_id: str = field(metadata={"alias": "chatId"})
|
|
36
|
+
message_id: str = field(metadata={"alias": "messageId"})
|
|
37
|
+
removed_by: EnvelopeAuthor = field(metadata={"alias": "removedBy"})
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
from trueconf.client.context_controller import BoundToBot
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class UploadingProgress(BoundToBot, DataClassDictMixin):
|
|
9
|
+
"""
|
|
10
|
+
**Event type:** file upload progress.
|
|
11
|
+
|
|
12
|
+
This object is received in the handler when a file is being uploaded and the upload progress is updated.
|
|
13
|
+
|
|
14
|
+
Notes:
|
|
15
|
+
This class is used as the event type in handler functions decorated with `@<router>.uploading_progress()`.
|
|
16
|
+
|
|
17
|
+
Source:
|
|
18
|
+
https://trueconf.com/docs/chatbot-connector/en/server-requests/#uploadingProgress
|
|
19
|
+
|
|
20
|
+
Attributes:
|
|
21
|
+
file_id (str): Unique identifier of the file being uploaded.
|
|
22
|
+
progress (int): Number of bytes uploaded to the server.
|
|
23
|
+
|
|
24
|
+
Examples:
|
|
25
|
+
```python
|
|
26
|
+
from trueconf.types import UploadingProgress
|
|
27
|
+
|
|
28
|
+
@<router>.uploading_progress()
|
|
29
|
+
async def on_progress(event: UploadingProgress):
|
|
30
|
+
print(f"File {event.file_id}: uploaded {event.progress} bytes")
|
|
31
|
+
```
|
|
32
|
+
"""
|
|
33
|
+
file_id: str = field(metadata={"alias": "fileId"})
|
|
34
|
+
progress: int
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from .forward_message_response import ForwardMessageResponse
|
|
2
|
+
from .edit_survey_response import EditSurveyResponse
|
|
3
|
+
from .get_chat_by_id_response import GetChatByIdResponse
|
|
4
|
+
from .remove_message_response import RemoveMessageResponse
|
|
5
|
+
from .send_message_response import SendMessageResponse
|
|
6
|
+
from .get_file_info_response import Previews
|
|
7
|
+
from .get_file_info_response import GetFileInfoResponse
|
|
8
|
+
from .send_survey_response import SendSurveyResponse
|
|
9
|
+
from .subscribe_file_progress_response import SubscribeFileProgressResponse
|
|
10
|
+
from .api_error import ApiError
|
|
11
|
+
from .create_group_chat_response import CreateGroupChatResponse
|
|
12
|
+
from .get_user_display_name_response import GetUserDisplayNameResponse
|
|
13
|
+
from .get_chats_response import GetChatsResponse
|
|
14
|
+
from .create_channel_response import CreateChannelResponse
|
|
15
|
+
from .get_chat_participants_response import GetChatParticipantsResponse
|
|
16
|
+
from .upload_file_response import UploadFileResponse
|
|
17
|
+
from .add_chat_participant_response import AddChatParticipantResponse
|
|
18
|
+
from .has_chat_participant_response import HasChatParticipantResponse
|
|
19
|
+
from .remove_chat_response import RemoveChatResponse
|
|
20
|
+
from .get_message_by_id_response import GetMessageByIdResponse
|
|
21
|
+
from .get_chat_history_response import GetChatHistoryResponse
|
|
22
|
+
from .create_p2p_chat_response import CreateP2PChatResponse
|
|
23
|
+
from .unsubscribe_file_progress_response import UnsubscribeFileProgressResponse
|
|
24
|
+
from .remove_chat_participant_response import RemoveChatParticipantResponse
|
|
25
|
+
from .edit_message_response import EditMessageResponse
|
|
26
|
+
from .auth_response_payload import AuthResponsePayload
|
|
27
|
+
from .send_file_response import SendFileResponse
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
'ForwardMessageResponse',
|
|
31
|
+
'EditSurveyResponse',
|
|
32
|
+
'GetChatByIdResponse',
|
|
33
|
+
'RemoveMessageResponse',
|
|
34
|
+
'SendMessageResponse',
|
|
35
|
+
'Previews',
|
|
36
|
+
'GetFileInfoResponse',
|
|
37
|
+
'SendSurveyResponse',
|
|
38
|
+
'SubscribeFileProgressResponse',
|
|
39
|
+
'ApiError',
|
|
40
|
+
'CreateGroupChatResponse',
|
|
41
|
+
'GetUserDisplayNameResponse',
|
|
42
|
+
'GetChatsResponse',
|
|
43
|
+
'CreateChannelResponse',
|
|
44
|
+
'GetChatParticipantsResponse',
|
|
45
|
+
'UploadFileResponse',
|
|
46
|
+
'AddChatParticipantResponse',
|
|
47
|
+
'HasChatParticipantResponse',
|
|
48
|
+
'RemoveChatResponse',
|
|
49
|
+
'GetMessageByIdResponse',
|
|
50
|
+
'GetChatHistoryResponse',
|
|
51
|
+
'CreateP2PChatResponse',
|
|
52
|
+
'UnsubscribeFileProgressResponse',
|
|
53
|
+
'RemoveChatParticipantResponse',
|
|
54
|
+
'EditMessageResponse',
|
|
55
|
+
'AuthResponsePayload',
|
|
56
|
+
'SendFileResponse'
|
|
57
|
+
]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class ApiError(DataClassDictMixin):
|
|
8
|
+
error_code: int = field(metadata={"alias": "errorCode"})
|
|
9
|
+
|
|
10
|
+
_error_messages = {
|
|
11
|
+
# Network Errors
|
|
12
|
+
100: "Connection error",
|
|
13
|
+
101: "Connection timeout",
|
|
14
|
+
102: "TLS/SSL error",
|
|
15
|
+
103: "Unsupported protocol",
|
|
16
|
+
104: "Route not found",
|
|
17
|
+
|
|
18
|
+
# Authorization Errors
|
|
19
|
+
200: "Not authorized",
|
|
20
|
+
201: "Invalid credentials",
|
|
21
|
+
202: "User disabled",
|
|
22
|
+
203: "Credentials expired",
|
|
23
|
+
|
|
24
|
+
# Chat Errors
|
|
25
|
+
300: "Internal server error",
|
|
26
|
+
301: "Operation timeout",
|
|
27
|
+
302: "Access denied",
|
|
28
|
+
303: "Not enough rights",
|
|
29
|
+
304: "Chat not found",
|
|
30
|
+
305: "User is not a chat participant",
|
|
31
|
+
306: "Message not found",
|
|
32
|
+
307: "Unknown message",
|
|
33
|
+
308: "File not found",
|
|
34
|
+
309: "User already in chat",
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
def __str__(self):
|
|
38
|
+
return f"[{self.error_code}] {self._error_messages.get(self.error_code, 'Unknown error')}"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class AuthResponsePayload(DataClassDictMixin):
|
|
8
|
+
user_id: str = field(metadata={"alias": "userId"})
|
|
9
|
+
connection_id: str = field(metadata={"alias": "connectionId"})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class ForwardMessageResponse(DataClassDictMixin):
|
|
8
|
+
chat_id: str = field(metadata={"alias": "chatId"})
|
|
9
|
+
message_id: str = field(metadata={"alias": "messageId"})
|
|
10
|
+
timestamp: int
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
from trueconf.types.last_message import LastMessage
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class GetChatByIdResponse(DataClassDictMixin):
|
|
9
|
+
chat_id: str = field(metadata={"alias": "chatId"})
|
|
10
|
+
title: str
|
|
11
|
+
chat_type: int = field(metadata={"alias": "chatType"})
|
|
12
|
+
unread_messages: int = field(metadata={"alias": "unreadMessages"})
|
|
13
|
+
last_message: LastMessage = field(metadata={"alias": "lastMessage"})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from typing import List
|
|
4
|
+
from mashumaro import DataClassDictMixin
|
|
5
|
+
from trueconf.types.message import Message
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class GetChatHistoryResponse(DataClassDictMixin):
|
|
9
|
+
count: int
|
|
10
|
+
chat_id: str = field(metadata={"alias": "chatId"})
|
|
11
|
+
messages: List[Message] = field(
|
|
12
|
+
default_factory=list,
|
|
13
|
+
metadata={"alias": "messages"})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from typing import List
|
|
4
|
+
from mashumaro import DataClassDictMixin
|
|
5
|
+
from trueconf.types.chat_participant import ChatParticipant
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class GetChatParticipantsResponse(DataClassDictMixin):
|
|
10
|
+
participants: List[ChatParticipant] = field(
|
|
11
|
+
default_factory=list,
|
|
12
|
+
metadata={"alias": "participants"})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from typing import List
|
|
4
|
+
from mashumaro import DataClassDictMixin
|
|
5
|
+
from trueconf.types.responses.get_chat_by_id_response import GetChatByIdResponse
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class GetChatsResponse(DataClassDictMixin):
|
|
10
|
+
chats: List[GetChatByIdResponse] = field(
|
|
11
|
+
default_factory=list,
|
|
12
|
+
metadata={"alias": "chats"})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from typing import Optional, List
|
|
4
|
+
from mashumaro import DataClassDictMixin
|
|
5
|
+
from trueconf.enums.file_ready_state import FileReadyState
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class Previews(DataClassDictMixin):
|
|
10
|
+
name: str
|
|
11
|
+
size: int
|
|
12
|
+
mimetype: str = field(metadata={"alias": "mimeType"})
|
|
13
|
+
download_url: str = field(metadata={"alias": "downloadUrl"})
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclass
|
|
17
|
+
class GetFileInfoResponse(DataClassDictMixin):
|
|
18
|
+
name: str
|
|
19
|
+
size: int
|
|
20
|
+
previews: Optional[List[Previews]]
|
|
21
|
+
mimetype: str = field(metadata={"alias": "mimeType"})
|
|
22
|
+
download_url: Optional[str] = field(metadata={"alias": "downloadUrl"})
|
|
23
|
+
ready_state: FileReadyState = field(metadata={"alias": "readyState"})
|
|
24
|
+
info_hash: str = field(metadata={"alias": "infoHash"})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from typing import Optional, Union
|
|
4
|
+
from mashumaro import DataClassDictMixin
|
|
5
|
+
from trueconf.enums.message_type import MessageType
|
|
6
|
+
from trueconf.types.author_box import EnvelopeAuthor, EnvelopeBox
|
|
7
|
+
from trueconf.types.content.text import TextContent
|
|
8
|
+
from trueconf.types.content.attachment import AttachmentContent
|
|
9
|
+
from trueconf.types.content.survey import SurveyContent
|
|
10
|
+
from trueconf.types.content.remove_participant import RemoveParticipant
|
|
11
|
+
from trueconf.types.content.forward_message import ForwardMessage
|
|
12
|
+
from trueconf.types.content.chat_created import ParticipantRoleContent
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass
|
|
16
|
+
class GetMessageByIdResponse(DataClassDictMixin):
|
|
17
|
+
timestamp: int
|
|
18
|
+
type: MessageType
|
|
19
|
+
author: EnvelopeAuthor
|
|
20
|
+
box: EnvelopeBox
|
|
21
|
+
content: Union[
|
|
22
|
+
TextContent, AttachmentContent, SurveyContent, ParticipantRoleContent, RemoveParticipant, ForwardMessage]
|
|
23
|
+
message_id: str = field(metadata={"alias": "messageId"})
|
|
24
|
+
chat_id: str = field(metadata={"alias": "chatId"})
|
|
25
|
+
is_edited: bool = field(metadata={"alias": "isEdited"})
|
|
26
|
+
reply_message_id: Optional[str] = field(default=None, metadata={"alias": "replyMessageId"})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class SendFileResponse(DataClassDictMixin):
|
|
8
|
+
timestamp: int
|
|
9
|
+
chat_id: str = field(metadata={"alias": "chatId"})
|
|
10
|
+
message_id: str = field(metadata={"alias": "messageId"})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class SendMessageResponse(DataClassDictMixin):
|
|
8
|
+
chat_id: str = field(metadata={"alias": "chatId"})
|
|
9
|
+
message_id: str = field(metadata={"alias": "messageId"})
|
|
10
|
+
timestamp: int
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class SendSurveyResponse(DataClassDictMixin):
|
|
8
|
+
chat_id: str = field(metadata={"alias": "chatId"})
|
|
9
|
+
message_id: str = field(metadata={"alias": "messageId"})
|
|
10
|
+
timestamp: int
|
trueconf/types/update.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from mashumaro import DataClassDictMixin
|
|
4
|
+
from trueconf.client.context_controller import BoundToBot
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class Update(BoundToBot, DataClassDictMixin):
|
|
9
|
+
method: str
|
|
10
|
+
type: int
|
|
11
|
+
id: int
|
|
12
|
+
payload: dict
|