@algolia/client-search 5.53.0 → 5.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,7 @@ __export(searchClient_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(searchClient_exports);
27
27
  var import_client_common = require("@algolia/client-common");
28
- var apiClientVersion = "5.53.0";
28
+ var apiClientVersion = "5.54.0";
29
29
  function getDefaultHosts(appId) {
30
30
  return [
31
31
  {
@@ -572,12 +572,8 @@ function createSearchClient({
572
572
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
573
573
  */
574
574
  addApiKey(apiKey, requestOptions) {
575
- if (!apiKey) {
576
- throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");
577
- }
578
- if (!apiKey.acl) {
579
- throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");
580
- }
575
+ (0, import_client_common.validateRequired)("apiKey", "addApiKey", apiKey);
576
+ (0, import_client_common.validateRequired)("apiKey.acl", "addApiKey", apiKey.acl);
581
577
  const requestPath = "/1/keys";
582
578
  const headers = {};
583
579
  const queryParameters = {};
@@ -602,15 +598,9 @@ function createSearchClient({
602
598
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
603
599
  */
604
600
  addOrUpdateObject({ indexName, objectID, body }, requestOptions) {
605
- if (!indexName) {
606
- throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");
607
- }
608
- if (!objectID) {
609
- throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");
610
- }
611
- if (!body) {
612
- throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");
613
- }
601
+ (0, import_client_common.validateRequired)("indexName", "addOrUpdateObject", indexName);
602
+ (0, import_client_common.validateRequired)("objectID", "addOrUpdateObject", objectID);
603
+ (0, import_client_common.validateRequired)("body", "addOrUpdateObject", body);
614
604
  const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
615
605
  const headers = {};
616
606
  const queryParameters = {};
@@ -632,12 +622,8 @@ function createSearchClient({
632
622
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
633
623
  */
634
624
  appendSource(source, requestOptions) {
635
- if (!source) {
636
- throw new Error("Parameter `source` is required when calling `appendSource`.");
637
- }
638
- if (!source.source) {
639
- throw new Error("Parameter `source.source` is required when calling `appendSource`.");
640
- }
625
+ (0, import_client_common.validateRequired)("source", "appendSource", source);
626
+ (0, import_client_common.validateRequired)("source.source", "appendSource", source.source);
641
627
  const requestPath = "/1/security/sources/append";
642
628
  const headers = {};
643
629
  const queryParameters = {};
@@ -663,15 +649,9 @@ function createSearchClient({
663
649
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
664
650
  */
665
651
  assignUserId({ xAlgoliaUserID, assignUserIdParams }, requestOptions) {
666
- if (!xAlgoliaUserID) {
667
- throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");
668
- }
669
- if (!assignUserIdParams) {
670
- throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");
671
- }
672
- if (!assignUserIdParams.cluster) {
673
- throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");
674
- }
652
+ (0, import_client_common.validateRequired)("xAlgoliaUserID", "assignUserId", xAlgoliaUserID);
653
+ (0, import_client_common.validateRequired)("assignUserIdParams", "assignUserId", assignUserIdParams);
654
+ (0, import_client_common.validateRequired)("assignUserIdParams.cluster", "assignUserId", assignUserIdParams.cluster);
675
655
  const requestPath = "/1/clusters/mapping";
676
656
  const headers = {};
677
657
  const queryParameters = {};
@@ -698,15 +678,9 @@ function createSearchClient({
698
678
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
699
679
  */
700
680
  batch({ indexName, batchWriteParams }, requestOptions) {
701
- if (!indexName) {
702
- throw new Error("Parameter `indexName` is required when calling `batch`.");
703
- }
704
- if (!batchWriteParams) {
705
- throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");
706
- }
707
- if (!batchWriteParams.requests) {
708
- throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");
709
- }
681
+ (0, import_client_common.validateRequired)("indexName", "batch", indexName);
682
+ (0, import_client_common.validateRequired)("batchWriteParams", "batch", batchWriteParams);
683
+ (0, import_client_common.validateRequired)("batchWriteParams.requests", "batch", batchWriteParams.requests);
710
684
  const requestPath = "/1/indexes/{indexName}/batch".replace("{indexName}", encodeURIComponent(indexName));
711
685
  const headers = {};
712
686
  const queryParameters = {};
@@ -732,18 +706,10 @@ function createSearchClient({
732
706
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
733
707
  */
734
708
  batchAssignUserIds({ xAlgoliaUserID, batchAssignUserIdsParams }, requestOptions) {
735
- if (!xAlgoliaUserID) {
736
- throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");
737
- }
738
- if (!batchAssignUserIdsParams) {
739
- throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");
740
- }
741
- if (!batchAssignUserIdsParams.cluster) {
742
- throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");
743
- }
744
- if (!batchAssignUserIdsParams.users) {
745
- throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");
746
- }
709
+ (0, import_client_common.validateRequired)("xAlgoliaUserID", "batchAssignUserIds", xAlgoliaUserID);
710
+ (0, import_client_common.validateRequired)("batchAssignUserIdsParams", "batchAssignUserIds", batchAssignUserIdsParams);
711
+ (0, import_client_common.validateRequired)("batchAssignUserIdsParams.cluster", "batchAssignUserIds", batchAssignUserIdsParams.cluster);
712
+ (0, import_client_common.validateRequired)("batchAssignUserIdsParams.users", "batchAssignUserIds", batchAssignUserIdsParams.users);
747
713
  const requestPath = "/1/clusters/mapping/batch";
748
714
  const headers = {};
749
715
  const queryParameters = {};
@@ -770,17 +736,13 @@ function createSearchClient({
770
736
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
771
737
  */
772
738
  batchDictionaryEntries({ dictionaryName, batchDictionaryEntriesParams }, requestOptions) {
773
- if (!dictionaryName) {
774
- throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");
775
- }
776
- if (!batchDictionaryEntriesParams) {
777
- throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");
778
- }
779
- if (!batchDictionaryEntriesParams.requests) {
780
- throw new Error(
781
- "Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`."
782
- );
783
- }
739
+ (0, import_client_common.validateRequired)("dictionaryName", "batchDictionaryEntries", dictionaryName);
740
+ (0, import_client_common.validateRequired)("batchDictionaryEntriesParams", "batchDictionaryEntries", batchDictionaryEntriesParams);
741
+ (0, import_client_common.validateRequired)(
742
+ "batchDictionaryEntriesParams.requests",
743
+ "batchDictionaryEntries",
744
+ batchDictionaryEntriesParams.requests
745
+ );
784
746
  const requestPath = "/1/dictionaries/{dictionaryName}/batch".replace(
785
747
  "{dictionaryName}",
786
748
  encodeURIComponent(dictionaryName)
@@ -807,9 +769,7 @@ function createSearchClient({
807
769
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
808
770
  */
809
771
  browse({ indexName, browseParams }, requestOptions) {
810
- if (!indexName) {
811
- throw new Error("Parameter `indexName` is required when calling `browse`.");
812
- }
772
+ (0, import_client_common.validateRequired)("indexName", "browse", indexName);
813
773
  const requestPath = "/1/indexes/{indexName}/browse".replace("{indexName}", encodeURIComponent(indexName));
814
774
  const headers = {};
815
775
  const queryParameters = {};
@@ -833,9 +793,7 @@ function createSearchClient({
833
793
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
834
794
  */
835
795
  clearObjects({ indexName }, requestOptions) {
836
- if (!indexName) {
837
- throw new Error("Parameter `indexName` is required when calling `clearObjects`.");
838
- }
796
+ (0, import_client_common.validateRequired)("indexName", "clearObjects", indexName);
839
797
  const requestPath = "/1/indexes/{indexName}/clear".replace("{indexName}", encodeURIComponent(indexName));
840
798
  const headers = {};
841
799
  const queryParameters = {};
@@ -858,9 +816,7 @@ function createSearchClient({
858
816
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
859
817
  */
860
818
  clearRules({ indexName, forwardToReplicas }, requestOptions) {
861
- if (!indexName) {
862
- throw new Error("Parameter `indexName` is required when calling `clearRules`.");
863
- }
819
+ (0, import_client_common.validateRequired)("indexName", "clearRules", indexName);
864
820
  const requestPath = "/1/indexes/{indexName}/rules/clear".replace("{indexName}", encodeURIComponent(indexName));
865
821
  const headers = {};
866
822
  const queryParameters = {};
@@ -886,9 +842,7 @@ function createSearchClient({
886
842
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
887
843
  */
888
844
  clearSynonyms({ indexName, forwardToReplicas }, requestOptions) {
889
- if (!indexName) {
890
- throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");
891
- }
845
+ (0, import_client_common.validateRequired)("indexName", "clearSynonyms", indexName);
892
846
  const requestPath = "/1/indexes/{indexName}/synonyms/clear".replace("{indexName}", encodeURIComponent(indexName));
893
847
  const headers = {};
894
848
  const queryParameters = {};
@@ -911,9 +865,7 @@ function createSearchClient({
911
865
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
912
866
  */
913
867
  customDelete({ path, parameters }, requestOptions) {
914
- if (!path) {
915
- throw new Error("Parameter `path` is required when calling `customDelete`.");
916
- }
868
+ (0, import_client_common.validateRequired)("path", "customDelete", path);
917
869
  const requestPath = "/{path}".replace("{path}", path);
918
870
  const headers = {};
919
871
  const queryParameters = parameters ? parameters : {};
@@ -933,9 +885,7 @@ function createSearchClient({
933
885
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
934
886
  */
935
887
  customGet({ path, parameters }, requestOptions) {
936
- if (!path) {
937
- throw new Error("Parameter `path` is required when calling `customGet`.");
938
- }
888
+ (0, import_client_common.validateRequired)("path", "customGet", path);
939
889
  const requestPath = "/{path}".replace("{path}", path);
940
890
  const headers = {};
941
891
  const queryParameters = parameters ? parameters : {};
@@ -956,9 +906,7 @@ function createSearchClient({
956
906
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
957
907
  */
958
908
  customPost({ path, parameters, body }, requestOptions) {
959
- if (!path) {
960
- throw new Error("Parameter `path` is required when calling `customPost`.");
961
- }
909
+ (0, import_client_common.validateRequired)("path", "customPost", path);
962
910
  const requestPath = "/{path}".replace("{path}", path);
963
911
  const headers = {};
964
912
  const queryParameters = parameters ? parameters : {};
@@ -980,9 +928,7 @@ function createSearchClient({
980
928
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
981
929
  */
982
930
  customPut({ path, parameters, body }, requestOptions) {
983
- if (!path) {
984
- throw new Error("Parameter `path` is required when calling `customPut`.");
985
- }
931
+ (0, import_client_common.validateRequired)("path", "customPut", path);
986
932
  const requestPath = "/{path}".replace("{path}", path);
987
933
  const headers = {};
988
934
  const queryParameters = parameters ? parameters : {};
@@ -1005,9 +951,7 @@ function createSearchClient({
1005
951
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1006
952
  */
1007
953
  deleteApiKey({ key }, requestOptions) {
1008
- if (!key) {
1009
- throw new Error("Parameter `key` is required when calling `deleteApiKey`.");
1010
- }
954
+ (0, import_client_common.validateRequired)("key", "deleteApiKey", key);
1011
955
  const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
1012
956
  const headers = {};
1013
957
  const queryParameters = {};
@@ -1030,12 +974,8 @@ function createSearchClient({
1030
974
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1031
975
  */
1032
976
  deleteBy({ indexName, deleteByParams }, requestOptions) {
1033
- if (!indexName) {
1034
- throw new Error("Parameter `indexName` is required when calling `deleteBy`.");
1035
- }
1036
- if (!deleteByParams) {
1037
- throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");
1038
- }
977
+ (0, import_client_common.validateRequired)("indexName", "deleteBy", indexName);
978
+ (0, import_client_common.validateRequired)("deleteByParams", "deleteBy", deleteByParams);
1039
979
  const requestPath = "/1/indexes/{indexName}/deleteByQuery".replace("{indexName}", encodeURIComponent(indexName));
1040
980
  const headers = {};
1041
981
  const queryParameters = {};
@@ -1058,9 +998,7 @@ function createSearchClient({
1058
998
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1059
999
  */
1060
1000
  deleteIndex({ indexName }, requestOptions) {
1061
- if (!indexName) {
1062
- throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");
1063
- }
1001
+ (0, import_client_common.validateRequired)("indexName", "deleteIndex", indexName);
1064
1002
  const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
1065
1003
  const headers = {};
1066
1004
  const queryParameters = {};
@@ -1083,12 +1021,8 @@ function createSearchClient({
1083
1021
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1084
1022
  */
1085
1023
  deleteObject({ indexName, objectID }, requestOptions) {
1086
- if (!indexName) {
1087
- throw new Error("Parameter `indexName` is required when calling `deleteObject`.");
1088
- }
1089
- if (!objectID) {
1090
- throw new Error("Parameter `objectID` is required when calling `deleteObject`.");
1091
- }
1024
+ (0, import_client_common.validateRequired)("indexName", "deleteObject", indexName);
1025
+ (0, import_client_common.validateRequired)("objectID", "deleteObject", objectID);
1092
1026
  const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1093
1027
  const headers = {};
1094
1028
  const queryParameters = {};
@@ -1112,12 +1046,8 @@ function createSearchClient({
1112
1046
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1113
1047
  */
1114
1048
  deleteRule({ indexName, objectID, forwardToReplicas }, requestOptions) {
1115
- if (!indexName) {
1116
- throw new Error("Parameter `indexName` is required when calling `deleteRule`.");
1117
- }
1118
- if (!objectID) {
1119
- throw new Error("Parameter `objectID` is required when calling `deleteRule`.");
1120
- }
1049
+ (0, import_client_common.validateRequired)("indexName", "deleteRule", indexName);
1050
+ (0, import_client_common.validateRequired)("objectID", "deleteRule", objectID);
1121
1051
  const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1122
1052
  const headers = {};
1123
1053
  const queryParameters = {};
@@ -1142,9 +1072,7 @@ function createSearchClient({
1142
1072
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1143
1073
  */
1144
1074
  deleteSource({ source }, requestOptions) {
1145
- if (!source) {
1146
- throw new Error("Parameter `source` is required when calling `deleteSource`.");
1147
- }
1075
+ (0, import_client_common.validateRequired)("source", "deleteSource", source);
1148
1076
  const requestPath = "/1/security/sources/{source}".replace("{source}", encodeURIComponent(source));
1149
1077
  const headers = {};
1150
1078
  const queryParameters = {};
@@ -1168,12 +1096,8 @@ function createSearchClient({
1168
1096
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1169
1097
  */
1170
1098
  deleteSynonym({ indexName, objectID, forwardToReplicas }, requestOptions) {
1171
- if (!indexName) {
1172
- throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");
1173
- }
1174
- if (!objectID) {
1175
- throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");
1176
- }
1099
+ (0, import_client_common.validateRequired)("indexName", "deleteSynonym", indexName);
1100
+ (0, import_client_common.validateRequired)("objectID", "deleteSynonym", objectID);
1177
1101
  const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1178
1102
  const headers = {};
1179
1103
  const queryParameters = {};
@@ -1198,9 +1122,7 @@ function createSearchClient({
1198
1122
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1199
1123
  */
1200
1124
  getApiKey({ key }, requestOptions) {
1201
- if (!key) {
1202
- throw new Error("Parameter `key` is required when calling `getApiKey`.");
1203
- }
1125
+ (0, import_client_common.validateRequired)("key", "getApiKey", key);
1204
1126
  const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
1205
1127
  const headers = {};
1206
1128
  const queryParameters = {};
@@ -1222,9 +1144,7 @@ function createSearchClient({
1222
1144
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1223
1145
  */
1224
1146
  getAppTask({ taskID }, requestOptions) {
1225
- if (!taskID) {
1226
- throw new Error("Parameter `taskID` is required when calling `getAppTask`.");
1227
- }
1147
+ (0, import_client_common.validateRequired)("taskID", "getAppTask", taskID);
1228
1148
  const requestPath = "/1/task/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
1229
1149
  const headers = {};
1230
1150
  const queryParameters = {};
@@ -1322,12 +1242,8 @@ function createSearchClient({
1322
1242
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1323
1243
  */
1324
1244
  getObject({ indexName, objectID, attributesToRetrieve }, requestOptions) {
1325
- if (!indexName) {
1326
- throw new Error("Parameter `indexName` is required when calling `getObject`.");
1327
- }
1328
- if (!objectID) {
1329
- throw new Error("Parameter `objectID` is required when calling `getObject`.");
1330
- }
1245
+ (0, import_client_common.validateRequired)("indexName", "getObject", indexName);
1246
+ (0, import_client_common.validateRequired)("objectID", "getObject", objectID);
1331
1247
  const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1332
1248
  const headers = {};
1333
1249
  const queryParameters = {};
@@ -1351,12 +1267,8 @@ function createSearchClient({
1351
1267
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1352
1268
  */
1353
1269
  getObjects(getObjectsParams, requestOptions) {
1354
- if (!getObjectsParams) {
1355
- throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");
1356
- }
1357
- if (!getObjectsParams.requests) {
1358
- throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");
1359
- }
1270
+ (0, import_client_common.validateRequired)("getObjectsParams", "getObjects", getObjectsParams);
1271
+ (0, import_client_common.validateRequired)("getObjectsParams.requests", "getObjects", getObjectsParams.requests);
1360
1272
  const requestPath = "/1/indexes/*/objects";
1361
1273
  const headers = {};
1362
1274
  const queryParameters = {};
@@ -1382,12 +1294,8 @@ function createSearchClient({
1382
1294
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1383
1295
  */
1384
1296
  getRule({ indexName, objectID }, requestOptions) {
1385
- if (!indexName) {
1386
- throw new Error("Parameter `indexName` is required when calling `getRule`.");
1387
- }
1388
- if (!objectID) {
1389
- throw new Error("Parameter `objectID` is required when calling `getRule`.");
1390
- }
1297
+ (0, import_client_common.validateRequired)("indexName", "getRule", indexName);
1298
+ (0, import_client_common.validateRequired)("objectID", "getRule", objectID);
1391
1299
  const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1392
1300
  const headers = {};
1393
1301
  const queryParameters = {};
@@ -1410,9 +1318,7 @@ function createSearchClient({
1410
1318
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1411
1319
  */
1412
1320
  getSettings({ indexName, getVersion }, requestOptions) {
1413
- if (!indexName) {
1414
- throw new Error("Parameter `indexName` is required when calling `getSettings`.");
1415
- }
1321
+ (0, import_client_common.validateRequired)("indexName", "getSettings", indexName);
1416
1322
  const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
1417
1323
  const headers = {};
1418
1324
  const queryParameters = {};
@@ -1457,12 +1363,8 @@ function createSearchClient({
1457
1363
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1458
1364
  */
1459
1365
  getSynonym({ indexName, objectID }, requestOptions) {
1460
- if (!indexName) {
1461
- throw new Error("Parameter `indexName` is required when calling `getSynonym`.");
1462
- }
1463
- if (!objectID) {
1464
- throw new Error("Parameter `objectID` is required when calling `getSynonym`.");
1465
- }
1366
+ (0, import_client_common.validateRequired)("indexName", "getSynonym", indexName);
1367
+ (0, import_client_common.validateRequired)("objectID", "getSynonym", objectID);
1466
1368
  const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1467
1369
  const headers = {};
1468
1370
  const queryParameters = {};
@@ -1485,12 +1387,8 @@ function createSearchClient({
1485
1387
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1486
1388
  */
1487
1389
  getTask({ indexName, taskID }, requestOptions) {
1488
- if (!indexName) {
1489
- throw new Error("Parameter `indexName` is required when calling `getTask`.");
1490
- }
1491
- if (!taskID) {
1492
- throw new Error("Parameter `taskID` is required when calling `getTask`.");
1493
- }
1390
+ (0, import_client_common.validateRequired)("indexName", "getTask", indexName);
1391
+ (0, import_client_common.validateRequired)("taskID", "getTask", taskID);
1494
1392
  const requestPath = "/1/indexes/{indexName}/task/{taskID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{taskID}", encodeURIComponent(taskID));
1495
1393
  const headers = {};
1496
1394
  const queryParameters = {};
@@ -1535,9 +1433,7 @@ function createSearchClient({
1535
1433
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1536
1434
  */
1537
1435
  getUserId({ userID }, requestOptions) {
1538
- if (!userID) {
1539
- throw new Error("Parameter `userID` is required when calling `getUserId`.");
1540
- }
1436
+ (0, import_client_common.validateRequired)("userID", "getUserId", userID);
1541
1437
  const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
1542
1438
  const headers = {};
1543
1439
  const queryParameters = {};
@@ -1682,12 +1578,8 @@ function createSearchClient({
1682
1578
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1683
1579
  */
1684
1580
  multipleBatch(batchParams, requestOptions) {
1685
- if (!batchParams) {
1686
- throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");
1687
- }
1688
- if (!batchParams.requests) {
1689
- throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");
1690
- }
1581
+ (0, import_client_common.validateRequired)("batchParams", "multipleBatch", batchParams);
1582
+ (0, import_client_common.validateRequired)("batchParams.requests", "multipleBatch", batchParams.requests);
1691
1583
  const requestPath = "/1/indexes/*/batch";
1692
1584
  const headers = {};
1693
1585
  const queryParameters = {};
@@ -1711,18 +1603,10 @@ function createSearchClient({
1711
1603
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1712
1604
  */
1713
1605
  operationIndex({ indexName, operationIndexParams }, requestOptions) {
1714
- if (!indexName) {
1715
- throw new Error("Parameter `indexName` is required when calling `operationIndex`.");
1716
- }
1717
- if (!operationIndexParams) {
1718
- throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");
1719
- }
1720
- if (!operationIndexParams.operation) {
1721
- throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");
1722
- }
1723
- if (!operationIndexParams.destination) {
1724
- throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");
1725
- }
1606
+ (0, import_client_common.validateRequired)("indexName", "operationIndex", indexName);
1607
+ (0, import_client_common.validateRequired)("operationIndexParams", "operationIndex", operationIndexParams);
1608
+ (0, import_client_common.validateRequired)("operationIndexParams.operation", "operationIndex", operationIndexParams.operation);
1609
+ (0, import_client_common.validateRequired)("operationIndexParams.destination", "operationIndex", operationIndexParams.destination);
1726
1610
  const requestPath = "/1/indexes/{indexName}/operation".replace("{indexName}", encodeURIComponent(indexName));
1727
1611
  const headers = {};
1728
1612
  const queryParameters = {};
@@ -1748,15 +1632,9 @@ function createSearchClient({
1748
1632
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1749
1633
  */
1750
1634
  partialUpdateObject({ indexName, objectID, attributesToUpdate, createIfNotExists }, requestOptions) {
1751
- if (!indexName) {
1752
- throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");
1753
- }
1754
- if (!objectID) {
1755
- throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");
1756
- }
1757
- if (!attributesToUpdate) {
1758
- throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");
1759
- }
1635
+ (0, import_client_common.validateRequired)("indexName", "partialUpdateObject", indexName);
1636
+ (0, import_client_common.validateRequired)("objectID", "partialUpdateObject", objectID);
1637
+ (0, import_client_common.validateRequired)("attributesToUpdate", "partialUpdateObject", attributesToUpdate);
1760
1638
  const requestPath = "/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1761
1639
  const headers = {};
1762
1640
  const queryParameters = {};
@@ -1784,9 +1662,7 @@ function createSearchClient({
1784
1662
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1785
1663
  */
1786
1664
  removeUserId({ userID }, requestOptions) {
1787
- if (!userID) {
1788
- throw new Error("Parameter `userID` is required when calling `removeUserId`.");
1789
- }
1665
+ (0, import_client_common.validateRequired)("userID", "removeUserId", userID);
1790
1666
  const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
1791
1667
  const headers = {};
1792
1668
  const queryParameters = {};
@@ -1808,9 +1684,7 @@ function createSearchClient({
1808
1684
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1809
1685
  */
1810
1686
  replaceSources({ source }, requestOptions) {
1811
- if (!source) {
1812
- throw new Error("Parameter `source` is required when calling `replaceSources`.");
1813
- }
1687
+ (0, import_client_common.validateRequired)("source", "replaceSources", source);
1814
1688
  const requestPath = "/1/security/sources";
1815
1689
  const headers = {};
1816
1690
  const queryParameters = {};
@@ -1833,9 +1707,7 @@ function createSearchClient({
1833
1707
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1834
1708
  */
1835
1709
  restoreApiKey({ key }, requestOptions) {
1836
- if (!key) {
1837
- throw new Error("Parameter `key` is required when calling `restoreApiKey`.");
1838
- }
1710
+ (0, import_client_common.validateRequired)("key", "restoreApiKey", key);
1839
1711
  const requestPath = "/1/keys/{key}/restore".replace("{key}", encodeURIComponent(key));
1840
1712
  const headers = {};
1841
1713
  const queryParameters = {};
@@ -1858,12 +1730,8 @@ function createSearchClient({
1858
1730
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1859
1731
  */
1860
1732
  saveObject({ indexName, body }, requestOptions) {
1861
- if (!indexName) {
1862
- throw new Error("Parameter `indexName` is required when calling `saveObject`.");
1863
- }
1864
- if (!body) {
1865
- throw new Error("Parameter `body` is required when calling `saveObject`.");
1866
- }
1733
+ (0, import_client_common.validateRequired)("indexName", "saveObject", indexName);
1734
+ (0, import_client_common.validateRequired)("body", "saveObject", body);
1867
1735
  const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
1868
1736
  const headers = {};
1869
1737
  const queryParameters = {};
@@ -1889,21 +1757,11 @@ function createSearchClient({
1889
1757
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1890
1758
  */
1891
1759
  saveRule({ indexName, objectID, rule, forwardToReplicas }, requestOptions) {
1892
- if (!indexName) {
1893
- throw new Error("Parameter `indexName` is required when calling `saveRule`.");
1894
- }
1895
- if (!objectID) {
1896
- throw new Error("Parameter `objectID` is required when calling `saveRule`.");
1897
- }
1898
- if (!rule) {
1899
- throw new Error("Parameter `rule` is required when calling `saveRule`.");
1900
- }
1901
- if (!rule.objectID) {
1902
- throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");
1903
- }
1904
- if (!rule.consequence) {
1905
- throw new Error("Parameter `rule.consequence` is required when calling `saveRule`.");
1906
- }
1760
+ (0, import_client_common.validateRequired)("indexName", "saveRule", indexName);
1761
+ (0, import_client_common.validateRequired)("objectID", "saveRule", objectID);
1762
+ (0, import_client_common.validateRequired)("rule", "saveRule", rule);
1763
+ (0, import_client_common.validateRequired)("rule.objectID", "saveRule", rule.objectID);
1764
+ (0, import_client_common.validateRequired)("rule.consequence", "saveRule", rule.consequence);
1907
1765
  const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1908
1766
  const headers = {};
1909
1767
  const queryParameters = {};
@@ -1932,12 +1790,8 @@ function createSearchClient({
1932
1790
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1933
1791
  */
1934
1792
  saveRules({ indexName, rules, forwardToReplicas, clearExistingRules }, requestOptions) {
1935
- if (!indexName) {
1936
- throw new Error("Parameter `indexName` is required when calling `saveRules`.");
1937
- }
1938
- if (!rules) {
1939
- throw new Error("Parameter `rules` is required when calling `saveRules`.");
1940
- }
1793
+ (0, import_client_common.validateRequired)("indexName", "saveRules", indexName);
1794
+ (0, import_client_common.validateRequired)("rules", "saveRules", rules);
1941
1795
  const requestPath = "/1/indexes/{indexName}/rules/batch".replace("{indexName}", encodeURIComponent(indexName));
1942
1796
  const headers = {};
1943
1797
  const queryParameters = {};
@@ -1969,21 +1823,11 @@ function createSearchClient({
1969
1823
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1970
1824
  */
1971
1825
  saveSynonym({ indexName, objectID, synonymHit, forwardToReplicas }, requestOptions) {
1972
- if (!indexName) {
1973
- throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");
1974
- }
1975
- if (!objectID) {
1976
- throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");
1977
- }
1978
- if (!synonymHit) {
1979
- throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");
1980
- }
1981
- if (!synonymHit.objectID) {
1982
- throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");
1983
- }
1984
- if (!synonymHit.type) {
1985
- throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");
1986
- }
1826
+ (0, import_client_common.validateRequired)("indexName", "saveSynonym", indexName);
1827
+ (0, import_client_common.validateRequired)("objectID", "saveSynonym", objectID);
1828
+ (0, import_client_common.validateRequired)("synonymHit", "saveSynonym", synonymHit);
1829
+ (0, import_client_common.validateRequired)("synonymHit.objectID", "saveSynonym", synonymHit.objectID);
1830
+ (0, import_client_common.validateRequired)("synonymHit.type", "saveSynonym", synonymHit.type);
1987
1831
  const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1988
1832
  const headers = {};
1989
1833
  const queryParameters = {};
@@ -2012,12 +1856,8 @@ function createSearchClient({
2012
1856
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2013
1857
  */
2014
1858
  saveSynonyms({ indexName, synonymHit, forwardToReplicas, replaceExistingSynonyms }, requestOptions) {
2015
- if (!indexName) {
2016
- throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");
2017
- }
2018
- if (!synonymHit) {
2019
- throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");
2020
- }
1859
+ (0, import_client_common.validateRequired)("indexName", "saveSynonyms", indexName);
1860
+ (0, import_client_common.validateRequired)("synonymHit", "saveSynonyms", synonymHit);
2021
1861
  const requestPath = "/1/indexes/{indexName}/synonyms/batch".replace("{indexName}", encodeURIComponent(indexName));
2022
1862
  const headers = {};
2023
1863
  const queryParameters = {};
@@ -2066,12 +1906,8 @@ function createSearchClient({
2066
1906
  };
2067
1907
  searchMethodParams = newSignatureRequest;
2068
1908
  }
2069
- if (!searchMethodParams) {
2070
- throw new Error("Parameter `searchMethodParams` is required when calling `search`.");
2071
- }
2072
- if (!searchMethodParams.requests) {
2073
- throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");
2074
- }
1909
+ (0, import_client_common.validateRequired)("searchMethodParams", "search", searchMethodParams);
1910
+ (0, import_client_common.validateRequired)("searchMethodParams.requests", "search", searchMethodParams.requests);
2075
1911
  const requestPath = "/1/indexes/*/queries";
2076
1912
  const headers = {};
2077
1913
  const queryParameters = {};
@@ -2097,19 +1933,13 @@ function createSearchClient({
2097
1933
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2098
1934
  */
2099
1935
  searchDictionaryEntries({ dictionaryName, searchDictionaryEntriesParams }, requestOptions) {
2100
- if (!dictionaryName) {
2101
- throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");
2102
- }
2103
- if (!searchDictionaryEntriesParams) {
2104
- throw new Error(
2105
- "Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`."
2106
- );
2107
- }
2108
- if (!searchDictionaryEntriesParams.query) {
2109
- throw new Error(
2110
- "Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`."
2111
- );
2112
- }
1936
+ (0, import_client_common.validateRequired)("dictionaryName", "searchDictionaryEntries", dictionaryName);
1937
+ (0, import_client_common.validateRequired)("searchDictionaryEntriesParams", "searchDictionaryEntries", searchDictionaryEntriesParams);
1938
+ (0, import_client_common.validateRequired)(
1939
+ "searchDictionaryEntriesParams.query",
1940
+ "searchDictionaryEntries",
1941
+ searchDictionaryEntriesParams.query
1942
+ );
2113
1943
  const requestPath = "/1/dictionaries/{dictionaryName}/search".replace(
2114
1944
  "{dictionaryName}",
2115
1945
  encodeURIComponent(dictionaryName)
@@ -2139,12 +1969,8 @@ function createSearchClient({
2139
1969
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2140
1970
  */
2141
1971
  searchForFacetValues({ indexName, facetName, searchForFacetValuesRequest }, requestOptions) {
2142
- if (!indexName) {
2143
- throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");
2144
- }
2145
- if (!facetName) {
2146
- throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");
2147
- }
1972
+ (0, import_client_common.validateRequired)("indexName", "searchForFacetValues", indexName);
1973
+ (0, import_client_common.validateRequired)("facetName", "searchForFacetValues", facetName);
2148
1974
  const requestPath = "/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}", encodeURIComponent(indexName)).replace("{facetName}", encodeURIComponent(facetName));
2149
1975
  const headers = {};
2150
1976
  const queryParameters = {};
@@ -2170,9 +1996,7 @@ function createSearchClient({
2170
1996
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2171
1997
  */
2172
1998
  searchRules({ indexName, searchRulesParams }, requestOptions) {
2173
- if (!indexName) {
2174
- throw new Error("Parameter `indexName` is required when calling `searchRules`.");
2175
- }
1999
+ (0, import_client_common.validateRequired)("indexName", "searchRules", indexName);
2176
2000
  const requestPath = "/1/indexes/{indexName}/rules/search".replace("{indexName}", encodeURIComponent(indexName));
2177
2001
  const headers = {};
2178
2002
  const queryParameters = {};
@@ -2198,9 +2022,7 @@ function createSearchClient({
2198
2022
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2199
2023
  */
2200
2024
  searchSingleIndex({ indexName, searchParams }, requestOptions) {
2201
- if (!indexName) {
2202
- throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");
2203
- }
2025
+ (0, import_client_common.validateRequired)("indexName", "searchSingleIndex", indexName);
2204
2026
  const requestPath = "/1/indexes/{indexName}/query".replace("{indexName}", encodeURIComponent(indexName));
2205
2027
  const headers = {};
2206
2028
  const queryParameters = {};
@@ -2226,9 +2048,7 @@ function createSearchClient({
2226
2048
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2227
2049
  */
2228
2050
  searchSynonyms({ indexName, searchSynonymsParams }, requestOptions) {
2229
- if (!indexName) {
2230
- throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");
2231
- }
2051
+ (0, import_client_common.validateRequired)("indexName", "searchSynonyms", indexName);
2232
2052
  const requestPath = "/1/indexes/{indexName}/synonyms/search".replace(
2233
2053
  "{indexName}",
2234
2054
  encodeURIComponent(indexName)
@@ -2257,12 +2077,8 @@ function createSearchClient({
2257
2077
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2258
2078
  */
2259
2079
  searchUserIds(searchUserIdsParams, requestOptions) {
2260
- if (!searchUserIdsParams) {
2261
- throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");
2262
- }
2263
- if (!searchUserIdsParams.query) {
2264
- throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");
2265
- }
2080
+ (0, import_client_common.validateRequired)("searchUserIdsParams", "searchUserIds", searchUserIdsParams);
2081
+ (0, import_client_common.validateRequired)("searchUserIdsParams.query", "searchUserIds", searchUserIdsParams.query);
2266
2082
  const requestPath = "/1/clusters/mapping/search";
2267
2083
  const headers = {};
2268
2084
  const queryParameters = {};
@@ -2286,14 +2102,12 @@ function createSearchClient({
2286
2102
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2287
2103
  */
2288
2104
  setDictionarySettings(dictionarySettingsParams, requestOptions) {
2289
- if (!dictionarySettingsParams) {
2290
- throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");
2291
- }
2292
- if (!dictionarySettingsParams.disableStandardEntries) {
2293
- throw new Error(
2294
- "Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`."
2295
- );
2296
- }
2105
+ (0, import_client_common.validateRequired)("dictionarySettingsParams", "setDictionarySettings", dictionarySettingsParams);
2106
+ (0, import_client_common.validateRequired)(
2107
+ "dictionarySettingsParams.disableStandardEntries",
2108
+ "setDictionarySettings",
2109
+ dictionarySettingsParams.disableStandardEntries
2110
+ );
2297
2111
  const requestPath = "/1/dictionaries/*/settings";
2298
2112
  const headers = {};
2299
2113
  const queryParameters = {};
@@ -2318,12 +2132,8 @@ function createSearchClient({
2318
2132
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2319
2133
  */
2320
2134
  setSettings({ indexName, indexSettings, forwardToReplicas }, requestOptions) {
2321
- if (!indexName) {
2322
- throw new Error("Parameter `indexName` is required when calling `setSettings`.");
2323
- }
2324
- if (!indexSettings) {
2325
- throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");
2326
- }
2135
+ (0, import_client_common.validateRequired)("indexName", "setSettings", indexName);
2136
+ (0, import_client_common.validateRequired)("indexSettings", "setSettings", indexSettings);
2327
2137
  const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
2328
2138
  const headers = {};
2329
2139
  const queryParameters = {};
@@ -2350,15 +2160,9 @@ function createSearchClient({
2350
2160
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2351
2161
  */
2352
2162
  updateApiKey({ key, apiKey }, requestOptions) {
2353
- if (!key) {
2354
- throw new Error("Parameter `key` is required when calling `updateApiKey`.");
2355
- }
2356
- if (!apiKey) {
2357
- throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");
2358
- }
2359
- if (!apiKey.acl) {
2360
- throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");
2361
- }
2163
+ (0, import_client_common.validateRequired)("key", "updateApiKey", key);
2164
+ (0, import_client_common.validateRequired)("apiKey", "updateApiKey", apiKey);
2165
+ (0, import_client_common.validateRequired)("apiKey.acl", "updateApiKey", apiKey.acl);
2362
2166
  const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
2363
2167
  const headers = {};
2364
2168
  const queryParameters = {};