File tree Expand file tree Collapse file tree 5 files changed +6
-7
lines changed
Expand file tree Collapse file tree 5 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 22
33namespace AlwaysOpen \SerpApi \DTOs \Google ;
44
5- use Spatie \LaravelData \Attributes \DataCollectionOf ;
65use Spatie \LaravelData \Data ;
76
87class ImmersiveProductResponse extends Data
Original file line number Diff line number Diff line change 22
33namespace AlwaysOpen \SerpApi ;
44
5- use Illuminate \Support \Arr ;
6-
75class SerpApi
86{
97 public const string ENGINE_GOOGLE_IMMERSIVE_PRODUCT = 'google_immersive_product ' ;
Original file line number Diff line number Diff line change 1313class SerpApiClient
1414{
1515 protected string $ apiKey ;
16+
1617 protected string $ baseUrl = 'https://serpapi.com/search ' ;
1718
1819 public const string JSON_TYPE = 'json ' ;
20+
1921 public const string HTML_TYPE = 'html ' ;
2022
2123 public function __construct (
@@ -41,7 +43,7 @@ public function makeGetRequest(
4143
4244 $ request = new Request (
4345 method: 'get ' ,
44- uri: $ this ->baseUrl . ". $ responseType " . ($ paramString ? '? ' . $ paramString : '' ),
46+ uri: $ this ->baseUrl . ". $ responseType " . ($ paramString ? '? ' . $ paramString : '' ),
4547 );
4648
4749 /**
@@ -76,7 +78,7 @@ public function makeGoogleImmersiveProductRequest(
7678
7779 $ response = $ this ->makeGetRequest ($ params , $ responseType );
7880
79- if (self :: JSON_TYPE === $ responseType ) {
81+ if ($ responseType === self :: JSON_TYPE ) {
8082 if ($ asDto ) {
8183 return ImmersiveProductResponse::from ($ response ->json ());
8284 }
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ public function register()
1818 public function boot ()
1919 {
2020 $ this ->publishes ([
21- __DIR__ . '/../config/serp-api.php ' => config_path ('serp-api.php ' ),
21+ __DIR__ . '/../config/serp-api.php ' => config_path ('serp-api.php ' ),
2222 __DIR__ .'/../config/data.php ' => config_path ('data.php ' ),
2323 ], 'config ' );
2424 }
Original file line number Diff line number Diff line change 22
33namespace AlwaysOpen \SerpApi \Tests \Feature ;
44
5- use AlwaysOpen \SerpApi \Tests \BaseTest ;
65use AlwaysOpen \SerpApi \SerpApiClient ;
6+ use AlwaysOpen \SerpApi \Tests \BaseTest ;
77use Illuminate \Support \Facades \Http ;
88
99class SerpApiClientTest extends BaseTest
You can’t perform that action at this time.
0 commit comments