...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
- Класс: \CCrmRestService
- Вызов: CCrmRestService::onRestServiceMethod
static function onRestServiceMethod($arParams, $nav, CRestServer $server) { if(!CCrmPerms::IsAccessEnabled()) { throw new RestException('Access denied.'); } $methodName = $server->getMethod(); $parts = explode('.', $methodName); $partCount = count($parts); if($partCount < 3 || $parts[0] !== 'crm') { throw new RestException("Method '{$methodName}' is not supported in current context."); } $typeName = mb_strtoupper($parts[1]); $proxy = null; $subType = isset($parts[2])? mb_strtoupper($parts[2]) : ''; if (isset(self::$PROXIES[$typeName.'.'.$subType])) { $proxy = self::$PROXIES[$typeName.'.'.$subType]; } else if(isset(self::$PROXIES[$typeName])) { $proxy = self::$PROXIES[$typeName]; } if(!$proxy) { if($typeName === 'SETTINGS') { $proxy = self::$PROXIES[$typeName] = new CCrmSettingsRestProxy(); } elseif($typeName === 'ENUM') { $proxy = self::$PROXIES[$typeName] = new CCrmEnumerationRestProxy(); } elseif($typeName === 'MULTIFIELD') { $proxy = self::$PROXIES[$typeName] = new CCrmMultiFieldRestProxy(); } elseif($typeName === 'CURRENCY') { $proxy = self::$PROXIES[$typeName] = new CCrmCurrencyRestProxy(); } elseif($typeName === 'CATALOG') { $proxy = self::$PROXIES[$typeName] = new CCrmCatalogRestProxy(); } elseif($typeName === 'PRODUCT' && $subType === 'PROPERTY') { $proxy = self::$PROXIES[$typeName.'.'.$subType] = new CCrmProductPropertyRestProxy(); } elseif($typeName === 'PRODUCT') { $proxy = self::$PROXIES[$typeName] = new CCrmProductRestProxy(); } elseif($typeName === 'PRODUCTSECTION') { $proxy = self::$PROXIES[$typeName] = new CCrmProductSectionRestProxy(); } elseif($typeName === 'PRODUCTROW') { $proxy = self::$PROXIES[$typeName] = new CCrmProductRowRestProxy(); } elseif($typeName === 'STATUS') { $proxy = self::$PROXIES[$typeName] = new CCrmStatusRestProxy(); } elseif($typeName === 'LEAD') { $proxy = self::$PROXIES[$typeName] = new CCrmLeadRestProxy(); } elseif($typeName === 'DEAL') { if($subType === 'RECURRING') { $proxy = self::$PROXIES[$typeName.'.'.$subType] = new CCrmDealRecurringRestProxy(); } else { $proxy = self::$PROXIES[$typeName] = new CCrmDealRestProxy(); } } elseif($typeName === 'DEALCATEGORY') { $proxy = self::$PROXIES[$typeName] = new CCrmDealCategoryProxy(); } elseif($typeName === 'COMPANY') { $proxy = self::$PROXIES[$typeName] = new CCrmCompanyRestProxy(); } elseif($typeName === 'CONTACT') { $proxy = self::$PROXIES[$typeName] = new CCrmContactRestProxy(); } elseif($typeName === 'QUOTE') { $proxy = self::$PROXIES[$typeName] = new CCrmQuoteRestProxy(); } elseif($typeName === 'ITEM') { $proxy = self::$PROXIES[$typeName] = new CCrmItemRestProxy(); } elseif($typeName === 'INVOICE' && $subType === 'STATUS') { $proxy = self::$PROXIES[$typeName.'.'.$subType] = new CCrmStatusInvoiceRestProxy(); } elseif($typeName === 'INVOICE') { if($subType === 'RECURRING') { $proxy = self::$PROXIES[$typeName.'.'.$subType] = new CCrmInvoiceRecurringRestProxy(); } else { $proxy = self::$PROXIES[$typeName] = new CCrmInvoiceRestProxy(); } } elseif($typeName === 'REQUISITE') { if($subType === 'LINK') { $proxy = self::$PROXIES[$typeName.'.'.$subType] = new CCrmRequisiteLinkRestProxy(); } else { $proxy = self::$PROXIES[$typeName] = new CCrmRequisiteRestProxy(); } } elseif($typeName === 'ADDRESS') { $proxy = self::$PROXIES[$typeName] = new CCrmAddressRestProxy(); } elseif($typeName === 'ADDRESSTYPE') { $proxy = self::$PROXIES[$typeName] = new CCrmAddressTypeRestProxy(); } elseif($typeName === 'ACTIVITY') { if($subType === 'TYPE') { $proxy = self::$PROXIES[$typeName.'.'.$subType] = new \Bitrix\Crm\Activity\Rest\TypeProxy(); } else { $proxy = self::$PROXIES[$typeName] = new CCrmActivityRestProxy(); } } elseif($typeName === 'DUPLICATE') { $proxy = self::$PROXIES[$typeName] = new CCrmDuplicateRestProxy(); } elseif($typeName === 'LIVEFEEDMESSAGE') { $proxy = self::$PROXIES[$typeName] = new CCrmLiveFeedMessageRestProxy(); } elseif($typeName === 'USERFIELD') { $proxy = self::$PROXIES[$typeName] = new CCrmUserFieldRestProxy(CCrmOwnerType::Undefined); } elseif($typeName === 'EXTERNALCHANNEL') { if($subType === 'CONNECTOR') { $proxy = self::$PROXIES[$typeName.'.'.$subType] = new CCrmExternalChannelConnectorRestProxy(); } else { $proxy = self::$PROXIES[$typeName] = new CCrmExternalChannelRestProxy(); } } elseif($typeName === 'WEBFORM') { $proxy = self::$PROXIES[$typeName] = new CCrmWebformRestProxy(); } elseif($typeName === 'SITEBUTTON') { $proxy = self::$PROXIES[$typeName] = new CCrmSiteButtonRestProxy(); } elseif($typeName === 'PERSONTYPE') { $proxy = self::$PROXIES[$typeName] = new CCrmPersonTypeRestProxy(); } elseif($typeName === 'PAYSYSTEM') { $proxy = self::$PROXIES[$typeName] = new CCrmPaySystemRestProxy(); } elseif($typeName === 'MEASURE') { $proxy = self::$PROXIES[$typeName] = new CCrmMeasureRestProxy(); } elseif($typeName === 'AUTOMATION') { $proxy = self::$PROXIES[$typeName] = new \Bitrix\Crm\Automation\Rest\Proxy(); } elseif($typeName === 'TIMELINE') { if ($subType === 'COMMENT') { $proxy = self::$PROXIES[$typeName.'.'.$subType] = new CCrmTimelineCommentRestProxy(); } elseif ($subType === 'BINDINGS') { $proxy = self::$PROXIES[$typeName.'.'.$subType] = new CCrmTimelineBindingRestProxy(); } } else { throw new RestException("Could not find proxy for method '{$methodName}'."); } $proxy->setServer($server); } return $proxy->processMethodRequest( $parts[2], $partCount > 3 ? array_slice($parts, 3) : array(), $arParams, $nav, $server ); }