From ec8134ce4faa6afd199455e7c9899cc2ad7f9f2c Mon Sep 17 00:00:00 2001 From: George Date: Tue, 23 Jul 2019 12:31:35 +0500 Subject: [PATCH] Add ad fields enums and parameters --- src/services/ads/AdsService.php | 33 +++++++++++++++++-- .../ads/enum/CpcVideoAdBuilderAdFieldEnum.php | 15 +++++++++ .../enum/CpmBannerAdBuilderAdFieldEnum.php | 16 +++++++++ .../ads/enum/CpmVideoAdBuilderAdFieldEnum.php | 16 +++++++++ .../ads/enum/TextAdBuilderAdFieldEnum.php | 4 ++- src/services/ads/enum/TextAdFieldEnum.php | 6 ++-- .../enum/TextAdPriceExtensionFieldEnum.php | 15 +++++++++ .../ads/enum/TextImageAdFieldEnum.php | 4 ++- 8 files changed, 103 insertions(+), 6 deletions(-) create mode 100644 src/services/ads/enum/CpcVideoAdBuilderAdFieldEnum.php create mode 100644 src/services/ads/enum/CpmBannerAdBuilderAdFieldEnum.php create mode 100644 src/services/ads/enum/CpmVideoAdBuilderAdFieldEnum.php create mode 100644 src/services/ads/enum/TextAdPriceExtensionFieldEnum.php diff --git a/src/services/ads/AdsService.php b/src/services/ads/AdsService.php index bd8b881..0e38b6e 100644 --- a/src/services/ads/AdsService.php +++ b/src/services/ads/AdsService.php @@ -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; @@ -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 @@ -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 @@ -101,6 +114,10 @@ public function get( $params['TextAdFieldNames'] = $TextAdFieldNames; } + if ($TextAdPriceExtensionFieldNames) { + $params['TextAdPriceExtensionFieldNames'] = $TextAdPriceExtensionFieldNames; + } + if ($MobileAppAdFieldNames) { $params['MobileAppAdFieldNames'] = $MobileAppAdFieldNames; } @@ -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; } @@ -208,4 +237,4 @@ protected function getName(): string { return 'ads'; } -} \ No newline at end of file +} diff --git a/src/services/ads/enum/CpcVideoAdBuilderAdFieldEnum.php b/src/services/ads/enum/CpcVideoAdBuilderAdFieldEnum.php new file mode 100644 index 0000000..bb0a20c --- /dev/null +++ b/src/services/ads/enum/CpcVideoAdBuilderAdFieldEnum.php @@ -0,0 +1,15 @@ +