- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/classes/general/im_rest.php
- Класс: CIMRestService
- Вызов: CIMRestService::notifyDelete
static function notifyDelete($arParams, $n, CRestServer $server)
{
$arParams = array_change_key_case($arParams, CASE_UPPER);
if (isset($arParams['ID']))
{
$CIMNotify = new CIMNotify();
return $CIMNotify->DeleteWithCheck($arParams['ID']);
}
if ($server->getAuthType() == BitrixRestSessionAuthAuth::AUTH_TYPE)
{
throw new BitrixRestRestException("Incorrect params", "PARAMS_ERROR", CRestServer::STATUS_WRONG_REQUEST);
}
$clientId = $server->getClientId();
if (!$clientId)
{
if (!empty($arParams['CLIENT_ID']))
{
$clientId = 'custom'.$arParams['CLIENT_ID'];
}
else
{
throw new BitrixRestAccessException("Client ID not specified");
}
}
if (!empty($arParams['TAG']))
{
$appKey = mb_substr(md5($clientId), 0, 5);
$result = CIMNotify::DeleteByTag('MP|'.$appKey.'|'.$arParams['TAG']);
}
else if (!empty($arParams['SUB_TAG']))
{
$appKey = mb_substr(md5($clientId), 0, 5);
$result = CIMNotify::DeleteBySubTag('MP|'.$appKey.'|'.$arParams['SUB_TAG']);
}
else
{
throw new BitrixRestRestException("Incorrect params", "PARAMS_ERROR", CRestServer::STATUS_WRONG_REQUEST);
}
return $result;
}