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