From 5854261939cdfc544a7f6e926ab81cd2b0306781 Mon Sep 17 00:00:00 2001 From: Damien Couchez Date: Thu, 10 Feb 2022 15:15:59 +0100 Subject: [PATCH] fix(php): Remove header handling in clients (#128) --- .../algoliasearch-client-php/lib/Algolia.php | 2 +- .../lib/Api/AbtestingApi.php | 103 +- .../lib/Api/AnalyticsApi.php | 344 +---- .../lib/Api/InsightsApi.php | 23 +- .../lib/Api/PersonalizationApi.php | 83 +- .../lib/Api/QuerySuggestionsApi.php | 142 +-- .../lib/Api/RecommendApi.php | 23 +- .../lib/Api/SearchApi.php | 1116 +---------------- .../lib/Configuration/Configuration.php | 4 +- .../RequestOptions/RequestOptionsFactory.php | 4 +- .../lib/RetryStrategy/ApiWrapper.php | 6 - templates/php/Configuration.mustache | 4 +- templates/php/api.mustache | 55 +- 13 files changed, 125 insertions(+), 1784 deletions(-) diff --git a/clients/algoliasearch-client-php/lib/Algolia.php b/clients/algoliasearch-client-php/lib/Algolia.php index 91d4adee66..c9aede0df0 100644 --- a/clients/algoliasearch-client-php/lib/Algolia.php +++ b/clients/algoliasearch-client-php/lib/Algolia.php @@ -10,7 +10,7 @@ final class Algolia { - const VERSION = '1.0.0'; + const VERSION = '4.0.0'; /** * Holds an instance of the simple cache repository (PSR-16). diff --git a/clients/algoliasearch-client-php/lib/Api/AbtestingApi.php b/clients/algoliasearch-client-php/lib/Api/AbtestingApi.php index cc49fff7c8..988c8a2c3e 100644 --- a/clients/algoliasearch-client-php/lib/Api/AbtestingApi.php +++ b/clients/algoliasearch-client-php/lib/Api/AbtestingApi.php @@ -109,30 +109,13 @@ public function addABTests($addABTestsRequest) $resourcePath = '/2/abtests'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($addABTestsRequest)) { $httpBody = $addABTestsRequest; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation deleteABTest @@ -157,7 +140,6 @@ public function deleteABTest($id) $resourcePath = '/2/abtests/{id}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($id !== null) { @@ -168,24 +150,7 @@ public function deleteABTest($id) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('DELETE', $resourcePath, $query, $httpBody); + return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); } /** * Operation getABTest @@ -210,7 +175,6 @@ public function getABTest($id) $resourcePath = '/2/abtests/{id}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($id !== null) { @@ -221,24 +185,7 @@ public function getABTest($id) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation listABTests @@ -257,7 +204,6 @@ public function listABTests($offset = 0, $limit = 10) { $resourcePath = '/2/abtests'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($offset !== null) { @@ -280,24 +226,7 @@ public function listABTests($offset = 0, $limit = 10) } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation stopABTest @@ -322,7 +251,6 @@ public function stopABTest($id) $resourcePath = '/2/abtests/{id}/stop'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($id !== null) { @@ -333,28 +261,13 @@ public function stopABTest($id) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } - private function sendRequest($method, $resourcePath, $query, $httpBody) + private function sendRequest($method, $resourcePath, $queryParams, $httpBody) { + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + if ($method === 'GET') { $request = $this->api->read( $method, diff --git a/clients/algoliasearch-client-php/lib/Api/AnalyticsApi.php b/clients/algoliasearch-client-php/lib/Api/AnalyticsApi.php index 02b866ba4a..7cd5e4d415 100644 --- a/clients/algoliasearch-client-php/lib/Api/AnalyticsApi.php +++ b/clients/algoliasearch-client-php/lib/Api/AnalyticsApi.php @@ -119,7 +119,6 @@ public function getAverageClickPosition($index, $startDate = null, $endDate = nu $resourcePath = '/2/clicks/averageClickPosition'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -162,24 +161,7 @@ public function getAverageClickPosition($index, $startDate = null, $endDate = nu } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getClickPositions @@ -214,7 +196,6 @@ public function getClickPositions($index, $startDate = null, $endDate = null, $t $resourcePath = '/2/clicks/positions'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -257,24 +238,7 @@ public function getClickPositions($index, $startDate = null, $endDate = null, $t } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getClickThroughRate @@ -309,7 +273,6 @@ public function getClickThroughRate($index, $startDate = null, $endDate = null, $resourcePath = '/2/clicks/clickThroughRate'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -352,24 +315,7 @@ public function getClickThroughRate($index, $startDate = null, $endDate = null, } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getConversationRate @@ -404,7 +350,6 @@ public function getConversationRate($index, $startDate = null, $endDate = null, $resourcePath = '/2/conversions/conversionRate'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -447,24 +392,7 @@ public function getConversationRate($index, $startDate = null, $endDate = null, } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getNoClickRate @@ -499,7 +427,6 @@ public function getNoClickRate($index, $startDate = null, $endDate = null, $tags $resourcePath = '/2/searches/noClickRate'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -542,24 +469,7 @@ public function getNoClickRate($index, $startDate = null, $endDate = null, $tags } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getNoResultsRate @@ -594,7 +504,6 @@ public function getNoResultsRate($index, $startDate = null, $endDate = null, $ta $resourcePath = '/2/searches/noResultRate'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -637,24 +546,7 @@ public function getNoResultsRate($index, $startDate = null, $endDate = null, $ta } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getSearchesCount @@ -689,7 +581,6 @@ public function getSearchesCount($index, $startDate = null, $endDate = null, $ta $resourcePath = '/2/searches/count'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -732,24 +623,7 @@ public function getSearchesCount($index, $startDate = null, $endDate = null, $ta } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getSearchesNoClicks @@ -786,7 +660,6 @@ public function getSearchesNoClicks($index, $startDate = null, $endDate = null, $resourcePath = '/2/searches/noClicks'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -849,24 +722,7 @@ public function getSearchesNoClicks($index, $startDate = null, $endDate = null, } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getSearchesNoResults @@ -903,7 +759,6 @@ public function getSearchesNoResults($index, $startDate = null, $endDate = null, $resourcePath = '/2/searches/noResults'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -966,24 +821,7 @@ public function getSearchesNoResults($index, $startDate = null, $endDate = null, } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getStatus @@ -1008,7 +846,6 @@ public function getStatus($index) $resourcePath = '/2/status'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -1021,24 +858,7 @@ public function getStatus($index) } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getTopCountries @@ -1075,7 +895,6 @@ public function getTopCountries($index, $startDate = null, $endDate = null, $lim $resourcePath = '/2/countries'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -1138,24 +957,7 @@ public function getTopCountries($index, $startDate = null, $endDate = null, $lim } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getTopFilterAttributes @@ -1193,7 +995,6 @@ public function getTopFilterAttributes($index, $search = null, $startDate = null $resourcePath = '/2/filters'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -1266,24 +1067,7 @@ public function getTopFilterAttributes($index, $search = null, $startDate = null } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getTopFilterForAttribute @@ -1328,7 +1112,6 @@ public function getTopFilterForAttribute($attribute, $index, $search = null, $st $resourcePath = '/2/filters/{attribute}'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -1409,24 +1192,7 @@ public function getTopFilterForAttribute($attribute, $index, $search = null, $st ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getTopFiltersNoResults @@ -1464,7 +1230,6 @@ public function getTopFiltersNoResults($index, $search = null, $startDate = null $resourcePath = '/2/filters/noResults'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -1537,24 +1302,7 @@ public function getTopFiltersNoResults($index, $search = null, $startDate = null } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getTopHits @@ -1593,7 +1341,6 @@ public function getTopHits($index, $search = null, $clickAnalytics = false, $sta $resourcePath = '/2/hits'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -1676,24 +1423,7 @@ public function getTopHits($index, $search = null, $clickAnalytics = false, $sta } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getTopSearches @@ -1733,7 +1463,6 @@ public function getTopSearches($index, $clickAnalytics = false, $startDate = nul $resourcePath = '/2/searches'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -1826,24 +1555,7 @@ public function getTopSearches($index, $clickAnalytics = false, $startDate = nul } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getUsersCount @@ -1878,7 +1590,6 @@ public function getUsersCount($index, $startDate = null, $endDate = null, $tags $resourcePath = '/2/users/count'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($index !== null) { @@ -1921,28 +1632,13 @@ public function getUsersCount($index, $startDate = null, $endDate = null, $tags } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } - private function sendRequest($method, $resourcePath, $query, $httpBody) + private function sendRequest($method, $resourcePath, $queryParams, $httpBody) { + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + if ($method === 'GET') { $request = $this->api->read( $method, diff --git a/clients/algoliasearch-client-php/lib/Api/InsightsApi.php b/clients/algoliasearch-client-php/lib/Api/InsightsApi.php index 3d6ac06bd4..36878a140d 100644 --- a/clients/algoliasearch-client-php/lib/Api/InsightsApi.php +++ b/clients/algoliasearch-client-php/lib/Api/InsightsApi.php @@ -108,34 +108,19 @@ public function pushEvents($insightEvents) $resourcePath = '/1/events'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($insightEvents)) { $httpBody = $insightEvents; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } - private function sendRequest($method, $resourcePath, $query, $httpBody) + private function sendRequest($method, $resourcePath, $queryParams, $httpBody) { + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + if ($method === 'GET') { $request = $this->api->read( $method, diff --git a/clients/algoliasearch-client-php/lib/Api/PersonalizationApi.php b/clients/algoliasearch-client-php/lib/Api/PersonalizationApi.php index 4c94a8e159..c19f0f05f2 100644 --- a/clients/algoliasearch-client-php/lib/Api/PersonalizationApi.php +++ b/clients/algoliasearch-client-php/lib/Api/PersonalizationApi.php @@ -109,7 +109,6 @@ public function deleteUserProfile($userToken) $resourcePath = '/1/profiles/{userToken}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($userToken !== null) { @@ -120,24 +119,7 @@ public function deleteUserProfile($userToken) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('DELETE', $resourcePath, $query, $httpBody); + return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); } /** * Operation getPersonalizationStrategy @@ -154,27 +136,9 @@ public function getPersonalizationStrategy() { $resourcePath = '/1/strategies/personalization'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getUserTokenProfile @@ -199,7 +163,6 @@ public function getUserTokenProfile($userToken) $resourcePath = '/1/profiles/personalization/{userToken}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($userToken !== null) { @@ -210,24 +173,7 @@ public function getUserTokenProfile($userToken) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation setPersonalizationStrategy @@ -252,34 +198,19 @@ public function setPersonalizationStrategy($personalizationStrategyParams) $resourcePath = '/1/strategies/personalization'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($personalizationStrategyParams)) { $httpBody = $personalizationStrategyParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } - private function sendRequest($method, $resourcePath, $query, $httpBody) + private function sendRequest($method, $resourcePath, $queryParams, $httpBody) { + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + if ($method === 'GET') { $request = $this->api->read( $method, diff --git a/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsApi.php b/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsApi.php index 91d4035d0f..d967f3b0a0 100644 --- a/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsApi.php +++ b/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsApi.php @@ -109,30 +109,13 @@ public function createConfig($querySuggestionsIndexWithIndexParam) $resourcePath = '/1/configs'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($querySuggestionsIndexWithIndexParam)) { $httpBody = $querySuggestionsIndexWithIndexParam; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation deleteConfig @@ -157,7 +140,6 @@ public function deleteConfig($indexName) $resourcePath = '/1/configs/{indexName}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -168,24 +150,7 @@ public function deleteConfig($indexName) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('DELETE', $resourcePath, $query, $httpBody); + return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); } /** * Operation getAllConfigs @@ -202,27 +167,9 @@ public function getAllConfigs() { $resourcePath = '/1/configs'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getConfig @@ -247,7 +194,6 @@ public function getConfig($indexName) $resourcePath = '/1/configs/{indexName}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -258,24 +204,7 @@ public function getConfig($indexName) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getConfigStatus @@ -300,7 +229,6 @@ public function getConfigStatus($indexName) $resourcePath = '/1/configs/{indexName}/status'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -311,24 +239,7 @@ public function getConfigStatus($indexName) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getLogFile @@ -353,7 +264,6 @@ public function getLogFile($indexName) $resourcePath = '/1/logs/{indexName}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -364,24 +274,7 @@ public function getLogFile($indexName) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation updateConfig @@ -413,7 +306,6 @@ public function updateConfig($indexName, $querySuggestionsIndexParam) $resourcePath = '/1/configs/{indexName}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -424,31 +316,17 @@ public function updateConfig($indexName, $querySuggestionsIndexParam) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($querySuggestionsIndexParam)) { $httpBody = $querySuggestionsIndexParam; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('PUT', $resourcePath, $query, $httpBody); + return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); } - private function sendRequest($method, $resourcePath, $query, $httpBody) + private function sendRequest($method, $resourcePath, $queryParams, $httpBody) { + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + if ($method === 'GET') { $request = $this->api->read( $method, diff --git a/clients/algoliasearch-client-php/lib/Api/RecommendApi.php b/clients/algoliasearch-client-php/lib/Api/RecommendApi.php index 8d595cfed1..03c62856e5 100644 --- a/clients/algoliasearch-client-php/lib/Api/RecommendApi.php +++ b/clients/algoliasearch-client-php/lib/Api/RecommendApi.php @@ -108,34 +108,19 @@ public function getRecommendations($getRecommendationsParams) $resourcePath = '/1/indexes/*/recommendations'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($getRecommendationsParams)) { $httpBody = $getRecommendationsParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } - private function sendRequest($method, $resourcePath, $query, $httpBody) + private function sendRequest($method, $resourcePath, $queryParams, $httpBody) { + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + if ($method === 'GET') { $request = $this->api->read( $method, diff --git a/clients/algoliasearch-client-php/lib/Api/SearchApi.php b/clients/algoliasearch-client-php/lib/Api/SearchApi.php index 26c4526328..e896c2b7e2 100644 --- a/clients/algoliasearch-client-php/lib/Api/SearchApi.php +++ b/clients/algoliasearch-client-php/lib/Api/SearchApi.php @@ -110,30 +110,13 @@ public function addApiKey($apiKey) $resourcePath = '/1/keys'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($apiKey)) { $httpBody = $apiKey; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation addOrUpdateObject @@ -172,7 +155,6 @@ public function addOrUpdateObject($indexName, $objectID, $body) $resourcePath = '/1/indexes/{indexName}/{objectID}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -191,27 +173,11 @@ public function addOrUpdateObject($indexName, $objectID, $body) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($body)) { $httpBody = $body; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('PUT', $resourcePath, $query, $httpBody); + return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); } /** * Operation appendSource @@ -236,30 +202,13 @@ public function appendSource($source) $resourcePath = '/1/security/sources/append'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($source)) { $httpBody = $source; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation assignUserId @@ -295,7 +244,6 @@ public function assignUserId($xAlgoliaUserID, $assignUserIdParams) $resourcePath = '/1/clusters/mapping'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($xAlgoliaUserID !== null) { @@ -308,27 +256,11 @@ public function assignUserId($xAlgoliaUserID, $assignUserIdParams) } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($assignUserIdParams)) { $httpBody = $assignUserIdParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation batch @@ -360,7 +292,6 @@ public function batch($indexName, $batchWriteParams) $resourcePath = '/1/indexes/{indexName}/batch'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -371,27 +302,11 @@ public function batch($indexName, $batchWriteParams) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($batchWriteParams)) { $httpBody = $batchWriteParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation batchAssignUserIds @@ -427,7 +342,6 @@ public function batchAssignUserIds($xAlgoliaUserID, $batchAssignUserIdsParams) $resourcePath = '/1/clusters/mapping/batch'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($xAlgoliaUserID !== null) { @@ -440,27 +354,11 @@ public function batchAssignUserIds($xAlgoliaUserID, $batchAssignUserIdsParams) } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($batchAssignUserIdsParams)) { $httpBody = $batchAssignUserIdsParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation batchDictionaryEntries @@ -492,7 +390,6 @@ public function batchDictionaryEntries($dictionaryName, $batchDictionaryEntriesP $resourcePath = '/1/dictionaries/{dictionaryName}/batch'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($dictionaryName !== null) { @@ -503,27 +400,11 @@ public function batchDictionaryEntries($dictionaryName, $batchDictionaryEntriesP ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($batchDictionaryEntriesParams)) { $httpBody = $batchDictionaryEntriesParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation batchRules @@ -557,7 +438,6 @@ public function batchRules($indexName, $rule, $forwardToReplicas = null, $clearE $resourcePath = '/1/indexes/{indexName}/rules/batch'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($forwardToReplicas !== null) { @@ -588,27 +468,11 @@ public function batchRules($indexName, $rule, $forwardToReplicas = null, $clearE ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($rule)) { $httpBody = $rule; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation browse @@ -634,7 +498,6 @@ public function browse($indexName, $browseRequest = null) $resourcePath = '/1/indexes/{indexName}/browse'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -645,27 +508,11 @@ public function browse($indexName, $browseRequest = null) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($browseRequest)) { $httpBody = $browseRequest; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation clearAllSynonyms @@ -691,7 +538,6 @@ public function clearAllSynonyms($indexName, $forwardToReplicas = null) $resourcePath = '/1/indexes/{indexName}/synonyms/clear'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($forwardToReplicas !== null) { @@ -712,24 +558,7 @@ public function clearAllSynonyms($indexName, $forwardToReplicas = null) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation clearObjects @@ -754,7 +583,6 @@ public function clearObjects($indexName) $resourcePath = '/1/indexes/{indexName}/clear'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -765,24 +593,7 @@ public function clearObjects($indexName) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation clearRules @@ -808,7 +619,6 @@ public function clearRules($indexName, $forwardToReplicas = null) $resourcePath = '/1/indexes/{indexName}/rules/clear'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($forwardToReplicas !== null) { @@ -829,24 +639,7 @@ public function clearRules($indexName, $forwardToReplicas = null) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation deleteApiKey @@ -871,7 +664,6 @@ public function deleteApiKey($key) $resourcePath = '/1/keys/{key}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($key !== null) { @@ -882,24 +674,7 @@ public function deleteApiKey($key) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('DELETE', $resourcePath, $query, $httpBody); + return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); } /** * Operation deleteBy @@ -931,7 +706,6 @@ public function deleteBy($indexName, $searchParams) $resourcePath = '/1/indexes/{indexName}/deleteByQuery'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -942,27 +716,11 @@ public function deleteBy($indexName, $searchParams) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($searchParams)) { $httpBody = $searchParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation deleteIndex @@ -987,7 +745,6 @@ public function deleteIndex($indexName) $resourcePath = '/1/indexes/{indexName}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -998,24 +755,7 @@ public function deleteIndex($indexName) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('DELETE', $resourcePath, $query, $httpBody); + return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); } /** * Operation deleteObject @@ -1047,7 +787,6 @@ public function deleteObject($indexName, $objectID) $resourcePath = '/1/indexes/{indexName}/{objectID}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -1066,24 +805,7 @@ public function deleteObject($indexName, $objectID) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('DELETE', $resourcePath, $query, $httpBody); + return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); } /** * Operation deleteRule @@ -1116,7 +838,6 @@ public function deleteRule($indexName, $objectID, $forwardToReplicas = null) $resourcePath = '/1/indexes/{indexName}/rules/{objectID}'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($forwardToReplicas !== null) { @@ -1145,24 +866,7 @@ public function deleteRule($indexName, $objectID, $forwardToReplicas = null) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('DELETE', $resourcePath, $query, $httpBody); + return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); } /** * Operation deleteSource @@ -1187,7 +891,6 @@ public function deleteSource($source) $resourcePath = '/1/security/sources/{source}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($source !== null) { @@ -1198,24 +901,7 @@ public function deleteSource($source) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('DELETE', $resourcePath, $query, $httpBody); + return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); } /** * Operation deleteSynonym @@ -1248,7 +934,6 @@ public function deleteSynonym($indexName, $objectID, $forwardToReplicas = null) $resourcePath = '/1/indexes/{indexName}/synonyms/{objectID}'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($forwardToReplicas !== null) { @@ -1277,24 +962,7 @@ public function deleteSynonym($indexName, $objectID, $forwardToReplicas = null) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('DELETE', $resourcePath, $query, $httpBody); + return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); } /** * Operation getApiKey @@ -1319,7 +987,6 @@ public function getApiKey($key) $resourcePath = '/1/keys/{key}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($key !== null) { @@ -1330,24 +997,7 @@ public function getApiKey($key) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getDictionaryLanguages @@ -1364,27 +1014,9 @@ public function getDictionaryLanguages() { $resourcePath = '/1/dictionaries/*/languages'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getDictionarySettings @@ -1401,27 +1033,9 @@ public function getDictionarySettings() { $resourcePath = '/1/dictionaries/*/settings'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getLogs @@ -1446,7 +1060,6 @@ public function getLogs($offset = 0, $length = 10, $indexName = 'null', $type = $resourcePath = '/1/logs'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($offset !== null) { @@ -1489,24 +1102,7 @@ public function getLogs($offset = 0, $length = 10, $indexName = 'null', $type = } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getObject @@ -1539,7 +1135,6 @@ public function getObject($indexName, $objectID, $attributesToRetrieve = null) $resourcePath = '/1/indexes/{indexName}/{objectID}'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($attributesToRetrieve !== null) { @@ -1568,24 +1163,7 @@ public function getObject($indexName, $objectID, $attributesToRetrieve = null) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getObjects @@ -1610,30 +1188,13 @@ public function getObjects($getObjectsParams) $resourcePath = '/1/indexes/*/objects'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($getObjectsParams)) { $httpBody = $getObjectsParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation getRule @@ -1665,7 +1226,6 @@ public function getRule($indexName, $objectID) $resourcePath = '/1/indexes/{indexName}/rules/{objectID}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -1684,24 +1244,7 @@ public function getRule($indexName, $objectID) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getSettings @@ -1726,7 +1269,6 @@ public function getSettings($indexName) $resourcePath = '/1/indexes/{indexName}/settings'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -1737,24 +1279,7 @@ public function getSettings($indexName) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getSources @@ -1771,27 +1296,9 @@ public function getSources() { $resourcePath = '/1/security/sources'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getSynonym @@ -1823,7 +1330,6 @@ public function getSynonym($indexName, $objectID) $resourcePath = '/1/indexes/{indexName}/synonyms/{objectID}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -1842,24 +1348,7 @@ public function getSynonym($indexName, $objectID) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getTask @@ -1891,7 +1380,6 @@ public function getTask($indexName, $taskID) $resourcePath = '/1/indexes/{indexName}/task/{taskID}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -1910,24 +1398,7 @@ public function getTask($indexName, $taskID) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getTopUserIds @@ -1944,27 +1415,9 @@ public function getTopUserIds() { $resourcePath = '/1/clusters/mapping/top'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation getUserId @@ -1992,7 +1445,6 @@ public function getUserId($userID) $resourcePath = '/1/clusters/mapping/{userID}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($userID !== null) { @@ -2003,24 +1455,7 @@ public function getUserId($userID) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation hasPendingMappings @@ -2038,7 +1473,6 @@ public function hasPendingMappings($getClusters = null) { $resourcePath = '/1/clusters/mapping/pending'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($getClusters !== null) { @@ -2051,24 +1485,7 @@ public function hasPendingMappings($getClusters = null) } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation listApiKeys @@ -2085,27 +1502,9 @@ public function listApiKeys() { $resourcePath = '/1/keys'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation listClusters @@ -2122,27 +1521,9 @@ public function listClusters() { $resourcePath = '/1/clusters'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation listIndices @@ -2160,7 +1541,6 @@ public function listIndices($page = null) { $resourcePath = '/1/indexes'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($page !== null) { @@ -2173,24 +1553,7 @@ public function listIndices($page = null) } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation listUserIds @@ -2209,7 +1572,6 @@ public function listUserIds($page = null, $hitsPerPage = 100) { $resourcePath = '/1/clusters/mapping'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($page !== null) { @@ -2232,24 +1594,7 @@ public function listUserIds($page = null, $hitsPerPage = 100) } } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody); } /** * Operation multipleBatch @@ -2274,30 +1619,13 @@ public function multipleBatch($batchParams) $resourcePath = '/1/indexes/*/batch'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($batchParams)) { $httpBody = $batchParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation multipleQueries @@ -2322,30 +1650,13 @@ public function multipleQueries($multipleQueriesParams) $resourcePath = '/1/indexes/*/queries'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($multipleQueriesParams)) { $httpBody = $multipleQueriesParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation operationIndex @@ -2377,7 +1688,6 @@ public function operationIndex($indexName, $operationIndexParams) $resourcePath = '/1/indexes/{indexName}/operation'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -2388,27 +1698,11 @@ public function operationIndex($indexName, $operationIndexParams) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($operationIndexParams)) { $httpBody = $operationIndexParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation partialUpdateObject @@ -2448,7 +1742,6 @@ public function partialUpdateObject($indexName, $objectID, $oneOfStringBuiltInOp $resourcePath = '/1/indexes/{indexName}/{objectID}/partial'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($createIfNotExists !== null) { @@ -2477,27 +1770,11 @@ public function partialUpdateObject($indexName, $objectID, $oneOfStringBuiltInOp ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($oneOfStringBuiltInOperation)) { $httpBody = $oneOfStringBuiltInOperation; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation removeUserId @@ -2525,7 +1802,6 @@ public function removeUserId($userID) $resourcePath = '/1/clusters/mapping/{userID}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($userID !== null) { @@ -2536,24 +1812,7 @@ public function removeUserId($userID) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('DELETE', $resourcePath, $query, $httpBody); + return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody); } /** * Operation replaceSources @@ -2578,30 +1837,13 @@ public function replaceSources($source) $resourcePath = '/1/security/sources'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($source)) { $httpBody = $source; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('PUT', $resourcePath, $query, $httpBody); + return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); } /** * Operation restoreApiKey @@ -2626,7 +1868,6 @@ public function restoreApiKey($key) $resourcePath = '/1/keys/{key}/restore'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($key !== null) { @@ -2637,24 +1878,7 @@ public function restoreApiKey($key) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation saveObject @@ -2686,7 +1910,6 @@ public function saveObject($indexName, $body) $resourcePath = '/1/indexes/{indexName}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -2697,27 +1920,11 @@ public function saveObject($indexName, $body) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($body)) { $httpBody = $body; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation saveRule @@ -2757,7 +1964,6 @@ public function saveRule($indexName, $objectID, $rule, $forwardToReplicas = null $resourcePath = '/1/indexes/{indexName}/rules/{objectID}'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($forwardToReplicas !== null) { @@ -2786,27 +1992,11 @@ public function saveRule($indexName, $objectID, $rule, $forwardToReplicas = null ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($rule)) { $httpBody = $rule; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('PUT', $resourcePath, $query, $httpBody); + return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); } /** * Operation saveSynonym @@ -2846,7 +2036,6 @@ public function saveSynonym($indexName, $objectID, $synonymHit, $forwardToReplic $resourcePath = '/1/indexes/{indexName}/synonyms/{objectID}'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($forwardToReplicas !== null) { @@ -2875,27 +2064,11 @@ public function saveSynonym($indexName, $objectID, $synonymHit, $forwardToReplic ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($synonymHit)) { $httpBody = $synonymHit; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('PUT', $resourcePath, $query, $httpBody); + return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); } /** * Operation saveSynonyms @@ -2929,7 +2102,6 @@ public function saveSynonyms($indexName, $synonymHit, $forwardToReplicas = null, $resourcePath = '/1/indexes/{indexName}/synonyms/batch'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($forwardToReplicas !== null) { @@ -2960,27 +2132,11 @@ public function saveSynonyms($indexName, $synonymHit, $forwardToReplicas = null, ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($synonymHit)) { $httpBody = $synonymHit; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation search @@ -3012,7 +2168,6 @@ public function search($indexName, $searchParams) $resourcePath = '/1/indexes/{indexName}/query'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -3023,27 +2178,11 @@ public function search($indexName, $searchParams) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($searchParams)) { $httpBody = $searchParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation searchDictionaryEntries @@ -3075,7 +2214,6 @@ public function searchDictionaryEntries($dictionaryName, $searchDictionaryEntrie $resourcePath = '/1/dictionaries/{dictionaryName}/search'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($dictionaryName !== null) { @@ -3086,27 +2224,11 @@ public function searchDictionaryEntries($dictionaryName, $searchDictionaryEntrie ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($searchDictionaryEntriesParams)) { $httpBody = $searchDictionaryEntriesParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation searchForFacetValues @@ -3139,7 +2261,6 @@ public function searchForFacetValues($indexName, $facetName, $searchForFacetValu $resourcePath = '/1/indexes/{indexName}/facets/{facetName}/query'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -3158,27 +2279,11 @@ public function searchForFacetValues($indexName, $facetName, $searchForFacetValu ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($searchForFacetValuesRequest)) { $httpBody = $searchForFacetValuesRequest; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation searchRules @@ -3210,7 +2315,6 @@ public function searchRules($indexName, $searchRulesParams) $resourcePath = '/1/indexes/{indexName}/rules/search'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($indexName !== null) { @@ -3221,27 +2325,11 @@ public function searchRules($indexName, $searchRulesParams) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($searchRulesParams)) { $httpBody = $searchRulesParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation searchSynonyms @@ -3270,7 +2358,6 @@ public function searchSynonyms($indexName, $query = '', $type = null, $page = 0, $resourcePath = '/1/indexes/{indexName}/synonyms/search'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($query !== null) { @@ -3321,24 +2408,7 @@ public function searchSynonyms($indexName, $query = '', $type = null, $page = 0, ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation searchUserIds @@ -3363,30 +2433,13 @@ public function searchUserIds($searchUserIdsParams) $resourcePath = '/1/clusters/mapping/search'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($searchUserIdsParams)) { $httpBody = $searchUserIdsParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody); } /** * Operation setDictionarySettings @@ -3411,30 +2464,13 @@ public function setDictionarySettings($dictionarySettingsParams) $resourcePath = '/1/dictionaries/*/settings'; $queryParams = []; - $headerParams = []; $httpBody = []; - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($dictionarySettingsParams)) { $httpBody = $dictionarySettingsParams; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('PUT', $resourcePath, $query, $httpBody); + return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); } /** * Operation setSettings @@ -3467,7 +2503,6 @@ public function setSettings($indexName, $indexSettings, $forwardToReplicas = nul $resourcePath = '/1/indexes/{indexName}/settings'; $queryParams = []; - $headerParams = []; $httpBody = []; if ($forwardToReplicas !== null) { @@ -3488,27 +2523,11 @@ public function setSettings($indexName, $indexSettings, $forwardToReplicas = nul ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($indexSettings)) { $httpBody = $indexSettings; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('PUT', $resourcePath, $query, $httpBody); + return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); } /** * Operation updateApiKey @@ -3540,7 +2559,6 @@ public function updateApiKey($key, $apiKey) $resourcePath = '/1/keys/{key}'; $queryParams = []; - $headerParams = []; $httpBody = []; // path params if ($key !== null) { @@ -3551,31 +2569,17 @@ public function updateApiKey($key, $apiKey) ); } - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; if (isset($apiKey)) { $httpBody = $apiKey; } - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - - return $this->sendRequest('PUT', $resourcePath, $query, $httpBody); + return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody); } - private function sendRequest($method, $resourcePath, $query, $httpBody) + private function sendRequest($method, $resourcePath, $queryParams, $httpBody) { + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + if ($method === 'GET') { $request = $this->api->read( $method, diff --git a/clients/algoliasearch-client-php/lib/Configuration/Configuration.php b/clients/algoliasearch-client-php/lib/Configuration/Configuration.php index 3ff4f0d094..44c1de0eb7 100644 --- a/clients/algoliasearch-client-php/lib/Configuration/Configuration.php +++ b/clients/algoliasearch-client-php/lib/Configuration/Configuration.php @@ -26,11 +26,11 @@ abstract class Configuration protected $accessToken = ''; /** - * User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default + * User agent of the HTTP request (by default it is autogenerated) * * @var string */ - protected $userAgent = 'OpenAPI-Generator/1.0.0/PHP'; + protected $userAgent = null; /** * Debug switch (default set to false) diff --git a/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php b/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php index f02eca5c7e..5f23b630b8 100644 --- a/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php +++ b/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php @@ -68,7 +68,9 @@ private function normalize($options) 'headers' => [ 'X-Algolia-Application-Id' => $this->config->getAppId(), 'X-Algolia-API-Key' => $this->config->getAlgoliaApiKey(), - 'User-Agent' => $this->config->getUserAgent() ? $this->config->getUserAgent() : UserAgent::get(), + 'User-Agent' => $this->config->getUserAgent() !== null ? + $this->config->getUserAgent() : + UserAgent::get(), 'Content-Type' => 'application/json', ], 'query' => [], diff --git a/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php b/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php index ce4d782241..e008c5e32b 100644 --- a/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php +++ b/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php @@ -28,11 +28,6 @@ final class ApiWrapper implements ApiWrapperInterface */ private $http; - /** - * @var Configuration - */ - private $config; - /** * @var \Algolia\AlgoliaSearch\RetryStrategy\ClusterHosts */ @@ -61,7 +56,6 @@ public function __construct( LoggerInterface $logger = null ) { $this->http = $http; - $this->config = $config; $this->clusterHosts = $clusterHosts; $this->requestOptionsFactory = $RqstOptsFactory ?: new RequestOptionsFactory($config); $this->logger = $logger ?: Algolia::getLogger(); diff --git a/templates/php/Configuration.mustache b/templates/php/Configuration.mustache index 2fa87b1468..d541a3f51e 100644 --- a/templates/php/Configuration.mustache +++ b/templates/php/Configuration.mustache @@ -26,11 +26,11 @@ abstract class Configuration protected $accessToken = ''; /** - * User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default + * User agent of the HTTP request (by default it is autogenerated) * * @var string */ - protected $userAgent = '{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}{{^artifactVersion}}1.0.0{{/artifactVersion}}/PHP{{/httpUserAgent}}'; + protected $userAgent = null; /** * Debug switch (default set to false) diff --git a/templates/php/api.mustache b/templates/php/api.mustache index 7784cc69df..eeb45f4bf4 100644 --- a/templates/php/api.mustache +++ b/templates/php/api.mustache @@ -219,7 +219,6 @@ use {{invokerPackage}}\RetryStrategy\ClusterHosts; $resourcePath = '{{{path}}}'; $queryParams = []; - $headerParams = []; $httpBody = []; {{#queryParams}} @@ -249,17 +248,6 @@ use {{invokerPackage}}\RetryStrategy\ClusterHosts; } {{/isExplode}} {{/queryParams}} - {{#headerParams}} - // header params - {{#collectionFormat}} - if (is_array(${{paramName}})) { - ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}'); - } - {{/collectionFormat}} - if (${{paramName}} !== null) { - $headerParams['{{baseName}}'] = ObjectSerializer::toHeaderValue(${{paramName}}); - } - {{/headerParams}} {{#pathParams}} // path params {{#collectionFormat}} @@ -276,47 +264,11 @@ use {{invokerPackage}}\RetryStrategy\ClusterHosts; } {{/pathParams}} - $headers = []; - $headers['Accept'] = 'application/json'; - $headers['Content-Type'] = 'application/json'; {{#bodyParams}} if (isset(${{paramName}})) { $httpBody = ${{paramName}}; } {{/bodyParams}} - {{#authMethods}} - {{#isBasic}} - {{#isBasicBasic}} - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - {{/isBasicBasic}} - {{#isBasicBearer}} - // this endpoint requires Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authentication (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - {{/isBasicBearer}} - {{/isBasic}} - {{#isOAuth}} - // this endpoint requires OAuth (access token) - if ($this->config->getAccessToken() !== null) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - {{/isOAuth}} - {{/authMethods}} - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); {{#servers.0}} $operationHosts = [{{#servers}}"{{{url}}}"{{^-last}}, {{/-last}}{{/servers}}]; @@ -326,14 +278,15 @@ use {{invokerPackage}}\RetryStrategy\ClusterHosts; $operationHost = $operationHosts[$this->hostIndex]; {{/servers.0}} - $query = \GuzzleHttp\Psr7\Query::build($queryParams); - return $this->sendRequest('{{httpMethod}}', $resourcePath, $query, $httpBody); + return $this->sendRequest('{{httpMethod}}', $resourcePath, $queryParams, $httpBody); } {{/operation}} - private function sendRequest($method, $resourcePath, $query, $httpBody) + private function sendRequest($method, $resourcePath, $queryParams, $httpBody) { + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + if($method == 'GET') { $request = $this->api->read( $method,