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
|
|
|
static protected $requiredParams = ['type', 'id', 'video_url', 'mime_type', 'thumb_url', 'title']; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* {@inheritdoc} |
25
|
|
|
* |
26
|
|
|
* @var array |
27
|
|
|
*/ |
28
|
|
|
static protected $map = [ |
29
|
|
|
'type' => true, |
30
|
|
|
'id' => true, |
31
|
|
|
'video_url' => true, |
32
|
|
|
'mime_type' => true, |
33
|
|
|
'thumb_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 |
69
|
|
|
*/ |
70
|
|
|
protected $videoWidth; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Optional. Video height |
74
|
|
|
* |
75
|
|
|
* @var int |
76
|
|
|
*/ |
77
|
|
|
protected $videoHeight; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Optional. Video duration in seconds |
81
|
|
|
* |
82
|
|
|
* @var int |
83
|
|
|
*/ |
84
|
|
|
protected $videoDuration; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* URL of the thumbnail (jpeg only) for the video |
88
|
|
|
* |
89
|
|
|
* @var string |
90
|
|
|
*/ |
91
|
|
|
protected $thumbUrl; |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Optional. Short description of the result |
95
|
|
|
* |
96
|
|
|
* @var string |
97
|
|
|
*/ |
98
|
|
|
protected $caption; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Optional. Short description of the result |
102
|
|
|
* |
103
|
|
|
* @var string |
104
|
|
|
*/ |
105
|
|
|
protected $description; |
106
|
|
|
|
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Video constructor |
110
|
|
|
* |
111
|
|
|
* @param string $id |
112
|
|
|
* @param string $videoUrl |
113
|
|
|
* @param string $thumbUrl |
114
|
|
|
* @param string $mimeType |
115
|
|
|
* @param string $title |
116
|
|
|
* @param string|null $caption |
117
|
|
|
* @param string|null $description |
118
|
|
|
* @param int|null $videoWidth |
119
|
|
|
* @param int|null $videoHeight |
120
|
|
|
* @param int|null $videoDuration |
121
|
|
|
* @param InputMessageContent|null $inputMessageContent |
122
|
|
|
* @param InlineKeyboardMarkup|null $inlineKeyboardMarkup |
123
|
|
|
*/ |
124
|
|
|
public function __construct( |
125
|
|
|
$id, |
126
|
|
|
$videoUrl, |
127
|
|
|
$thumbUrl, |
128
|
|
|
$mimeType, |
129
|
|
|
$title, |
130
|
|
|
$caption = null, |
131
|
|
|
$description = null, |
132
|
|
|
$videoWidth = null, |
133
|
|
|
$videoHeight = null, |
134
|
|
|
$videoDuration = null, |
135
|
|
|
$inputMessageContent = null, |
136
|
|
|
$inlineKeyboardMarkup = null |
137
|
|
|
) { |
138
|
|
|
parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup); |
139
|
|
|
|
140
|
|
|
$this->videoUrl = $videoUrl; |
141
|
|
|
$this->thumbUrl = $thumbUrl; |
142
|
|
|
$this->caption = $caption; |
143
|
|
|
$this->description = $description; |
144
|
|
|
$this->mimeType = $mimeType; |
145
|
|
|
$this->videoWidth = $videoWidth; |
146
|
|
|
$this->videoHeight = $videoHeight; |
147
|
|
|
$this->videoDuration = $videoDuration; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @return string |
153
|
|
|
*/ |
154
|
|
|
public function getVideoUrl() |
155
|
|
|
{ |
156
|
|
|
return $this->videoUrl; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @param string $videoUrl |
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
|
|
|
public function setMimeType($mimeType) |
179
|
|
|
{ |
180
|
|
|
$this->mimeType = $mimeType; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* @return int |
185
|
|
|
*/ |
186
|
|
|
public function getVideoWidth() |
187
|
|
|
{ |
188
|
|
|
return $this->videoWidth; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* @param int $videoWidth |
193
|
|
|
*/ |
194
|
|
|
public function setVideoWidth($videoWidth) |
195
|
|
|
{ |
196
|
|
|
$this->videoWidth = $videoWidth; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* @return int |
201
|
|
|
*/ |
202
|
|
|
public function getVideoHeight() |
203
|
|
|
{ |
204
|
|
|
return $this->videoHeight; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* @param int $videoHeight |
209
|
|
|
*/ |
210
|
|
|
public function setVideoHeight($videoHeight) |
211
|
|
|
{ |
212
|
|
|
$this->videoHeight = $videoHeight; |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
/** |
216
|
|
|
* @return int |
217
|
|
|
*/ |
218
|
|
|
public function getVideoDuration() |
219
|
|
|
{ |
220
|
|
|
return $this->videoDuration; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* @param int $videoDuration |
225
|
|
|
*/ |
226
|
|
|
public function setVideoDuration($videoDuration) |
227
|
|
|
{ |
228
|
|
|
$this->videoDuration = $videoDuration; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* @return mixed |
233
|
|
|
*/ |
234
|
|
|
public function getThumbUrl() |
235
|
|
|
{ |
236
|
|
|
return $this->thumbUrl; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* @param mixed $thumbUrl |
241
|
|
|
*/ |
242
|
|
|
public function setThumbUrl($thumbUrl) |
243
|
|
|
{ |
244
|
|
|
$this->thumbUrl = $thumbUrl; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* @return string |
249
|
|
|
*/ |
250
|
|
|
public function getCaption() |
251
|
|
|
{ |
252
|
|
|
return $this->caption; |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* @param string $caption |
257
|
|
|
*/ |
258
|
|
|
public function setCaption($caption) |
259
|
|
|
{ |
260
|
|
|
$this->caption = $caption; |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
/** |
264
|
|
|
* @return string |
265
|
|
|
*/ |
266
|
|
|
public function getDescription() |
267
|
|
|
{ |
268
|
|
|
return $this->description; |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
/** |
272
|
|
|
* @param string $description |
273
|
|
|
*/ |
274
|
|
|
public function setDescription($description) |
275
|
|
|
{ |
276
|
|
|
$this->description = $description; |
277
|
|
|
} |
278
|
|
|
} |
279
|
|
|
|