(chat_id, application_id, message, chat_user_id, chat_user_type, ip_address, source)
| 227 | |
| 228 | @staticmethod |
| 229 | def generate_chat(chat_id, application_id, message, chat_user_id, chat_user_type, ip_address, source): |
| 230 | if chat_id is None: |
| 231 | chat_id = str(uuid.uuid1()) |
| 232 | chat_info = ChatInfo(chat_id, chat_user_id, chat_user_type, ip_address, source, [], [], |
| 233 | application_id) |
| 234 | chat_info.set_cache() |
| 235 | else: |
| 236 | chat_info = ChatInfo.get_cache(chat_id) |
| 237 | if chat_info is None: |
| 238 | open_chat = ChatSerializers(data={ |
| 239 | 'chat_id': chat_id, |
| 240 | 'chat_user_id': chat_user_id, |
| 241 | 'chat_user_type': chat_user_type, |
| 242 | 'application_id': application_id, |
| 243 | 'ip_address': ip_address, |
| 244 | 'source': source, |
| 245 | }) |
| 246 | open_chat.is_valid(raise_exception=True) |
| 247 | chat_info = open_chat.re_open_chat(chat_id) |
| 248 | chat_info.set_cache() |
| 249 | return chat_id |
| 250 | |
| 251 | def chat(self, instance: Dict, with_valid=True): |
| 252 | if with_valid: |
no test coverage detected