• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/classes/general/im_rest.php
  • Класс: CIMRestService
  • Вызов: CIMRestService::notifyGet
static function notifyGet($arParams, $n, CRestServer $server)
{
	$arParams = array_change_key_case($arParams, CASE_UPPER);

	if (
		(isset($arParams['LAST_ID']) && !isset($arParams['LAST_TYPE'])) ||
		(!isset($arParams['LAST_ID']) && isset($arParams['LAST_TYPE']))
	)
	{
		throw new BitrixRestRestException(
			"Parameters LAST_ID and LAST_TYPE should be used together.",
			"LAST_ID_AND_LAST_TYPE",
			CRestServer::STATUS_WRONG_REQUEST
		);
	}

	if (isset($arParams['LAST_ID']) )
	{
		if (!preg_match('/^d+$/', $arParams['LAST_ID']))
		{
			throw new BitrixRestRestException(
				"Last notification ID can't be string",
				"LAST_ID_STRING",
				CRestServer::STATUS_WRONG_REQUEST
			);
		}

		$options['LAST_ID'] = (int)$arParams['LAST_ID'];
		$options['LAST_TYPE'] = (int)$arParams['LAST_TYPE'];
	}

	if (isset($arParams['LIMIT']))
	{
		$options['LIMIT'] = (int)$arParams['LIMIT'] > 50 ? 50 : (int)$arParams['LIMIT'];
	}
	else
	{
		$options['LIMIT'] = 50;
	}

	$options['CONVERT_TEXT'] = isset($arParams['CONVERT_TEXT']) && $arParams['CONVERT_TEXT'] === 'Y';

	return (new BitrixImNotify($options))->get();
}