• Модуль: rest
  • Путь к файлу: ~/bitrix/modules/rest/classes/general/rest_provider.php
  • Класс: CRestProvider
  • Вызов: CRestProvider::getDescription
public function getDescription()
{
	if(!is_array(self::$arMethodsList))
	{
		$globalMethods = array(
			CRestUtil::GLOBAL_SCOPE => array(
				'batch' => array(__CLASS__, 'methodsBatch'),

				'scope' => array(__CLASS__, 'scopeList'),
				'methods' => array(__CLASS__, 'methodsList'),
				'method.get' => array(__CLASS__, 'getMethod'),

				'server.time' => array(__CLASS__, 'getServerTime'),
			),
		);

		$ownMethods = array(
			CRestUtil::GLOBAL_SCOPE => array(
				'app.option.get' => array(__CLASS__, 'appOptionGet'),
				'app.option.set' => array(__CLASS__, 'appOptionSet'),
				'user.option.get' => array(__CLASS__, 'userOptionGet'),
				'user.option.set' => array(__CLASS__, 'userOptionSet'),

				CRestUtil::EVENTS => array(
					'OnAppUninstall' => array(
						'rest',
						'OnRestAppDelete',
						array(__CLASS__, 'OnAppEvent'),
						array(
							"sendAuth" => false,
							"category" => BitrixRestSqs::CATEGORY_IMPORTANT,
						)
					),
					'OnAppInstall' => array(
						'rest',
						'OnRestAppInstall',
						array(__CLASS__, 'OnAppEvent'),
						array(
							"sendRefreshToken" => true,
							"category" => BitrixRestSqs::CATEGORY_IMPORTANT,
						)
					),
					'OnAppUpdate' => array(
						'rest',
						'OnRestAppUpdate',
						array(__CLASS__, 'OnAppEvent'),
						array(
							"sendRefreshToken" => true,
							"category" => BitrixRestSqs::CATEGORY_IMPORTANT,
						)
					),
					'OnAppPayment' => array(
						'bitrix24',
						'OnAfterAppPaid',
						array(__CLASS__, 'OnAppPayment'),
						array(
							"category" => BitrixRestSqs::CATEGORY_IMPORTANT,
						)
					),
					'OnSubscriptionRenew' => [
						'rest',
						'onAfterSubscriptionRenew',
						[
							__CLASS__,
							'onSubscriptionRenew',
						],
						[
							'sendRefreshToken' => true,
						],
					],
					'OnAppTest' => array(
						'rest',
						'OnRestAppTest',
						array(__CLASS__, 'OnAppEvent'),
						array(
							"sendRefreshToken" => true,
						)
					),
					'OnAppMethodConfirm' => array(
						'rest',
						'OnRestAppMethodConfirm',
						array(__CLASS__, 'OnAppEvent'),
						array(
							"sendAuth" => false,
							"category" => BitrixRestSqs::CATEGORY_IMPORTANT,
						)
					),
				),
				CRestUtil::PLACEMENTS => array(
					CRestUtil::PLACEMENT_APP_URI => array(
						'max_count' => 1
					)
				)
			),
		);

		if(!BitrixMainModuleManager::isModuleInstalled('oauth'))
		{
			$ownMethods[CRestUtil::GLOBAL_SCOPE]['app.info'] = array(__CLASS__, 'appInfo');
			$ownMethods[CRestUtil::GLOBAL_SCOPE]['feature.get'] = array(__CLASS__, 'getFeature');
		}

		$arDescription = array();

		foreach(GetModuleEvents("rest", "OnRestServiceBuildDescription", true) as $arEvent)
		{
			$res = ExecuteModuleEventEx($arEvent);
			if(is_array($res))
			{
				$arDescription = array_merge_recursive($res, $arDescription);
			}
		}

		self::$arMethodsList = array_merge_recursive(
			$globalMethods,
			$ownMethods,
			$arDescription
		);

		if(!array_key_exists('profile', self::$arMethodsList[CRestUtil::GLOBAL_SCOPE]))
		{
			self::$arMethodsList[CRestUtil::GLOBAL_SCOPE]['profile'] = array(
				'callback' => array(__CLASS__, 'getProfile'),
				'options' => array(),
			);
		}

		array_change_key_case(self::$arMethodsList, CASE_LOWER);

		foreach(self::$arMethodsList as $scope => $arScopeMethods)
		{
			self::$arMethodsList[$scope] = array_change_key_case(self::$arMethodsList[$scope], CASE_LOWER);
			if(
				array_key_exists(CRestUtil::EVENTS, self::$arMethodsList[$scope])
				&& is_array(self::$arMethodsList[$scope][CRestUtil::EVENTS])
			)
			{
				self::$arMethodsList[$scope][CRestUtil::EVENTS] = array_change_key_case(self::$arMethodsList[$scope][CRestUtil::EVENTS], CASE_UPPER);
			}
			if(
				array_key_exists(CRestUtil::PLACEMENTS, self::$arMethodsList[$scope])
				&& is_array(self::$arMethodsList[$scope][CRestUtil::PLACEMENTS])
			)
			{
				self::$arMethodsList[$scope][CRestUtil::PLACEMENTS] = array_change_key_case(self::$arMethodsList[$scope][CRestUtil::PLACEMENTS], CASE_UPPER);
			}
		}
	}

	return self::$arMethodsList;
}