Skip to content

Commit 9a55418

Browse files
committed
Added AggregationType request parameter
1 parent 26e9b65 commit 9a55418

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22

33
All Notable changes to `laravel-search-console` will be documented in this file.
4+
## [1.7.1] - 2021-04-11
5+
- Add 'AggregationType' request and response parameter
6+
47
## [1.7.0] - 2021-04-11
58
- Add 'dataState' request and response parameter
69

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ $sites = SearchConsole::setAccessToken($token)->listSites();
113113
[['dimension' => 'query', 'operator' => 'notContains', 'expression' => 'cheesecake']],
114114
1000,
115115
'web',
116-
'all'
116+
'all',
117+
'auto'
117118
);
118119
```
119120

@@ -130,7 +131,7 @@ public function public function listSites(): Collection
130131

131132
### Retrieve Search Analytics Data
132133
```php
133-
public function searchAnalyticsQuery(string $siteUrl, Period $period, array $dimensions = [], array $filters = [], int $rows = 1000, string $searchType = 'web', string $dataState = 'final'): Collection
134+
public function searchAnalyticsQuery(string $siteUrl, Period $period, array $dimensions = [], array $filters = [], int $rows = 1000, string $searchType = 'web', string $dataState = 'final', string $aggregationType = 'auto'): Collection
134135
```
135136

136137
### Check Access Token

src/ExponentialBackoff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function execute(callable $function, array $arguments = [])
6161
}
6262
}
6363

64-
if ($exception->getCode() == 401 || $exception->getCode() == 403) {
64+
if ($exception->getCode() >= 400 && $exception->getCode() <= 499) {
6565
break;
6666
}
6767

src/SearchConsole.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,19 @@ public function listSites()
9595
* @param int $rows
9696
* @param string $searchType
9797
* @param string $dataState
98+
* @param string $aggregationType
9899
* @return Collection
99100
* @throws \Exception
100101
*/
101-
public function searchAnalyticsQuery(string $siteUrl, Period $period, array $dimensions = [], array $filters = [], int $rows = 1000, string $searchType = 'web', string $dataState = 'final')
102+
public function searchAnalyticsQuery(string $siteUrl, Period $period, array $dimensions = [], array $filters = [], int $rows = 1000, string $searchType = 'web', string $dataState = 'final', string $aggregationType = 'auto')
102103
{
103104
$request = new Google_Service_Webmasters_SearchAnalyticsQueryRequest();
104105
$request->setStartDate($period->startDate->toDateString());
105106
$request->setEndDate($period->endDate->toDateString());
106107
$request->setSearchType($searchType);
107108
$request->setDimensions($dimensions);
108109
$request->setDataState($dataState);
110+
$request->setAggregationType($aggregationType);
109111
$request = $this->applyFilters($request, $filters);
110112

111113
return $this->client->performQuery($siteUrl, $rows, $request);

src/SearchConsoleClient.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public function performQuery($siteUrl, $rows, $request): Collection
8282
$item['position'] = $row->getPosition();
8383
$item['searchType'] = $request->getSearchType();
8484
$item['dataState'] = $request->getDataState();
85+
$item['aggregationType'] = $request->getAggregationType();
8586

8687
$dataRows->put($uniqueHash, $item);
8788
}

0 commit comments

Comments
 (0)