Skip to content

Commit

Permalink
resolves issue #15 #14
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Gladyshev committed Jul 26, 2020
1 parent 0678d0c commit c42f859
Show file tree
Hide file tree
Showing 9 changed files with 392 additions and 45 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -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

Expand Down
20 changes: 13 additions & 7 deletions src/Service/AdGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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/
*/
Expand All @@ -76,6 +81,7 @@ public function get(
$MobileAppAdGroupFieldNames = null,
$DynamicTextAdGroupFieldNames = null,
$DynamicTextFeedAdGroupFieldNames = null,
$SmartAdGroupFieldNames = null,
$Page = null
) {
$params = compact(get_param_names(__METHOD__));
Expand Down
31 changes: 17 additions & 14 deletions src/Service/Ads.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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/
*/
Expand All @@ -188,6 +190,7 @@ public function get(
$CpcVideoAdBuilderAdFieldNames = null,
$CpmBannerAdBuilderAdFieldNames = null,
$CpmVideoAdBuilderAdFieldNames = null,
$SmartAdBuilderAdFieldNames = null,
$Page = null
) {
$params = compact(get_param_names(__METHOD__));
Expand Down
22 changes: 16 additions & 6 deletions src/Service/BidModifiers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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/
*/
Expand All @@ -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__));
Expand Down
2 changes: 2 additions & 0 deletions src/Service/Campaigns.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -91,6 +92,7 @@ public function get(
$MobileAppCampaignFieldNames = null,
$DynamicTextCampaignFieldNames = null,
$CpmBannerCampaignFieldNames = null,
$SmartCampaignFieldNames = null,
$Page = null
) {
$params = compact(get_param_names(__METHOD__));
Expand Down
10 changes: 6 additions & 4 deletions src/Service/Changes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
]);
}

Expand Down
33 changes: 20 additions & 13 deletions src/Service/Creatives.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,47 @@

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 <deel@email.ru>
* @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,
$FieldNames,
$VideoExtensionCreativeFieldNames = null,
$CpcVideoCreativeFieldNames = null,
$CpmVideoCreativeFieldNames = null,
$SmartCreativeFieldNames = null,
$Page = null
)
{
) {
$params = compact(get_param_names(__METHOD__));

return $this->request([
Expand Down
124 changes: 124 additions & 0 deletions src/Service/Feeds.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?php
/**
* @author Dmitry Gladyshev <[email protected]>
* @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
]);
}
}
Loading

0 comments on commit c42f859

Please sign in to comment.