• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Entity/File/FileItem.php
  • Класс: Bitrix\Im\V2\Entity\File\FileItem
  • Вызов: FileItem::toRestFormat
public function toRestFormat(array $option = []): array
{
	$diskFile = $this->getDiskFile();
	return [
		'id' => (int)$diskFile->getId(),
		'chatId' => (int)$this->getChatId(),
		'date' => $diskFile->getCreateTime()->format('c'),
		'type' => $this->getContentType(),
		'name' => $diskFile->getName(),
		'extension' => mb_strtolower($diskFile->getExtension()),
		'size' => (int)$diskFile->getSize(),
		'image' => $this->getPreviewSizes() ?? false,
		'status' => $diskFile->getGlobalContentVersion() > 1? 'done': 'upload',
		'progress' => $diskFile->getGlobalContentVersion() > 1? 100: -1,
		'authorId' => (int)$diskFile->getCreatedBy(),
		'authorName' => \Bitrix\Im\User::formatFullNameFromDatabase($diskFile->getCreateUser()),
		'urlPreview' => $this->getPreviewLink(),
		'urlShow' => $this->getShowLink(),
		'urlDownload' => $this->getDownloadLink(),
		'viewerAttrs' => $this->getViewerAttributes(),
	];
}