@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.
@@ -31,7 +31,7 @@ var import_requester_node_http = require("@algolia/requester-node-http");
31
31
 
32
32
  // src/searchClient.ts
33
33
  var import_client_common = require("@algolia/client-common");
34
- var apiClientVersion = "5.53.0";
34
+ var apiClientVersion = "5.54.0";
35
35
  function getDefaultHosts(appId) {
36
36
  return [
37
37
  {
@@ -578,12 +578,8 @@ function createSearchClient({
578
578
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
579
579
  */
580
580
  addApiKey(apiKey, requestOptions) {
581
- if (!apiKey) {
582
- throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");
583
- }
584
- if (!apiKey.acl) {
585
- throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");
586
- }
581
+ (0, import_client_common.validateRequired)("apiKey", "addApiKey", apiKey);
582
+ (0, import_client_common.validateRequired)("apiKey.acl", "addApiKey", apiKey.acl);
587
583
  const requestPath = "/1/keys";
588
584
  const headers = {};
589
585
  const queryParameters = {};
@@ -608,15 +604,9 @@ function createSearchClient({
608
604
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
609
605
  */
610
606
  addOrUpdateObject({ indexName, objectID, body }, requestOptions) {
611
- if (!indexName) {
612
- throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");
613
- }
614
- if (!objectID) {
615
- throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");
616
- }
617
- if (!body) {
618
- throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");
619
- }
607
+ (0, import_client_common.validateRequired)("indexName", "addOrUpdateObject", indexName);
608
+ (0, import_client_common.validateRequired)("objectID", "addOrUpdateObject", objectID);
609
+ (0, import_client_common.validateRequired)("body", "addOrUpdateObject", body);
620
610
  const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
621
611
  const headers = {};
622
612
  const queryParameters = {};
@@ -638,12 +628,8 @@ function createSearchClient({
638
628
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
639
629
  */
640
630
  appendSource(source, requestOptions) {
641
- if (!source) {
642
- throw new Error("Parameter `source` is required when calling `appendSource`.");
643
- }
644
- if (!source.source) {
645
- throw new Error("Parameter `source.source` is required when calling `appendSource`.");
646
- }
631
+ (0, import_client_common.validateRequired)("source", "appendSource", source);
632
+ (0, import_client_common.validateRequired)("source.source", "appendSource", source.source);
647
633
  const requestPath = "/1/security/sources/append";
648
634
  const headers = {};
649
635
  const queryParameters = {};
@@ -669,15 +655,9 @@ function createSearchClient({
669
655
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
670
656
  */
671
657
  assignUserId({ xAlgoliaUserID, assignUserIdParams }, requestOptions) {
672
- if (!xAlgoliaUserID) {
673
- throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");
674
- }
675
- if (!assignUserIdParams) {
676
- throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");
677
- }
678
- if (!assignUserIdParams.cluster) {
679
- throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");
680
- }
658
+ (0, import_client_common.validateRequired)("xAlgoliaUserID", "assignUserId", xAlgoliaUserID);
659
+ (0, import_client_common.validateRequired)("assignUserIdParams", "assignUserId", assignUserIdParams);
660
+ (0, import_client_common.validateRequired)("assignUserIdParams.cluster", "assignUserId", assignUserIdParams.cluster);
681
661
  const requestPath = "/1/clusters/mapping";
682
662
  const headers = {};
683
663
  const queryParameters = {};
@@ -704,15 +684,9 @@ function createSearchClient({
704
684
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
705
685
  */
706
686
  batch({ indexName, batchWriteParams }, requestOptions) {
707
- if (!indexName) {
708
- throw new Error("Parameter `indexName` is required when calling `batch`.");
709
- }
710
- if (!batchWriteParams) {
711
- throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");
712
- }
713
- if (!batchWriteParams.requests) {
714
- throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");
715
- }
687
+ (0, import_client_common.validateRequired)("indexName", "batch", indexName);
688
+ (0, import_client_common.validateRequired)("batchWriteParams", "batch", batchWriteParams);
689
+ (0, import_client_common.validateRequired)("batchWriteParams.requests", "batch", batchWriteParams.requests);
716
690
  const requestPath = "/1/indexes/{indexName}/batch".replace("{indexName}", encodeURIComponent(indexName));
717
691
  const headers = {};
718
692
  const queryParameters = {};
@@ -738,18 +712,10 @@ function createSearchClient({
738
712
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
739
713
  */
740
714
  batchAssignUserIds({ xAlgoliaUserID, batchAssignUserIdsParams }, requestOptions) {
741
- if (!xAlgoliaUserID) {
742
- throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");
743
- }
744
- if (!batchAssignUserIdsParams) {
745
- throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");
746
- }
747
- if (!batchAssignUserIdsParams.cluster) {
748
- throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");
749
- }
750
- if (!batchAssignUserIdsParams.users) {
751
- throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");
752
- }
715
+ (0, import_client_common.validateRequired)("xAlgoliaUserID", "batchAssignUserIds", xAlgoliaUserID);
716
+ (0, import_client_common.validateRequired)("batchAssignUserIdsParams", "batchAssignUserIds", batchAssignUserIdsParams);
717
+ (0, import_client_common.validateRequired)("batchAssignUserIdsParams.cluster", "batchAssignUserIds", batchAssignUserIdsParams.cluster);
718
+ (0, import_client_common.validateRequired)("batchAssignUserIdsParams.users", "batchAssignUserIds", batchAssignUserIdsParams.users);
753
719
  const requestPath = "/1/clusters/mapping/batch";
754
720
  const headers = {};
755
721
  const queryParameters = {};
@@ -776,17 +742,13 @@ function createSearchClient({
776
742
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
777
743
  */
778
744
  batchDictionaryEntries({ dictionaryName, batchDictionaryEntriesParams }, requestOptions) {
779
- if (!dictionaryName) {
780
- throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");
781
- }
782
- if (!batchDictionaryEntriesParams) {
783
- throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");
784
- }
785
- if (!batchDictionaryEntriesParams.requests) {
786
- throw new Error(
787
- "Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`."
788
- );
789
- }
745
+ (0, import_client_common.validateRequired)("dictionaryName", "batchDictionaryEntries", dictionaryName);
746
+ (0, import_client_common.validateRequired)("batchDictionaryEntriesParams", "batchDictionaryEntries", batchDictionaryEntriesParams);
747
+ (0, import_client_common.validateRequired)(
748
+ "batchDictionaryEntriesParams.requests",
749
+ "batchDictionaryEntries",
750
+ batchDictionaryEntriesParams.requests
751
+ );
790
752
  const requestPath = "/1/dictionaries/{dictionaryName}/batch".replace(
791
753
  "{dictionaryName}",
792
754
  encodeURIComponent(dictionaryName)
@@ -813,9 +775,7 @@ function createSearchClient({
813
775
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
814
776
  */
815
777
  browse({ indexName, browseParams }, requestOptions) {
816
- if (!indexName) {
817
- throw new Error("Parameter `indexName` is required when calling `browse`.");
818
- }
778
+ (0, import_client_common.validateRequired)("indexName", "browse", indexName);
819
779
  const requestPath = "/1/indexes/{indexName}/browse".replace("{indexName}", encodeURIComponent(indexName));
820
780
  const headers = {};
821
781
  const queryParameters = {};
@@ -839,9 +799,7 @@ function createSearchClient({
839
799
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
840
800
  */
841
801
  clearObjects({ indexName }, requestOptions) {
842
- if (!indexName) {
843
- throw new Error("Parameter `indexName` is required when calling `clearObjects`.");
844
- }
802
+ (0, import_client_common.validateRequired)("indexName", "clearObjects", indexName);
845
803
  const requestPath = "/1/indexes/{indexName}/clear".replace("{indexName}", encodeURIComponent(indexName));
846
804
  const headers = {};
847
805
  const queryParameters = {};
@@ -864,9 +822,7 @@ function createSearchClient({
864
822
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
865
823
  */
866
824
  clearRules({ indexName, forwardToReplicas }, requestOptions) {
867
- if (!indexName) {
868
- throw new Error("Parameter `indexName` is required when calling `clearRules`.");
869
- }
825
+ (0, import_client_common.validateRequired)("indexName", "clearRules", indexName);
870
826
  const requestPath = "/1/indexes/{indexName}/rules/clear".replace("{indexName}", encodeURIComponent(indexName));
871
827
  const headers = {};
872
828
  const queryParameters = {};
@@ -892,9 +848,7 @@ function createSearchClient({
892
848
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
893
849
  */
894
850
  clearSynonyms({ indexName, forwardToReplicas }, requestOptions) {
895
- if (!indexName) {
896
- throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");
897
- }
851
+ (0, import_client_common.validateRequired)("indexName", "clearSynonyms", indexName);
898
852
  const requestPath = "/1/indexes/{indexName}/synonyms/clear".replace("{indexName}", encodeURIComponent(indexName));
899
853
  const headers = {};
900
854
  const queryParameters = {};
@@ -917,9 +871,7 @@ function createSearchClient({
917
871
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
918
872
  */
919
873
  customDelete({ path, parameters }, requestOptions) {
920
- if (!path) {
921
- throw new Error("Parameter `path` is required when calling `customDelete`.");
922
- }
874
+ (0, import_client_common.validateRequired)("path", "customDelete", path);
923
875
  const requestPath = "/{path}".replace("{path}", path);
924
876
  const headers = {};
925
877
  const queryParameters = parameters ? parameters : {};
@@ -939,9 +891,7 @@ function createSearchClient({
939
891
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
940
892
  */
941
893
  customGet({ path, parameters }, requestOptions) {
942
- if (!path) {
943
- throw new Error("Parameter `path` is required when calling `customGet`.");
944
- }
894
+ (0, import_client_common.validateRequired)("path", "customGet", path);
945
895
  const requestPath = "/{path}".replace("{path}", path);
946
896
  const headers = {};
947
897
  const queryParameters = parameters ? parameters : {};
@@ -962,9 +912,7 @@ function createSearchClient({
962
912
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
963
913
  */
964
914
  customPost({ path, parameters, body }, requestOptions) {
965
- if (!path) {
966
- throw new Error("Parameter `path` is required when calling `customPost`.");
967
- }
915
+ (0, import_client_common.validateRequired)("path", "customPost", path);
968
916
  const requestPath = "/{path}".replace("{path}", path);
969
917
  const headers = {};
970
918
  const queryParameters = parameters ? parameters : {};
@@ -986,9 +934,7 @@ function createSearchClient({
986
934
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
987
935
  */
988
936
  customPut({ path, parameters, body }, requestOptions) {
989
- if (!path) {
990
- throw new Error("Parameter `path` is required when calling `customPut`.");
991
- }
937
+ (0, import_client_common.validateRequired)("path", "customPut", path);
992
938
  const requestPath = "/{path}".replace("{path}", path);
993
939
  const headers = {};
994
940
  const queryParameters = parameters ? parameters : {};
@@ -1011,9 +957,7 @@ function createSearchClient({
1011
957
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1012
958
  */
1013
959
  deleteApiKey({ key }, requestOptions) {
1014
- if (!key) {
1015
- throw new Error("Parameter `key` is required when calling `deleteApiKey`.");
1016
- }
960
+ (0, import_client_common.validateRequired)("key", "deleteApiKey", key);
1017
961
  const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
1018
962
  const headers = {};
1019
963
  const queryParameters = {};
@@ -1036,12 +980,8 @@ function createSearchClient({
1036
980
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1037
981
  */
1038
982
  deleteBy({ indexName, deleteByParams }, requestOptions) {
1039
- if (!indexName) {
1040
- throw new Error("Parameter `indexName` is required when calling `deleteBy`.");
1041
- }
1042
- if (!deleteByParams) {
1043
- throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");
1044
- }
983
+ (0, import_client_common.validateRequired)("indexName", "deleteBy", indexName);
984
+ (0, import_client_common.validateRequired)("deleteByParams", "deleteBy", deleteByParams);
1045
985
  const requestPath = "/1/indexes/{indexName}/deleteByQuery".replace("{indexName}", encodeURIComponent(indexName));
1046
986
  const headers = {};
1047
987
  const queryParameters = {};
@@ -1064,9 +1004,7 @@ function createSearchClient({
1064
1004
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1065
1005
  */
1066
1006
  deleteIndex({ indexName }, requestOptions) {
1067
- if (!indexName) {
1068
- throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");
1069
- }
1007
+ (0, import_client_common.validateRequired)("indexName", "deleteIndex", indexName);
1070
1008
  const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
1071
1009
  const headers = {};
1072
1010
  const queryParameters = {};
@@ -1089,12 +1027,8 @@ function createSearchClient({
1089
1027
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1090
1028
  */
1091
1029
  deleteObject({ indexName, objectID }, requestOptions) {
1092
- if (!indexName) {
1093
- throw new Error("Parameter `indexName` is required when calling `deleteObject`.");
1094
- }
1095
- if (!objectID) {
1096
- throw new Error("Parameter `objectID` is required when calling `deleteObject`.");
1097
- }
1030
+ (0, import_client_common.validateRequired)("indexName", "deleteObject", indexName);
1031
+ (0, import_client_common.validateRequired)("objectID", "deleteObject", objectID);
1098
1032
  const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1099
1033
  const headers = {};
1100
1034
  const queryParameters = {};
@@ -1118,12 +1052,8 @@ function createSearchClient({
1118
1052
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1119
1053
  */
1120
1054
  deleteRule({ indexName, objectID, forwardToReplicas }, requestOptions) {
1121
- if (!indexName) {
1122
- throw new Error("Parameter `indexName` is required when calling `deleteRule`.");
1123
- }
1124
- if (!objectID) {
1125
- throw new Error("Parameter `objectID` is required when calling `deleteRule`.");
1126
- }
1055
+ (0, import_client_common.validateRequired)("indexName", "deleteRule", indexName);
1056
+ (0, import_client_common.validateRequired)("objectID", "deleteRule", objectID);
1127
1057
  const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1128
1058
  const headers = {};
1129
1059
  const queryParameters = {};
@@ -1148,9 +1078,7 @@ function createSearchClient({
1148
1078
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1149
1079
  */
1150
1080
  deleteSource({ source }, requestOptions) {
1151
- if (!source) {
1152
- throw new Error("Parameter `source` is required when calling `deleteSource`.");
1153
- }
1081
+ (0, import_client_common.validateRequired)("source", "deleteSource", source);
1154
1082
  const requestPath = "/1/security/sources/{source}".replace("{source}", encodeURIComponent(source));
1155
1083
  const headers = {};
1156
1084
  const queryParameters = {};
@@ -1174,12 +1102,8 @@ function createSearchClient({
1174
1102
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1175
1103
  */
1176
1104
  deleteSynonym({ indexName, objectID, forwardToReplicas }, requestOptions) {
1177
- if (!indexName) {
1178
- throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");
1179
- }
1180
- if (!objectID) {
1181
- throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");
1182
- }
1105
+ (0, import_client_common.validateRequired)("indexName", "deleteSynonym", indexName);
1106
+ (0, import_client_common.validateRequired)("objectID", "deleteSynonym", objectID);
1183
1107
  const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1184
1108
  const headers = {};
1185
1109
  const queryParameters = {};
@@ -1204,9 +1128,7 @@ function createSearchClient({
1204
1128
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1205
1129
  */
1206
1130
  getApiKey({ key }, requestOptions) {
1207
- if (!key) {
1208
- throw new Error("Parameter `key` is required when calling `getApiKey`.");
1209
- }
1131
+ (0, import_client_common.validateRequired)("key", "getApiKey", key);
1210
1132
  const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
1211
1133
  const headers = {};
1212
1134
  const queryParameters = {};
@@ -1228,9 +1150,7 @@ function createSearchClient({
1228
1150
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1229
1151
  */
1230
1152
  getAppTask({ taskID }, requestOptions) {
1231
- if (!taskID) {
1232
- throw new Error("Parameter `taskID` is required when calling `getAppTask`.");
1233
- }
1153
+ (0, import_client_common.validateRequired)("taskID", "getAppTask", taskID);
1234
1154
  const requestPath = "/1/task/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
1235
1155
  const headers = {};
1236
1156
  const queryParameters = {};
@@ -1328,12 +1248,8 @@ function createSearchClient({
1328
1248
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1329
1249
  */
1330
1250
  getObject({ indexName, objectID, attributesToRetrieve }, requestOptions) {
1331
- if (!indexName) {
1332
- throw new Error("Parameter `indexName` is required when calling `getObject`.");
1333
- }
1334
- if (!objectID) {
1335
- throw new Error("Parameter `objectID` is required when calling `getObject`.");
1336
- }
1251
+ (0, import_client_common.validateRequired)("indexName", "getObject", indexName);
1252
+ (0, import_client_common.validateRequired)("objectID", "getObject", objectID);
1337
1253
  const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1338
1254
  const headers = {};
1339
1255
  const queryParameters = {};
@@ -1357,12 +1273,8 @@ function createSearchClient({
1357
1273
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1358
1274
  */
1359
1275
  getObjects(getObjectsParams, requestOptions) {
1360
- if (!getObjectsParams) {
1361
- throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");
1362
- }
1363
- if (!getObjectsParams.requests) {
1364
- throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");
1365
- }
1276
+ (0, import_client_common.validateRequired)("getObjectsParams", "getObjects", getObjectsParams);
1277
+ (0, import_client_common.validateRequired)("getObjectsParams.requests", "getObjects", getObjectsParams.requests);
1366
1278
  const requestPath = "/1/indexes/*/objects";
1367
1279
  const headers = {};
1368
1280
  const queryParameters = {};
@@ -1388,12 +1300,8 @@ function createSearchClient({
1388
1300
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1389
1301
  */
1390
1302
  getRule({ indexName, objectID }, requestOptions) {
1391
- if (!indexName) {
1392
- throw new Error("Parameter `indexName` is required when calling `getRule`.");
1393
- }
1394
- if (!objectID) {
1395
- throw new Error("Parameter `objectID` is required when calling `getRule`.");
1396
- }
1303
+ (0, import_client_common.validateRequired)("indexName", "getRule", indexName);
1304
+ (0, import_client_common.validateRequired)("objectID", "getRule", objectID);
1397
1305
  const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1398
1306
  const headers = {};
1399
1307
  const queryParameters = {};
@@ -1416,9 +1324,7 @@ function createSearchClient({
1416
1324
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1417
1325
  */
1418
1326
  getSettings({ indexName, getVersion }, requestOptions) {
1419
- if (!indexName) {
1420
- throw new Error("Parameter `indexName` is required when calling `getSettings`.");
1421
- }
1327
+ (0, import_client_common.validateRequired)("indexName", "getSettings", indexName);
1422
1328
  const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
1423
1329
  const headers = {};
1424
1330
  const queryParameters = {};
@@ -1463,12 +1369,8 @@ function createSearchClient({
1463
1369
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1464
1370
  */
1465
1371
  getSynonym({ indexName, objectID }, requestOptions) {
1466
- if (!indexName) {
1467
- throw new Error("Parameter `indexName` is required when calling `getSynonym`.");
1468
- }
1469
- if (!objectID) {
1470
- throw new Error("Parameter `objectID` is required when calling `getSynonym`.");
1471
- }
1372
+ (0, import_client_common.validateRequired)("indexName", "getSynonym", indexName);
1373
+ (0, import_client_common.validateRequired)("objectID", "getSynonym", objectID);
1472
1374
  const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1473
1375
  const headers = {};
1474
1376
  const queryParameters = {};
@@ -1491,12 +1393,8 @@ function createSearchClient({
1491
1393
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1492
1394
  */
1493
1395
  getTask({ indexName, taskID }, requestOptions) {
1494
- if (!indexName) {
1495
- throw new Error("Parameter `indexName` is required when calling `getTask`.");
1496
- }
1497
- if (!taskID) {
1498
- throw new Error("Parameter `taskID` is required when calling `getTask`.");
1499
- }
1396
+ (0, import_client_common.validateRequired)("indexName", "getTask", indexName);
1397
+ (0, import_client_common.validateRequired)("taskID", "getTask", taskID);
1500
1398
  const requestPath = "/1/indexes/{indexName}/task/{taskID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{taskID}", encodeURIComponent(taskID));
1501
1399
  const headers = {};
1502
1400
  const queryParameters = {};
@@ -1541,9 +1439,7 @@ function createSearchClient({
1541
1439
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1542
1440
  */
1543
1441
  getUserId({ userID }, requestOptions) {
1544
- if (!userID) {
1545
- throw new Error("Parameter `userID` is required when calling `getUserId`.");
1546
- }
1442
+ (0, import_client_common.validateRequired)("userID", "getUserId", userID);
1547
1443
  const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
1548
1444
  const headers = {};
1549
1445
  const queryParameters = {};
@@ -1688,12 +1584,8 @@ function createSearchClient({
1688
1584
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1689
1585
  */
1690
1586
  multipleBatch(batchParams, requestOptions) {
1691
- if (!batchParams) {
1692
- throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");
1693
- }
1694
- if (!batchParams.requests) {
1695
- throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");
1696
- }
1587
+ (0, import_client_common.validateRequired)("batchParams", "multipleBatch", batchParams);
1588
+ (0, import_client_common.validateRequired)("batchParams.requests", "multipleBatch", batchParams.requests);
1697
1589
  const requestPath = "/1/indexes/*/batch";
1698
1590
  const headers = {};
1699
1591
  const queryParameters = {};
@@ -1717,18 +1609,10 @@ function createSearchClient({
1717
1609
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1718
1610
  */
1719
1611
  operationIndex({ indexName, operationIndexParams }, requestOptions) {
1720
- if (!indexName) {
1721
- throw new Error("Parameter `indexName` is required when calling `operationIndex`.");
1722
- }
1723
- if (!operationIndexParams) {
1724
- throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");
1725
- }
1726
- if (!operationIndexParams.operation) {
1727
- throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");
1728
- }
1729
- if (!operationIndexParams.destination) {
1730
- throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");
1731
- }
1612
+ (0, import_client_common.validateRequired)("indexName", "operationIndex", indexName);
1613
+ (0, import_client_common.validateRequired)("operationIndexParams", "operationIndex", operationIndexParams);
1614
+ (0, import_client_common.validateRequired)("operationIndexParams.operation", "operationIndex", operationIndexParams.operation);
1615
+ (0, import_client_common.validateRequired)("operationIndexParams.destination", "operationIndex", operationIndexParams.destination);
1732
1616
  const requestPath = "/1/indexes/{indexName}/operation".replace("{indexName}", encodeURIComponent(indexName));
1733
1617
  const headers = {};
1734
1618
  const queryParameters = {};
@@ -1754,15 +1638,9 @@ function createSearchClient({
1754
1638
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1755
1639
  */
1756
1640
  partialUpdateObject({ indexName, objectID, attributesToUpdate, createIfNotExists }, requestOptions) {
1757
- if (!indexName) {
1758
- throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");
1759
- }
1760
- if (!objectID) {
1761
- throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");
1762
- }
1763
- if (!attributesToUpdate) {
1764
- throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");
1765
- }
1641
+ (0, import_client_common.validateRequired)("indexName", "partialUpdateObject", indexName);
1642
+ (0, import_client_common.validateRequired)("objectID", "partialUpdateObject", objectID);
1643
+ (0, import_client_common.validateRequired)("attributesToUpdate", "partialUpdateObject", attributesToUpdate);
1766
1644
  const requestPath = "/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1767
1645
  const headers = {};
1768
1646
  const queryParameters = {};
@@ -1790,9 +1668,7 @@ function createSearchClient({
1790
1668
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1791
1669
  */
1792
1670
  removeUserId({ userID }, requestOptions) {
1793
- if (!userID) {
1794
- throw new Error("Parameter `userID` is required when calling `removeUserId`.");
1795
- }
1671
+ (0, import_client_common.validateRequired)("userID", "removeUserId", userID);
1796
1672
  const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
1797
1673
  const headers = {};
1798
1674
  const queryParameters = {};
@@ -1814,9 +1690,7 @@ function createSearchClient({
1814
1690
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1815
1691
  */
1816
1692
  replaceSources({ source }, requestOptions) {
1817
- if (!source) {
1818
- throw new Error("Parameter `source` is required when calling `replaceSources`.");
1819
- }
1693
+ (0, import_client_common.validateRequired)("source", "replaceSources", source);
1820
1694
  const requestPath = "/1/security/sources";
1821
1695
  const headers = {};
1822
1696
  const queryParameters = {};
@@ -1839,9 +1713,7 @@ function createSearchClient({
1839
1713
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1840
1714
  */
1841
1715
  restoreApiKey({ key }, requestOptions) {
1842
- if (!key) {
1843
- throw new Error("Parameter `key` is required when calling `restoreApiKey`.");
1844
- }
1716
+ (0, import_client_common.validateRequired)("key", "restoreApiKey", key);
1845
1717
  const requestPath = "/1/keys/{key}/restore".replace("{key}", encodeURIComponent(key));
1846
1718
  const headers = {};
1847
1719
  const queryParameters = {};
@@ -1864,12 +1736,8 @@ function createSearchClient({
1864
1736
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1865
1737
  */
1866
1738
  saveObject({ indexName, body }, requestOptions) {
1867
- if (!indexName) {
1868
- throw new Error("Parameter `indexName` is required when calling `saveObject`.");
1869
- }
1870
- if (!body) {
1871
- throw new Error("Parameter `body` is required when calling `saveObject`.");
1872
- }
1739
+ (0, import_client_common.validateRequired)("indexName", "saveObject", indexName);
1740
+ (0, import_client_common.validateRequired)("body", "saveObject", body);
1873
1741
  const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
1874
1742
  const headers = {};
1875
1743
  const queryParameters = {};
@@ -1895,21 +1763,11 @@ function createSearchClient({
1895
1763
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1896
1764
  */
1897
1765
  saveRule({ indexName, objectID, rule, forwardToReplicas }, requestOptions) {
1898
- if (!indexName) {
1899
- throw new Error("Parameter `indexName` is required when calling `saveRule`.");
1900
- }
1901
- if (!objectID) {
1902
- throw new Error("Parameter `objectID` is required when calling `saveRule`.");
1903
- }
1904
- if (!rule) {
1905
- throw new Error("Parameter `rule` is required when calling `saveRule`.");
1906
- }
1907
- if (!rule.objectID) {
1908
- throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");
1909
- }
1910
- if (!rule.consequence) {
1911
- throw new Error("Parameter `rule.consequence` is required when calling `saveRule`.");
1912
- }
1766
+ (0, import_client_common.validateRequired)("indexName", "saveRule", indexName);
1767
+ (0, import_client_common.validateRequired)("objectID", "saveRule", objectID);
1768
+ (0, import_client_common.validateRequired)("rule", "saveRule", rule);
1769
+ (0, import_client_common.validateRequired)("rule.objectID", "saveRule", rule.objectID);
1770
+ (0, import_client_common.validateRequired)("rule.consequence", "saveRule", rule.consequence);
1913
1771
  const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1914
1772
  const headers = {};
1915
1773
  const queryParameters = {};
@@ -1938,12 +1796,8 @@ function createSearchClient({
1938
1796
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1939
1797
  */
1940
1798
  saveRules({ indexName, rules, forwardToReplicas, clearExistingRules }, requestOptions) {
1941
- if (!indexName) {
1942
- throw new Error("Parameter `indexName` is required when calling `saveRules`.");
1943
- }
1944
- if (!rules) {
1945
- throw new Error("Parameter `rules` is required when calling `saveRules`.");
1946
- }
1799
+ (0, import_client_common.validateRequired)("indexName", "saveRules", indexName);
1800
+ (0, import_client_common.validateRequired)("rules", "saveRules", rules);
1947
1801
  const requestPath = "/1/indexes/{indexName}/rules/batch".replace("{indexName}", encodeURIComponent(indexName));
1948
1802
  const headers = {};
1949
1803
  const queryParameters = {};
@@ -1975,21 +1829,11 @@ function createSearchClient({
1975
1829
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1976
1830
  */
1977
1831
  saveSynonym({ indexName, objectID, synonymHit, forwardToReplicas }, requestOptions) {
1978
- if (!indexName) {
1979
- throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");
1980
- }
1981
- if (!objectID) {
1982
- throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");
1983
- }
1984
- if (!synonymHit) {
1985
- throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");
1986
- }
1987
- if (!synonymHit.objectID) {
1988
- throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");
1989
- }
1990
- if (!synonymHit.type) {
1991
- throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");
1992
- }
1832
+ (0, import_client_common.validateRequired)("indexName", "saveSynonym", indexName);
1833
+ (0, import_client_common.validateRequired)("objectID", "saveSynonym", objectID);
1834
+ (0, import_client_common.validateRequired)("synonymHit", "saveSynonym", synonymHit);
1835
+ (0, import_client_common.validateRequired)("synonymHit.objectID", "saveSynonym", synonymHit.objectID);
1836
+ (0, import_client_common.validateRequired)("synonymHit.type", "saveSynonym", synonymHit.type);
1993
1837
  const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1994
1838
  const headers = {};
1995
1839
  const queryParameters = {};
@@ -2018,12 +1862,8 @@ function createSearchClient({
2018
1862
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2019
1863
  */
2020
1864
  saveSynonyms({ indexName, synonymHit, forwardToReplicas, replaceExistingSynonyms }, requestOptions) {
2021
- if (!indexName) {
2022
- throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");
2023
- }
2024
- if (!synonymHit) {
2025
- throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");
2026
- }
1865
+ (0, import_client_common.validateRequired)("indexName", "saveSynonyms", indexName);
1866
+ (0, import_client_common.validateRequired)("synonymHit", "saveSynonyms", synonymHit);
2027
1867
  const requestPath = "/1/indexes/{indexName}/synonyms/batch".replace("{indexName}", encodeURIComponent(indexName));
2028
1868
  const headers = {};
2029
1869
  const queryParameters = {};
@@ -2072,12 +1912,8 @@ function createSearchClient({
2072
1912
  };
2073
1913
  searchMethodParams = newSignatureRequest;
2074
1914
  }
2075
- if (!searchMethodParams) {
2076
- throw new Error("Parameter `searchMethodParams` is required when calling `search`.");
2077
- }
2078
- if (!searchMethodParams.requests) {
2079
- throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");
2080
- }
1915
+ (0, import_client_common.validateRequired)("searchMethodParams", "search", searchMethodParams);
1916
+ (0, import_client_common.validateRequired)("searchMethodParams.requests", "search", searchMethodParams.requests);
2081
1917
  const requestPath = "/1/indexes/*/queries";
2082
1918
  const headers = {};
2083
1919
  const queryParameters = {};
@@ -2103,19 +1939,13 @@ function createSearchClient({
2103
1939
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2104
1940
  */
2105
1941
  searchDictionaryEntries({ dictionaryName, searchDictionaryEntriesParams }, requestOptions) {
2106
- if (!dictionaryName) {
2107
- throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");
2108
- }
2109
- if (!searchDictionaryEntriesParams) {
2110
- throw new Error(
2111
- "Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`."
2112
- );
2113
- }
2114
- if (!searchDictionaryEntriesParams.query) {
2115
- throw new Error(
2116
- "Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`."
2117
- );
2118
- }
1942
+ (0, import_client_common.validateRequired)("dictionaryName", "searchDictionaryEntries", dictionaryName);
1943
+ (0, import_client_common.validateRequired)("searchDictionaryEntriesParams", "searchDictionaryEntries", searchDictionaryEntriesParams);
1944
+ (0, import_client_common.validateRequired)(
1945
+ "searchDictionaryEntriesParams.query",
1946
+ "searchDictionaryEntries",
1947
+ searchDictionaryEntriesParams.query
1948
+ );
2119
1949
  const requestPath = "/1/dictionaries/{dictionaryName}/search".replace(
2120
1950
  "{dictionaryName}",
2121
1951
  encodeURIComponent(dictionaryName)
@@ -2145,12 +1975,8 @@ function createSearchClient({
2145
1975
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2146
1976
  */
2147
1977
  searchForFacetValues({ indexName, facetName, searchForFacetValuesRequest }, requestOptions) {
2148
- if (!indexName) {
2149
- throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");
2150
- }
2151
- if (!facetName) {
2152
- throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");
2153
- }
1978
+ (0, import_client_common.validateRequired)("indexName", "searchForFacetValues", indexName);
1979
+ (0, import_client_common.validateRequired)("facetName", "searchForFacetValues", facetName);
2154
1980
  const requestPath = "/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}", encodeURIComponent(indexName)).replace("{facetName}", encodeURIComponent(facetName));
2155
1981
  const headers = {};
2156
1982
  const queryParameters = {};
@@ -2176,9 +2002,7 @@ function createSearchClient({
2176
2002
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2177
2003
  */
2178
2004
  searchRules({ indexName, searchRulesParams }, requestOptions) {
2179
- if (!indexName) {
2180
- throw new Error("Parameter `indexName` is required when calling `searchRules`.");
2181
- }
2005
+ (0, import_client_common.validateRequired)("indexName", "searchRules", indexName);
2182
2006
  const requestPath = "/1/indexes/{indexName}/rules/search".replace("{indexName}", encodeURIComponent(indexName));
2183
2007
  const headers = {};
2184
2008
  const queryParameters = {};
@@ -2204,9 +2028,7 @@ function createSearchClient({
2204
2028
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2205
2029
  */
2206
2030
  searchSingleIndex({ indexName, searchParams }, requestOptions) {
2207
- if (!indexName) {
2208
- throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");
2209
- }
2031
+ (0, import_client_common.validateRequired)("indexName", "searchSingleIndex", indexName);
2210
2032
  const requestPath = "/1/indexes/{indexName}/query".replace("{indexName}", encodeURIComponent(indexName));
2211
2033
  const headers = {};
2212
2034
  const queryParameters = {};
@@ -2232,9 +2054,7 @@ function createSearchClient({
2232
2054
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2233
2055
  */
2234
2056
  searchSynonyms({ indexName, searchSynonymsParams }, requestOptions) {
2235
- if (!indexName) {
2236
- throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");
2237
- }
2057
+ (0, import_client_common.validateRequired)("indexName", "searchSynonyms", indexName);
2238
2058
  const requestPath = "/1/indexes/{indexName}/synonyms/search".replace(
2239
2059
  "{indexName}",
2240
2060
  encodeURIComponent(indexName)
@@ -2263,12 +2083,8 @@ function createSearchClient({
2263
2083
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2264
2084
  */
2265
2085
  searchUserIds(searchUserIdsParams, requestOptions) {
2266
- if (!searchUserIdsParams) {
2267
- throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");
2268
- }
2269
- if (!searchUserIdsParams.query) {
2270
- throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");
2271
- }
2086
+ (0, import_client_common.validateRequired)("searchUserIdsParams", "searchUserIds", searchUserIdsParams);
2087
+ (0, import_client_common.validateRequired)("searchUserIdsParams.query", "searchUserIds", searchUserIdsParams.query);
2272
2088
  const requestPath = "/1/clusters/mapping/search";
2273
2089
  const headers = {};
2274
2090
  const queryParameters = {};
@@ -2292,14 +2108,12 @@ function createSearchClient({
2292
2108
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2293
2109
  */
2294
2110
  setDictionarySettings(dictionarySettingsParams, requestOptions) {
2295
- if (!dictionarySettingsParams) {
2296
- throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");
2297
- }
2298
- if (!dictionarySettingsParams.disableStandardEntries) {
2299
- throw new Error(
2300
- "Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`."
2301
- );
2302
- }
2111
+ (0, import_client_common.validateRequired)("dictionarySettingsParams", "setDictionarySettings", dictionarySettingsParams);
2112
+ (0, import_client_common.validateRequired)(
2113
+ "dictionarySettingsParams.disableStandardEntries",
2114
+ "setDictionarySettings",
2115
+ dictionarySettingsParams.disableStandardEntries
2116
+ );
2303
2117
  const requestPath = "/1/dictionaries/*/settings";
2304
2118
  const headers = {};
2305
2119
  const queryParameters = {};
@@ -2324,12 +2138,8 @@ function createSearchClient({
2324
2138
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2325
2139
  */
2326
2140
  setSettings({ indexName, indexSettings, forwardToReplicas }, requestOptions) {
2327
- if (!indexName) {
2328
- throw new Error("Parameter `indexName` is required when calling `setSettings`.");
2329
- }
2330
- if (!indexSettings) {
2331
- throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");
2332
- }
2141
+ (0, import_client_common.validateRequired)("indexName", "setSettings", indexName);
2142
+ (0, import_client_common.validateRequired)("indexSettings", "setSettings", indexSettings);
2333
2143
  const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
2334
2144
  const headers = {};
2335
2145
  const queryParameters = {};
@@ -2356,15 +2166,9 @@ function createSearchClient({
2356
2166
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2357
2167
  */
2358
2168
  updateApiKey({ key, apiKey }, requestOptions) {
2359
- if (!key) {
2360
- throw new Error("Parameter `key` is required when calling `updateApiKey`.");
2361
- }
2362
- if (!apiKey) {
2363
- throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");
2364
- }
2365
- if (!apiKey.acl) {
2366
- throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");
2367
- }
2169
+ (0, import_client_common.validateRequired)("key", "updateApiKey", key);
2170
+ (0, import_client_common.validateRequired)("apiKey", "updateApiKey", apiKey);
2171
+ (0, import_client_common.validateRequired)("apiKey.acl", "updateApiKey", apiKey.acl);
2368
2172
  const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
2369
2173
  const headers = {};
2370
2174
  const queryParameters = {};