- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/classes/general/im_rest.php
- Класс: CIMRestService
- Вызов: CIMRestService::dialogWriting
static function dialogWriting($arParams, $n, CRestServer $server)
{
$arParams = array_change_key_case($arParams, CASE_UPPER);
if (isset($arParams['DIALOG_ID']))
{
if (!BitrixImCommon::isDialogId($arParams['DIALOG_ID']))
{
throw new BitrixRestRestException("Dialog ID can't be empty", "DIALOG_ID_EMPTY", CRestServer::STATUS_WRONG_REQUEST);
}
}
else if (isset($arParams['CHAT_ID']))
{
$arParams['CHAT_ID'] = intval($arParams['CHAT_ID']);
if ($arParams['CHAT_ID'] <= 0)
{
throw new BitrixRestRestException("Chat ID can't be empty", "CHAT_ID_EMPTY", CRestServer::STATUS_WRONG_REQUEST);
}
$arParams['DIALOG_ID'] = 'chat'.$arParams['CHAT_ID'];
}
$result = CIMMessenger::StartWriting($arParams['DIALOG_ID']);
if (!$result)
{
throw new BitrixRestRestException("Action unavailable", "ACCESS_ERROR", CRestServer::STATUS_FORBIDDEN);
}
return true;
}