Skip to content

Commit

Permalink
Add ad fields enums and parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
SonicGD committed Jul 23, 2019
1 parent 54cf573 commit ec8134c
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 6 deletions.
33 changes: 31 additions & 2 deletions src/services/ads/AdsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
use directapi\common\results\ActionResult;
use directapi\services\ads\criterias\AdsSelectionCriteria;
use directapi\services\ads\enum\AdFieldEnum;
use directapi\services\ads\enum\CpcVideoAdBuilderAdFieldEnum;
use directapi\services\ads\enum\CpmBannerAdBuilderAdFieldEnum;
use directapi\services\ads\enum\CpmVideoAdBuilderAdFieldEnum;
use directapi\services\ads\enum\DynamicTextAdFieldEnum;
use directapi\services\ads\enum\MobileAppAdBuilderAdFieldEnum;
use directapi\services\ads\enum\MobileAppAdFieldEnum;
use directapi\services\ads\enum\MobileAppImageAdFieldEnum;
use directapi\services\ads\enum\TextAdBuilderAdFieldEnum;
use directapi\services\ads\enum\TextAdFieldEnum;
use directapi\services\ads\enum\TextAdPriceExtensionFieldEnum;
use directapi\services\ads\enum\TextImageAdFieldEnum;
use directapi\services\ads\models\AdAddItem;
use directapi\services\ads\models\AdGetItem;
Expand Down Expand Up @@ -66,12 +70,16 @@ public function delete(IdsCriteria $SelectionCriteria): array
*
* @param AdFieldEnum[] $FieldNames
* @param TextAdFieldEnum[] $TextAdFieldNames
* @param TextAdPriceExtensionFieldEnum[] $TextAdPriceExtensionFieldNames
* @param MobileAppAdFieldEnum[] $MobileAppAdFieldNames
* @param DynamicTextAdFieldEnum[] $DynamicTextAdFieldNames
* @param TextImageAdFieldEnum[] $TextImageAdFieldNames
* @param MobileAppImageAdFieldEnum[] $MobileAppImageAdFieldNames
* @param TextAdBuilderAdFieldEnum[] $TextAdBuilderAdFieldNames
* @param MobileAppAdBuilderAdFieldEnum[] $MobileAppAdBuilderAdFieldNames
* @param CpcVideoAdBuilderAdFieldEnum[] $CpcVideoAdBuilderAdFieldNames
* @param CpmBannerAdBuilderAdFieldEnum[] $CpmBannerAdBuilderAdFieldNames
* @param CpmVideoAdBuilderAdFieldEnum[] $CpmVideoAdBuilderAdFieldNames
* @param LimitOffset $Page
* @return models\AdGetItem[]
* @throws \GuzzleHttp\Exception\GuzzleException
Expand All @@ -84,14 +92,19 @@ public function get(
AdsSelectionCriteria $SelectionCriteria,
array $FieldNames,
array $TextAdFieldNames = [],
array $TextAdPriceExtensionFieldNames = [],
array $MobileAppAdFieldNames = [],
array $DynamicTextAdFieldNames = [],
array $TextImageAdFieldNames = [],
array $MobileAppImageAdFieldNames = [],
array $TextAdBuilderAdFieldNames = [],
array $MobileAppAdBuilderAdFieldNames = [],
array $CpcVideoAdBuilderAdFieldNames = [],
array $CpmBannerAdBuilderAdFieldNames = [],
array $CpmVideoAdBuilderAdFieldNames = [],
LimitOffset $Page = null
): array {
): array
{
$params = [
'SelectionCriteria' => $SelectionCriteria,
'FieldNames' => $FieldNames
Expand All @@ -101,6 +114,10 @@ public function get(
$params['TextAdFieldNames'] = $TextAdFieldNames;
}

if ($TextAdPriceExtensionFieldNames) {
$params['TextAdPriceExtensionFieldNames'] = $TextAdPriceExtensionFieldNames;
}

if ($MobileAppAdFieldNames) {
$params['MobileAppAdFieldNames'] = $MobileAppAdFieldNames;
}
Expand All @@ -125,6 +142,18 @@ public function get(
$params['MobileAppAdBuilderAdFieldNames'] = $MobileAppAdBuilderAdFieldNames;
}

if ($CpcVideoAdBuilderAdFieldNames) {
$params['CpcVideoAdBuilderAdFieldNames'] = $CpcVideoAdBuilderAdFieldNames;
}

if ($CpmBannerAdBuilderAdFieldNames) {
$params['CpmBannerAdBuilderAdFieldNames'] = $CpmBannerAdBuilderAdFieldNames;
}

if ($CpmVideoAdBuilderAdFieldNames) {
$params['CpmVideoAdBuilderAdFieldNames'] = $CpmVideoAdBuilderAdFieldNames;
}

if ($Page) {
$params['Page'] = $Page;
}
Expand Down Expand Up @@ -208,4 +237,4 @@ protected function getName(): string
{
return 'ads';
}
}
}
15 changes: 15 additions & 0 deletions src/services/ads/enum/CpcVideoAdBuilderAdFieldEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php


namespace directapi\services\ads\enum;


use directapi\components\Enum;

class CpcVideoAdBuilderAdFieldEnum extends Enum
{
public const CREATIVE = 'Creative';
public const HREF = 'Href';
public const TURBO_PAGE_ID = 'TurboPageId';
public const TURBO_PAGE_MODERATION = 'TurboPageModeration';
}
16 changes: 16 additions & 0 deletions src/services/ads/enum/CpmBannerAdBuilderAdFieldEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php


namespace directapi\services\ads\enum;


use directapi\components\Enum;

class CpmBannerAdBuilderAdFieldEnum extends Enum
{
public const CREATIVE = 'Creative';
public const HREF = 'Href';
public const TRACKING_PIXELS = 'TrackingPixels';
public const TURBO_PAGE_ID = 'TurboPageId';
public const TURBO_PAGE_MODERATION = 'TurboPageModeration';
}
16 changes: 16 additions & 0 deletions src/services/ads/enum/CpmVideoAdBuilderAdFieldEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php


namespace directapi\services\ads\enum;


use directapi\components\Enum;

class CpmVideoAdBuilderAdFieldEnum extends Enum
{
public const CREATIVE = 'Creative';
public const HREF = 'Href';
public const TRACKING_PIXELS = 'TrackingPixels';
public const TURBO_PAGE_ID = 'TurboPageId';
public const TURBO_PAGE_MODERATION = 'TurboPageModeration';
}
4 changes: 3 additions & 1 deletion src/services/ads/enum/TextAdBuilderAdFieldEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ class TextAdBuilderAdFieldEnum extends Enum
{
public const CREATIVE = 'Creative';
public const HREF = 'Href';
}
public const TURBO_PAGE_ID = 'TurboPageId';
public const TURBO_PAGE_MODERATION = 'TurboPageModeration';
}
6 changes: 4 additions & 2 deletions src/services/ads/enum/TextAdFieldEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ class TextAdFieldEnum extends Enum
public const SITE_LINKS_MODERATION = 'SitelinksModeration';
public const AD_IMAGE_MODERATION = 'AdImageModeration';
public const AD_EXTENSIONS = 'AdExtensions';
public CONST VIDEO_EXTENSION = 'VideoExtension';
}
public const VIDEO_EXTENSION = 'VideoExtension';
public const TURBO_PAGE_ID = 'TurboPageId';
public const TURBO_PAGE_MODERATION = 'TurboPageModeration';
}
15 changes: 15 additions & 0 deletions src/services/ads/enum/TextAdPriceExtensionFieldEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php


namespace directapi\services\ads\enum;


use directapi\components\Enum;

class TextAdPriceExtensionFieldEnum extends Enum
{
public const PRICE = 'Price';
public const OLD_PRICE = 'OldPrice';
public const PRICE_CURRENCY = 'PriceCurrency';
public const PRICE_QUALIFIER = 'PriceQualifier';
}
4 changes: 3 additions & 1 deletion src/services/ads/enum/TextImageAdFieldEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ class TextImageAdFieldEnum extends Enum
{
public const AD_IMAGE_HASH = 'AdImageHash';
public const HREF = 'Href';
}
public const TURBO_PAGE_ID = 'TurboPageId';
public const TURBO_PAGE_MODERATION = 'TurboPageModeration';
}

0 comments on commit ec8134c

Please sign in to comment.