Skip to content

Commit 4cd6824

Browse files
author
Thang Duong
committed
Release 35.0.0.
1 parent ba662a5 commit 4cd6824

File tree

1,994 files changed

+65211
-49989
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,994 files changed

+65211
-49989
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
### 35.0.0
2+
3+
##### AdWords
4+
5+
* Added `QueryValidator` for v201802 to validate parts of an AWQL string.
6+
* Added unit tests for `ServiceQueryBuilder`, `ReportQueryBuilder` and
7+
supporting classes for v201802.
8+
* Fixed
9+
[issue #473](https://github.com/googleads/googleads-php-lib/issues/473).
10+
11+
##### DFP
12+
13+
* Added `DaiAuthenticationKeyService` for creating, updating and retrieving
14+
`DaiAuthenticationKey` objects.
15+
* Added support and examples for v201805.
16+
* Removed support for v201705.
17+
* Removed examples for v201708.
18+
119
### 34.0.0
220

321
##### AdWords

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"description": "Google Ads APIs Client Library for PHP (AdWords and DFP)",
44
"require": {
55
"php": ">=5.5.9",
6+
"ext-mbstring": "*",
67
"ext-openssl": "*",
78
"ext-soap": "*",
89
"google/auth": "^1.0.0",

examples/AdWords/v201710/BasicOperations/UpdateKeyword.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@
3737
class UpdateKeyword
3838
{
3939

40-
// const AD_GROUP_ID = 'INSERT_AD_GROUP_ID_HERE';
41-
// const CRITERION_ID = 'INSERT_KEYWORD_CRITERION_ID_HERE';
42-
const AD_GROUP_ID = '17453504533';
43-
const CRITERION_ID = '174223779';
40+
const AD_GROUP_ID = 'INSERT_AD_GROUP_ID_HERE';
41+
const CRITERION_ID = 'INSERT_KEYWORD_CRITERION_ID_HERE';
4442

4543
public static function runExample(
4644
AdWordsServices $adWordsServices,

examples/AdWords/v201802/BasicOperations/UpdateKeyword.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@
3737
class UpdateKeyword
3838
{
3939

40-
// const AD_GROUP_ID = 'INSERT_AD_GROUP_ID_HERE';
41-
// const CRITERION_ID = 'INSERT_KEYWORD_CRITERION_ID_HERE';
42-
const AD_GROUP_ID = '17453504533';
43-
const CRITERION_ID = '174223779';
40+
const AD_GROUP_ID = 'INSERT_AD_GROUP_ID_HERE';
41+
const CRITERION_ID = 'INSERT_KEYWORD_CRITERION_ID_HERE';
4442

4543
public static function runExample(
4644
AdWordsServices $adWordsServices,

examples/AdWords/v201802/Optimization/GetKeywordBidSimulations.php

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Google\AdsApi\AdWords\AdWordsServices;
2323
use Google\AdsApi\AdWords\AdWordsSession;
2424
use Google\AdsApi\AdWords\AdWordsSessionBuilder;
25+
use Google\AdsApi\AdWords\Query\v201802\ServiceQueryBuilder;
2526
use Google\AdsApi\AdWords\v201802\cm\DataService;
2627
use Google\AdsApi\AdWords\v201802\cm\Paging;
2728
use Google\AdsApi\AdWords\v201802\cm\Predicate;
@@ -46,11 +47,10 @@ public static function runExample(
4647
) {
4748
$dataService = $adWordsServices->get($session, DataService::class);
4849

49-
// Create a selector to select all keyword bid simulations for the
50+
// Create a query to select all keyword bid simulations for the
5051
// specified ad group.
51-
$selector = new Selector();
52-
$selector->setFields(
53-
[
52+
$query = (new ServiceQueryBuilder())
53+
->select([
5454
'AdGroupId',
5555
'CriterionId',
5656
'StartDate',
@@ -61,61 +61,56 @@ public static function runExample(
6161
'LocalClicks',
6262
'LocalCost',
6363
'LocalImpressions'
64-
]
65-
);
66-
$selector->setPredicates(
67-
[
68-
new Predicate('AdGroupId', PredicateOperator::IN, [$adGroupId])
69-
]
70-
);
71-
$selector->setPaging(new Paging(0, self::PAGE_SIZE));
64+
])
65+
->where('AdGroupId')->in([$adGroupId])
66+
->limit(0, self::PAGE_SIZE)
67+
->build();
7268

7369
// Display bid landscapes.
74-
$landscapePointsInPreviousPage = 0;
75-
$startIndex = 0;
7670
do {
77-
// Offset the start index by the number of landscape points in the last
78-
// retrieved page, NOT the number of entries (bid landscapes) in the page.
79-
$startIndex += $landscapePointsInPreviousPage;
80-
$selector->getPaging()->setStartIndex($startIndex);
81-
82-
// Reset the count of landscape points in preparation for processing the
83-
// next page.
84-
$landscapePointsInPreviousPage = 0;
71+
if (isset($fetchedPage)) {
72+
// Advance the paging offset in subsequent iterations only.
73+
$query->nextPage();
74+
}
8575

86-
// Retrieve keyword bid simulations one page at a time, continuing to
87-
// request pages until all of them have been retrieved.
88-
$page = $dataService->getCriterionBidLandscape($selector);
76+
// Retrieve keyword bid simulations one page at a time, continuing
77+
// to request pages until all of them have been retrieved.
78+
$fetchedPage = $dataService->queryCriterionBidLandscape(
79+
sprintf('%s', $query)
80+
);
8981

9082
// Print out some information for each bid landscape.
91-
if ($page->getEntries() !== null) {
92-
foreach ($page->getEntries() as $bidLandscape) {
83+
if ($fetchedPage->getEntries() !== null) {
84+
foreach ($fetchedPage->getEntries() as $bidLandscape) {
9385
printf(
94-
"Found criterion bid landscape with ad group ID %d, criterion ID"
95-
. " %d, start date '%s', end date '%s', and landscape points:\n",
86+
"Found a criterion bid landscape with ad group ID %d," .
87+
" criterion ID %d, start date '%s', end date '%s'," .
88+
" and landscape points:%s",
9689
$bidLandscape->getAdGroupId(),
9790
$bidLandscape->getCriterionId(),
9891
$bidLandscape->getStartDate(),
99-
$bidLandscape->getEndDate()
92+
$bidLandscape->getEndDate(),
93+
PHP_EOL
10094
);
101-
$landscapePointsInPreviousPage = count($bidLandscape->getLandscapePoints());
102-
foreach ($bidLandscape->getLandscapePoints() as $bidLandscapePoint) {
95+
foreach ($bidLandscape->getLandscapePoints() as
96+
$bidLandscapePoint) {
10397
printf(
10498
" bid: %d => clicks: %d, cost: %d, impressions: %d"
10599
. ", biddable conversions: %.2f, biddable "
106-
. "conversions value: %.2f\n",
100+
. "conversions value: %.2f%s",
107101
$bidLandscapePoint->getBid()->getMicroAmount(),
108102
$bidLandscapePoint->getClicks(),
109103
$bidLandscapePoint->getCost()->getMicroAmount(),
110104
$bidLandscapePoint->getImpressions(),
111105
$bidLandscapePoint->getBiddableConversions(),
112-
$bidLandscapePoint->getBiddableConversionsValue()
106+
$bidLandscapePoint->getBiddableConversionsValue(),
107+
PHP_EOL
113108
);
114109
}
115-
print "\n";
110+
print PHP_EOL;
116111
}
117112
}
118-
} while ($landscapePointsInPreviousPage >= self::PAGE_SIZE);
113+
} while ($query->hasNext($fetchedPage));
119114
}
120115

121116
public static function main()
@@ -125,7 +120,8 @@ public static function main()
125120

126121
// Construct an API session configured from a properties file and the
127122
// OAuth2 credentials above.
128-
$session = (new AdWordsSessionBuilder())->fromFile()->withOAuth2Credential($oAuth2Credential)->build();
123+
$session = (new AdWordsSessionBuilder())
124+
->fromFile()->withOAuth2Credential($oAuth2Credential)->build();
129125
self::runExample(
130126
new AdWordsServices(),
131127
$session,

examples/AdWords/v201802/Targeting/AddCampaignTargetingCriteria.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ public static function runExample(
9090
$radius->setType(ConstantOperandConstantType::DOUBLE);
9191
$radius->setUnit(ConstantOperandUnit::MILES);
9292
$radius->setDoubleValue(10.0);
93-
$distance = new LocationExtensionOperand($radius);
93+
$distance = new LocationExtensionOperand();
94+
$distance->setRadius($radius);
9495
$locationGroup = new LocationGroups();
9596
$locationGroup->setFeedId(intval($locationFeedId));
9697
$locationGroup->setMatchingFunction(

examples/Dfp/v201708/CustomTargetingService/DeleteCustomTargetingKeys.php

Lines changed: 0 additions & 130 deletions
This file was deleted.

0 commit comments

Comments
 (0)