Spaces:
Sleeping
Sleeping
File size: 697 Bytes
365f03f 12d44ef b3e237c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import json
from typing import Optional, List, Dict
class Attachment:
def __init__(self, filename: str, data: str):
self.filename = filename
self.data = data
class Message:
def __init__(self, message_id: str, body: Optional[str], attachments: Optional[List[Attachment]], company: str):
self.id = message_id
self.body = body
self.attachments = attachments
self.company = company
def to_json(self):
return {
"id": self.id,
"body": self.body,
"attachments": [attachment.__dict__ for attachment in self.attachments] if self.attachments else None,
"company": self.company
}
|