- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/classes/general/im_rest.php
- Класс: CIMRestService
- Вызов: CIMRestService::chatUrlCounterGet
static function chatUrlCounterGet($arParams, $n, CRestServer $server)
{
$arParams = array_change_key_case($arParams, CASE_UPPER);
if (!isset($arParams['CHAT_ID']))
{
throw new BitrixRestRestException('CHAT_ID can`t be empty', 'CHAT_ID_EMPTY', CRestServer::STATUS_WRONG_REQUEST);
}
$chatId = $arParams['CHAT_ID'];
$chat = BitrixImV2Chat::getInstance($chatId);
if (!$chat->hasAccess())
{
throw new BitrixRestRestException('You do not have access to this chat', BitrixImV2RestRestError::ACCESS_ERROR, CRestServer::STATUS_FORBIDDEN);
}
$startId = $chat->getStartId();
return [
'counter' => (new BitrixImV2LinkUrlUrlService())->getCount($chatId, $startId)
];
}