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
|
|
|
* Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat. |
13
|
|
|
*/ |
14
|
|
|
class CreateNewSupergroupChat extends TdFunction |
15
|
|
|
{ |
16
|
|
|
public const TYPE_NAME = 'createNewSupergroupChat'; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Title of the new chat; 1-128 characters. |
20
|
|
|
* |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
protected string $title; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* True, if a channel chat should be created. |
27
|
|
|
* |
28
|
|
|
* @var bool |
29
|
|
|
*/ |
30
|
|
|
protected bool $isChannel; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Chat description; 0-255 characters. |
34
|
|
|
* |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
protected string $description; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Chat location if a location-based supergroup is being created. |
41
|
|
|
* |
42
|
|
|
* @var ChatLocation |
43
|
|
|
*/ |
44
|
|
|
protected ChatLocation $location; |
45
|
|
|
|
46
|
|
|
public function __construct(string $title, bool $isChannel, string $description, ChatLocation $location) |
47
|
|
|
{ |
48
|
|
|
$this->title = $title; |
49
|
|
|
$this->isChannel = $isChannel; |
50
|
|
|
$this->description = $description; |
51
|
|
|
$this->location = $location; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public static function fromArray(array $array): CreateNewSupergroupChat |
55
|
|
|
{ |
56
|
|
|
return new static( |
57
|
|
|
$array['title'], |
58
|
|
|
$array['is_channel'], |
59
|
|
|
$array['description'], |
60
|
|
|
TdSchemaRegistry::fromArray($array['location']), |
61
|
|
|
); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function typeSerialize(): array |
65
|
|
|
{ |
66
|
|
|
return [ |
67
|
|
|
'@type' => static::TYPE_NAME, |
68
|
|
|
'title' => $this->title, |
69
|
|
|
'is_channel' => $this->isChannel, |
70
|
|
|
'description' => $this->description, |
71
|
|
|
'location' => $this->location->typeSerialize(), |
72
|
|
|
]; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function getTitle(): string |
76
|
|
|
{ |
77
|
|
|
return $this->title; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function getIsChannel(): bool |
81
|
|
|
{ |
82
|
|
|
return $this->isChannel; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function getDescription(): string |
86
|
|
|
{ |
87
|
|
|
return $this->description; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function getLocation(): ChatLocation |
91
|
|
|
{ |
92
|
|
|
return $this->location; |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|