• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/rest.php
  • Класс: BitrixImOpenLinesRest
  • Вызов: Rest::sessionPin
static function sessionPin($arParams, $n, CRestServer $server)
{
	if (!$arParams['CHAT_ID'])
	{
		throw new RestException('Chat ID can't be empty', 'CHAT_ID_EMPTY', CRestServer::STATUS_WRONG_REQUEST);
	}

	$control = new BitrixImOpenLinesOperator($arParams['CHAT_ID']);
	isset($arParams['ACTIVATE']) ?: $arParams['ACTIVATE'] = null;
	$result = $control->setPinMode($arParams['ACTIVATE'] !== 'N');

	if (!$result->isSuccess())
	{
		throw new RestException($control->getError()->msg, $control->getError()->code, CRestServer::STATUS_WRONG_REQUEST);
	}

	return true;
}