@@ -129,6 +129,16 @@ export function createAnalyticsClient({
129
129
transporter . algoliaAgent . add ( { segment, version } ) ;
130
130
} ,
131
131
132
+ /**
133
+ * Helper method to switch the API key used to authenticate the requests.
134
+ *
135
+ * @param params - Method params.
136
+ * @param params.apiKey - The new API Key to use.
137
+ */
138
+ setClientApiKey ( { apiKey } : { apiKey : string } ) : void {
139
+ transporter . baseHeaders [ 'x-algolia-api-key' ] = apiKey ;
140
+ } ,
141
+
132
142
/**
133
143
* This method allow you to send requests to the Algolia REST API.
134
144
*
@@ -277,7 +287,6 @@ export function createAnalyticsClient({
277
287
if ( index !== undefined ) {
278
288
queryParameters . index = index . toString ( ) ;
279
289
}
280
-
281
290
if ( startDate !== undefined ) {
282
291
queryParameters . startDate = startDate . toString ( ) ;
283
292
}
@@ -325,12 +334,14 @@ export function createAnalyticsClient({
325
334
if ( index !== undefined ) {
326
335
queryParameters . index = index . toString ( ) ;
327
336
}
337
+
328
338
if ( startDate !== undefined ) {
329
339
queryParameters . startDate = startDate . toString ( ) ;
330
340
}
331
341
if ( endDate !== undefined ) {
332
342
queryParameters . endDate = endDate . toString ( ) ;
333
343
}
344
+
334
345
if ( tags !== undefined ) {
335
346
queryParameters . tags = tags . toString ( ) ;
336
347
}
@@ -419,6 +430,7 @@ export function createAnalyticsClient({
419
430
if ( index !== undefined ) {
420
431
queryParameters . index = index . toString ( ) ;
421
432
}
433
+
422
434
if ( startDate !== undefined ) {
423
435
queryParameters . startDate = startDate . toString ( ) ;
424
436
}
@@ -466,7 +478,6 @@ export function createAnalyticsClient({
466
478
if ( index !== undefined ) {
467
479
queryParameters . index = index . toString ( ) ;
468
480
}
469
-
470
481
if ( startDate !== undefined ) {
471
482
queryParameters . startDate = startDate . toString ( ) ;
472
483
}
@@ -517,10 +528,10 @@ export function createAnalyticsClient({
517
528
if ( startDate !== undefined ) {
518
529
queryParameters . startDate = startDate . toString ( ) ;
519
530
}
520
-
521
531
if ( endDate !== undefined ) {
522
532
queryParameters . endDate = endDate . toString ( ) ;
523
533
}
534
+
524
535
if ( tags !== undefined ) {
525
536
queryParameters . tags = tags . toString ( ) ;
526
537
}
@@ -562,14 +573,12 @@ export function createAnalyticsClient({
562
573
if ( index !== undefined ) {
563
574
queryParameters . index = index . toString ( ) ;
564
575
}
565
-
566
576
if ( startDate !== undefined ) {
567
577
queryParameters . startDate = startDate . toString ( ) ;
568
578
}
569
579
if ( endDate !== undefined ) {
570
580
queryParameters . endDate = endDate . toString ( ) ;
571
581
}
572
-
573
582
if ( tags !== undefined ) {
574
583
queryParameters . tags = tags . toString ( ) ;
575
584
}
@@ -608,10 +617,10 @@ export function createAnalyticsClient({
608
617
const requestPath = '/2/conversions/purchaseRate' ;
609
618
const headers : Headers = { } ;
610
619
const queryParameters : QueryParameters = { } ;
611
-
612
620
if ( index !== undefined ) {
613
621
queryParameters . index = index . toString ( ) ;
614
622
}
623
+
615
624
if ( startDate !== undefined ) {
616
625
queryParameters . startDate = startDate . toString ( ) ;
617
626
}
@@ -659,10 +668,10 @@ export function createAnalyticsClient({
659
668
if ( index !== undefined ) {
660
669
queryParameters . index = index . toString ( ) ;
661
670
}
662
-
663
671
if ( startDate !== undefined ) {
664
672
queryParameters . startDate = startDate . toString ( ) ;
665
673
}
674
+
666
675
if ( endDate !== undefined ) {
667
676
queryParameters . endDate = endDate . toString ( ) ;
668
677
}
@@ -711,10 +720,10 @@ export function createAnalyticsClient({
711
720
if ( startDate !== undefined ) {
712
721
queryParameters . startDate = startDate . toString ( ) ;
713
722
}
714
-
715
723
if ( endDate !== undefined ) {
716
724
queryParameters . endDate = endDate . toString ( ) ;
717
725
}
726
+
718
727
if ( tags !== undefined ) {
719
728
queryParameters . tags = tags . toString ( ) ;
720
729
}
@@ -755,6 +764,7 @@ export function createAnalyticsClient({
755
764
const requestPath = '/2/searches/noClicks' ;
756
765
const headers : Headers = { } ;
757
766
const queryParameters : QueryParameters = { } ;
767
+
758
768
if ( index !== undefined ) {
759
769
queryParameters . index = index . toString ( ) ;
760
770
}
@@ -767,7 +777,6 @@ export function createAnalyticsClient({
767
777
if ( limit !== undefined ) {
768
778
queryParameters . limit = limit . toString ( ) ;
769
779
}
770
-
771
780
if ( offset !== undefined ) {
772
781
queryParameters . offset = offset . toString ( ) ;
773
782
}
@@ -814,7 +823,6 @@ export function createAnalyticsClient({
814
823
if ( index !== undefined ) {
815
824
queryParameters . index = index . toString ( ) ;
816
825
}
817
-
818
826
if ( startDate !== undefined ) {
819
827
queryParameters . startDate = startDate . toString ( ) ;
820
828
}
@@ -900,6 +908,7 @@ export function createAnalyticsClient({
900
908
const requestPath = '/2/countries' ;
901
909
const headers : Headers = { } ;
902
910
const queryParameters : QueryParameters = { } ;
911
+
903
912
if ( index !== undefined ) {
904
913
queryParameters . index = index . toString ( ) ;
905
914
}
@@ -912,7 +921,6 @@ export function createAnalyticsClient({
912
921
if ( limit !== undefined ) {
913
922
queryParameters . limit = limit . toString ( ) ;
914
923
}
915
-
916
924
if ( offset !== undefined ) {
917
925
queryParameters . offset = offset . toString ( ) ;
918
926
}
@@ -957,10 +965,10 @@ export function createAnalyticsClient({
957
965
const requestPath = '/2/filters' ;
958
966
const headers : Headers = { } ;
959
967
const queryParameters : QueryParameters = { } ;
960
-
961
968
if ( index !== undefined ) {
962
969
queryParameters . index = index . toString ( ) ;
963
970
}
971
+
964
972
if ( search !== undefined ) {
965
973
queryParameters . search = search . toString ( ) ;
966
974
}
@@ -1042,6 +1050,7 @@ export function createAnalyticsClient({
1042
1050
if ( offset !== undefined ) {
1043
1051
queryParameters . offset = offset . toString ( ) ;
1044
1052
}
1053
+
1045
1054
if ( tags !== undefined ) {
1046
1055
queryParameters . tags = tags . toString ( ) ;
1047
1056
}
0 commit comments