• Модуль: messageservice
  • Путь к файлу: ~/bitrix/modules/messageservice/lib/Providers/Edna/EdnaUtils.php
  • Класс: BitrixMessageServiceProvidersEdnaEdnaUtils
  • Вызов: EdnaUtils::getChannelList
public function getChannelList(string $imType): Result
{
	if (!in_array($imType, ConstantsChannelType::getAllTypeList(), true))
	{
		return (new Result())->addError(new Error('Incorrect imType'));
	}

	$channelResult = $this->gelAllChannelList();
	if (!$channelResult->isSuccess())
	{
		return (new Result())->addError(new Error('Edna service error'));
	}

	$channelList = [];
	foreach ($channelResult->getData() as $channel)
	{
		if (is_array($channel) && isset($channel['type']) && $channel['type'] === $imType)
		{
			$channelList[] = $channel;
		}
	}
	if (empty($channelList))
	{
		return (new Result())->addError(new Error("There are no $imType channels in your profile"));
	}

	$result = new Result();
	$result->setData($channelList);

	return $result;
}