1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This phpFile is auto-generated. |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
declare(strict_types=1); |
8
|
|
|
|
9
|
|
|
namespace AurimasNiekis\TdLibSchema; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Describes a web page preview. |
13
|
|
|
*/ |
14
|
|
|
class WebPage extends TdObject |
15
|
|
|
{ |
16
|
|
|
public const TYPE_NAME = 'webPage'; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Original URL of the link. |
20
|
|
|
* |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
protected string $url; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* URL to display. |
27
|
|
|
* |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
protected string $displayUrl; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Type of the web page. Can be: article, photo, audio, video, document, profile, app, or something else. |
34
|
|
|
* |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
protected string $type; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Short name of the site (e.g., Google Docs, App Store). |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected string $siteName; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Title of the content. |
48
|
|
|
* |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
protected string $title; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Description of the content. |
55
|
|
|
* |
56
|
|
|
* @var string |
57
|
|
|
*/ |
58
|
|
|
protected string $description; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Image representing the content; may be null. |
62
|
|
|
* |
63
|
|
|
* @var Photo|null |
64
|
|
|
*/ |
65
|
|
|
protected ?Photo $photo; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* URL to show in the embedded preview. |
69
|
|
|
* |
70
|
|
|
* @var string |
71
|
|
|
*/ |
72
|
|
|
protected string $embedUrl; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* MIME type of the embedded preview, (e.g., text/html or video/mp4). |
76
|
|
|
* |
77
|
|
|
* @var string |
78
|
|
|
*/ |
79
|
|
|
protected string $embedType; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Width of the embedded preview. |
83
|
|
|
* |
84
|
|
|
* @var int |
85
|
|
|
*/ |
86
|
|
|
protected int $embedWidth; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Height of the embedded preview. |
90
|
|
|
* |
91
|
|
|
* @var int |
92
|
|
|
*/ |
93
|
|
|
protected int $embedHeight; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Duration of the content, in seconds. |
97
|
|
|
* |
98
|
|
|
* @var int |
99
|
|
|
*/ |
100
|
|
|
protected int $duration; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Author of the content. |
104
|
|
|
* |
105
|
|
|
* @var string |
106
|
|
|
*/ |
107
|
|
|
protected string $author; |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Preview of the content as an animation, if available; may be null. |
111
|
|
|
* |
112
|
|
|
* @var Animation|null |
113
|
|
|
*/ |
114
|
|
|
protected ?Animation $animation; |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Preview of the content as an audio file, if available; may be null. |
118
|
|
|
* |
119
|
|
|
* @var Audio|null |
120
|
|
|
*/ |
121
|
|
|
protected ?Audio $audio; |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Preview of the content as a document, if available (currently only available for small PDF files and ZIP archives); may be null. |
125
|
|
|
* |
126
|
|
|
* @var Document|null |
127
|
|
|
*/ |
128
|
|
|
protected ?Document $document; |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Preview of the content as a sticker for small WEBP files, if available; may be null. |
132
|
|
|
* |
133
|
|
|
* @var Sticker|null |
134
|
|
|
*/ |
135
|
|
|
protected ?Sticker $sticker; |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Preview of the content as a video, if available; may be null. |
139
|
|
|
* |
140
|
|
|
* @var Video|null |
141
|
|
|
*/ |
142
|
|
|
protected ?Video $video; |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* Preview of the content as a video note, if available; may be null. |
146
|
|
|
* |
147
|
|
|
* @var VideoNote|null |
148
|
|
|
*/ |
149
|
|
|
protected ?VideoNote $videoNote; |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* Preview of the content as a voice note, if available; may be null. |
153
|
|
|
* |
154
|
|
|
* @var VoiceNote|null |
155
|
|
|
*/ |
156
|
|
|
protected ?VoiceNote $voiceNote; |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Version of instant view, available for the web page (currently can be 1 or 2), 0 if none. |
160
|
|
|
* |
161
|
|
|
* @var int |
162
|
|
|
*/ |
163
|
|
|
protected int $instantViewVersion; |
164
|
|
|
|
165
|
|
|
public function __construct( |
166
|
|
|
string $url, |
167
|
|
|
string $displayUrl, |
168
|
|
|
string $type, |
169
|
|
|
string $siteName, |
170
|
|
|
string $title, |
171
|
|
|
string $description, |
172
|
|
|
?Photo $photo, |
173
|
|
|
string $embedUrl, |
174
|
|
|
string $embedType, |
175
|
|
|
int $embedWidth, |
176
|
|
|
int $embedHeight, |
177
|
|
|
int $duration, |
178
|
|
|
string $author, |
179
|
|
|
?Animation $animation, |
180
|
|
|
?Audio $audio, |
181
|
|
|
?Document $document, |
182
|
|
|
?Sticker $sticker, |
183
|
|
|
?Video $video, |
184
|
|
|
?VideoNote $videoNote, |
185
|
|
|
?VoiceNote $voiceNote, |
186
|
|
|
int $instantViewVersion |
187
|
|
|
) { |
188
|
|
|
$this->url = $url; |
189
|
|
|
$this->displayUrl = $displayUrl; |
190
|
|
|
$this->type = $type; |
191
|
|
|
$this->siteName = $siteName; |
192
|
|
|
$this->title = $title; |
193
|
|
|
$this->description = $description; |
194
|
|
|
$this->photo = $photo; |
195
|
|
|
$this->embedUrl = $embedUrl; |
196
|
|
|
$this->embedType = $embedType; |
197
|
|
|
$this->embedWidth = $embedWidth; |
198
|
|
|
$this->embedHeight = $embedHeight; |
199
|
|
|
$this->duration = $duration; |
200
|
|
|
$this->author = $author; |
201
|
|
|
$this->animation = $animation; |
202
|
|
|
$this->audio = $audio; |
203
|
|
|
$this->document = $document; |
204
|
|
|
$this->sticker = $sticker; |
205
|
|
|
$this->video = $video; |
206
|
|
|
$this->videoNote = $videoNote; |
207
|
|
|
$this->voiceNote = $voiceNote; |
208
|
|
|
$this->instantViewVersion = $instantViewVersion; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
public static function fromArray(array $array): WebPage |
212
|
|
|
{ |
213
|
|
|
return new static( |
214
|
|
|
$array['url'], |
215
|
|
|
$array['display_url'], |
216
|
|
|
$array['type'], |
217
|
|
|
$array['site_name'], |
218
|
|
|
$array['title'], |
219
|
|
|
$array['description'], |
220
|
|
|
(isset($array['photo']) ? TdSchemaRegistry::fromArray($array['photo']) : null), |
221
|
|
|
$array['embed_url'], |
222
|
|
|
$array['embed_type'], |
223
|
|
|
$array['embed_width'], |
224
|
|
|
$array['embed_height'], |
225
|
|
|
$array['duration'], |
226
|
|
|
$array['author'], |
227
|
|
|
(isset($array['animation']) ? TdSchemaRegistry::fromArray($array['animation']) : null), |
228
|
|
|
(isset($array['audio']) ? TdSchemaRegistry::fromArray($array['audio']) : null), |
229
|
|
|
(isset($array['document']) ? TdSchemaRegistry::fromArray($array['document']) : null), |
230
|
|
|
(isset($array['sticker']) ? TdSchemaRegistry::fromArray($array['sticker']) : null), |
231
|
|
|
(isset($array['video']) ? TdSchemaRegistry::fromArray($array['video']) : null), |
232
|
|
|
(isset($array['video_note']) ? TdSchemaRegistry::fromArray($array['video_note']) : null), |
233
|
|
|
(isset($array['voice_note']) ? TdSchemaRegistry::fromArray($array['voice_note']) : null), |
234
|
|
|
$array['instant_view_version'], |
235
|
|
|
); |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
public function typeSerialize(): array |
239
|
|
|
{ |
240
|
|
|
return [ |
241
|
|
|
'@type' => static::TYPE_NAME, |
242
|
|
|
'url' => $this->url, |
243
|
|
|
'display_url' => $this->displayUrl, |
244
|
|
|
'type' => $this->type, |
245
|
|
|
'site_name' => $this->siteName, |
246
|
|
|
'title' => $this->title, |
247
|
|
|
'description' => $this->description, |
248
|
|
|
'photo' => (isset($this->photo) ? $this->photo : null), |
249
|
|
|
'embed_url' => $this->embedUrl, |
250
|
|
|
'embed_type' => $this->embedType, |
251
|
|
|
'embed_width' => $this->embedWidth, |
252
|
|
|
'embed_height' => $this->embedHeight, |
253
|
|
|
'duration' => $this->duration, |
254
|
|
|
'author' => $this->author, |
255
|
|
|
'animation' => (isset($this->animation) ? $this->animation : null), |
256
|
|
|
'audio' => (isset($this->audio) ? $this->audio : null), |
257
|
|
|
'document' => (isset($this->document) ? $this->document : null), |
258
|
|
|
'sticker' => (isset($this->sticker) ? $this->sticker : null), |
259
|
|
|
'video' => (isset($this->video) ? $this->video : null), |
260
|
|
|
'video_note' => (isset($this->videoNote) ? $this->videoNote : null), |
261
|
|
|
'voice_note' => (isset($this->voiceNote) ? $this->voiceNote : null), |
262
|
|
|
'instant_view_version' => $this->instantViewVersion, |
263
|
|
|
]; |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
public function getUrl(): string |
267
|
|
|
{ |
268
|
|
|
return $this->url; |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
public function getDisplayUrl(): string |
272
|
|
|
{ |
273
|
|
|
return $this->displayUrl; |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
public function getType(): string |
277
|
|
|
{ |
278
|
|
|
return $this->type; |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
public function getSiteName(): string |
282
|
|
|
{ |
283
|
|
|
return $this->siteName; |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
public function getTitle(): string |
287
|
|
|
{ |
288
|
|
|
return $this->title; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
public function getDescription(): string |
292
|
|
|
{ |
293
|
|
|
return $this->description; |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
public function getPhoto(): ?Photo |
297
|
|
|
{ |
298
|
|
|
return $this->photo; |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
public function getEmbedUrl(): string |
302
|
|
|
{ |
303
|
|
|
return $this->embedUrl; |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
public function getEmbedType(): string |
307
|
|
|
{ |
308
|
|
|
return $this->embedType; |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
public function getEmbedWidth(): int |
312
|
|
|
{ |
313
|
|
|
return $this->embedWidth; |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
public function getEmbedHeight(): int |
317
|
|
|
{ |
318
|
|
|
return $this->embedHeight; |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
public function getDuration(): int |
322
|
|
|
{ |
323
|
|
|
return $this->duration; |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
public function getAuthor(): string |
327
|
|
|
{ |
328
|
|
|
return $this->author; |
329
|
|
|
} |
330
|
|
|
|
331
|
|
|
public function getAnimation(): ?Animation |
332
|
|
|
{ |
333
|
|
|
return $this->animation; |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
public function getAudio(): ?Audio |
337
|
|
|
{ |
338
|
|
|
return $this->audio; |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
public function getDocument(): ?Document |
342
|
|
|
{ |
343
|
|
|
return $this->document; |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
public function getSticker(): ?Sticker |
347
|
|
|
{ |
348
|
|
|
return $this->sticker; |
349
|
|
|
} |
350
|
|
|
|
351
|
|
|
public function getVideo(): ?Video |
352
|
|
|
{ |
353
|
|
|
return $this->video; |
354
|
|
|
} |
355
|
|
|
|
356
|
|
|
public function getVideoNote(): ?VideoNote |
357
|
|
|
{ |
358
|
|
|
return $this->videoNote; |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
public function getVoiceNote(): ?VoiceNote |
362
|
|
|
{ |
363
|
|
|
return $this->voiceNote; |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
public function getInstantViewVersion(): int |
367
|
|
|
{ |
368
|
|
|
return $this->instantViewVersion; |
369
|
|
|
} |
370
|
|
|
} |
371
|
|
|
|