-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchats.py
More file actions
124 lines (105 loc) · 3.85 KB
/
chats.py
File metadata and controls
124 lines (105 loc) · 3.85 KB
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
114
115
116
117
118
119
120
121
122
123
124
from mpt_api_client.http import AsyncService, Service
from mpt_api_client.http.mixins import (
AsyncCollectionMixin,
AsyncCreateMixin,
AsyncGetMixin,
AsyncUpdateMixin,
CollectionMixin,
CreateMixin,
GetMixin,
UpdateMixin,
)
from mpt_api_client.models import Model
from mpt_api_client.resources.helpdesk.chat_answers import (
AsyncChatAnswersService,
ChatAnswersService,
)
from mpt_api_client.resources.helpdesk.chat_attachments import (
AsyncChatAttachmentsService,
ChatAttachmentsService,
)
from mpt_api_client.resources.helpdesk.chat_links import (
AsyncChatLinksService,
ChatLinksService,
)
from mpt_api_client.resources.helpdesk.chat_messages import (
AsyncChatMessagesService,
ChatMessagesService,
)
from mpt_api_client.resources.helpdesk.chat_participants import (
AsyncChatParticipantsService,
ChatParticipantsService,
)
class Chat(Model):
"""Helpdesk Chat resource."""
class ChatsServiceConfig:
"""Helpdesk Chats service configuration."""
_endpoint = "/public/v1/helpdesk/chats"
_model_class = Chat
_collection_key = "data"
class ChatsService(
CreateMixin[Chat],
UpdateMixin[Chat],
GetMixin[Chat],
CollectionMixin[Chat],
Service[Chat],
ChatsServiceConfig,
):
"""Helpdesk Chats service."""
def attachments(self, chat_id: str) -> ChatAttachmentsService:
"""Return chat attachments service."""
return ChatAttachmentsService(
http_client=self.http_client, endpoint_params={"chat_id": chat_id}
)
def messages(self, chat_id: str) -> ChatMessagesService:
"""Return chat messages service."""
return ChatMessagesService(
http_client=self.http_client, endpoint_params={"chat_id": chat_id}
)
def links(self, chat_id: str) -> ChatLinksService:
"""Return chat links service."""
return ChatLinksService(http_client=self.http_client, endpoint_params={"chat_id": chat_id})
def participants(self, chat_id: str) -> ChatParticipantsService:
"""Return chat participants service."""
return ChatParticipantsService(
http_client=self.http_client, endpoint_params={"chat_id": chat_id}
)
def answers(self, chat_id: str) -> ChatAnswersService:
"""Return chat answers service."""
return ChatAnswersService(
http_client=self.http_client, endpoint_params={"chat_id": chat_id}
)
class AsyncChatsService(
AsyncCreateMixin[Chat],
AsyncUpdateMixin[Chat],
AsyncGetMixin[Chat],
AsyncCollectionMixin[Chat],
AsyncService[Chat],
ChatsServiceConfig,
):
"""Async Helpdesk Chats service."""
def attachments(self, chat_id: str) -> AsyncChatAttachmentsService:
"""Return async chat attachments service."""
return AsyncChatAttachmentsService(
http_client=self.http_client, endpoint_params={"chat_id": chat_id}
)
def messages(self, chat_id: str) -> AsyncChatMessagesService:
"""Return async chat messages service."""
return AsyncChatMessagesService(
http_client=self.http_client, endpoint_params={"chat_id": chat_id}
)
def links(self, chat_id: str) -> AsyncChatLinksService:
"""Return async chat links service."""
return AsyncChatLinksService(
http_client=self.http_client, endpoint_params={"chat_id": chat_id}
)
def participants(self, chat_id: str) -> AsyncChatParticipantsService:
"""Return async chat participants service."""
return AsyncChatParticipantsService(
http_client=self.http_client, endpoint_params={"chat_id": chat_id}
)
def answers(self, chat_id: str) -> AsyncChatAnswersService:
"""Return async chat answers service."""
return AsyncChatAnswersService(
http_client=self.http_client, endpoint_params={"chat_id": chat_id}
)