Skip to content

Commit f387277

Browse files
algolia-botmillotp
andcommitted
chore: generated code for commit 39ab5e8. [skip ci]
Co-authored-by: Pierre Millot <[email protected]>
1 parent 39ab5e8 commit f387277

File tree

200 files changed

+8287
-5024
lines changed

Some content is hidden

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

200 files changed

+8287
-5024
lines changed

clients/algoliasearch-client-php/lib/Api/AbtestingClient.php

Lines changed: 88 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
namespace Algolia\AlgoliaSearch\Api;
44

5+
use GuzzleHttp\Exception\RequestException;
6+
use GuzzleHttp\Exception\ConnectException;
7+
use GuzzleHttp\Psr7\MultipartStream;
8+
use GuzzleHttp\RequestOptions;
9+
use GuzzleHttp\Utils;
510
use Algolia\AlgoliaSearch\Algolia;
11+
use Algolia\AlgoliaSearch\ApiException;
612
use Algolia\AlgoliaSearch\Configuration\AbtestingConfig;
713
use Algolia\AlgoliaSearch\ObjectSerializer;
814
use Algolia\AlgoliaSearch\RetryStrategy\ApiWrapper;
@@ -31,8 +37,10 @@ class AbtestingClient
3137
* @param AbtestingConfig $config
3238
* @param ApiWrapperInterface $apiWrapper
3339
*/
34-
public function __construct(ApiWrapperInterface $apiWrapper, AbtestingConfig $config)
35-
{
40+
public function __construct(
41+
ApiWrapperInterface $apiWrapper,
42+
AbtestingConfig $config
43+
) {
3644
$this->config = $config;
3745

3846
$this->api = $apiWrapper;
@@ -48,7 +56,12 @@ public function __construct(ApiWrapperInterface $apiWrapper, AbtestingConfig $co
4856
public static function create($appId = null, $apiKey = null, $region = null)
4957
{
5058
$allowedRegions = explode('-', 'us-de');
51-
$config = AbtestingConfig::create($appId, $apiKey, $region, $allowedRegions);
59+
$config = AbtestingConfig::create(
60+
$appId,
61+
$apiKey,
62+
$region,
63+
$allowedRegions
64+
);
5265

5366
return static::createWithConfig($config);
5467
}
@@ -66,7 +79,9 @@ public static function createWithConfig(AbtestingConfig $config)
6679
// If a list of hosts was passed, we ignore the cache
6780
$clusterHosts = ClusterHosts::create($hosts);
6881
} else {
69-
$clusterHosts = ClusterHosts::create('analytics.'.$config->getRegion().'.algolia.com');
82+
$clusterHosts = ClusterHosts::create(
83+
'analytics.' . $config->getRegion() . '.algolia.com'
84+
);
7085
}
7186

7287
$apiWrapper = new ApiWrapper(
@@ -93,15 +108,17 @@ public function getClientConfig()
93108
* - $addABTestsRequest['name'] => (string) A/B test name. (required)
94109
* - $addABTestsRequest['variant'] => (array) List of 2 variants for the A/B test. (required)
95110
* - $addABTestsRequest['endAt'] => (string) End date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ. (required)
96-
*
97111
* @see \Algolia\AlgoliaSearch\Model\Abtesting\AddABTestsRequest
98112
*
99113
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ABTestResponse
100114
*/
101115
public function addABTests($addABTestsRequest)
102116
{
103117
// verify the required parameter 'addABTestsRequest' is set
104-
if ($addABTestsRequest === null || (is_array($addABTestsRequest) && count($addABTestsRequest) === 0)) {
118+
if (
119+
$addABTestsRequest === null ||
120+
(is_array($addABTestsRequest) && count($addABTestsRequest) === 0)
121+
) {
105122
throw new \InvalidArgumentException(
106123
'Missing the required parameter $addABTestsRequest when calling addABTests'
107124
);
@@ -115,7 +132,12 @@ public function addABTests($addABTestsRequest)
115132
$httpBody = $addABTestsRequest;
116133
}
117134

118-
return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody);
135+
return $this->sendRequest(
136+
'POST',
137+
$resourcePath,
138+
$queryParams,
139+
$httpBody
140+
);
119141
}
120142

121143
/**
@@ -151,14 +173,15 @@ public function del($path, $parameters = null)
151173

152174
// path params
153175
if ($path !== null) {
154-
$resourcePath = str_replace(
155-
'{path}',
156-
$path,
157-
$resourcePath
158-
);
176+
$resourcePath = str_replace('{path}', $path, $resourcePath);
159177
}
160178

161-
return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody);
179+
return $this->sendRequest(
180+
'DELETE',
181+
$resourcePath,
182+
$queryParams,
183+
$httpBody
184+
);
162185
}
163186

164187
/**
@@ -190,7 +213,12 @@ public function deleteABTest($id)
190213
);
191214
}
192215

193-
return $this->sendRequest('DELETE', $resourcePath, $queryParams, $httpBody);
216+
return $this->sendRequest(
217+
'DELETE',
218+
$resourcePath,
219+
$queryParams,
220+
$httpBody
221+
);
194222
}
195223

196224
/**
@@ -226,14 +254,15 @@ public function get($path, $parameters = null)
226254

227255
// path params
228256
if ($path !== null) {
229-
$resourcePath = str_replace(
230-
'{path}',
231-
$path,
232-
$resourcePath
233-
);
257+
$resourcePath = str_replace('{path}', $path, $resourcePath);
234258
}
235259

236-
return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody);
260+
return $this->sendRequest(
261+
'GET',
262+
$resourcePath,
263+
$queryParams,
264+
$httpBody
265+
);
237266
}
238267

239268
/**
@@ -265,7 +294,12 @@ public function getABTest($id)
265294
);
266295
}
267296

268-
return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody);
297+
return $this->sendRequest(
298+
'GET',
299+
$resourcePath,
300+
$queryParams,
301+
$httpBody
302+
);
269303
}
270304

271305
/**
@@ -302,7 +336,12 @@ public function listABTests($offset = 0, $limit = 10)
302336
}
303337
}
304338

305-
return $this->sendRequest('GET', $resourcePath, $queryParams, $httpBody);
339+
return $this->sendRequest(
340+
'GET',
341+
$resourcePath,
342+
$queryParams,
343+
$httpBody
344+
);
306345
}
307346

308347
/**
@@ -339,18 +378,19 @@ public function post($path, $parameters = null, $body = null)
339378

340379
// path params
341380
if ($path !== null) {
342-
$resourcePath = str_replace(
343-
'{path}',
344-
$path,
345-
$resourcePath
346-
);
381+
$resourcePath = str_replace('{path}', $path, $resourcePath);
347382
}
348383

349384
if (isset($body)) {
350385
$httpBody = $body;
351386
}
352387

353-
return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody);
388+
return $this->sendRequest(
389+
'POST',
390+
$resourcePath,
391+
$queryParams,
392+
$httpBody
393+
);
354394
}
355395

356396
/**
@@ -387,18 +427,19 @@ public function put($path, $parameters = null, $body = null)
387427

388428
// path params
389429
if ($path !== null) {
390-
$resourcePath = str_replace(
391-
'{path}',
392-
$path,
393-
$resourcePath
394-
);
430+
$resourcePath = str_replace('{path}', $path, $resourcePath);
395431
}
396432

397433
if (isset($body)) {
398434
$httpBody = $body;
399435
}
400436

401-
return $this->sendRequest('PUT', $resourcePath, $queryParams, $httpBody);
437+
return $this->sendRequest(
438+
'PUT',
439+
$resourcePath,
440+
$queryParams,
441+
$httpBody
442+
);
402443
}
403444

404445
/**
@@ -430,14 +471,23 @@ public function stopABTest($id)
430471
);
431472
}
432473

433-
return $this->sendRequest('POST', $resourcePath, $queryParams, $httpBody);
474+
return $this->sendRequest(
475+
'POST',
476+
$resourcePath,
477+
$queryParams,
478+
$httpBody
479+
);
434480
}
435481

436-
private function sendRequest($method, $resourcePath, $queryParams, $httpBody)
437-
{
482+
private function sendRequest(
483+
$method,
484+
$resourcePath,
485+
$queryParams,
486+
$httpBody
487+
) {
438488
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
439489

440-
if ($method === 'GET') {
490+
if ($method == 'GET') {
441491
$request = $this->api->read(
442492
$method,
443493
$resourcePath . ($query ? "?{$query}" : '')

0 commit comments

Comments
 (0)