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
|
|
|
* An audio message. |
13
|
|
|
*/ |
14
|
|
|
class InputMessageAudio extends InputMessageContent |
15
|
|
|
{ |
16
|
|
|
public const TYPE_NAME = 'inputMessageAudio'; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Audio file to be sent. |
20
|
|
|
* |
21
|
|
|
* @var InputFile |
22
|
|
|
*/ |
23
|
|
|
protected InputFile $audio; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Thumbnail of the cover for the album, if available. |
27
|
|
|
* |
28
|
|
|
* @var InputThumbnail |
29
|
|
|
*/ |
30
|
|
|
protected InputThumbnail $albumCoverThumbnail; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Duration of the audio, in seconds; may be replaced by the server. |
34
|
|
|
* |
35
|
|
|
* @var int |
36
|
|
|
*/ |
37
|
|
|
protected int $duration; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Title of the audio; 0-64 characters; may be replaced by the server. |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected string $title; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Performer of the audio; 0-64 characters, may be replaced by the server. |
48
|
|
|
* |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
protected string $performer; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Audio caption; 0-GetOption("message_caption_length_max") characters. |
55
|
|
|
* |
56
|
|
|
* @var FormattedText |
57
|
|
|
*/ |
58
|
|
|
protected FormattedText $caption; |
59
|
|
|
|
60
|
|
|
public function __construct( |
61
|
|
|
InputFile $audio, |
62
|
|
|
InputThumbnail $albumCoverThumbnail, |
63
|
|
|
int $duration, |
64
|
|
|
string $title, |
65
|
|
|
string $performer, |
66
|
|
|
FormattedText $caption |
67
|
|
|
) { |
68
|
|
|
parent::__construct(); |
69
|
|
|
|
70
|
|
|
$this->audio = $audio; |
71
|
|
|
$this->albumCoverThumbnail = $albumCoverThumbnail; |
72
|
|
|
$this->duration = $duration; |
73
|
|
|
$this->title = $title; |
74
|
|
|
$this->performer = $performer; |
75
|
|
|
$this->caption = $caption; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public static function fromArray(array $array): InputMessageAudio |
79
|
|
|
{ |
80
|
|
|
return new static( |
81
|
|
|
TdSchemaRegistry::fromArray($array['audio']), |
82
|
|
|
TdSchemaRegistry::fromArray($array['album_cover_thumbnail']), |
83
|
|
|
$array['duration'], |
84
|
|
|
$array['title'], |
85
|
|
|
$array['performer'], |
86
|
|
|
TdSchemaRegistry::fromArray($array['caption']), |
87
|
|
|
); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function typeSerialize(): array |
91
|
|
|
{ |
92
|
|
|
return [ |
93
|
|
|
'@type' => static::TYPE_NAME, |
94
|
|
|
'audio' => $this->audio->typeSerialize(), |
95
|
|
|
'album_cover_thumbnail' => $this->albumCoverThumbnail->typeSerialize(), |
96
|
|
|
'duration' => $this->duration, |
97
|
|
|
'title' => $this->title, |
98
|
|
|
'performer' => $this->performer, |
99
|
|
|
'caption' => $this->caption->typeSerialize(), |
100
|
|
|
]; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function getAudio(): InputFile |
104
|
|
|
{ |
105
|
|
|
return $this->audio; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function getAlbumCoverThumbnail(): InputThumbnail |
109
|
|
|
{ |
110
|
|
|
return $this->albumCoverThumbnail; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
public function getDuration(): int |
114
|
|
|
{ |
115
|
|
|
return $this->duration; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
public function getTitle(): string |
119
|
|
|
{ |
120
|
|
|
return $this->title; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
public function getPerformer(): string |
124
|
|
|
{ |
125
|
|
|
return $this->performer; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
public function getCaption(): FormattedText |
129
|
|
|
{ |
130
|
|
|
return $this->caption; |
131
|
|
|
} |
132
|
|
|
} |
133
|
|
|
|