@algolia/client-search 5.52.1 → 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.
- package/README.md +4 -4
- package/dist/browser.d.ts +88 -14
- package/dist/builds/browser.js +145 -323
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +5 -1
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +7 -3
- package/dist/builds/fetch.js +149 -325
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +147 -324
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +149 -325
- package/dist/builds/node.js.map +1 -1
- package/dist/builds/worker.js +145 -323
- package/dist/builds/worker.js.map +1 -1
- package/dist/fetch.d.ts +88 -14
- package/dist/node.d.cts +88 -14
- package/dist/node.d.ts +88 -14
- package/dist/src/searchClient.cjs +143 -322
- package/dist/src/searchClient.cjs.map +1 -1
- package/dist/src/searchClient.js +147 -328
- package/dist/src/searchClient.js.map +1 -1
- package/dist/worker.d.ts +88 -14
- package/package.json +9 -9
package/dist/builds/worker.js
CHANGED
|
@@ -9,9 +9,10 @@ import {
|
|
|
9
9
|
createIterablePromise,
|
|
10
10
|
createTransporter,
|
|
11
11
|
getAlgoliaAgent,
|
|
12
|
-
shuffle
|
|
12
|
+
shuffle,
|
|
13
|
+
validateRequired
|
|
13
14
|
} from "@algolia/client-common";
|
|
14
|
-
var apiClientVersion = "5.
|
|
15
|
+
var apiClientVersion = "5.54.0";
|
|
15
16
|
function getDefaultHosts(appId) {
|
|
16
17
|
return [
|
|
17
18
|
{
|
|
@@ -345,9 +346,17 @@ function createSearchClient({
|
|
|
345
346
|
* @param chunkedBatch.action - The `batch` `action` to perform on the given array of `objects`, defaults to `addObject`.
|
|
346
347
|
* @param chunkedBatch.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
|
|
347
348
|
* @param chunkedBatch.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
|
|
349
|
+
* @param chunkedBatch.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
348
350
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
|
|
349
351
|
*/
|
|
350
|
-
async chunkedBatch({
|
|
352
|
+
async chunkedBatch({
|
|
353
|
+
indexName,
|
|
354
|
+
objects,
|
|
355
|
+
action = "addObject",
|
|
356
|
+
waitForTasks,
|
|
357
|
+
batchSize = 1e3,
|
|
358
|
+
maxRetries = 100
|
|
359
|
+
}, requestOptions) {
|
|
351
360
|
let requests = [];
|
|
352
361
|
const responses = [];
|
|
353
362
|
const objectEntries = objects.entries();
|
|
@@ -360,7 +369,7 @@ function createSearchClient({
|
|
|
360
369
|
}
|
|
361
370
|
if (waitForTasks) {
|
|
362
371
|
for (const resp of responses) {
|
|
363
|
-
await this.waitForTask({ indexName, taskID: resp.taskID });
|
|
372
|
+
await this.waitForTask({ indexName, taskID: resp.taskID, maxRetries });
|
|
364
373
|
}
|
|
365
374
|
}
|
|
366
375
|
return responses;
|
|
@@ -374,11 +383,12 @@ function createSearchClient({
|
|
|
374
383
|
* @param saveObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
375
384
|
* @param saveObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
|
|
376
385
|
* @param saveObjects.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
|
|
386
|
+
* @param saveObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
377
387
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
|
|
378
388
|
*/
|
|
379
|
-
async saveObjects({ indexName, objects, waitForTasks, batchSize }, requestOptions) {
|
|
389
|
+
async saveObjects({ indexName, objects, waitForTasks, batchSize, maxRetries }, requestOptions) {
|
|
380
390
|
return await this.chunkedBatch(
|
|
381
|
-
{ indexName, objects, action: "addObject", waitForTasks, batchSize },
|
|
391
|
+
{ indexName, objects, action: "addObject", waitForTasks, batchSize, maxRetries },
|
|
382
392
|
requestOptions
|
|
383
393
|
);
|
|
384
394
|
},
|
|
@@ -391,16 +401,18 @@ function createSearchClient({
|
|
|
391
401
|
* @param deleteObjects.objectIDs - The objectIDs to delete.
|
|
392
402
|
* @param deleteObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
|
|
393
403
|
* @param deleteObjects.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
|
|
404
|
+
* @param deleteObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
394
405
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
|
|
395
406
|
*/
|
|
396
|
-
async deleteObjects({ indexName, objectIDs, waitForTasks, batchSize }, requestOptions) {
|
|
407
|
+
async deleteObjects({ indexName, objectIDs, waitForTasks, batchSize, maxRetries }, requestOptions) {
|
|
397
408
|
return await this.chunkedBatch(
|
|
398
409
|
{
|
|
399
410
|
indexName,
|
|
400
411
|
objects: objectIDs.map((objectID) => ({ objectID })),
|
|
401
412
|
action: "deleteObject",
|
|
402
413
|
waitForTasks,
|
|
403
|
-
batchSize
|
|
414
|
+
batchSize,
|
|
415
|
+
maxRetries
|
|
404
416
|
},
|
|
405
417
|
requestOptions
|
|
406
418
|
);
|
|
@@ -415,16 +427,18 @@ function createSearchClient({
|
|
|
415
427
|
* @param partialUpdateObjects.createIfNotExists - To be provided if non-existing objects are passed, otherwise, the call will fail.
|
|
416
428
|
* @param partialUpdateObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
|
|
417
429
|
* @param partialUpdateObjects.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
|
|
430
|
+
* @param partialUpdateObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
418
431
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
|
|
419
432
|
*/
|
|
420
|
-
async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks, batchSize }, requestOptions) {
|
|
433
|
+
async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks, batchSize, maxRetries }, requestOptions) {
|
|
421
434
|
return await this.chunkedBatch(
|
|
422
435
|
{
|
|
423
436
|
indexName,
|
|
424
437
|
objects,
|
|
425
438
|
action: createIfNotExists ? "partialUpdateObject" : "partialUpdateObjectNoCreate",
|
|
426
439
|
batchSize,
|
|
427
|
-
waitForTasks
|
|
440
|
+
waitForTasks,
|
|
441
|
+
maxRetries
|
|
428
442
|
},
|
|
429
443
|
requestOptions
|
|
430
444
|
);
|
|
@@ -439,9 +453,10 @@ function createSearchClient({
|
|
|
439
453
|
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
440
454
|
* @param replaceAllObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `objects.length / batchSize`. Defaults to 1000.
|
|
441
455
|
* @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
|
|
456
|
+
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
442
457
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch`, `operationIndex` and `getTask` method and merged with the transporter requestOptions.
|
|
443
458
|
*/
|
|
444
|
-
async replaceAllObjects({ indexName, objects, batchSize, scopes }, requestOptions) {
|
|
459
|
+
async replaceAllObjects({ indexName, objects, batchSize, scopes, maxRetries = 100 }, requestOptions) {
|
|
445
460
|
const randomSuffix = Math.floor(Math.random() * 1e6) + 1e5;
|
|
446
461
|
const tmpIndexName = `${indexName}_tmp_${randomSuffix}`;
|
|
447
462
|
if (scopes === void 0) {
|
|
@@ -460,12 +475,13 @@ function createSearchClient({
|
|
|
460
475
|
requestOptions
|
|
461
476
|
);
|
|
462
477
|
const batchResponses = await this.chunkedBatch(
|
|
463
|
-
{ indexName: tmpIndexName, objects, waitForTasks: true, batchSize },
|
|
478
|
+
{ indexName: tmpIndexName, objects, waitForTasks: true, batchSize, maxRetries },
|
|
464
479
|
requestOptions
|
|
465
480
|
);
|
|
466
481
|
await this.waitForTask({
|
|
467
482
|
indexName: tmpIndexName,
|
|
468
|
-
taskID: copyOperationResponse.taskID
|
|
483
|
+
taskID: copyOperationResponse.taskID,
|
|
484
|
+
maxRetries
|
|
469
485
|
});
|
|
470
486
|
copyOperationResponse = await this.operationIndex(
|
|
471
487
|
{
|
|
@@ -480,7 +496,8 @@ function createSearchClient({
|
|
|
480
496
|
);
|
|
481
497
|
await this.waitForTask({
|
|
482
498
|
indexName: tmpIndexName,
|
|
483
|
-
taskID: copyOperationResponse.taskID
|
|
499
|
+
taskID: copyOperationResponse.taskID,
|
|
500
|
+
maxRetries
|
|
484
501
|
});
|
|
485
502
|
const moveOperationResponse = await this.operationIndex(
|
|
486
503
|
{
|
|
@@ -491,7 +508,8 @@ function createSearchClient({
|
|
|
491
508
|
);
|
|
492
509
|
await this.waitForTask({
|
|
493
510
|
indexName: tmpIndexName,
|
|
494
|
-
taskID: moveOperationResponse.taskID
|
|
511
|
+
taskID: moveOperationResponse.taskID,
|
|
512
|
+
maxRetries
|
|
495
513
|
});
|
|
496
514
|
return { copyOperationResponse, batchResponses, moveOperationResponse };
|
|
497
515
|
} catch (error) {
|
|
@@ -541,12 +559,8 @@ function createSearchClient({
|
|
|
541
559
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
542
560
|
*/
|
|
543
561
|
addApiKey(apiKey, requestOptions) {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
}
|
|
547
|
-
if (!apiKey.acl) {
|
|
548
|
-
throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");
|
|
549
|
-
}
|
|
562
|
+
validateRequired("apiKey", "addApiKey", apiKey);
|
|
563
|
+
validateRequired("apiKey.acl", "addApiKey", apiKey.acl);
|
|
550
564
|
const requestPath = "/1/keys";
|
|
551
565
|
const headers = {};
|
|
552
566
|
const queryParameters = {};
|
|
@@ -571,15 +585,9 @@ function createSearchClient({
|
|
|
571
585
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
572
586
|
*/
|
|
573
587
|
addOrUpdateObject({ indexName, objectID, body }, requestOptions) {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
if (!objectID) {
|
|
578
|
-
throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");
|
|
579
|
-
}
|
|
580
|
-
if (!body) {
|
|
581
|
-
throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");
|
|
582
|
-
}
|
|
588
|
+
validateRequired("indexName", "addOrUpdateObject", indexName);
|
|
589
|
+
validateRequired("objectID", "addOrUpdateObject", objectID);
|
|
590
|
+
validateRequired("body", "addOrUpdateObject", body);
|
|
583
591
|
const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
584
592
|
const headers = {};
|
|
585
593
|
const queryParameters = {};
|
|
@@ -601,12 +609,8 @@ function createSearchClient({
|
|
|
601
609
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
602
610
|
*/
|
|
603
611
|
appendSource(source, requestOptions) {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
}
|
|
607
|
-
if (!source.source) {
|
|
608
|
-
throw new Error("Parameter `source.source` is required when calling `appendSource`.");
|
|
609
|
-
}
|
|
612
|
+
validateRequired("source", "appendSource", source);
|
|
613
|
+
validateRequired("source.source", "appendSource", source.source);
|
|
610
614
|
const requestPath = "/1/security/sources/append";
|
|
611
615
|
const headers = {};
|
|
612
616
|
const queryParameters = {};
|
|
@@ -632,15 +636,9 @@ function createSearchClient({
|
|
|
632
636
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
633
637
|
*/
|
|
634
638
|
assignUserId({ xAlgoliaUserID, assignUserIdParams }, requestOptions) {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
if (!assignUserIdParams) {
|
|
639
|
-
throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");
|
|
640
|
-
}
|
|
641
|
-
if (!assignUserIdParams.cluster) {
|
|
642
|
-
throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");
|
|
643
|
-
}
|
|
639
|
+
validateRequired("xAlgoliaUserID", "assignUserId", xAlgoliaUserID);
|
|
640
|
+
validateRequired("assignUserIdParams", "assignUserId", assignUserIdParams);
|
|
641
|
+
validateRequired("assignUserIdParams.cluster", "assignUserId", assignUserIdParams.cluster);
|
|
644
642
|
const requestPath = "/1/clusters/mapping";
|
|
645
643
|
const headers = {};
|
|
646
644
|
const queryParameters = {};
|
|
@@ -667,15 +665,9 @@ function createSearchClient({
|
|
|
667
665
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
668
666
|
*/
|
|
669
667
|
batch({ indexName, batchWriteParams }, requestOptions) {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
if (!batchWriteParams) {
|
|
674
|
-
throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");
|
|
675
|
-
}
|
|
676
|
-
if (!batchWriteParams.requests) {
|
|
677
|
-
throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");
|
|
678
|
-
}
|
|
668
|
+
validateRequired("indexName", "batch", indexName);
|
|
669
|
+
validateRequired("batchWriteParams", "batch", batchWriteParams);
|
|
670
|
+
validateRequired("batchWriteParams.requests", "batch", batchWriteParams.requests);
|
|
679
671
|
const requestPath = "/1/indexes/{indexName}/batch".replace("{indexName}", encodeURIComponent(indexName));
|
|
680
672
|
const headers = {};
|
|
681
673
|
const queryParameters = {};
|
|
@@ -701,18 +693,10 @@ function createSearchClient({
|
|
|
701
693
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
702
694
|
*/
|
|
703
695
|
batchAssignUserIds({ xAlgoliaUserID, batchAssignUserIdsParams }, requestOptions) {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");
|
|
709
|
-
}
|
|
710
|
-
if (!batchAssignUserIdsParams.cluster) {
|
|
711
|
-
throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");
|
|
712
|
-
}
|
|
713
|
-
if (!batchAssignUserIdsParams.users) {
|
|
714
|
-
throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");
|
|
715
|
-
}
|
|
696
|
+
validateRequired("xAlgoliaUserID", "batchAssignUserIds", xAlgoliaUserID);
|
|
697
|
+
validateRequired("batchAssignUserIdsParams", "batchAssignUserIds", batchAssignUserIdsParams);
|
|
698
|
+
validateRequired("batchAssignUserIdsParams.cluster", "batchAssignUserIds", batchAssignUserIdsParams.cluster);
|
|
699
|
+
validateRequired("batchAssignUserIdsParams.users", "batchAssignUserIds", batchAssignUserIdsParams.users);
|
|
716
700
|
const requestPath = "/1/clusters/mapping/batch";
|
|
717
701
|
const headers = {};
|
|
718
702
|
const queryParameters = {};
|
|
@@ -739,17 +723,13 @@ function createSearchClient({
|
|
|
739
723
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
740
724
|
*/
|
|
741
725
|
batchDictionaryEntries({ dictionaryName, batchDictionaryEntriesParams }, requestOptions) {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
throw new Error(
|
|
750
|
-
"Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`."
|
|
751
|
-
);
|
|
752
|
-
}
|
|
726
|
+
validateRequired("dictionaryName", "batchDictionaryEntries", dictionaryName);
|
|
727
|
+
validateRequired("batchDictionaryEntriesParams", "batchDictionaryEntries", batchDictionaryEntriesParams);
|
|
728
|
+
validateRequired(
|
|
729
|
+
"batchDictionaryEntriesParams.requests",
|
|
730
|
+
"batchDictionaryEntries",
|
|
731
|
+
batchDictionaryEntriesParams.requests
|
|
732
|
+
);
|
|
753
733
|
const requestPath = "/1/dictionaries/{dictionaryName}/batch".replace(
|
|
754
734
|
"{dictionaryName}",
|
|
755
735
|
encodeURIComponent(dictionaryName)
|
|
@@ -776,9 +756,7 @@ function createSearchClient({
|
|
|
776
756
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
777
757
|
*/
|
|
778
758
|
browse({ indexName, browseParams }, requestOptions) {
|
|
779
|
-
|
|
780
|
-
throw new Error("Parameter `indexName` is required when calling `browse`.");
|
|
781
|
-
}
|
|
759
|
+
validateRequired("indexName", "browse", indexName);
|
|
782
760
|
const requestPath = "/1/indexes/{indexName}/browse".replace("{indexName}", encodeURIComponent(indexName));
|
|
783
761
|
const headers = {};
|
|
784
762
|
const queryParameters = {};
|
|
@@ -802,9 +780,7 @@ function createSearchClient({
|
|
|
802
780
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
803
781
|
*/
|
|
804
782
|
clearObjects({ indexName }, requestOptions) {
|
|
805
|
-
|
|
806
|
-
throw new Error("Parameter `indexName` is required when calling `clearObjects`.");
|
|
807
|
-
}
|
|
783
|
+
validateRequired("indexName", "clearObjects", indexName);
|
|
808
784
|
const requestPath = "/1/indexes/{indexName}/clear".replace("{indexName}", encodeURIComponent(indexName));
|
|
809
785
|
const headers = {};
|
|
810
786
|
const queryParameters = {};
|
|
@@ -827,9 +803,7 @@ function createSearchClient({
|
|
|
827
803
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
828
804
|
*/
|
|
829
805
|
clearRules({ indexName, forwardToReplicas }, requestOptions) {
|
|
830
|
-
|
|
831
|
-
throw new Error("Parameter `indexName` is required when calling `clearRules`.");
|
|
832
|
-
}
|
|
806
|
+
validateRequired("indexName", "clearRules", indexName);
|
|
833
807
|
const requestPath = "/1/indexes/{indexName}/rules/clear".replace("{indexName}", encodeURIComponent(indexName));
|
|
834
808
|
const headers = {};
|
|
835
809
|
const queryParameters = {};
|
|
@@ -855,9 +829,7 @@ function createSearchClient({
|
|
|
855
829
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
856
830
|
*/
|
|
857
831
|
clearSynonyms({ indexName, forwardToReplicas }, requestOptions) {
|
|
858
|
-
|
|
859
|
-
throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");
|
|
860
|
-
}
|
|
832
|
+
validateRequired("indexName", "clearSynonyms", indexName);
|
|
861
833
|
const requestPath = "/1/indexes/{indexName}/synonyms/clear".replace("{indexName}", encodeURIComponent(indexName));
|
|
862
834
|
const headers = {};
|
|
863
835
|
const queryParameters = {};
|
|
@@ -880,9 +852,7 @@ function createSearchClient({
|
|
|
880
852
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
881
853
|
*/
|
|
882
854
|
customDelete({ path, parameters }, requestOptions) {
|
|
883
|
-
|
|
884
|
-
throw new Error("Parameter `path` is required when calling `customDelete`.");
|
|
885
|
-
}
|
|
855
|
+
validateRequired("path", "customDelete", path);
|
|
886
856
|
const requestPath = "/{path}".replace("{path}", path);
|
|
887
857
|
const headers = {};
|
|
888
858
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -902,9 +872,7 @@ function createSearchClient({
|
|
|
902
872
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
903
873
|
*/
|
|
904
874
|
customGet({ path, parameters }, requestOptions) {
|
|
905
|
-
|
|
906
|
-
throw new Error("Parameter `path` is required when calling `customGet`.");
|
|
907
|
-
}
|
|
875
|
+
validateRequired("path", "customGet", path);
|
|
908
876
|
const requestPath = "/{path}".replace("{path}", path);
|
|
909
877
|
const headers = {};
|
|
910
878
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -925,9 +893,7 @@ function createSearchClient({
|
|
|
925
893
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
926
894
|
*/
|
|
927
895
|
customPost({ path, parameters, body }, requestOptions) {
|
|
928
|
-
|
|
929
|
-
throw new Error("Parameter `path` is required when calling `customPost`.");
|
|
930
|
-
}
|
|
896
|
+
validateRequired("path", "customPost", path);
|
|
931
897
|
const requestPath = "/{path}".replace("{path}", path);
|
|
932
898
|
const headers = {};
|
|
933
899
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -949,9 +915,7 @@ function createSearchClient({
|
|
|
949
915
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
950
916
|
*/
|
|
951
917
|
customPut({ path, parameters, body }, requestOptions) {
|
|
952
|
-
|
|
953
|
-
throw new Error("Parameter `path` is required when calling `customPut`.");
|
|
954
|
-
}
|
|
918
|
+
validateRequired("path", "customPut", path);
|
|
955
919
|
const requestPath = "/{path}".replace("{path}", path);
|
|
956
920
|
const headers = {};
|
|
957
921
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -974,9 +938,7 @@ function createSearchClient({
|
|
|
974
938
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
975
939
|
*/
|
|
976
940
|
deleteApiKey({ key }, requestOptions) {
|
|
977
|
-
|
|
978
|
-
throw new Error("Parameter `key` is required when calling `deleteApiKey`.");
|
|
979
|
-
}
|
|
941
|
+
validateRequired("key", "deleteApiKey", key);
|
|
980
942
|
const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
|
|
981
943
|
const headers = {};
|
|
982
944
|
const queryParameters = {};
|
|
@@ -999,12 +961,8 @@ function createSearchClient({
|
|
|
999
961
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1000
962
|
*/
|
|
1001
963
|
deleteBy({ indexName, deleteByParams }, requestOptions) {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
}
|
|
1005
|
-
if (!deleteByParams) {
|
|
1006
|
-
throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");
|
|
1007
|
-
}
|
|
964
|
+
validateRequired("indexName", "deleteBy", indexName);
|
|
965
|
+
validateRequired("deleteByParams", "deleteBy", deleteByParams);
|
|
1008
966
|
const requestPath = "/1/indexes/{indexName}/deleteByQuery".replace("{indexName}", encodeURIComponent(indexName));
|
|
1009
967
|
const headers = {};
|
|
1010
968
|
const queryParameters = {};
|
|
@@ -1027,9 +985,7 @@ function createSearchClient({
|
|
|
1027
985
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1028
986
|
*/
|
|
1029
987
|
deleteIndex({ indexName }, requestOptions) {
|
|
1030
|
-
|
|
1031
|
-
throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");
|
|
1032
|
-
}
|
|
988
|
+
validateRequired("indexName", "deleteIndex", indexName);
|
|
1033
989
|
const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
1034
990
|
const headers = {};
|
|
1035
991
|
const queryParameters = {};
|
|
@@ -1052,12 +1008,8 @@ function createSearchClient({
|
|
|
1052
1008
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1053
1009
|
*/
|
|
1054
1010
|
deleteObject({ indexName, objectID }, requestOptions) {
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
}
|
|
1058
|
-
if (!objectID) {
|
|
1059
|
-
throw new Error("Parameter `objectID` is required when calling `deleteObject`.");
|
|
1060
|
-
}
|
|
1011
|
+
validateRequired("indexName", "deleteObject", indexName);
|
|
1012
|
+
validateRequired("objectID", "deleteObject", objectID);
|
|
1061
1013
|
const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1062
1014
|
const headers = {};
|
|
1063
1015
|
const queryParameters = {};
|
|
@@ -1081,12 +1033,8 @@ function createSearchClient({
|
|
|
1081
1033
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1082
1034
|
*/
|
|
1083
1035
|
deleteRule({ indexName, objectID, forwardToReplicas }, requestOptions) {
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
}
|
|
1087
|
-
if (!objectID) {
|
|
1088
|
-
throw new Error("Parameter `objectID` is required when calling `deleteRule`.");
|
|
1089
|
-
}
|
|
1036
|
+
validateRequired("indexName", "deleteRule", indexName);
|
|
1037
|
+
validateRequired("objectID", "deleteRule", objectID);
|
|
1090
1038
|
const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1091
1039
|
const headers = {};
|
|
1092
1040
|
const queryParameters = {};
|
|
@@ -1111,9 +1059,7 @@ function createSearchClient({
|
|
|
1111
1059
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1112
1060
|
*/
|
|
1113
1061
|
deleteSource({ source }, requestOptions) {
|
|
1114
|
-
|
|
1115
|
-
throw new Error("Parameter `source` is required when calling `deleteSource`.");
|
|
1116
|
-
}
|
|
1062
|
+
validateRequired("source", "deleteSource", source);
|
|
1117
1063
|
const requestPath = "/1/security/sources/{source}".replace("{source}", encodeURIComponent(source));
|
|
1118
1064
|
const headers = {};
|
|
1119
1065
|
const queryParameters = {};
|
|
@@ -1137,12 +1083,8 @@ function createSearchClient({
|
|
|
1137
1083
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1138
1084
|
*/
|
|
1139
1085
|
deleteSynonym({ indexName, objectID, forwardToReplicas }, requestOptions) {
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
}
|
|
1143
|
-
if (!objectID) {
|
|
1144
|
-
throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");
|
|
1145
|
-
}
|
|
1086
|
+
validateRequired("indexName", "deleteSynonym", indexName);
|
|
1087
|
+
validateRequired("objectID", "deleteSynonym", objectID);
|
|
1146
1088
|
const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1147
1089
|
const headers = {};
|
|
1148
1090
|
const queryParameters = {};
|
|
@@ -1167,9 +1109,7 @@ function createSearchClient({
|
|
|
1167
1109
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1168
1110
|
*/
|
|
1169
1111
|
getApiKey({ key }, requestOptions) {
|
|
1170
|
-
|
|
1171
|
-
throw new Error("Parameter `key` is required when calling `getApiKey`.");
|
|
1172
|
-
}
|
|
1112
|
+
validateRequired("key", "getApiKey", key);
|
|
1173
1113
|
const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
|
|
1174
1114
|
const headers = {};
|
|
1175
1115
|
const queryParameters = {};
|
|
@@ -1191,9 +1131,7 @@ function createSearchClient({
|
|
|
1191
1131
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1192
1132
|
*/
|
|
1193
1133
|
getAppTask({ taskID }, requestOptions) {
|
|
1194
|
-
|
|
1195
|
-
throw new Error("Parameter `taskID` is required when calling `getAppTask`.");
|
|
1196
|
-
}
|
|
1134
|
+
validateRequired("taskID", "getAppTask", taskID);
|
|
1197
1135
|
const requestPath = "/1/task/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
|
|
1198
1136
|
const headers = {};
|
|
1199
1137
|
const queryParameters = {};
|
|
@@ -1291,12 +1229,8 @@ function createSearchClient({
|
|
|
1291
1229
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1292
1230
|
*/
|
|
1293
1231
|
getObject({ indexName, objectID, attributesToRetrieve }, requestOptions) {
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
}
|
|
1297
|
-
if (!objectID) {
|
|
1298
|
-
throw new Error("Parameter `objectID` is required when calling `getObject`.");
|
|
1299
|
-
}
|
|
1232
|
+
validateRequired("indexName", "getObject", indexName);
|
|
1233
|
+
validateRequired("objectID", "getObject", objectID);
|
|
1300
1234
|
const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1301
1235
|
const headers = {};
|
|
1302
1236
|
const queryParameters = {};
|
|
@@ -1320,12 +1254,8 @@ function createSearchClient({
|
|
|
1320
1254
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1321
1255
|
*/
|
|
1322
1256
|
getObjects(getObjectsParams, requestOptions) {
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
}
|
|
1326
|
-
if (!getObjectsParams.requests) {
|
|
1327
|
-
throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");
|
|
1328
|
-
}
|
|
1257
|
+
validateRequired("getObjectsParams", "getObjects", getObjectsParams);
|
|
1258
|
+
validateRequired("getObjectsParams.requests", "getObjects", getObjectsParams.requests);
|
|
1329
1259
|
const requestPath = "/1/indexes/*/objects";
|
|
1330
1260
|
const headers = {};
|
|
1331
1261
|
const queryParameters = {};
|
|
@@ -1351,12 +1281,8 @@ function createSearchClient({
|
|
|
1351
1281
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1352
1282
|
*/
|
|
1353
1283
|
getRule({ indexName, objectID }, requestOptions) {
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
}
|
|
1357
|
-
if (!objectID) {
|
|
1358
|
-
throw new Error("Parameter `objectID` is required when calling `getRule`.");
|
|
1359
|
-
}
|
|
1284
|
+
validateRequired("indexName", "getRule", indexName);
|
|
1285
|
+
validateRequired("objectID", "getRule", objectID);
|
|
1360
1286
|
const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1361
1287
|
const headers = {};
|
|
1362
1288
|
const queryParameters = {};
|
|
@@ -1379,9 +1305,7 @@ function createSearchClient({
|
|
|
1379
1305
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1380
1306
|
*/
|
|
1381
1307
|
getSettings({ indexName, getVersion }, requestOptions) {
|
|
1382
|
-
|
|
1383
|
-
throw new Error("Parameter `indexName` is required when calling `getSettings`.");
|
|
1384
|
-
}
|
|
1308
|
+
validateRequired("indexName", "getSettings", indexName);
|
|
1385
1309
|
const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
|
|
1386
1310
|
const headers = {};
|
|
1387
1311
|
const queryParameters = {};
|
|
@@ -1426,12 +1350,8 @@ function createSearchClient({
|
|
|
1426
1350
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1427
1351
|
*/
|
|
1428
1352
|
getSynonym({ indexName, objectID }, requestOptions) {
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
}
|
|
1432
|
-
if (!objectID) {
|
|
1433
|
-
throw new Error("Parameter `objectID` is required when calling `getSynonym`.");
|
|
1434
|
-
}
|
|
1353
|
+
validateRequired("indexName", "getSynonym", indexName);
|
|
1354
|
+
validateRequired("objectID", "getSynonym", objectID);
|
|
1435
1355
|
const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1436
1356
|
const headers = {};
|
|
1437
1357
|
const queryParameters = {};
|
|
@@ -1454,12 +1374,8 @@ function createSearchClient({
|
|
|
1454
1374
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1455
1375
|
*/
|
|
1456
1376
|
getTask({ indexName, taskID }, requestOptions) {
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
}
|
|
1460
|
-
if (!taskID) {
|
|
1461
|
-
throw new Error("Parameter `taskID` is required when calling `getTask`.");
|
|
1462
|
-
}
|
|
1377
|
+
validateRequired("indexName", "getTask", indexName);
|
|
1378
|
+
validateRequired("taskID", "getTask", taskID);
|
|
1463
1379
|
const requestPath = "/1/indexes/{indexName}/task/{taskID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{taskID}", encodeURIComponent(taskID));
|
|
1464
1380
|
const headers = {};
|
|
1465
1381
|
const queryParameters = {};
|
|
@@ -1504,9 +1420,7 @@ function createSearchClient({
|
|
|
1504
1420
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1505
1421
|
*/
|
|
1506
1422
|
getUserId({ userID }, requestOptions) {
|
|
1507
|
-
|
|
1508
|
-
throw new Error("Parameter `userID` is required when calling `getUserId`.");
|
|
1509
|
-
}
|
|
1423
|
+
validateRequired("userID", "getUserId", userID);
|
|
1510
1424
|
const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
|
|
1511
1425
|
const headers = {};
|
|
1512
1426
|
const queryParameters = {};
|
|
@@ -1651,12 +1565,8 @@ function createSearchClient({
|
|
|
1651
1565
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1652
1566
|
*/
|
|
1653
1567
|
multipleBatch(batchParams, requestOptions) {
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
}
|
|
1657
|
-
if (!batchParams.requests) {
|
|
1658
|
-
throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");
|
|
1659
|
-
}
|
|
1568
|
+
validateRequired("batchParams", "multipleBatch", batchParams);
|
|
1569
|
+
validateRequired("batchParams.requests", "multipleBatch", batchParams.requests);
|
|
1660
1570
|
const requestPath = "/1/indexes/*/batch";
|
|
1661
1571
|
const headers = {};
|
|
1662
1572
|
const queryParameters = {};
|
|
@@ -1680,18 +1590,10 @@ function createSearchClient({
|
|
|
1680
1590
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1681
1591
|
*/
|
|
1682
1592
|
operationIndex({ indexName, operationIndexParams }, requestOptions) {
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");
|
|
1688
|
-
}
|
|
1689
|
-
if (!operationIndexParams.operation) {
|
|
1690
|
-
throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");
|
|
1691
|
-
}
|
|
1692
|
-
if (!operationIndexParams.destination) {
|
|
1693
|
-
throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");
|
|
1694
|
-
}
|
|
1593
|
+
validateRequired("indexName", "operationIndex", indexName);
|
|
1594
|
+
validateRequired("operationIndexParams", "operationIndex", operationIndexParams);
|
|
1595
|
+
validateRequired("operationIndexParams.operation", "operationIndex", operationIndexParams.operation);
|
|
1596
|
+
validateRequired("operationIndexParams.destination", "operationIndex", operationIndexParams.destination);
|
|
1695
1597
|
const requestPath = "/1/indexes/{indexName}/operation".replace("{indexName}", encodeURIComponent(indexName));
|
|
1696
1598
|
const headers = {};
|
|
1697
1599
|
const queryParameters = {};
|
|
@@ -1717,15 +1619,9 @@ function createSearchClient({
|
|
|
1717
1619
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1718
1620
|
*/
|
|
1719
1621
|
partialUpdateObject({ indexName, objectID, attributesToUpdate, createIfNotExists }, requestOptions) {
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
if (!objectID) {
|
|
1724
|
-
throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");
|
|
1725
|
-
}
|
|
1726
|
-
if (!attributesToUpdate) {
|
|
1727
|
-
throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");
|
|
1728
|
-
}
|
|
1622
|
+
validateRequired("indexName", "partialUpdateObject", indexName);
|
|
1623
|
+
validateRequired("objectID", "partialUpdateObject", objectID);
|
|
1624
|
+
validateRequired("attributesToUpdate", "partialUpdateObject", attributesToUpdate);
|
|
1729
1625
|
const requestPath = "/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1730
1626
|
const headers = {};
|
|
1731
1627
|
const queryParameters = {};
|
|
@@ -1753,9 +1649,7 @@ function createSearchClient({
|
|
|
1753
1649
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1754
1650
|
*/
|
|
1755
1651
|
removeUserId({ userID }, requestOptions) {
|
|
1756
|
-
|
|
1757
|
-
throw new Error("Parameter `userID` is required when calling `removeUserId`.");
|
|
1758
|
-
}
|
|
1652
|
+
validateRequired("userID", "removeUserId", userID);
|
|
1759
1653
|
const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
|
|
1760
1654
|
const headers = {};
|
|
1761
1655
|
const queryParameters = {};
|
|
@@ -1777,9 +1671,7 @@ function createSearchClient({
|
|
|
1777
1671
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1778
1672
|
*/
|
|
1779
1673
|
replaceSources({ source }, requestOptions) {
|
|
1780
|
-
|
|
1781
|
-
throw new Error("Parameter `source` is required when calling `replaceSources`.");
|
|
1782
|
-
}
|
|
1674
|
+
validateRequired("source", "replaceSources", source);
|
|
1783
1675
|
const requestPath = "/1/security/sources";
|
|
1784
1676
|
const headers = {};
|
|
1785
1677
|
const queryParameters = {};
|
|
@@ -1802,9 +1694,7 @@ function createSearchClient({
|
|
|
1802
1694
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1803
1695
|
*/
|
|
1804
1696
|
restoreApiKey({ key }, requestOptions) {
|
|
1805
|
-
|
|
1806
|
-
throw new Error("Parameter `key` is required when calling `restoreApiKey`.");
|
|
1807
|
-
}
|
|
1697
|
+
validateRequired("key", "restoreApiKey", key);
|
|
1808
1698
|
const requestPath = "/1/keys/{key}/restore".replace("{key}", encodeURIComponent(key));
|
|
1809
1699
|
const headers = {};
|
|
1810
1700
|
const queryParameters = {};
|
|
@@ -1827,12 +1717,8 @@ function createSearchClient({
|
|
|
1827
1717
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1828
1718
|
*/
|
|
1829
1719
|
saveObject({ indexName, body }, requestOptions) {
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
}
|
|
1833
|
-
if (!body) {
|
|
1834
|
-
throw new Error("Parameter `body` is required when calling `saveObject`.");
|
|
1835
|
-
}
|
|
1720
|
+
validateRequired("indexName", "saveObject", indexName);
|
|
1721
|
+
validateRequired("body", "saveObject", body);
|
|
1836
1722
|
const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
1837
1723
|
const headers = {};
|
|
1838
1724
|
const queryParameters = {};
|
|
@@ -1858,21 +1744,11 @@ function createSearchClient({
|
|
|
1858
1744
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1859
1745
|
*/
|
|
1860
1746
|
saveRule({ indexName, objectID, rule, forwardToReplicas }, requestOptions) {
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
}
|
|
1867
|
-
if (!rule) {
|
|
1868
|
-
throw new Error("Parameter `rule` is required when calling `saveRule`.");
|
|
1869
|
-
}
|
|
1870
|
-
if (!rule.objectID) {
|
|
1871
|
-
throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");
|
|
1872
|
-
}
|
|
1873
|
-
if (!rule.consequence) {
|
|
1874
|
-
throw new Error("Parameter `rule.consequence` is required when calling `saveRule`.");
|
|
1875
|
-
}
|
|
1747
|
+
validateRequired("indexName", "saveRule", indexName);
|
|
1748
|
+
validateRequired("objectID", "saveRule", objectID);
|
|
1749
|
+
validateRequired("rule", "saveRule", rule);
|
|
1750
|
+
validateRequired("rule.objectID", "saveRule", rule.objectID);
|
|
1751
|
+
validateRequired("rule.consequence", "saveRule", rule.consequence);
|
|
1876
1752
|
const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1877
1753
|
const headers = {};
|
|
1878
1754
|
const queryParameters = {};
|
|
@@ -1901,12 +1777,8 @@ function createSearchClient({
|
|
|
1901
1777
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1902
1778
|
*/
|
|
1903
1779
|
saveRules({ indexName, rules, forwardToReplicas, clearExistingRules }, requestOptions) {
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
}
|
|
1907
|
-
if (!rules) {
|
|
1908
|
-
throw new Error("Parameter `rules` is required when calling `saveRules`.");
|
|
1909
|
-
}
|
|
1780
|
+
validateRequired("indexName", "saveRules", indexName);
|
|
1781
|
+
validateRequired("rules", "saveRules", rules);
|
|
1910
1782
|
const requestPath = "/1/indexes/{indexName}/rules/batch".replace("{indexName}", encodeURIComponent(indexName));
|
|
1911
1783
|
const headers = {};
|
|
1912
1784
|
const queryParameters = {};
|
|
@@ -1938,21 +1810,11 @@ function createSearchClient({
|
|
|
1938
1810
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1939
1811
|
*/
|
|
1940
1812
|
saveSynonym({ indexName, objectID, synonymHit, forwardToReplicas }, requestOptions) {
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
}
|
|
1947
|
-
if (!synonymHit) {
|
|
1948
|
-
throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");
|
|
1949
|
-
}
|
|
1950
|
-
if (!synonymHit.objectID) {
|
|
1951
|
-
throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");
|
|
1952
|
-
}
|
|
1953
|
-
if (!synonymHit.type) {
|
|
1954
|
-
throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");
|
|
1955
|
-
}
|
|
1813
|
+
validateRequired("indexName", "saveSynonym", indexName);
|
|
1814
|
+
validateRequired("objectID", "saveSynonym", objectID);
|
|
1815
|
+
validateRequired("synonymHit", "saveSynonym", synonymHit);
|
|
1816
|
+
validateRequired("synonymHit.objectID", "saveSynonym", synonymHit.objectID);
|
|
1817
|
+
validateRequired("synonymHit.type", "saveSynonym", synonymHit.type);
|
|
1956
1818
|
const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1957
1819
|
const headers = {};
|
|
1958
1820
|
const queryParameters = {};
|
|
@@ -1981,12 +1843,8 @@ function createSearchClient({
|
|
|
1981
1843
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1982
1844
|
*/
|
|
1983
1845
|
saveSynonyms({ indexName, synonymHit, forwardToReplicas, replaceExistingSynonyms }, requestOptions) {
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
}
|
|
1987
|
-
if (!synonymHit) {
|
|
1988
|
-
throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");
|
|
1989
|
-
}
|
|
1846
|
+
validateRequired("indexName", "saveSynonyms", indexName);
|
|
1847
|
+
validateRequired("synonymHit", "saveSynonyms", synonymHit);
|
|
1990
1848
|
const requestPath = "/1/indexes/{indexName}/synonyms/batch".replace("{indexName}", encodeURIComponent(indexName));
|
|
1991
1849
|
const headers = {};
|
|
1992
1850
|
const queryParameters = {};
|
|
@@ -2035,12 +1893,8 @@ function createSearchClient({
|
|
|
2035
1893
|
};
|
|
2036
1894
|
searchMethodParams = newSignatureRequest;
|
|
2037
1895
|
}
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
}
|
|
2041
|
-
if (!searchMethodParams.requests) {
|
|
2042
|
-
throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");
|
|
2043
|
-
}
|
|
1896
|
+
validateRequired("searchMethodParams", "search", searchMethodParams);
|
|
1897
|
+
validateRequired("searchMethodParams.requests", "search", searchMethodParams.requests);
|
|
2044
1898
|
const requestPath = "/1/indexes/*/queries";
|
|
2045
1899
|
const headers = {};
|
|
2046
1900
|
const queryParameters = {};
|
|
@@ -2066,19 +1920,13 @@ function createSearchClient({
|
|
|
2066
1920
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2067
1921
|
*/
|
|
2068
1922
|
searchDictionaryEntries({ dictionaryName, searchDictionaryEntriesParams }, requestOptions) {
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
}
|
|
2077
|
-
if (!searchDictionaryEntriesParams.query) {
|
|
2078
|
-
throw new Error(
|
|
2079
|
-
"Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`."
|
|
2080
|
-
);
|
|
2081
|
-
}
|
|
1923
|
+
validateRequired("dictionaryName", "searchDictionaryEntries", dictionaryName);
|
|
1924
|
+
validateRequired("searchDictionaryEntriesParams", "searchDictionaryEntries", searchDictionaryEntriesParams);
|
|
1925
|
+
validateRequired(
|
|
1926
|
+
"searchDictionaryEntriesParams.query",
|
|
1927
|
+
"searchDictionaryEntries",
|
|
1928
|
+
searchDictionaryEntriesParams.query
|
|
1929
|
+
);
|
|
2082
1930
|
const requestPath = "/1/dictionaries/{dictionaryName}/search".replace(
|
|
2083
1931
|
"{dictionaryName}",
|
|
2084
1932
|
encodeURIComponent(dictionaryName)
|
|
@@ -2108,12 +1956,8 @@ function createSearchClient({
|
|
|
2108
1956
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2109
1957
|
*/
|
|
2110
1958
|
searchForFacetValues({ indexName, facetName, searchForFacetValuesRequest }, requestOptions) {
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
}
|
|
2114
|
-
if (!facetName) {
|
|
2115
|
-
throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");
|
|
2116
|
-
}
|
|
1959
|
+
validateRequired("indexName", "searchForFacetValues", indexName);
|
|
1960
|
+
validateRequired("facetName", "searchForFacetValues", facetName);
|
|
2117
1961
|
const requestPath = "/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}", encodeURIComponent(indexName)).replace("{facetName}", encodeURIComponent(facetName));
|
|
2118
1962
|
const headers = {};
|
|
2119
1963
|
const queryParameters = {};
|
|
@@ -2139,9 +1983,7 @@ function createSearchClient({
|
|
|
2139
1983
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2140
1984
|
*/
|
|
2141
1985
|
searchRules({ indexName, searchRulesParams }, requestOptions) {
|
|
2142
|
-
|
|
2143
|
-
throw new Error("Parameter `indexName` is required when calling `searchRules`.");
|
|
2144
|
-
}
|
|
1986
|
+
validateRequired("indexName", "searchRules", indexName);
|
|
2145
1987
|
const requestPath = "/1/indexes/{indexName}/rules/search".replace("{indexName}", encodeURIComponent(indexName));
|
|
2146
1988
|
const headers = {};
|
|
2147
1989
|
const queryParameters = {};
|
|
@@ -2167,9 +2009,7 @@ function createSearchClient({
|
|
|
2167
2009
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2168
2010
|
*/
|
|
2169
2011
|
searchSingleIndex({ indexName, searchParams }, requestOptions) {
|
|
2170
|
-
|
|
2171
|
-
throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");
|
|
2172
|
-
}
|
|
2012
|
+
validateRequired("indexName", "searchSingleIndex", indexName);
|
|
2173
2013
|
const requestPath = "/1/indexes/{indexName}/query".replace("{indexName}", encodeURIComponent(indexName));
|
|
2174
2014
|
const headers = {};
|
|
2175
2015
|
const queryParameters = {};
|
|
@@ -2195,9 +2035,7 @@ function createSearchClient({
|
|
|
2195
2035
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2196
2036
|
*/
|
|
2197
2037
|
searchSynonyms({ indexName, searchSynonymsParams }, requestOptions) {
|
|
2198
|
-
|
|
2199
|
-
throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");
|
|
2200
|
-
}
|
|
2038
|
+
validateRequired("indexName", "searchSynonyms", indexName);
|
|
2201
2039
|
const requestPath = "/1/indexes/{indexName}/synonyms/search".replace(
|
|
2202
2040
|
"{indexName}",
|
|
2203
2041
|
encodeURIComponent(indexName)
|
|
@@ -2226,12 +2064,8 @@ function createSearchClient({
|
|
|
2226
2064
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2227
2065
|
*/
|
|
2228
2066
|
searchUserIds(searchUserIdsParams, requestOptions) {
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
}
|
|
2232
|
-
if (!searchUserIdsParams.query) {
|
|
2233
|
-
throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");
|
|
2234
|
-
}
|
|
2067
|
+
validateRequired("searchUserIdsParams", "searchUserIds", searchUserIdsParams);
|
|
2068
|
+
validateRequired("searchUserIdsParams.query", "searchUserIds", searchUserIdsParams.query);
|
|
2235
2069
|
const requestPath = "/1/clusters/mapping/search";
|
|
2236
2070
|
const headers = {};
|
|
2237
2071
|
const queryParameters = {};
|
|
@@ -2255,14 +2089,12 @@ function createSearchClient({
|
|
|
2255
2089
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2256
2090
|
*/
|
|
2257
2091
|
setDictionarySettings(dictionarySettingsParams, requestOptions) {
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
);
|
|
2265
|
-
}
|
|
2092
|
+
validateRequired("dictionarySettingsParams", "setDictionarySettings", dictionarySettingsParams);
|
|
2093
|
+
validateRequired(
|
|
2094
|
+
"dictionarySettingsParams.disableStandardEntries",
|
|
2095
|
+
"setDictionarySettings",
|
|
2096
|
+
dictionarySettingsParams.disableStandardEntries
|
|
2097
|
+
);
|
|
2266
2098
|
const requestPath = "/1/dictionaries/*/settings";
|
|
2267
2099
|
const headers = {};
|
|
2268
2100
|
const queryParameters = {};
|
|
@@ -2287,12 +2119,8 @@ function createSearchClient({
|
|
|
2287
2119
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2288
2120
|
*/
|
|
2289
2121
|
setSettings({ indexName, indexSettings, forwardToReplicas }, requestOptions) {
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
}
|
|
2293
|
-
if (!indexSettings) {
|
|
2294
|
-
throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");
|
|
2295
|
-
}
|
|
2122
|
+
validateRequired("indexName", "setSettings", indexName);
|
|
2123
|
+
validateRequired("indexSettings", "setSettings", indexSettings);
|
|
2296
2124
|
const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
|
|
2297
2125
|
const headers = {};
|
|
2298
2126
|
const queryParameters = {};
|
|
@@ -2319,15 +2147,9 @@ function createSearchClient({
|
|
|
2319
2147
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2320
2148
|
*/
|
|
2321
2149
|
updateApiKey({ key, apiKey }, requestOptions) {
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
if (!apiKey) {
|
|
2326
|
-
throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");
|
|
2327
|
-
}
|
|
2328
|
-
if (!apiKey.acl) {
|
|
2329
|
-
throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");
|
|
2330
|
-
}
|
|
2150
|
+
validateRequired("key", "updateApiKey", key);
|
|
2151
|
+
validateRequired("apiKey", "updateApiKey", apiKey);
|
|
2152
|
+
validateRequired("apiKey.acl", "updateApiKey", apiKey.acl);
|
|
2331
2153
|
const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
|
|
2332
2154
|
const headers = {};
|
|
2333
2155
|
const queryParameters = {};
|