|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types; |
|
4
|
|
|
|
|
5
|
|
|
use TelegramBot\Api\BaseType; |
|
6
|
|
|
use TelegramBot\Api\TypeInterface; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Class VideoNote |
|
10
|
|
|
* This object represents a video message (available in Telegram apps as of v.4.0). |
|
11
|
|
|
* |
|
12
|
|
|
* @package TelegramBot\Api\Types |
|
13
|
|
|
*/ |
|
14
|
|
|
class VideoNote extends BaseType implements TypeInterface |
|
15
|
|
|
{ |
|
16
|
|
|
protected static $requiredParams = ['file_id', 'file_unique_id', 'length', 'duration']; |
|
17
|
|
|
|
|
18
|
|
|
protected static $map = [ |
|
19
|
|
|
'file_id' => true, |
|
20
|
|
|
'file_unique_id' => true, |
|
21
|
|
|
'length' => true, |
|
22
|
|
|
'duration' => true, |
|
23
|
|
|
'thumbnail' => PhotoSize::class, |
|
24
|
|
|
'file_size' => true, |
|
25
|
|
|
]; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Unique identifier for this file |
|
29
|
|
|
* |
|
30
|
|
|
* @var string |
|
31
|
|
|
*/ |
|
32
|
|
|
protected $fileId; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. |
|
36
|
|
|
* |
|
37
|
|
|
* @var string |
|
38
|
|
|
*/ |
|
39
|
|
|
protected $fileUniqueId; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Video width and height (diameter of the video message) as defined by sender |
|
43
|
|
|
* |
|
44
|
|
|
* @var int |
|
45
|
|
|
*/ |
|
46
|
|
|
protected $length; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Duration of the video in seconds as defined by sender |
|
50
|
|
|
* |
|
51
|
|
|
* @var int |
|
52
|
|
|
*/ |
|
53
|
|
|
protected $duration; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Optional. Video thumbnail |
|
57
|
|
|
* |
|
58
|
|
|
* @var PhotoSize|null |
|
59
|
|
|
*/ |
|
60
|
|
|
protected $thumbnail; |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Optional. File size in bytes |
|
64
|
|
|
* |
|
65
|
|
|
* @var int|null |
|
66
|
|
|
*/ |
|
67
|
|
|
protected $fileSize; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @return string |
|
71
|
|
|
*/ |
|
72
|
|
|
public function getFileId() |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->fileId; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* @param string $fileId |
|
79
|
|
|
* |
|
80
|
|
|
* @return void |
|
81
|
|
|
*/ |
|
82
|
|
|
public function setFileId($fileId) |
|
83
|
|
|
{ |
|
84
|
|
|
$this->fileId = $fileId; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* @return string |
|
89
|
|
|
*/ |
|
90
|
|
|
public function getFileUniqueId() |
|
91
|
|
|
{ |
|
92
|
|
|
return $this->fileUniqueId; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* @param string $fileUniqueId |
|
97
|
|
|
* |
|
98
|
|
|
* @return void |
|
99
|
|
|
*/ |
|
100
|
|
|
public function setFileUniqueId($fileUniqueId) |
|
101
|
|
|
{ |
|
102
|
|
|
$this->fileUniqueId = $fileUniqueId; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* @return int |
|
107
|
|
|
*/ |
|
108
|
|
|
public function getLength() |
|
109
|
|
|
{ |
|
110
|
|
|
return $this->length; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @param int $length |
|
115
|
|
|
* |
|
116
|
|
|
* @return void |
|
117
|
|
|
*/ |
|
118
|
|
|
public function setLength($length) |
|
119
|
|
|
{ |
|
120
|
|
|
$this->length = $length; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* @return int |
|
125
|
|
|
*/ |
|
126
|
|
|
public function getDuration() |
|
127
|
|
|
{ |
|
128
|
|
|
return $this->duration; |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* @param int $duration |
|
133
|
|
|
* |
|
134
|
|
|
* @return void |
|
135
|
|
|
*/ |
|
136
|
|
|
public function setDuration($duration) |
|
137
|
|
|
{ |
|
138
|
|
|
$this->duration = $duration; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
/** |
|
142
|
|
|
* @return PhotoSize|null |
|
143
|
|
|
*/ |
|
144
|
|
|
public function getThumbnail() |
|
145
|
|
|
{ |
|
146
|
|
|
return $this->thumbnail; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* @param PhotoSize $thumbnail |
|
151
|
|
|
* |
|
152
|
|
|
* @return void |
|
153
|
|
|
*/ |
|
154
|
|
|
public function setThumbnail($thumbnail) |
|
155
|
|
|
{ |
|
156
|
|
|
$this->thumbnail = $thumbnail; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* @deprecated use getThumbnail method |
|
161
|
|
|
* |
|
162
|
|
|
* @return PhotoSize|null |
|
163
|
|
|
*/ |
|
164
|
|
|
public function getThumb() |
|
165
|
|
|
{ |
|
166
|
|
|
return $this->getThumbnail(); |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* @deprecated use setThumbnail method |
|
171
|
|
|
* |
|
172
|
|
|
* @param PhotoSize $thumb |
|
173
|
|
|
* |
|
174
|
|
|
* @return void |
|
175
|
|
|
*/ |
|
176
|
|
|
public function setThumb($thumb) |
|
177
|
|
|
{ |
|
178
|
|
|
$this->setThumbnail($thumb); |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* @return int|null |
|
183
|
|
|
*/ |
|
184
|
|
|
public function getFileSize() |
|
185
|
|
|
{ |
|
186
|
|
|
return $this->fileSize; |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
/** |
|
190
|
|
|
* @param int $fileSize |
|
191
|
|
|
* |
|
192
|
|
|
* @return void |
|
193
|
|
|
*/ |
|
194
|
|
|
public function setFileSize($fileSize) |
|
195
|
|
|
{ |
|
196
|
|
|
$this->fileSize = $fileSize; |
|
197
|
|
|
} |
|
198
|
|
|
} |
|
199
|
|
|
|