rintrix/models.py

39 lines
653 B
Python
Raw Normal View History

from dataclasses import dataclass, field
2022-02-24 16:27:55 +11:00
@dataclass
2022-02-24 16:27:55 +11:00
class Account():
mxid:str
username:str
homeserver:str
avatar_url:str=''
nickname:str=''
rooms:List[Room]=field(default_factory=list)
@dataclass
2022-02-24 16:27:55 +11:00
class Room():
id:str
name:str=''
members:List[Member]=field(default_factory=list)
parents:List[Space]=field(default_factory=list)
messages:List[Message]=field(default_factory=list)
@dataclass
2022-02-24 16:27:55 +11:00
class Space(Room):
children:List[Room]=field(default_factory=list)
@dataclass
2022-02-24 16:27:55 +11:00
class Message():
id:str
contents:str
author:Member
@dataclass
2022-02-24 16:27:55 +11:00
class User():
mxid:str
nick:str
avatar:str
@dataclass
2022-02-24 16:27:55 +11:00
class Member(User):
room_av:str
room_nick:str