Spaces:
Sleeping
Sleeping
Update models/models.py
Browse files- models/models.py +4 -4
models/models.py
CHANGED
@@ -2,19 +2,20 @@ import json
|
|
2 |
from typing import Optional, List, Dict
|
3 |
|
4 |
class Attachment:
|
5 |
-
def __init__(self, filename: str, data: str):
|
6 |
self.filename = filename
|
7 |
self.data = data
|
|
|
|
|
8 |
|
9 |
|
10 |
class Message:
|
11 |
-
def __init__(self, message_id: str, body: Optional[str], attachments: Optional[List[Attachment]], company: str , body_len:int
|
12 |
self.id = message_id
|
13 |
self.body = body
|
14 |
self.attachments = attachments
|
15 |
self.company = company
|
16 |
self.body_len = body_len
|
17 |
-
self.attachment_len = attachment_len
|
18 |
|
19 |
def to_json(self):
|
20 |
return {
|
@@ -23,5 +24,4 @@ class Message:
|
|
23 |
"attachments": [attachment.__dict__ for attachment in self.attachments] if self.attachments else None,
|
24 |
"company": self.company,
|
25 |
"body_len" : self.body_len,
|
26 |
-
"attachemnt_len" : self.attachment_len
|
27 |
}
|
|
|
2 |
from typing import Optional, List, Dict
|
3 |
|
4 |
class Attachment:
|
5 |
+
def __init__(self, filename: str, data: str,attachment_len:int):
|
6 |
self.filename = filename
|
7 |
self.data = data
|
8 |
+
self.attachment_len = attachment_len
|
9 |
+
|
10 |
|
11 |
|
12 |
class Message:
|
13 |
+
def __init__(self, message_id: str, body: Optional[str], attachments: Optional[List[Attachment]], company: str , body_len:int):
|
14 |
self.id = message_id
|
15 |
self.body = body
|
16 |
self.attachments = attachments
|
17 |
self.company = company
|
18 |
self.body_len = body_len
|
|
|
19 |
|
20 |
def to_json(self):
|
21 |
return {
|
|
|
24 |
"attachments": [attachment.__dict__ for attachment in self.attachments] if self.attachments else None,
|
25 |
"company": self.company,
|
26 |
"body_len" : self.body_len,
|
|
|
27 |
}
|