- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/V2/Message.php
- Класс: BitrixImV2Message
- Вызов: Message::toRestFormat
public function toRestFormat(array $option = []): array
{
$dateCreate = $this->getDateCreate();
$authorId = $this->getNotifyEvent() === Notify::EVENT_SYSTEM ? 0 : $this->getAuthorId();
return [
'id' => $this->getId(),
'chat_id' => $this->getChatId(),
'author_id' => $authorId,
'date' => isset($dateCreate) ? $dateCreate->format('c') : null,
'text' => $this->getFormattedMessage(),
'isSystem' => $this->isSystem(),
'replaces' => $this->getReplaceMap(),
'unread' => $this->isUnread(),
'viewed' => $this->isViewed(),
'viewedByOthers' => $this->isViewedByOthers(),
'uuid' => $this->getUuid(),
'params' => $this->getParamsForRest(),
];
}