|
|
import json |
|
|
from typing import Optional, List, Dict |
|
|
|
|
|
class Attachment: |
|
|
def __init__(self, attachment_len:int,filename: str, data: str): |
|
|
self.attachment_len = attachment_len |
|
|
self.filename = filename |
|
|
self.data = data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Message: |
|
|
|
|
|
|
|
|
def __init__(self, message_id: str ,company: str ,structured_data:Optional[List]): |
|
|
self.id = message_id |
|
|
self.company = company |
|
|
self.structured_data = structured_data |
|
|
|
|
|
|
|
|
def to_json(self): |
|
|
return { |
|
|
"id": self.id, |
|
|
"company": self.company, |
|
|
"structured_data": self.structured_data if self.structured_data else None |
|
|
} |
|
|
|
|
|
|