|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types\Inline\QueryResult; |
|
4
|
|
|
|
|
5
|
|
|
use TelegramBot\Api\Types\Inline\InlineKeyboardMarkup; |
|
6
|
|
|
use TelegramBot\Api\Types\Inline\InputMessageContent; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Class InlineQueryResultVideo |
|
10
|
|
|
* Represents link to a page containing an embedded video player or a video file. |
|
11
|
|
|
* |
|
12
|
|
|
* @package TelegramBot\Api\Types\Inline |
|
13
|
|
|
*/ |
|
14
|
|
|
class Video extends AbstractInlineQueryResult |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* {@inheritdoc} |
|
18
|
|
|
* |
|
19
|
|
|
* @var array |
|
20
|
|
|
*/ |
|
21
|
|
|
protected static $requiredParams = ['type', 'id', 'video_url', 'mime_type', 'thumbnail_url', 'title']; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* {@inheritdoc} |
|
25
|
|
|
* |
|
26
|
|
|
* @var array |
|
27
|
|
|
*/ |
|
28
|
|
|
protected static $map = [ |
|
29
|
|
|
'type' => true, |
|
30
|
|
|
'id' => true, |
|
31
|
|
|
'video_url' => true, |
|
32
|
|
|
'mime_type' => true, |
|
33
|
|
|
'thumbnail_url' => true, |
|
34
|
|
|
'title' => true, |
|
35
|
|
|
'caption' => true, |
|
36
|
|
|
'description' => true, |
|
37
|
|
|
'video_width' => true, |
|
38
|
|
|
'video_height' => true, |
|
39
|
|
|
'video_duration' => true, |
|
40
|
|
|
'reply_markup' => InlineKeyboardMarkup::class, |
|
41
|
|
|
'input_message_content' => InputMessageContent::class, |
|
42
|
|
|
]; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* {@inheritdoc} |
|
46
|
|
|
* |
|
47
|
|
|
* @var string |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $type = 'video'; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* A valid URL for the embedded video player or video file |
|
53
|
|
|
* |
|
54
|
|
|
* @var string |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $videoUrl; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Mime type of the content of video url, “text/html” or “video/mp4” |
|
60
|
|
|
* |
|
61
|
|
|
* @var string |
|
62
|
|
|
*/ |
|
63
|
|
|
protected $mimeType; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Optional. Video width |
|
67
|
|
|
* |
|
68
|
|
|
* @var int|null |
|
69
|
|
|
*/ |
|
70
|
|
|
protected $videoWidth; |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* Optional. Video height |
|
74
|
|
|
* |
|
75
|
|
|
* @var int|null |
|
76
|
|
|
*/ |
|
77
|
|
|
protected $videoHeight; |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Optional. Video duration in seconds |
|
81
|
|
|
* |
|
82
|
|
|
* @var int|null |
|
83
|
|
|
*/ |
|
84
|
|
|
protected $videoDuration; |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* URL of the thumbnail (jpeg only) for the video |
|
88
|
|
|
* |
|
89
|
|
|
* @var string |
|
90
|
|
|
*/ |
|
91
|
|
|
protected $thumbnailUrl; |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Optional. Short description of the result |
|
95
|
|
|
* |
|
96
|
|
|
* @var string|null |
|
97
|
|
|
*/ |
|
98
|
|
|
protected $caption; |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* Optional. Short description of the result |
|
102
|
|
|
* |
|
103
|
|
|
* @var string|null |
|
104
|
|
|
*/ |
|
105
|
|
|
protected $description; |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* Video constructor |
|
109
|
|
|
* |
|
110
|
|
|
* @param string $id |
|
111
|
|
|
* @param string $videoUrl |
|
112
|
|
|
* @param string $thumbnailUrl |
|
113
|
|
|
* @param string $mimeType |
|
114
|
|
|
* @param string $title |
|
115
|
|
|
* @param string|null $caption |
|
116
|
|
|
* @param string|null $description |
|
117
|
|
|
* @param int|null $videoWidth |
|
118
|
|
|
* @param int|null $videoHeight |
|
119
|
|
|
* @param int|null $videoDuration |
|
120
|
|
|
* @param InputMessageContent|null $inputMessageContent |
|
121
|
|
|
* @param InlineKeyboardMarkup|null $inlineKeyboardMarkup |
|
122
|
|
|
*/ |
|
123
|
|
|
public function __construct( |
|
124
|
|
|
$id, |
|
125
|
|
|
$videoUrl, |
|
126
|
|
|
$thumbnailUrl, |
|
127
|
|
|
$mimeType, |
|
128
|
|
|
$title, |
|
129
|
|
|
$caption = null, |
|
130
|
|
|
$description = null, |
|
131
|
|
|
$videoWidth = null, |
|
132
|
|
|
$videoHeight = null, |
|
133
|
|
|
$videoDuration = null, |
|
134
|
|
|
$inputMessageContent = null, |
|
135
|
|
|
$inlineKeyboardMarkup = null |
|
136
|
|
|
) { |
|
137
|
|
|
parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup); |
|
138
|
|
|
|
|
139
|
|
|
$this->videoUrl = $videoUrl; |
|
140
|
|
|
$this->thumbnailUrl = $thumbnailUrl; |
|
141
|
|
|
$this->caption = $caption; |
|
142
|
|
|
$this->description = $description; |
|
143
|
|
|
$this->mimeType = $mimeType; |
|
144
|
|
|
$this->videoWidth = $videoWidth; |
|
145
|
|
|
$this->videoHeight = $videoHeight; |
|
146
|
|
|
$this->videoDuration = $videoDuration; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* @return string |
|
151
|
|
|
*/ |
|
152
|
|
|
public function getVideoUrl() |
|
153
|
|
|
{ |
|
154
|
|
|
return $this->videoUrl; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* @param string $videoUrl |
|
159
|
|
|
* |
|
160
|
|
|
* @return void |
|
161
|
|
|
*/ |
|
162
|
|
|
public function setVideoUrl($videoUrl) |
|
163
|
|
|
{ |
|
164
|
|
|
$this->videoUrl = $videoUrl; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* @return string |
|
169
|
|
|
*/ |
|
170
|
|
|
public function getMimeType() |
|
171
|
|
|
{ |
|
172
|
|
|
return $this->mimeType; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* @param string $mimeType |
|
177
|
|
|
* |
|
178
|
|
|
* @return void |
|
179
|
|
|
*/ |
|
180
|
|
|
public function setMimeType($mimeType) |
|
181
|
|
|
{ |
|
182
|
|
|
$this->mimeType = $mimeType; |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* @return int|null |
|
187
|
|
|
*/ |
|
188
|
|
|
public function getVideoWidth() |
|
189
|
|
|
{ |
|
190
|
|
|
return $this->videoWidth; |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
|
/** |
|
194
|
|
|
* @param int|null $videoWidth |
|
195
|
|
|
* |
|
196
|
|
|
* @return void |
|
197
|
|
|
*/ |
|
198
|
|
|
public function setVideoWidth($videoWidth) |
|
199
|
|
|
{ |
|
200
|
|
|
$this->videoWidth = $videoWidth; |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
/** |
|
204
|
|
|
* @return int|null |
|
205
|
|
|
*/ |
|
206
|
|
|
public function getVideoHeight() |
|
207
|
|
|
{ |
|
208
|
|
|
return $this->videoHeight; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
/** |
|
212
|
|
|
* @param int|null $videoHeight |
|
213
|
|
|
* |
|
214
|
|
|
* @return void |
|
215
|
|
|
*/ |
|
216
|
|
|
public function setVideoHeight($videoHeight) |
|
217
|
|
|
{ |
|
218
|
|
|
$this->videoHeight = $videoHeight; |
|
219
|
|
|
} |
|
220
|
|
|
|
|
221
|
|
|
/** |
|
222
|
|
|
* @return int|null |
|
223
|
|
|
*/ |
|
224
|
|
|
public function getVideoDuration() |
|
225
|
|
|
{ |
|
226
|
|
|
return $this->videoDuration; |
|
227
|
|
|
} |
|
228
|
|
|
|
|
229
|
|
|
/** |
|
230
|
|
|
* @param int|null $videoDuration |
|
231
|
|
|
* |
|
232
|
|
|
* @return void |
|
233
|
|
|
*/ |
|
234
|
|
|
public function setVideoDuration($videoDuration) |
|
235
|
|
|
{ |
|
236
|
|
|
$this->videoDuration = $videoDuration; |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
/** |
|
240
|
|
|
* @return string |
|
241
|
|
|
*/ |
|
242
|
|
|
public function getThumbnailUrl() |
|
243
|
|
|
{ |
|
244
|
|
|
return $this->thumbnailUrl; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* @param string $thumbnailUrl |
|
249
|
|
|
* |
|
250
|
|
|
* @return void |
|
251
|
|
|
*/ |
|
252
|
|
|
public function setThumbnailUrl($thumbnailUrl) |
|
253
|
|
|
{ |
|
254
|
|
|
$this->thumbnailUrl = $thumbnailUrl; |
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
|
/** |
|
258
|
|
|
* @deprecated Use getThumbnailUrl |
|
259
|
|
|
* |
|
260
|
|
|
* @return string |
|
261
|
|
|
*/ |
|
262
|
|
|
public function getThumbUrl() |
|
263
|
|
|
{ |
|
264
|
|
|
return $this->getThumbnailUrl(); |
|
265
|
|
|
} |
|
266
|
|
|
|
|
267
|
|
|
/** |
|
268
|
|
|
* @deprecated Use setThumbnailUrl |
|
269
|
|
|
* |
|
270
|
|
|
* @param string $thumbUrl |
|
271
|
|
|
* |
|
272
|
|
|
* @return void |
|
273
|
|
|
*/ |
|
274
|
|
|
public function setThumbUrl($thumbUrl) |
|
275
|
|
|
{ |
|
276
|
|
|
$this->setThumbnailUrl($thumbUrl); |
|
277
|
|
|
} |
|
278
|
|
|
|
|
279
|
|
|
/** |
|
280
|
|
|
* @return string|null |
|
281
|
|
|
*/ |
|
282
|
|
|
public function getCaption() |
|
283
|
|
|
{ |
|
284
|
|
|
return $this->caption; |
|
285
|
|
|
} |
|
286
|
|
|
|
|
287
|
|
|
/** |
|
288
|
|
|
* @param string|null $caption |
|
289
|
|
|
* |
|
290
|
|
|
* @return void |
|
291
|
|
|
*/ |
|
292
|
|
|
public function setCaption($caption) |
|
293
|
|
|
{ |
|
294
|
|
|
$this->caption = $caption; |
|
295
|
|
|
} |
|
296
|
|
|
|
|
297
|
|
|
/** |
|
298
|
|
|
* @return string|null |
|
299
|
|
|
*/ |
|
300
|
|
|
public function getDescription() |
|
301
|
|
|
{ |
|
302
|
|
|
return $this->description; |
|
303
|
|
|
} |
|
304
|
|
|
|
|
305
|
|
|
/** |
|
306
|
|
|
* @param string|null $description |
|
307
|
|
|
* |
|
308
|
|
|
* @return void |
|
309
|
|
|
*/ |
|
310
|
|
|
public function setDescription($description) |
|
311
|
|
|
{ |
|
312
|
|
|
$this->description = $description; |
|
313
|
|
|
} |
|
314
|
|
|
} |
|
315
|
|
|
|