-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmodels.py
77 lines (58 loc) · 1.25 KB
/
models.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
from pydantic import BaseModel
from typing import *
from datetime import datetime
class Conference(BaseModel):
eventId: str
eventCapacity: int
eventDate: int
bookingStart: int
bookingEnd: int
timestamp: int
pass
class Booking(BaseModel):
userId: str
eventId: str
ticketNumber: int
timestamp: int
pass
class Cancellation(BaseModel):
userId: str
eventId: str
ticketNumber: int
timestamp: datetime
pass
class PresenceMessage(BaseModel):
id: str
clientId: str
connectionId: str
timestamp: datetime
data: Optional[Union[dict, str]]
action: int
pass
class PresenceWrapper(BaseModel):
channelId: str
site: str
presence: List[PresenceMessage]
pass
class AblyWebhookMessage(BaseModel):
id: str
timestamp: datetime
data: str # Ably stringifies the data here
name: str
pass
class WebhookData(BaseModel):
channelId: str
site: str
messages: List[AblyWebhookMessage]
pass
class WebhookItem(BaseModel):
webhookId: str
source: str
timestamp: datetime
serial: Optional[str] = None
name: str
data: Union[WebhookData, PresenceWrapper]
pass
class AblyWebhook(BaseModel):
items: List[WebhookItem]
pass