diff --git a/CHANGELOG b/CHANGELOG index 02ba11d..2bad131 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,7 @@ -3.1.2 - Businesses service +3.1.2 - Businesses service added + - SmartCampaigns support added + - SmartBanners support added + - checkDictionaries fix 3.1.1 - Fix scrutinizer reflection issue diff --git a/src/Service/AdGroups.php b/src/Service/AdGroups.php index 0d34564..c4f542d 100644 --- a/src/Service/AdGroups.php +++ b/src/Service/AdGroups.php @@ -6,6 +6,8 @@ namespace Yandex\Direct\Service; +use ReflectionException; +use Yandex\Direct\Exception\ErrorResponseException; use Yandex\Direct\Exception\Exception; use Yandex\Direct\Service; use function Yandex\Direct\get_param_names; @@ -57,16 +59,19 @@ public function delete($SelectionCriteria) /** * Возвращает параметры групп, отвечающих заданным критериям. * - * @param $SelectionCriteria - * @param $FieldNames - * @param $MobileAppAdGroupFieldNames - * @param $DynamicTextAdGroupFieldNames - * @param $DynamicTextFeedAdGroupFieldNames - * @param $Page + * @param array $SelectionCriteria + * @param array $FieldNames + * @param array $MobileAppAdGroupFieldNames + * @param array $DynamicTextAdGroupFieldNames + * @param array $DynamicTextFeedAdGroupFieldNames + * @param array $SmartAdGroupFieldNames + * @param array $Page + * * @return array * * @throws Exception - * @throws \ReflectionException + * @throws ReflectionException + * @throws ErrorResponseException * * @see https://tech.yandex.ru/direct/doc/ref-v5/adgroups/delete-docpage/ */ @@ -76,6 +81,7 @@ public function get( $MobileAppAdGroupFieldNames = null, $DynamicTextAdGroupFieldNames = null, $DynamicTextFeedAdGroupFieldNames = null, + $SmartAdGroupFieldNames = null, $Page = null ) { $params = compact(get_param_names(__METHOD__)); diff --git a/src/Service/Ads.php b/src/Service/Ads.php index 4b65f87..1eba069 100644 --- a/src/Service/Ads.php +++ b/src/Service/Ads.php @@ -6,6 +6,7 @@ namespace Yandex\Direct\Service; +use ReflectionException; use Yandex\Direct\Exception\Exception; use Yandex\Direct\Service; use function Yandex\Direct\get_param_names; @@ -156,22 +157,23 @@ public function moderate($SelectionCriteria) /** * Возвращает параметры объявлений, отвечающих заданным критериям. * - * @param $SelectionCriteria - * @param $FieldNames - * @param $TextAdFieldNames - * @param $MobileAppAdFieldNames - * @param $DynamicTextAdFieldNames - * @param $TextImageAdFieldNames - * @param $MobileAppImageAdFieldNames - * @param $TextAdBuilderAdFieldNames - * @param $MobileAppAdBuilderAdFieldNames - * @param $CpcVideoAdBuilderAdFieldNames - * @param $CpmBannerAdBuilderAdFieldNames - * @param $CpmVideoAdBuilderAdFieldNames - * @param $Page + * @param array $SelectionCriteria + * @param array $FieldNames + * @param array $TextAdFieldNames + * @param array $MobileAppAdFieldNames + * @param array $DynamicTextAdFieldNames + * @param array $TextImageAdFieldNames + * @param array $MobileAppImageAdFieldNames + * @param array $TextAdBuilderAdFieldNames + * @param array $MobileAppAdBuilderAdFieldNames + * @param array $CpcVideoAdBuilderAdFieldNames + * @param array $CpmBannerAdBuilderAdFieldNames + * @param array $CpmVideoAdBuilderAdFieldNames + * @param array $SmartAdBuilderAdFieldNames + * @param array $Page * @return array * @throws Exception - * @throws \ReflectionException + * @throws ReflectionException * * @see https://tech.yandex.ru/direct/doc/ref-v5/ads/get-docpage/ */ @@ -188,6 +190,7 @@ public function get( $CpcVideoAdBuilderAdFieldNames = null, $CpmBannerAdBuilderAdFieldNames = null, $CpmVideoAdBuilderAdFieldNames = null, + $SmartAdBuilderAdFieldNames = null, $Page = null ) { $params = compact(get_param_names(__METHOD__)); diff --git a/src/Service/BidModifiers.php b/src/Service/BidModifiers.php index c5ac8a1..f68167f 100644 --- a/src/Service/BidModifiers.php +++ b/src/Service/BidModifiers.php @@ -6,6 +6,7 @@ namespace Yandex\Direct\Service; +use Yandex\Direct\Exception\ErrorResponseException; use Yandex\Direct\Exception\Exception; use Yandex\Direct\Service; use function Yandex\Direct\get_param_names; @@ -57,15 +58,21 @@ public function delete($SelectionCriteria) /** * Возвращает параметры корректировок, отвечающих заданным критериям. * - * @param $SelectionCriteria - * @param $FieldNames - * @param $MobileAdjustmentFieldNames - * @param $DemographicsAdjustmentFieldNames - * @param $RetargetingAdjustmentFieldNames - * @param $Page + * @param array $SelectionCriteria + * @param array $FieldNames + * @param array $MobileAdjustmentFieldNames + * @param array $DemographicsAdjustmentFieldNames + * @param array $RetargetingAdjustmentFieldNames + * @param array $RegionalAdjustmentFieldNames + * @param array $VideoAdjustmentFieldNames + * @param array $SmartAdAdjustmentFieldNames + * @param array $Page + * * @return array + * * @throws Exception * @throws \ReflectionException + * @throws ErrorResponseException * * @see https://tech.yandex.ru/direct/doc/ref-v5/bidmodifiers/get-docpage/ */ @@ -75,6 +82,9 @@ public function get( $MobileAdjustmentFieldNames = null, $DemographicsAdjustmentFieldNames = null, $RetargetingAdjustmentFieldNames = null, + $RegionalAdjustmentFieldNames = null, + $VideoAdjustmentFieldNames = null, + $SmartAdAdjustmentFieldNames = null, $Page = null ) { $params = compact(get_param_names(__METHOD__)); diff --git a/src/Service/Campaigns.php b/src/Service/Campaigns.php index b1aa01f..dfba811 100644 --- a/src/Service/Campaigns.php +++ b/src/Service/Campaigns.php @@ -77,6 +77,7 @@ public function delete($SelectionCriteria) * @param array $MobileAppCampaignFieldNames * @param array $DynamicTextCampaignFieldNames * @param array $CpmBannerCampaignFieldNames + * @param array $SmartCampaignFieldNames * @param array $Page * @return array * @throws Exception @@ -91,6 +92,7 @@ public function get( $MobileAppCampaignFieldNames = null, $DynamicTextCampaignFieldNames = null, $CpmBannerCampaignFieldNames = null, + $SmartCampaignFieldNames = null, $Page = null ) { $params = compact(get_param_names(__METHOD__)); diff --git a/src/Service/Changes.php b/src/Service/Changes.php index 28db59d..bd906a7 100644 --- a/src/Service/Changes.php +++ b/src/Service/Changes.php @@ -6,6 +6,7 @@ namespace Yandex\Direct\Service; +use ReflectionException; use Yandex\Direct\Exception\Exception; use Yandex\Direct\Service; use function Yandex\Direct\get_param_names; @@ -23,16 +24,17 @@ final class Changes extends Service * @param $Timestamp * @return array * @throws Exception + * @throws ReflectionException * * @see https://tech.yandex.ru/direct/doc/ref-v5/changes/checkDictionaries-docpage/ */ - public function checkDictionaries($Timestamp) + public function checkDictionaries($Timestamp = null) { + $params = compact(get_param_names(__METHOD__)); + return $this->request([ 'method' => 'checkDictionaries', - 'params' => [ - 'Timestamp' => $Timestamp - ] + 'params' => $params ]); } diff --git a/src/Service/Creatives.php b/src/Service/Creatives.php index 811bbc9..4d07276 100644 --- a/src/Service/Creatives.php +++ b/src/Service/Creatives.php @@ -5,30 +5,37 @@ namespace Yandex\Direct\Service; +use DOMDocument; +use ReflectionException; +use Yandex\Direct\Exception\ErrorResponseException; +use Yandex\Direct\Exception\Exception; use Yandex\Direct\Service; use function Yandex\Direct\get_param_names; /** * Возвращает параметры креативов, отвечающих заданным критериям. * - * @author Dmitry Gladyshev + * @see https://yandex.ru/dev/direct/doc/ref-v5/creatives/creatives-docpage/ */ final class Creatives extends Service { /** * Возвращает параметры креативов, отвечающих заданным критериям. * - * @param $SelectionCriteria - * @param $FieldNames - * @param $VideoExtensionCreativeFieldNames - * @param $CpcVideoCreativeFieldNames - * @param $CpmVideoCreativeFieldNames - * @param $Page - * @return array|\DOMDocument + * @param array $SelectionCriteria + * @param array $FieldNames + * @param array $VideoExtensionCreativeFieldNames + * @param array $CpcVideoCreativeFieldNames + * @param array $CpmVideoCreativeFieldNames + * @param array $SmartCreativeFieldNames + * @param array $Page + * @return array|DOMDocument * - * @throws \ReflectionException - * @throws \Yandex\Direct\Exception\ErrorResponseException - * @throws \Yandex\Direct\Exception\Exception + * @throws ErrorResponseException + * @throws Exception + * @throws ReflectionException + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/creatives/get-docpage/ */ public function get( $SelectionCriteria, @@ -36,9 +43,9 @@ public function get( $VideoExtensionCreativeFieldNames = null, $CpcVideoCreativeFieldNames = null, $CpmVideoCreativeFieldNames = null, + $SmartCreativeFieldNames = null, $Page = null - ) - { + ) { $params = compact(get_param_names(__METHOD__)); return $this->request([ diff --git a/src/Service/Feeds.php b/src/Service/Feeds.php new file mode 100644 index 0000000..920ceed --- /dev/null +++ b/src/Service/Feeds.php @@ -0,0 +1,124 @@ + + * @date 26/08/20120 21:34 + */ + +namespace Yandex\Direct\Service; + +use ReflectionException; +use Yandex\Direct\Exception\ErrorResponseException; +use Yandex\Direct\Exception\Exception; +use Yandex\Direct\Service; +use function Yandex\Direct\get_param_names; + +/** + * Class Feeds + * + * Сервис предназначен для выполнения операций с фидами. + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/feeds/feeds-docpage/ + */ +final class Feeds extends Service +{ + /** + * Создает фиды. + * + * @param array $Feeds + * + * @return array + * + * @throws ReflectionException + * @throws ErrorResponseException + * @throws Exception + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/feeds/add-docpage/ + */ + public function add($Feeds) + { + $params = compact(get_param_names(__METHOD__)); + + return $this->request([ + 'method' => 'add', + 'params' => $params + ]); + } + + /** + * Удаляет фиды. + * + * @param array $SelectionCriteria + * + * @return array + * + * @throws ReflectionException + * @throws ErrorResponseException + * @throws Exception + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/feeds/delete-docpage/ + */ + public function delete($SelectionCriteria) + { + $params = compact(get_param_names(__METHOD__)); + + return $this->request([ + 'method' => 'delete', + 'params' => $params + ]); + } + + /** + * Возвращает параметры фидов, отвечающих заданным критериям. + * + * @param array $SelectionCriteria + * @param array $FieldNames + * @param array $FileFeedFieldNames + * @param array $UrlFeedFieldNames + * @param array $Page + * + * @return array + * + * @throws ErrorResponseException + * @throws Exception + * @throws ReflectionException + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/feeds/get-docpage/ + */ + public function get( + $SelectionCriteria, + $FieldNames, + $FileFeedFieldNames = null, + $UrlFeedFieldNames = null, + $Page = null + ) { + $params = compact(get_param_names(__METHOD__)); + + return $this->request([ + 'method' => 'get', + 'params' => $params + ]); + } + + /** + * Изменяет параметры фида. + * + * @param array $Feeds + * + * @return array + * + * @throws ErrorResponseException + * @throws Exception + * @throws ReflectionException + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/feeds/update-docpage/ + */ + public function update($Feeds) + { + $params = compact(get_param_names(__METHOD__)); + + return $this->request([ + 'method' => 'update', + 'params' => $params + ]); + } +} diff --git a/src/Service/SmartAdTargets.php b/src/Service/SmartAdTargets.php new file mode 100644 index 0000000..31258cf --- /dev/null +++ b/src/Service/SmartAdTargets.php @@ -0,0 +1,190 @@ + + * @date 26/08/20120 21:34 + */ + +namespace Yandex\Direct\Service; + +use ReflectionException; +use Yandex\Direct\Exception\ErrorResponseException; +use Yandex\Direct\Exception\Exception; +use Yandex\Direct\Service; +use function Yandex\Direct\get_param_names; + +/** + * Class SmartAdTargets + * + * Сервис предназначен для выполнения операций с фильтрами — условиями нацеливания для смарт-баннеров. + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/smartadtargets/smartadtargets-docpage/ + */ +final class SmartAdTargets extends Service +{ + /** + * Создает фильтры — условия нацеливания для смарт-баннеров, назначает CPC, + * CPA или приоритет для создаваемых фильтров. + * + * @param array $SmartAdTargets + * + * @return array + * + * @throws ReflectionException + * @throws ErrorResponseException + * @throws Exception + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/smartadtargets/add-docpage/ + */ + public function add($SmartAdTargets) + { + $params = compact(get_param_names(__METHOD__)); + + return $this->request([ + 'method' => 'add', + 'params' => $params + ]); + } + + /** + * Удаляет фильтры — условия нацеливания для смарт-баннеров. + * + * @param array $SelectionCriteria + * + * @return array + * + * @throws ErrorResponseException + * @throws Exception + * @throws ReflectionException + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/smartadtargets/delete-docpage/ + */ + public function delete($SelectionCriteria) + { + $params = compact(get_param_names(__METHOD__)); + + return $this->request([ + 'method' => 'delete', + 'params' => $params + ]); + } + + /** + * Возвращает параметры фильтров — условий нацеливания для смарт-баннеров. + * + * @param array $SelectionCriteria + * @param array $FieldNames + * @param array $Page + * + * @return array + * + * @throws ErrorResponseException + * @throws Exception + * @throws ReflectionException + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/smartadtargets/get-docpage/ + */ + public function get( + $SelectionCriteria, + $FieldNames, + $Page = null + ) { + $params = compact(get_param_names(__METHOD__)); + + return $this->request([ + 'method' => 'get', + 'params' => $params + ]); + } + + /** + * Возобновляет показы по ранее остановленным фильтрам — условиям нацеливания для смарт-баннеров. + * + * @param array $SelectionCriteria + * + * @return array + * + * @throws ErrorResponseException + * @throws Exception + * @throws ReflectionException + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/smartadtargets/resume-docpage/ + */ + public function resume($SelectionCriteria) + { + $params = compact(get_param_names(__METHOD__)); + + return $this->request([ + 'method' => 'resume', + 'params' => $params + ]); + } + + /** + * Назначает CPC, CPA и приоритеты для фильтров. + * + * @param array $Bids + * + * @return array + * + * @throws ErrorResponseException + * @throws Exception + * @throws ReflectionException + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/smartadtargets/setBids-docpage/ + */ + public function setBids($Bids) + { + $params = compact(get_param_names(__METHOD__)); + + return $this->request([ + 'method' => 'setBids', + 'params' => $params + ]); + } + + /** + * Останавливает показы по фильтрам — условиям нацеливания для смарт-баннеров. + * + * @param array $SelectionCriteria + * + * @return array + * + * @throws ErrorResponseException + * @throws Exception + * @throws ReflectionException + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/smartadtargets/suspend-docpage/ + */ + public function suspend($SelectionCriteria) + { + $params = compact(get_param_names(__METHOD__)); + + return $this->request([ + 'method' => 'suspend', + 'params' => $params + ]); + } + + /** + * Изменяет параметры фильтров — условий нацеливания для смарт-баннеров. + * + * @param array $SmartAdTargets + * + * @return array + * + * @throws ErrorResponseException + * @throws Exception + * @throws ReflectionException + * + * @see https://yandex.ru/dev/direct/doc/ref-v5/smartadtargets/update-docpage/ + */ + public function update($SmartAdTargets) + { + $params = compact(get_param_names(__METHOD__)); + + return $this->request([ + 'method' => 'update', + 'params' => $params + ]); + } +}