-
Notifications
You must be signed in to change notification settings - Fork 1
/
event_types.ts
66 lines (54 loc) · 1.46 KB
/
event_types.ts
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
export type MatrixEventBase = {
type: string;
event_id: string;
room_id: string;
sender: string;
redacted_because: any | undefined;
};
export type FileEvent = {
url: string;
name: string;
mimetype: string;
size: number;
};
export type ThumbnailFileEvent = ImageFields & {
url: string;
mimetype: string;
size: number;
};
export type ImageFields = {
width: number;
height: number;
};
export type ImageEventContent = {
// TODO maybe not correct as it may be formatted?
"m.text": string;
"m.file": FileEvent;
"m.image": ImageFields;
"m.thumbnail": ThumbnailFileEvent[];
"matrixart.tags": string[];
};
export type MessageAlike = { "m.text": string; } | { body: string; mimetype: string; };
export type ImageEventContentWithCaption = ImageEventContent & {
"m.caption": MessageAlike[];
};
export type ImageEvent = MatrixEventBase & {
content: ImageEventContentWithCaption;
};
export type ImageGalleryContent = {
"m.image_gallery": ImageEventContent[];
"m.caption": MessageAlike[];
};
export type ImageGalleryEvent = MatrixEventBase & {
content: ImageGalleryContent;
};
export type BannerEventContent = {
"m.text": string;
"m.file": FileEvent;
"m.image": ImageFields;
};
export type BannerEvent = MatrixEventBase & {
content: BannerEventContent;
};
export type MatrixImageEvents = ImageEvent | ImageGalleryEvent;
export type MatrixEvent = MatrixImageEvents | BannerEvent;