1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This phpFile is auto-generated. |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
declare(strict_types=1); |
8
|
|
|
|
9
|
|
|
namespace PHPTdGram\Schema; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* A chat. (Can be a private chat, basic group, supergroup, or secret chat). |
13
|
|
|
*/ |
14
|
|
|
class Chat extends TdObject |
15
|
|
|
{ |
16
|
|
|
public const TYPE_NAME = 'chat'; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Chat unique identifier. |
20
|
|
|
*/ |
21
|
|
|
protected int $id; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Type of the chat. |
25
|
|
|
*/ |
26
|
|
|
protected ChatType $type; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* A chat list to which the chat belongs; may be null. |
30
|
|
|
*/ |
31
|
|
|
protected ?ChatList $chatList; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Chat title. |
35
|
|
|
*/ |
36
|
|
|
protected string $title; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Chat photo; may be null. |
40
|
|
|
*/ |
41
|
|
|
protected ?ChatPhoto $photo; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Actions that non-administrator chat members are allowed to take in the chat. |
45
|
|
|
*/ |
46
|
|
|
protected ChatPermissions $permissions; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Last message in the chat; may be null. |
50
|
|
|
*/ |
51
|
|
|
protected ?Message $lastMessage; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Descending parameter by which chats are sorted in the main chat list. If the order number of two chats is the same, they must be sorted in descending order by ID. If 0, the position of the chat in the list is undetermined. |
55
|
|
|
*/ |
56
|
|
|
protected string $order; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* True, if the chat is pinned. |
60
|
|
|
*/ |
61
|
|
|
protected bool $isPinned; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* True, if the chat is marked as unread. |
65
|
|
|
*/ |
66
|
|
|
protected bool $isMarkedAsUnread; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* True, if the chat is sponsored by the user's MTProxy server. |
70
|
|
|
*/ |
71
|
|
|
protected bool $isSponsored; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* True, if the chat has scheduled messages. |
75
|
|
|
*/ |
76
|
|
|
protected bool $hasScheduledMessages; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* True, if the chat messages can be deleted only for the current user while other users will continue to see the messages. |
80
|
|
|
*/ |
81
|
|
|
protected bool $canBeDeletedOnlyForSelf; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* True, if the chat messages can be deleted for all users. |
85
|
|
|
*/ |
86
|
|
|
protected bool $canBeDeletedForAllUsers; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* True, if the chat can be reported to Telegram moderators through reportChat. |
90
|
|
|
*/ |
91
|
|
|
protected bool $canBeReported; |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Default value of the disable_notification parameter, used when a message is sent to the chat. |
95
|
|
|
*/ |
96
|
|
|
protected bool $defaultDisableNotification; |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Number of unread messages in the chat. |
100
|
|
|
*/ |
101
|
|
|
protected int $unreadCount; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Identifier of the last read incoming message. |
105
|
|
|
*/ |
106
|
|
|
protected int $lastReadInboxMessageId; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Identifier of the last read outgoing message. |
110
|
|
|
*/ |
111
|
|
|
protected int $lastReadOutboxMessageId; |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Number of unread messages with a mention/reply in the chat. |
115
|
|
|
*/ |
116
|
|
|
protected int $unreadMentionCount; |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Notification settings for this chat. |
120
|
|
|
*/ |
121
|
|
|
protected ChatNotificationSettings $notificationSettings; |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Describes actions which should be possible to do through a chat action bar; may be null. |
125
|
|
|
*/ |
126
|
|
|
protected ?ChatActionBar $actionBar; |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Identifier of the pinned message in the chat; 0 if none. |
130
|
|
|
*/ |
131
|
|
|
protected int $pinnedMessageId; |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat. |
135
|
|
|
*/ |
136
|
|
|
protected int $replyMarkupMessageId; |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* A draft of a message in the chat; may be null. |
140
|
|
|
*/ |
141
|
|
|
protected ?DraftMessage $draftMessage; |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* Contains client-specific data associated with the chat. (For example, the chat position or local chat notification settings can be stored here.) Persistent if the message database is used. |
145
|
|
|
*/ |
146
|
|
|
protected string $clientData; |
147
|
|
|
|
148
|
|
|
public function __construct( |
149
|
|
|
int $id, |
150
|
|
|
ChatType $type, |
151
|
|
|
?ChatList $chatList, |
152
|
|
|
string $title, |
153
|
|
|
?ChatPhoto $photo, |
154
|
|
|
ChatPermissions $permissions, |
155
|
|
|
?Message $lastMessage, |
156
|
|
|
string $order, |
157
|
|
|
bool $isPinned, |
158
|
|
|
bool $isMarkedAsUnread, |
159
|
|
|
bool $isSponsored, |
160
|
|
|
bool $hasScheduledMessages, |
161
|
|
|
bool $canBeDeletedOnlyForSelf, |
162
|
|
|
bool $canBeDeletedForAllUsers, |
163
|
|
|
bool $canBeReported, |
164
|
|
|
bool $defaultDisableNotification, |
165
|
|
|
int $unreadCount, |
166
|
|
|
int $lastReadInboxMessageId, |
167
|
|
|
int $lastReadOutboxMessageId, |
168
|
|
|
int $unreadMentionCount, |
169
|
|
|
ChatNotificationSettings $notificationSettings, |
170
|
|
|
?ChatActionBar $actionBar, |
171
|
|
|
int $pinnedMessageId, |
172
|
|
|
int $replyMarkupMessageId, |
173
|
|
|
?DraftMessage $draftMessage, |
174
|
|
|
string $clientData |
175
|
|
|
) { |
176
|
|
|
$this->id = $id; |
177
|
|
|
$this->type = $type; |
178
|
|
|
$this->chatList = $chatList; |
179
|
|
|
$this->title = $title; |
180
|
|
|
$this->photo = $photo; |
181
|
|
|
$this->permissions = $permissions; |
182
|
|
|
$this->lastMessage = $lastMessage; |
183
|
|
|
$this->order = $order; |
184
|
|
|
$this->isPinned = $isPinned; |
185
|
|
|
$this->isMarkedAsUnread = $isMarkedAsUnread; |
186
|
|
|
$this->isSponsored = $isSponsored; |
187
|
|
|
$this->hasScheduledMessages = $hasScheduledMessages; |
188
|
|
|
$this->canBeDeletedOnlyForSelf = $canBeDeletedOnlyForSelf; |
189
|
|
|
$this->canBeDeletedForAllUsers = $canBeDeletedForAllUsers; |
190
|
|
|
$this->canBeReported = $canBeReported; |
191
|
|
|
$this->defaultDisableNotification = $defaultDisableNotification; |
192
|
|
|
$this->unreadCount = $unreadCount; |
193
|
|
|
$this->lastReadInboxMessageId = $lastReadInboxMessageId; |
194
|
|
|
$this->lastReadOutboxMessageId = $lastReadOutboxMessageId; |
195
|
|
|
$this->unreadMentionCount = $unreadMentionCount; |
196
|
|
|
$this->notificationSettings = $notificationSettings; |
197
|
|
|
$this->actionBar = $actionBar; |
198
|
|
|
$this->pinnedMessageId = $pinnedMessageId; |
199
|
|
|
$this->replyMarkupMessageId = $replyMarkupMessageId; |
200
|
|
|
$this->draftMessage = $draftMessage; |
201
|
|
|
$this->clientData = $clientData; |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
public static function fromArray(array $array): Chat |
205
|
|
|
{ |
206
|
|
|
return new static( |
207
|
|
|
$array['id'], |
208
|
|
|
TdSchemaRegistry::fromArray($array['type']), |
209
|
|
|
(isset($array['chat_list']) ? TdSchemaRegistry::fromArray($array['chat_list']) : null), |
210
|
|
|
$array['title'], |
211
|
|
|
(isset($array['photo']) ? TdSchemaRegistry::fromArray($array['photo']) : null), |
212
|
|
|
TdSchemaRegistry::fromArray($array['permissions']), |
213
|
|
|
(isset($array['last_message']) ? TdSchemaRegistry::fromArray($array['last_message']) : null), |
214
|
|
|
$array['order'], |
215
|
|
|
$array['is_pinned'], |
216
|
|
|
$array['is_marked_as_unread'], |
217
|
|
|
$array['is_sponsored'], |
218
|
|
|
$array['has_scheduled_messages'], |
219
|
|
|
$array['can_be_deleted_only_for_self'], |
220
|
|
|
$array['can_be_deleted_for_all_users'], |
221
|
|
|
$array['can_be_reported'], |
222
|
|
|
$array['default_disable_notification'], |
223
|
|
|
$array['unread_count'], |
224
|
|
|
$array['last_read_inbox_message_id'], |
225
|
|
|
$array['last_read_outbox_message_id'], |
226
|
|
|
$array['unread_mention_count'], |
227
|
|
|
TdSchemaRegistry::fromArray($array['notification_settings']), |
228
|
|
|
(isset($array['action_bar']) ? TdSchemaRegistry::fromArray($array['action_bar']) : null), |
229
|
|
|
$array['pinned_message_id'], |
230
|
|
|
$array['reply_markup_message_id'], |
231
|
|
|
(isset($array['draft_message']) ? TdSchemaRegistry::fromArray($array['draft_message']) : null), |
232
|
|
|
$array['client_data'], |
233
|
|
|
); |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
public function typeSerialize(): array |
237
|
|
|
{ |
238
|
|
|
return [ |
239
|
|
|
'@type' => static::TYPE_NAME, |
240
|
|
|
'id' => $this->id, |
241
|
|
|
'type' => $this->type->typeSerialize(), |
242
|
|
|
'chat_list' => (isset($this->chatList) ? $this->chatList : null), |
243
|
|
|
'title' => $this->title, |
244
|
|
|
'photo' => (isset($this->photo) ? $this->photo : null), |
245
|
|
|
'permissions' => $this->permissions->typeSerialize(), |
246
|
|
|
'last_message' => (isset($this->lastMessage) ? $this->lastMessage : null), |
247
|
|
|
'order' => $this->order, |
248
|
|
|
'is_pinned' => $this->isPinned, |
249
|
|
|
'is_marked_as_unread' => $this->isMarkedAsUnread, |
250
|
|
|
'is_sponsored' => $this->isSponsored, |
251
|
|
|
'has_scheduled_messages' => $this->hasScheduledMessages, |
252
|
|
|
'can_be_deleted_only_for_self' => $this->canBeDeletedOnlyForSelf, |
253
|
|
|
'can_be_deleted_for_all_users' => $this->canBeDeletedForAllUsers, |
254
|
|
|
'can_be_reported' => $this->canBeReported, |
255
|
|
|
'default_disable_notification' => $this->defaultDisableNotification, |
256
|
|
|
'unread_count' => $this->unreadCount, |
257
|
|
|
'last_read_inbox_message_id' => $this->lastReadInboxMessageId, |
258
|
|
|
'last_read_outbox_message_id' => $this->lastReadOutboxMessageId, |
259
|
|
|
'unread_mention_count' => $this->unreadMentionCount, |
260
|
|
|
'notification_settings' => $this->notificationSettings->typeSerialize(), |
261
|
|
|
'action_bar' => (isset($this->actionBar) ? $this->actionBar : null), |
262
|
|
|
'pinned_message_id' => $this->pinnedMessageId, |
263
|
|
|
'reply_markup_message_id' => $this->replyMarkupMessageId, |
264
|
|
|
'draft_message' => (isset($this->draftMessage) ? $this->draftMessage : null), |
265
|
|
|
'client_data' => $this->clientData, |
266
|
|
|
]; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
public function getId(): int |
270
|
|
|
{ |
271
|
|
|
return $this->id; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
public function getType(): ChatType |
275
|
|
|
{ |
276
|
|
|
return $this->type; |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
public function getChatList(): ?ChatList |
280
|
|
|
{ |
281
|
|
|
return $this->chatList; |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
public function getTitle(): string |
285
|
|
|
{ |
286
|
|
|
return $this->title; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
public function getPhoto(): ?ChatPhoto |
290
|
|
|
{ |
291
|
|
|
return $this->photo; |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
public function getPermissions(): ChatPermissions |
295
|
|
|
{ |
296
|
|
|
return $this->permissions; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
public function getLastMessage(): ?Message |
300
|
|
|
{ |
301
|
|
|
return $this->lastMessage; |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
public function getOrder(): string |
305
|
|
|
{ |
306
|
|
|
return $this->order; |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
public function getIsPinned(): bool |
310
|
|
|
{ |
311
|
|
|
return $this->isPinned; |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
public function getIsMarkedAsUnread(): bool |
315
|
|
|
{ |
316
|
|
|
return $this->isMarkedAsUnread; |
317
|
|
|
} |
318
|
|
|
|
319
|
|
|
public function getIsSponsored(): bool |
320
|
|
|
{ |
321
|
|
|
return $this->isSponsored; |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
public function getHasScheduledMessages(): bool |
325
|
|
|
{ |
326
|
|
|
return $this->hasScheduledMessages; |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
public function getCanBeDeletedOnlyForSelf(): bool |
330
|
|
|
{ |
331
|
|
|
return $this->canBeDeletedOnlyForSelf; |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
public function getCanBeDeletedForAllUsers(): bool |
335
|
|
|
{ |
336
|
|
|
return $this->canBeDeletedForAllUsers; |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
public function getCanBeReported(): bool |
340
|
|
|
{ |
341
|
|
|
return $this->canBeReported; |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
public function getDefaultDisableNotification(): bool |
345
|
|
|
{ |
346
|
|
|
return $this->defaultDisableNotification; |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
public function getUnreadCount(): int |
350
|
|
|
{ |
351
|
|
|
return $this->unreadCount; |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
public function getLastReadInboxMessageId(): int |
355
|
|
|
{ |
356
|
|
|
return $this->lastReadInboxMessageId; |
357
|
|
|
} |
358
|
|
|
|
359
|
|
|
public function getLastReadOutboxMessageId(): int |
360
|
|
|
{ |
361
|
|
|
return $this->lastReadOutboxMessageId; |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
public function getUnreadMentionCount(): int |
365
|
|
|
{ |
366
|
|
|
return $this->unreadMentionCount; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
public function getNotificationSettings(): ChatNotificationSettings |
370
|
|
|
{ |
371
|
|
|
return $this->notificationSettings; |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
public function getActionBar(): ?ChatActionBar |
375
|
|
|
{ |
376
|
|
|
return $this->actionBar; |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
public function getPinnedMessageId(): int |
380
|
|
|
{ |
381
|
|
|
return $this->pinnedMessageId; |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
public function getReplyMarkupMessageId(): int |
385
|
|
|
{ |
386
|
|
|
return $this->replyMarkupMessageId; |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
public function getDraftMessage(): ?DraftMessage |
390
|
|
|
{ |
391
|
|
|
return $this->draftMessage; |
392
|
|
|
} |
393
|
|
|
|
394
|
|
|
public function getClientData(): string |
395
|
|
|
{ |
396
|
|
|
return $this->clientData; |
397
|
|
|
} |
398
|
|
|
} |
399
|
|
|
|