-
Notifications
You must be signed in to change notification settings - Fork 6
/
models.ts
93 lines (79 loc) · 1.72 KB
/
models.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
export type MediaType = "audio_file" | "animation" | "video_file" | "sticker" | "voice_message"
| "contact" | "poll" | "location"
export interface Dimension {
width: number
height: number
}
export interface _Media {
spoiler?: boolean
size: number // Bytes
thumb?: string
}
export interface Image extends Dimension, _Media {
url: string
}
export interface PollOption {
text: string
voter_count: number
data: string
}
export interface TGFile extends _Media {
url: string
mime_type: string
media_type?: MediaType // If media_type is null, then it's not a media, just a regular file
original_name?: string
duration?: number
width?: number
height?: number
sticker_emoji?: string
title?: string
performer?: string
// For contact
phone_number?: string
first_name?: string
last_name?: string
}
export interface TGPollFile {
// For polls
id?: string
question?: string
options?: PollOption[]
total_voter_count?: number
is_closed?: number
is_anonymous?: number
type?: "REGULAR" | "QUIZ"
allow_multiple_answers?: boolean
}
export interface TGLocation
{
longitude: number
latitude: number
}
export interface TGLocationFile extends TGLocation{
title: string
address: string
foursquare_id: string
}
export interface ForwardFrom {
name: string
url?: string
}
export interface Post {
id: number
date: string
text?: string
forwarded_from?: string | ForwardFrom
type?: 'service' // If type is not service, it's a regular message
views?: string // Service messages have no view count
author?: string
reply?: {
id: number
text: string
thumb?: string
}
images?: Image[]
files?: TGFile[]
}
// TODO: Other files types (i.e. pdf)
// TODO: Video
// TODO: Author