• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/rest.php
  • Класс: BitrixImOpenLinesRest
  • Вызов: Rest::widgetDialogList
static function widgetDialogList($params, $offset = 0, CRestServer $server)
{
	// method disabled because of beta status
	throw new RestException('Method is unavailable', 'WRONG_REQUEST', CRestServer::STATUS_FORBIDDEN);

	if ($server->getAuthType() !== WidgetAuth::AUTH_TYPE)
	{
		throw new RestException('Access for this method allowed only by livechat authorization.', 'WRONG_AUTH_TYPE', CRestServer::STATUS_FORBIDDEN);
	}

	global $USER;
	if (!$USER->IsAuthorized())
	{
		throw new RestException('Access for this method allowed only for authorized users.', 'WRONG_AUTH_TYPE', CRestServer::STATUS_FORBIDDEN);
	}

	$params = array_change_key_case($params, CASE_UPPER);

	$params['CONFIG_ID'] = (int)$params['CONFIG_ID'];
	if ($params['CONFIG_ID'] <= 0)
	{
		throw new RestException('Config id is not specified.', 'WRONG_REQUEST', CRestServer::STATUS_WRONG_REQUEST);
	}

	if ($offset > 0)
	{
		$params['OFFSET'] = $offset;
	}

	$result = WidgetDialog::getList($USER->GetID(), $params);
	if (!is_array($result))
	{
		throw new RestException(
			WidgetDialog::getError()->msg,
			WidgetDialog::getError()->code,
			CRestServer::STATUS_WRONG_REQUEST
		);
	}

	return self::objectEncode($result);
}