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
|
|
|
* Edits an existing proxy server for network requests. Can be called before authorization. |
13
|
|
|
*/ |
14
|
|
|
class EditProxy extends TdFunction |
15
|
|
|
{ |
16
|
|
|
public const TYPE_NAME = 'editProxy'; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Proxy identifier. |
20
|
|
|
* |
21
|
|
|
* @var int |
22
|
|
|
*/ |
23
|
|
|
protected int $proxyId; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Proxy server IP address. |
27
|
|
|
* |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
protected string $server; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Proxy server port. |
34
|
|
|
* |
35
|
|
|
* @var int |
36
|
|
|
*/ |
37
|
|
|
protected int $port; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* True, if the proxy should be enabled. |
41
|
|
|
* |
42
|
|
|
* @var bool |
43
|
|
|
*/ |
44
|
|
|
protected bool $enable; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Proxy type. |
48
|
|
|
* |
49
|
|
|
* @var ProxyType |
50
|
|
|
*/ |
51
|
|
|
protected ProxyType $type; |
52
|
|
|
|
53
|
|
|
public function __construct(int $proxyId, string $server, int $port, bool $enable, ProxyType $type) |
54
|
|
|
{ |
55
|
|
|
$this->proxyId = $proxyId; |
56
|
|
|
$this->server = $server; |
57
|
|
|
$this->port = $port; |
58
|
|
|
$this->enable = $enable; |
59
|
|
|
$this->type = $type; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public static function fromArray(array $array): EditProxy |
63
|
|
|
{ |
64
|
|
|
return new static( |
65
|
|
|
$array['proxy_id'], |
66
|
|
|
$array['server'], |
67
|
|
|
$array['port'], |
68
|
|
|
$array['enable'], |
69
|
|
|
TdSchemaRegistry::fromArray($array['type']), |
70
|
|
|
); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function typeSerialize(): array |
74
|
|
|
{ |
75
|
|
|
return [ |
76
|
|
|
'@type' => static::TYPE_NAME, |
77
|
|
|
'proxy_id' => $this->proxyId, |
78
|
|
|
'server' => $this->server, |
79
|
|
|
'port' => $this->port, |
80
|
|
|
'enable' => $this->enable, |
81
|
|
|
'type' => $this->type->typeSerialize(), |
82
|
|
|
]; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function getProxyId(): int |
86
|
|
|
{ |
87
|
|
|
return $this->proxyId; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function getServer(): string |
91
|
|
|
{ |
92
|
|
|
return $this->server; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function getPort(): int |
96
|
|
|
{ |
97
|
|
|
return $this->port; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
public function getEnable(): bool |
101
|
|
|
{ |
102
|
|
|
return $this->enable; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function getType(): ProxyType |
106
|
|
|
{ |
107
|
|
|
return $this->type; |
108
|
|
|
} |
109
|
|
|
} |
110
|
|
|
|