File size: 760 Bytes
b2e9bf4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5916eec
b2e9bf4
 
 
 
 
 
 
 
 
 
 
 
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
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:
    #structured_data:Optional[List] add this in the below __init__
                 
    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
        }