Skip to content

Commit

Permalink
Release 2.0.3 (#23)
Browse files Browse the repository at this point in the history
* Force `userCountryCode` to be US to avoid 401 error
  • Loading branch information
gabrielfs7 authored Nov 8, 2020
1 parent f513ad5 commit a1e7f30
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 41 deletions.
83 changes: 44 additions & 39 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
# CHANGELOG

## 2.0.2

- Fix search using empty search term

## 2.0.1

- Fix Google Shopping wrong param name to froogle

## 2.0.0

- Add PSR7 Search compatibility
- Add common SearchInterface (Breaking change)
- Add open api specs
- Allow test api locally with PHP builtin server

## 1.2.2

- Improve tests
- Fix rising and top metrics filter

## 1.2.1

- Fix composer install documentation

## 1.2.0

- Added support for interests by region
- Improve documentation and code standard

## 1.1.0

- Added support for interests over time series result
- Improve documentation and code standard

## 1.0.0

- First stable release
# CHANGELOG

## 2.0.3

- Force `userCountryCode` to be US to avoid 401 error
- Deprecate language filter

## 2.0.2

- Fix search using empty search term

## 2.0.1

- Fix Google Shopping wrong param name to froogle

## 2.0.0

- Add PSR7 Search compatibility
- Add common SearchInterface (Breaking change)
- Add open api specs
- Allow test api locally with PHP builtin server

## 1.2.2

- Improve tests
- Fix rising and top metrics filter

## 1.2.1

- Fix composer install documentation

## 1.2.0

- Added support for interests by region
- Improve documentation and code standard

## 1.1.0

- Added support for interests over time series result
- Improve documentation and code standard

## 1.0.0

- First stable release
- Allow search using internal class for queries and results
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,21 @@ The Project is available on [Packagist](https://packagist.org/packages/gabrielfs
composer require gabrielfs7/google-trends
```

### Testing

Start PHP local server:

```shell script
php -S localhost:8000 web/index.php
```

Access the api endpoints:

- http://localhost:8000/search-interest-by-region?withTopMetrics=1&withRisingMetrics=1&searchTerm=carros&location=BR
- http://localhost:8000/search-interest-over-time?withTopMetrics=1&withRisingMetrics=1&searchTerm=carros&location=BR
- http://localhost:8000/search-related-topics?withTopMetrics=1&withRisingMetrics=1&searchTerm=carros&location=BR
- http://localhost:8000/search-related-queries?withTopMetrics=1&withRisingMetrics=1&searchTerm=carros&location=BR

## Example

After install it you can access an working example [here](/web/index.php).
Expand Down
2 changes: 1 addition & 1 deletion doc/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ components:
required: false
schema:
type: string
description: Bring results with this language.
description: DEPRECATED! Will be removed, cause other languages do not work as filter. We should utilize only location.
example: "en-US"
searchSource:
in: query
Expand Down
2 changes: 1 addition & 1 deletion src/Search/AbstractRelatedSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private function buildQuery(SearchFilter $searchFilter): string
'category' => $searchFilter->getCategory(),
],
'language' => 'en',
'userCountryCode' => $searchFilter->getLocation(),
'userCountryCode' => 'US',
];

if (!empty($searchFilter->getSearchTerm())) {
Expand Down
7 changes: 7 additions & 0 deletions src/Search/SearchFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class SearchFilter

/**
* @var string
* @deprecated Will be removed, cause other languages do not work as filter. We should utilize only location
*/
private $language;

Expand Down Expand Up @@ -174,6 +175,9 @@ public function withTopMetrics(): self
return $this;
}

/**
* @deprecated Will be removed, cause other languages do not work as filter. We should utilize only location
*/
public function withLanguage(string $language): self
{
$this->language = $language;
Expand Down Expand Up @@ -212,6 +216,9 @@ public function getLocation(): string
return $this->location;
}

/**
* @deprecated Will be removed, cause other languages do not work as filter. We should utilize only location
*/
public function getLanguage(): string
{
return $this->language;
Expand Down

0 comments on commit a1e7f30

Please sign in to comment.