|
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
|
|
|
* Asynchronously uploads a file to the cloud without sending it in a message. updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message. |
|
13
|
|
|
*/ |
|
14
|
|
|
class UploadFile extends TdFunction |
|
15
|
|
|
{ |
|
16
|
|
|
public const TYPE_NAME = 'uploadFile'; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* File to upload. |
|
20
|
|
|
* |
|
21
|
|
|
* @var InputFile |
|
22
|
|
|
*/ |
|
23
|
|
|
protected InputFile $file; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* File type. |
|
27
|
|
|
* |
|
28
|
|
|
* @var FileType |
|
29
|
|
|
*/ |
|
30
|
|
|
protected FileType $fileType; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which uploadFile was called will be uploaded first. |
|
34
|
|
|
* |
|
35
|
|
|
* @var int |
|
36
|
|
|
*/ |
|
37
|
|
|
protected int $priority; |
|
38
|
|
|
|
|
39
|
|
|
public function __construct(InputFile $file, FileType $fileType, int $priority) |
|
40
|
|
|
{ |
|
41
|
|
|
$this->file = $file; |
|
42
|
|
|
$this->fileType = $fileType; |
|
43
|
|
|
$this->priority = $priority; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public static function fromArray(array $array): UploadFile |
|
47
|
|
|
{ |
|
48
|
|
|
return new static( |
|
49
|
|
|
TdSchemaRegistry::fromArray($array['file']), |
|
50
|
|
|
TdSchemaRegistry::fromArray($array['file_type']), |
|
51
|
|
|
$array['priority'], |
|
52
|
|
|
); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function typeSerialize(): array |
|
56
|
|
|
{ |
|
57
|
|
|
return [ |
|
58
|
|
|
'@type' => static::TYPE_NAME, |
|
59
|
|
|
'file' => $this->file->typeSerialize(), |
|
60
|
|
|
'file_type' => $this->fileType->typeSerialize(), |
|
61
|
|
|
'priority' => $this->priority, |
|
62
|
|
|
]; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function getFile(): InputFile |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->file; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function getFileType(): FileType |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->fileType; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
public function getPriority(): int |
|
76
|
|
|
{ |
|
77
|
|
|
return $this->priority; |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|