@@ -109,7 +109,7 @@ public function getClientConfig()
109
109
*
110
110
* @see \Algolia\AlgoliaSearch\Model\Abtesting\AddABTestsRequest
111
111
*
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
113
113
*
114
114
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ABTestResponse
115
115
*/
@@ -127,16 +127,17 @@ public function addABTests($addABTestsRequest, $requestOptions = [])
127
127
128
128
$ resourcePath = '/2/abtests ' ;
129
129
$ queryParameters = [];
130
+ $ headers = [];
130
131
$ httpBody = [];
131
132
132
133
if (isset ($ addABTestsRequest )) {
133
134
$ httpBody = $ addABTestsRequest ;
134
135
}
135
- $ requestOptions += $ queryParameters ;
136
136
137
137
return $ this ->sendRequest (
138
138
'POST ' ,
139
139
$ resourcePath ,
140
+ $ headers ,
140
141
$ queryParameters ,
141
142
$ httpBody ,
142
143
$ requestOptions
@@ -148,7 +149,7 @@ public function addABTests($addABTestsRequest, $requestOptions = [])
148
149
*
149
150
* @param string $path The path of the API endpoint to target, anything after the /1 needs to be specified. (required)
150
151
* @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
152
153
*
153
154
* @return array<string, mixed>|object
154
155
*/
@@ -163,6 +164,7 @@ public function del($path, $parameters = null, $requestOptions = [])
163
164
164
165
$ resourcePath = '/1{path} ' ;
165
166
$ queryParameters = [];
167
+ $ headers = [];
166
168
$ httpBody = [];
167
169
168
170
if ($ parameters !== null ) {
@@ -187,11 +189,10 @@ public function del($path, $parameters = null, $requestOptions = [])
187
189
$ resourcePath = str_replace ('{path} ' , $ path , $ resourcePath );
188
190
}
189
191
190
- $ requestOptions += $ queryParameters ;
191
-
192
192
return $ this ->sendRequest (
193
193
'DELETE ' ,
194
194
$ resourcePath ,
195
+ $ headers ,
195
196
$ queryParameters ,
196
197
$ httpBody ,
197
198
$ requestOptions
@@ -202,7 +203,7 @@ public function del($path, $parameters = null, $requestOptions = [])
202
203
* Delete a test.
203
204
*
204
205
* @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
206
207
*
207
208
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ABTestResponse
208
209
*/
@@ -217,6 +218,7 @@ public function deleteABTest($id, $requestOptions = [])
217
218
218
219
$ resourcePath = '/2/abtests/{id} ' ;
219
220
$ queryParameters = [];
221
+ $ headers = [];
220
222
$ httpBody = [];
221
223
222
224
// path params
@@ -228,11 +230,10 @@ public function deleteABTest($id, $requestOptions = [])
228
230
);
229
231
}
230
232
231
- $ requestOptions += $ queryParameters ;
232
-
233
233
return $ this ->sendRequest (
234
234
'DELETE ' ,
235
235
$ resourcePath ,
236
+ $ headers ,
236
237
$ queryParameters ,
237
238
$ httpBody ,
238
239
$ requestOptions
@@ -244,7 +245,7 @@ public function deleteABTest($id, $requestOptions = [])
244
245
*
245
246
* @param string $path The path of the API endpoint to target, anything after the /1 needs to be specified. (required)
246
247
* @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
248
249
*
249
250
* @return array<string, mixed>|object
250
251
*/
@@ -259,6 +260,7 @@ public function get($path, $parameters = null, $requestOptions = [])
259
260
260
261
$ resourcePath = '/1{path} ' ;
261
262
$ queryParameters = [];
263
+ $ headers = [];
262
264
$ httpBody = [];
263
265
264
266
if ($ parameters !== null ) {
@@ -283,11 +285,10 @@ public function get($path, $parameters = null, $requestOptions = [])
283
285
$ resourcePath = str_replace ('{path} ' , $ path , $ resourcePath );
284
286
}
285
287
286
- $ requestOptions += $ queryParameters ;
287
-
288
288
return $ this ->sendRequest (
289
289
'GET ' ,
290
290
$ resourcePath ,
291
+ $ headers ,
291
292
$ queryParameters ,
292
293
$ httpBody ,
293
294
$ requestOptions
@@ -298,7 +299,7 @@ public function get($path, $parameters = null, $requestOptions = [])
298
299
* Get a test.
299
300
*
300
301
* @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
302
303
*
303
304
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ABTest
304
305
*/
@@ -313,6 +314,7 @@ public function getABTest($id, $requestOptions = [])
313
314
314
315
$ resourcePath = '/2/abtests/{id} ' ;
315
316
$ queryParameters = [];
317
+ $ headers = [];
316
318
$ httpBody = [];
317
319
318
320
// path params
@@ -324,11 +326,10 @@ public function getABTest($id, $requestOptions = [])
324
326
);
325
327
}
326
328
327
- $ requestOptions += $ queryParameters ;
328
-
329
329
return $ this ->sendRequest (
330
330
'GET ' ,
331
331
$ resourcePath ,
332
+ $ headers ,
332
333
$ queryParameters ,
333
334
$ httpBody ,
334
335
$ requestOptions
@@ -340,7 +341,7 @@ public function getABTest($id, $requestOptions = [])
340
341
*
341
342
* @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0)
342
343
* @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
344
345
*
345
346
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ListABTestsResponse
346
347
*/
@@ -351,6 +352,7 @@ public function listABTests(
351
352
) {
352
353
$ resourcePath = '/2/abtests ' ;
353
354
$ queryParameters = [];
355
+ $ headers = [];
354
356
$ httpBody = [];
355
357
356
358
if ($ offset !== null ) {
@@ -387,11 +389,10 @@ public function listABTests(
387
389
}
388
390
}
389
391
390
- $ requestOptions += $ queryParameters ;
391
-
392
392
return $ this ->sendRequest (
393
393
'GET ' ,
394
394
$ resourcePath ,
395
+ $ headers ,
395
396
$ queryParameters ,
396
397
$ httpBody ,
397
398
$ requestOptions
@@ -404,7 +405,7 @@ public function listABTests(
404
405
* @param string $path The path of the API endpoint to target, anything after the /1 needs to be specified. (required)
405
406
* @param array $parameters Query parameters to be applied to the current query. (optional)
406
407
* @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
408
409
*
409
410
* @return array<string, mixed>|object
410
411
*/
@@ -423,6 +424,7 @@ public function post(
423
424
424
425
$ resourcePath = '/1{path} ' ;
425
426
$ queryParameters = [];
427
+ $ headers = [];
426
428
$ httpBody = [];
427
429
428
430
if ($ parameters !== null ) {
@@ -450,11 +452,11 @@ public function post(
450
452
if (isset ($ body )) {
451
453
$ httpBody = $ body ;
452
454
}
453
- $ requestOptions += $ queryParameters ;
454
455
455
456
return $ this ->sendRequest (
456
457
'POST ' ,
457
458
$ resourcePath ,
459
+ $ headers ,
458
460
$ queryParameters ,
459
461
$ httpBody ,
460
462
$ requestOptions
@@ -467,7 +469,7 @@ public function post(
467
469
* @param string $path The path of the API endpoint to target, anything after the /1 needs to be specified. (required)
468
470
* @param array $parameters Query parameters to be applied to the current query. (optional)
469
471
* @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
471
473
*
472
474
* @return array<string, mixed>|object
473
475
*/
@@ -486,6 +488,7 @@ public function put(
486
488
487
489
$ resourcePath = '/1{path} ' ;
488
490
$ queryParameters = [];
491
+ $ headers = [];
489
492
$ httpBody = [];
490
493
491
494
if ($ parameters !== null ) {
@@ -513,11 +516,11 @@ public function put(
513
516
if (isset ($ body )) {
514
517
$ httpBody = $ body ;
515
518
}
516
- $ requestOptions += $ queryParameters ;
517
519
518
520
return $ this ->sendRequest (
519
521
'PUT ' ,
520
522
$ resourcePath ,
523
+ $ headers ,
521
524
$ queryParameters ,
522
525
$ httpBody ,
523
526
$ requestOptions
@@ -528,7 +531,7 @@ public function put(
528
531
* Stop a test.
529
532
*
530
533
* @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
532
535
*
533
536
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ABTestResponse
534
537
*/
@@ -543,6 +546,7 @@ public function stopABTest($id, $requestOptions = [])
543
546
544
547
$ resourcePath = '/2/abtests/{id}/stop ' ;
545
548
$ queryParameters = [];
549
+ $ headers = [];
546
550
$ httpBody = [];
547
551
548
552
// path params
@@ -554,11 +558,10 @@ public function stopABTest($id, $requestOptions = [])
554
558
);
555
559
}
556
560
557
- $ requestOptions += $ queryParameters ;
558
-
559
561
return $ this ->sendRequest (
560
562
'POST ' ,
561
563
$ resourcePath ,
564
+ $ headers ,
562
565
$ queryParameters ,
563
566
$ httpBody ,
564
567
$ requestOptions
@@ -568,11 +571,30 @@ public function stopABTest($id, $requestOptions = [])
568
571
private function sendRequest (
569
572
$ method ,
570
573
$ resourcePath ,
574
+ $ headers ,
571
575
$ queryParameters ,
572
576
$ httpBody ,
573
577
$ requestOptions
574
578
) {
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
+ );
576
598
577
599
if ($ method === 'GET ' ) {
578
600
$ request = $ this ->api ->read (
0 commit comments