Skip to content

Commit 9e2cc89

Browse files
chore: generated code for commit 8727ddc. [skip ci]
Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 8727ddc commit 9e2cc89

File tree

9 files changed

+505
-325
lines changed

9 files changed

+505
-325
lines changed

clients/algoliasearch-client-javascript/packages/client-common/src/transporter/createTransporter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,13 @@ export function createTransporter({
240240
cacheable: baseRequestOptions?.cacheable,
241241
timeout: baseRequestOptions?.timeout,
242242
queryParameters: {
243-
...methodOptions.queryParameters,
244243
...baseRequestOptions?.queryParameters,
244+
...methodOptions.queryParameters,
245245
},
246246
headers: {
247247
Accept: 'application/json',
248-
...methodOptions.headers,
249248
...baseRequestOptions?.headers,
249+
...methodOptions.headers,
250250
},
251251
};
252252

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

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function getClientConfig()
109109
*
110110
* @see \Algolia\AlgoliaSearch\Model\Abtesting\AddABTestsRequest
111111
*
112-
* @param array $requestOptions Request Options
112+
* @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
113113
*
114114
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ABTestResponse
115115
*/
@@ -127,16 +127,17 @@ public function addABTests($addABTestsRequest, $requestOptions = [])
127127

128128
$resourcePath = '/2/abtests';
129129
$queryParameters = [];
130+
$headers = [];
130131
$httpBody = [];
131132

132133
if (isset($addABTestsRequest)) {
133134
$httpBody = $addABTestsRequest;
134135
}
135-
$requestOptions += $queryParameters;
136136

137137
return $this->sendRequest(
138138
'POST',
139139
$resourcePath,
140+
$headers,
140141
$queryParameters,
141142
$httpBody,
142143
$requestOptions
@@ -148,7 +149,7 @@ public function addABTests($addABTestsRequest, $requestOptions = [])
148149
*
149150
* @param string $path The path of the API endpoint to target, anything after the /1 needs to be specified. (required)
150151
* @param array $parameters Query parameters to be applied to the current query. (optional)
151-
* @param array $requestOptions Request Options
152+
* @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
152153
*
153154
* @return array<string, mixed>|object
154155
*/
@@ -163,6 +164,7 @@ public function del($path, $parameters = null, $requestOptions = [])
163164

164165
$resourcePath = '/1{path}';
165166
$queryParameters = [];
167+
$headers = [];
166168
$httpBody = [];
167169

168170
if ($parameters !== null) {
@@ -187,11 +189,10 @@ public function del($path, $parameters = null, $requestOptions = [])
187189
$resourcePath = str_replace('{path}', $path, $resourcePath);
188190
}
189191

190-
$requestOptions += $queryParameters;
191-
192192
return $this->sendRequest(
193193
'DELETE',
194194
$resourcePath,
195+
$headers,
195196
$queryParameters,
196197
$httpBody,
197198
$requestOptions
@@ -202,7 +203,7 @@ public function del($path, $parameters = null, $requestOptions = [])
202203
* Delete a test.
203204
*
204205
* @param int $id The A/B test ID. (required)
205-
* @param array $requestOptions Request Options
206+
* @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
206207
*
207208
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ABTestResponse
208209
*/
@@ -217,6 +218,7 @@ public function deleteABTest($id, $requestOptions = [])
217218

218219
$resourcePath = '/2/abtests/{id}';
219220
$queryParameters = [];
221+
$headers = [];
220222
$httpBody = [];
221223

222224
// path params
@@ -228,11 +230,10 @@ public function deleteABTest($id, $requestOptions = [])
228230
);
229231
}
230232

231-
$requestOptions += $queryParameters;
232-
233233
return $this->sendRequest(
234234
'DELETE',
235235
$resourcePath,
236+
$headers,
236237
$queryParameters,
237238
$httpBody,
238239
$requestOptions
@@ -244,7 +245,7 @@ public function deleteABTest($id, $requestOptions = [])
244245
*
245246
* @param string $path The path of the API endpoint to target, anything after the /1 needs to be specified. (required)
246247
* @param array $parameters Query parameters to be applied to the current query. (optional)
247-
* @param array $requestOptions Request Options
248+
* @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
248249
*
249250
* @return array<string, mixed>|object
250251
*/
@@ -259,6 +260,7 @@ public function get($path, $parameters = null, $requestOptions = [])
259260

260261
$resourcePath = '/1{path}';
261262
$queryParameters = [];
263+
$headers = [];
262264
$httpBody = [];
263265

264266
if ($parameters !== null) {
@@ -283,11 +285,10 @@ public function get($path, $parameters = null, $requestOptions = [])
283285
$resourcePath = str_replace('{path}', $path, $resourcePath);
284286
}
285287

286-
$requestOptions += $queryParameters;
287-
288288
return $this->sendRequest(
289289
'GET',
290290
$resourcePath,
291+
$headers,
291292
$queryParameters,
292293
$httpBody,
293294
$requestOptions
@@ -298,7 +299,7 @@ public function get($path, $parameters = null, $requestOptions = [])
298299
* Get a test.
299300
*
300301
* @param int $id The A/B test ID. (required)
301-
* @param array $requestOptions Request Options
302+
* @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
302303
*
303304
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ABTest
304305
*/
@@ -313,6 +314,7 @@ public function getABTest($id, $requestOptions = [])
313314

314315
$resourcePath = '/2/abtests/{id}';
315316
$queryParameters = [];
317+
$headers = [];
316318
$httpBody = [];
317319

318320
// path params
@@ -324,11 +326,10 @@ public function getABTest($id, $requestOptions = [])
324326
);
325327
}
326328

327-
$requestOptions += $queryParameters;
328-
329329
return $this->sendRequest(
330330
'GET',
331331
$resourcePath,
332+
$headers,
332333
$queryParameters,
333334
$httpBody,
334335
$requestOptions
@@ -340,7 +341,7 @@ public function getABTest($id, $requestOptions = [])
340341
*
341342
* @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0)
342343
* @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10)
343-
* @param array $requestOptions Request Options
344+
* @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
344345
*
345346
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ListABTestsResponse
346347
*/
@@ -351,6 +352,7 @@ public function listABTests(
351352
) {
352353
$resourcePath = '/2/abtests';
353354
$queryParameters = [];
355+
$headers = [];
354356
$httpBody = [];
355357

356358
if ($offset !== null) {
@@ -387,11 +389,10 @@ public function listABTests(
387389
}
388390
}
389391

390-
$requestOptions += $queryParameters;
391-
392392
return $this->sendRequest(
393393
'GET',
394394
$resourcePath,
395+
$headers,
395396
$queryParameters,
396397
$httpBody,
397398
$requestOptions
@@ -404,7 +405,7 @@ public function listABTests(
404405
* @param string $path The path of the API endpoint to target, anything after the /1 needs to be specified. (required)
405406
* @param array $parameters Query parameters to be applied to the current query. (optional)
406407
* @param array $body The parameters to send with the custom request. (optional)
407-
* @param array $requestOptions Request Options
408+
* @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
408409
*
409410
* @return array<string, mixed>|object
410411
*/
@@ -423,6 +424,7 @@ public function post(
423424

424425
$resourcePath = '/1{path}';
425426
$queryParameters = [];
427+
$headers = [];
426428
$httpBody = [];
427429

428430
if ($parameters !== null) {
@@ -450,11 +452,11 @@ public function post(
450452
if (isset($body)) {
451453
$httpBody = $body;
452454
}
453-
$requestOptions += $queryParameters;
454455

455456
return $this->sendRequest(
456457
'POST',
457458
$resourcePath,
459+
$headers,
458460
$queryParameters,
459461
$httpBody,
460462
$requestOptions
@@ -467,7 +469,7 @@ public function post(
467469
* @param string $path The path of the API endpoint to target, anything after the /1 needs to be specified. (required)
468470
* @param array $parameters Query parameters to be applied to the current query. (optional)
469471
* @param array $body The parameters to send with the custom request. (optional)
470-
* @param array $requestOptions Request Options
472+
* @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
471473
*
472474
* @return array<string, mixed>|object
473475
*/
@@ -486,6 +488,7 @@ public function put(
486488

487489
$resourcePath = '/1{path}';
488490
$queryParameters = [];
491+
$headers = [];
489492
$httpBody = [];
490493

491494
if ($parameters !== null) {
@@ -513,11 +516,11 @@ public function put(
513516
if (isset($body)) {
514517
$httpBody = $body;
515518
}
516-
$requestOptions += $queryParameters;
517519

518520
return $this->sendRequest(
519521
'PUT',
520522
$resourcePath,
523+
$headers,
521524
$queryParameters,
522525
$httpBody,
523526
$requestOptions
@@ -528,7 +531,7 @@ public function put(
528531
* Stop a test.
529532
*
530533
* @param int $id The A/B test ID. (required)
531-
* @param array $requestOptions Request Options
534+
* @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
532535
*
533536
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ABTestResponse
534537
*/
@@ -543,6 +546,7 @@ public function stopABTest($id, $requestOptions = [])
543546

544547
$resourcePath = '/2/abtests/{id}/stop';
545548
$queryParameters = [];
549+
$headers = [];
546550
$httpBody = [];
547551

548552
// path params
@@ -554,11 +558,10 @@ public function stopABTest($id, $requestOptions = [])
554558
);
555559
}
556560

557-
$requestOptions += $queryParameters;
558-
559561
return $this->sendRequest(
560562
'POST',
561563
$resourcePath,
564+
$headers,
562565
$queryParameters,
563566
$httpBody,
564567
$requestOptions
@@ -568,11 +571,30 @@ public function stopABTest($id, $requestOptions = [])
568571
private function sendRequest(
569572
$method,
570573
$resourcePath,
574+
$headers,
571575
$queryParameters,
572576
$httpBody,
573577
$requestOptions
574578
) {
575-
$query = \GuzzleHttp\Psr7\Query::build($queryParameters);
579+
if (!isset($requestOptions['headers'])) {
580+
$requestOptions['headers'] = [];
581+
}
582+
if (!isset($requestOptions['queryParameters'])) {
583+
$requestOptions['queryParameters'] = [];
584+
}
585+
586+
$requestOptions['headers'] = array_merge(
587+
$headers,
588+
$requestOptions['headers']
589+
);
590+
$requestOptions['queryParameters'] = array_merge(
591+
$queryParameters,
592+
$requestOptions['queryParameters']
593+
);
594+
595+
$query = \GuzzleHttp\Psr7\Query::build(
596+
$requestOptions['queryParameters']
597+
);
576598

577599
if ($method === 'GET') {
578600
$request = $this->api->read(

0 commit comments

Comments
 (0)