3namespace Bitrix\Sender\Integration\Yandex\Toloka;
5use Bitrix\Main\Web\HttpClient;
6use Bitrix\Sender\Integration\Yandex\Toloka\Exception\AccessDeniedException;
7use Bitrix\Seo\Analytics\Service;
8use Bitrix\Seo\Engine\YandexJson;
11if(!defined(
"BITRIX_CLOUD_ADV_URL"))
13 $domain =
'bitrix.info';
15 class_exists(
'\Bitrix\Main\License\UrlProvider')
16 && method_exists(
'\Bitrix\Main\License\UrlProvider',
22 $domain = (new \Bitrix\Main\License\UrlProvider())->getTechDomain();
25 $cloudAdvUrl =
'https://cloud-adv.' . $domain;
27 define(
"BITRIX_CLOUD_ADV_URL", $cloudAdvUrl);
30if(!defined(
"SEO_BITRIX_API_URL"))
32 define(
"SEO_BITRIX_API_URL", BITRIX_CLOUD_ADV_URL.
"/rest/");
37 private const API_URL = SEO_BITRIX_API_URL;
43 private function checkResult(): void
45 $errorCode = $this->result[
'error'] ?? $this->result[
'code']??
false;
54 case 'verification_needed':
124 $scope = static::getScope().$data[
'methodName']??
'';
127 ->query($scope,
$data[
'parameters']??[])
130 $httpResult = $httpResult ?
133 $this->result = isset($httpResult[
'result']) ?
138 $this->checkResult();
145 $http->setRedirect(
false);
146 $http->get($authAdapter->getAuthUrl());
149 protected function query($scope, $param = NULL)
157 $http->setRedirect(
false);
160 "access_code" => $this->accessToken,
161 "client_id" => $this->clientId,
162 "client_secret" => $this->clientSecret,
163 "data" => json_encode($param, JSON_UNESCAPED_UNICODE)
171 $http->post(self::API_URL.$scope,
$postData,
false);
setClientSecret($clientSecret)
query($scope, $param=NULL)
setAccessToken($accessToken)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)