@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/browser.js
CHANGED
|
@@ -14,9 +14,10 @@ import {
|
|
|
14
14
|
createIterablePromise,
|
|
15
15
|
createTransporter,
|
|
16
16
|
getAlgoliaAgent,
|
|
17
|
-
shuffle
|
|
17
|
+
shuffle,
|
|
18
|
+
validateRequired
|
|
18
19
|
} from "@algolia/client-common";
|
|
19
|
-
var apiClientVersion = "5.
|
|
20
|
+
var apiClientVersion = "5.54.0";
|
|
20
21
|
function getDefaultHosts(appId) {
|
|
21
22
|
return [
|
|
22
23
|
{
|
|
@@ -350,9 +351,17 @@ function createSearchClient({
|
|
|
350
351
|
* @param chunkedBatch.action - The `batch` `action` to perform on the given array of `objects`, defaults to `addObject`.
|
|
351
352
|
* @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.
|
|
352
353
|
* @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.
|
|
354
|
+
* @param chunkedBatch.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
353
355
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
|
|
354
356
|
*/
|
|
355
|
-
async chunkedBatch({
|
|
357
|
+
async chunkedBatch({
|
|
358
|
+
indexName,
|
|
359
|
+
objects,
|
|
360
|
+
action = "addObject",
|
|
361
|
+
waitForTasks,
|
|
362
|
+
batchSize = 1e3,
|
|
363
|
+
maxRetries = 100
|
|
364
|
+
}, requestOptions) {
|
|
356
365
|
let requests = [];
|
|
357
366
|
const responses = [];
|
|
358
367
|
const objectEntries = objects.entries();
|
|
@@ -365,7 +374,7 @@ function createSearchClient({
|
|
|
365
374
|
}
|
|
366
375
|
if (waitForTasks) {
|
|
367
376
|
for (const resp of responses) {
|
|
368
|
-
await this.waitForTask({ indexName, taskID: resp.taskID });
|
|
377
|
+
await this.waitForTask({ indexName, taskID: resp.taskID, maxRetries });
|
|
369
378
|
}
|
|
370
379
|
}
|
|
371
380
|
return responses;
|
|
@@ -379,11 +388,12 @@ function createSearchClient({
|
|
|
379
388
|
* @param saveObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
380
389
|
* @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.
|
|
381
390
|
* @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.
|
|
391
|
+
* @param saveObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
382
392
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
|
|
383
393
|
*/
|
|
384
|
-
async saveObjects({ indexName, objects, waitForTasks, batchSize }, requestOptions) {
|
|
394
|
+
async saveObjects({ indexName, objects, waitForTasks, batchSize, maxRetries }, requestOptions) {
|
|
385
395
|
return await this.chunkedBatch(
|
|
386
|
-
{ indexName, objects, action: "addObject", waitForTasks, batchSize },
|
|
396
|
+
{ indexName, objects, action: "addObject", waitForTasks, batchSize, maxRetries },
|
|
387
397
|
requestOptions
|
|
388
398
|
);
|
|
389
399
|
},
|
|
@@ -396,16 +406,18 @@ function createSearchClient({
|
|
|
396
406
|
* @param deleteObjects.objectIDs - The objectIDs to delete.
|
|
397
407
|
* @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.
|
|
398
408
|
* @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.
|
|
409
|
+
* @param deleteObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
399
410
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
|
|
400
411
|
*/
|
|
401
|
-
async deleteObjects({ indexName, objectIDs, waitForTasks, batchSize }, requestOptions) {
|
|
412
|
+
async deleteObjects({ indexName, objectIDs, waitForTasks, batchSize, maxRetries }, requestOptions) {
|
|
402
413
|
return await this.chunkedBatch(
|
|
403
414
|
{
|
|
404
415
|
indexName,
|
|
405
416
|
objects: objectIDs.map((objectID) => ({ objectID })),
|
|
406
417
|
action: "deleteObject",
|
|
407
418
|
waitForTasks,
|
|
408
|
-
batchSize
|
|
419
|
+
batchSize,
|
|
420
|
+
maxRetries
|
|
409
421
|
},
|
|
410
422
|
requestOptions
|
|
411
423
|
);
|
|
@@ -420,16 +432,18 @@ function createSearchClient({
|
|
|
420
432
|
* @param partialUpdateObjects.createIfNotExists - To be provided if non-existing objects are passed, otherwise, the call will fail.
|
|
421
433
|
* @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.
|
|
422
434
|
* @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.
|
|
435
|
+
* @param partialUpdateObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
423
436
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
|
|
424
437
|
*/
|
|
425
|
-
async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks, batchSize }, requestOptions) {
|
|
438
|
+
async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks, batchSize, maxRetries }, requestOptions) {
|
|
426
439
|
return await this.chunkedBatch(
|
|
427
440
|
{
|
|
428
441
|
indexName,
|
|
429
442
|
objects,
|
|
430
443
|
action: createIfNotExists ? "partialUpdateObject" : "partialUpdateObjectNoCreate",
|
|
431
444
|
batchSize,
|
|
432
|
-
waitForTasks
|
|
445
|
+
waitForTasks,
|
|
446
|
+
maxRetries
|
|
433
447
|
},
|
|
434
448
|
requestOptions
|
|
435
449
|
);
|
|
@@ -444,9 +458,10 @@ function createSearchClient({
|
|
|
444
458
|
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
445
459
|
* @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.
|
|
446
460
|
* @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
|
|
461
|
+
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
447
462
|
* @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.
|
|
448
463
|
*/
|
|
449
|
-
async replaceAllObjects({ indexName, objects, batchSize, scopes }, requestOptions) {
|
|
464
|
+
async replaceAllObjects({ indexName, objects, batchSize, scopes, maxRetries = 100 }, requestOptions) {
|
|
450
465
|
const randomSuffix = Math.floor(Math.random() * 1e6) + 1e5;
|
|
451
466
|
const tmpIndexName = `${indexName}_tmp_${randomSuffix}`;
|
|
452
467
|
if (scopes === void 0) {
|
|
@@ -465,12 +480,13 @@ function createSearchClient({
|
|
|
465
480
|
requestOptions
|
|
466
481
|
);
|
|
467
482
|
const batchResponses = await this.chunkedBatch(
|
|
468
|
-
{ indexName: tmpIndexName, objects, waitForTasks: true, batchSize },
|
|
483
|
+
{ indexName: tmpIndexName, objects, waitForTasks: true, batchSize, maxRetries },
|
|
469
484
|
requestOptions
|
|
470
485
|
);
|
|
471
486
|
await this.waitForTask({
|
|
472
487
|
indexName: tmpIndexName,
|
|
473
|
-
taskID: copyOperationResponse.taskID
|
|
488
|
+
taskID: copyOperationResponse.taskID,
|
|
489
|
+
maxRetries
|
|
474
490
|
});
|
|
475
491
|
copyOperationResponse = await this.operationIndex(
|
|
476
492
|
{
|
|
@@ -485,7 +501,8 @@ function createSearchClient({
|
|
|
485
501
|
);
|
|
486
502
|
await this.waitForTask({
|
|
487
503
|
indexName: tmpIndexName,
|
|
488
|
-
taskID: copyOperationResponse.taskID
|
|
504
|
+
taskID: copyOperationResponse.taskID,
|
|
505
|
+
maxRetries
|
|
489
506
|
});
|
|
490
507
|
const moveOperationResponse = await this.operationIndex(
|
|
491
508
|
{
|
|
@@ -496,7 +513,8 @@ function createSearchClient({
|
|
|
496
513
|
);
|
|
497
514
|
await this.waitForTask({
|
|
498
515
|
indexName: tmpIndexName,
|
|
499
|
-
taskID: moveOperationResponse.taskID
|
|
516
|
+
taskID: moveOperationResponse.taskID,
|
|
517
|
+
maxRetries
|
|
500
518
|
});
|
|
501
519
|
return { copyOperationResponse, batchResponses, moveOperationResponse };
|
|
502
520
|
} catch (error) {
|
|
@@ -546,12 +564,8 @@ function createSearchClient({
|
|
|
546
564
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
547
565
|
*/
|
|
548
566
|
addApiKey(apiKey, requestOptions) {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
}
|
|
552
|
-
if (!apiKey.acl) {
|
|
553
|
-
throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");
|
|
554
|
-
}
|
|
567
|
+
validateRequired("apiKey", "addApiKey", apiKey);
|
|
568
|
+
validateRequired("apiKey.acl", "addApiKey", apiKey.acl);
|
|
555
569
|
const requestPath = "/1/keys";
|
|
556
570
|
const headers = {};
|
|
557
571
|
const queryParameters = {};
|
|
@@ -576,15 +590,9 @@ function createSearchClient({
|
|
|
576
590
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
577
591
|
*/
|
|
578
592
|
addOrUpdateObject({ indexName, objectID, body }, requestOptions) {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
if (!objectID) {
|
|
583
|
-
throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");
|
|
584
|
-
}
|
|
585
|
-
if (!body) {
|
|
586
|
-
throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");
|
|
587
|
-
}
|
|
593
|
+
validateRequired("indexName", "addOrUpdateObject", indexName);
|
|
594
|
+
validateRequired("objectID", "addOrUpdateObject", objectID);
|
|
595
|
+
validateRequired("body", "addOrUpdateObject", body);
|
|
588
596
|
const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
589
597
|
const headers = {};
|
|
590
598
|
const queryParameters = {};
|
|
@@ -606,12 +614,8 @@ function createSearchClient({
|
|
|
606
614
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
607
615
|
*/
|
|
608
616
|
appendSource(source, requestOptions) {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
if (!source.source) {
|
|
613
|
-
throw new Error("Parameter `source.source` is required when calling `appendSource`.");
|
|
614
|
-
}
|
|
617
|
+
validateRequired("source", "appendSource", source);
|
|
618
|
+
validateRequired("source.source", "appendSource", source.source);
|
|
615
619
|
const requestPath = "/1/security/sources/append";
|
|
616
620
|
const headers = {};
|
|
617
621
|
const queryParameters = {};
|
|
@@ -637,15 +641,9 @@ function createSearchClient({
|
|
|
637
641
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
638
642
|
*/
|
|
639
643
|
assignUserId({ xAlgoliaUserID, assignUserIdParams }, requestOptions) {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
if (!assignUserIdParams) {
|
|
644
|
-
throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");
|
|
645
|
-
}
|
|
646
|
-
if (!assignUserIdParams.cluster) {
|
|
647
|
-
throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");
|
|
648
|
-
}
|
|
644
|
+
validateRequired("xAlgoliaUserID", "assignUserId", xAlgoliaUserID);
|
|
645
|
+
validateRequired("assignUserIdParams", "assignUserId", assignUserIdParams);
|
|
646
|
+
validateRequired("assignUserIdParams.cluster", "assignUserId", assignUserIdParams.cluster);
|
|
649
647
|
const requestPath = "/1/clusters/mapping";
|
|
650
648
|
const headers = {};
|
|
651
649
|
const queryParameters = {};
|
|
@@ -672,15 +670,9 @@ function createSearchClient({
|
|
|
672
670
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
673
671
|
*/
|
|
674
672
|
batch({ indexName, batchWriteParams }, requestOptions) {
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
if (!batchWriteParams) {
|
|
679
|
-
throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");
|
|
680
|
-
}
|
|
681
|
-
if (!batchWriteParams.requests) {
|
|
682
|
-
throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");
|
|
683
|
-
}
|
|
673
|
+
validateRequired("indexName", "batch", indexName);
|
|
674
|
+
validateRequired("batchWriteParams", "batch", batchWriteParams);
|
|
675
|
+
validateRequired("batchWriteParams.requests", "batch", batchWriteParams.requests);
|
|
684
676
|
const requestPath = "/1/indexes/{indexName}/batch".replace("{indexName}", encodeURIComponent(indexName));
|
|
685
677
|
const headers = {};
|
|
686
678
|
const queryParameters = {};
|
|
@@ -706,18 +698,10 @@ function createSearchClient({
|
|
|
706
698
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
707
699
|
*/
|
|
708
700
|
batchAssignUserIds({ xAlgoliaUserID, batchAssignUserIdsParams }, requestOptions) {
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");
|
|
714
|
-
}
|
|
715
|
-
if (!batchAssignUserIdsParams.cluster) {
|
|
716
|
-
throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");
|
|
717
|
-
}
|
|
718
|
-
if (!batchAssignUserIdsParams.users) {
|
|
719
|
-
throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");
|
|
720
|
-
}
|
|
701
|
+
validateRequired("xAlgoliaUserID", "batchAssignUserIds", xAlgoliaUserID);
|
|
702
|
+
validateRequired("batchAssignUserIdsParams", "batchAssignUserIds", batchAssignUserIdsParams);
|
|
703
|
+
validateRequired("batchAssignUserIdsParams.cluster", "batchAssignUserIds", batchAssignUserIdsParams.cluster);
|
|
704
|
+
validateRequired("batchAssignUserIdsParams.users", "batchAssignUserIds", batchAssignUserIdsParams.users);
|
|
721
705
|
const requestPath = "/1/clusters/mapping/batch";
|
|
722
706
|
const headers = {};
|
|
723
707
|
const queryParameters = {};
|
|
@@ -744,17 +728,13 @@ function createSearchClient({
|
|
|
744
728
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
745
729
|
*/
|
|
746
730
|
batchDictionaryEntries({ dictionaryName, batchDictionaryEntriesParams }, requestOptions) {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
throw new Error(
|
|
755
|
-
"Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`."
|
|
756
|
-
);
|
|
757
|
-
}
|
|
731
|
+
validateRequired("dictionaryName", "batchDictionaryEntries", dictionaryName);
|
|
732
|
+
validateRequired("batchDictionaryEntriesParams", "batchDictionaryEntries", batchDictionaryEntriesParams);
|
|
733
|
+
validateRequired(
|
|
734
|
+
"batchDictionaryEntriesParams.requests",
|
|
735
|
+
"batchDictionaryEntries",
|
|
736
|
+
batchDictionaryEntriesParams.requests
|
|
737
|
+
);
|
|
758
738
|
const requestPath = "/1/dictionaries/{dictionaryName}/batch".replace(
|
|
759
739
|
"{dictionaryName}",
|
|
760
740
|
encodeURIComponent(dictionaryName)
|
|
@@ -781,9 +761,7 @@ function createSearchClient({
|
|
|
781
761
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
782
762
|
*/
|
|
783
763
|
browse({ indexName, browseParams }, requestOptions) {
|
|
784
|
-
|
|
785
|
-
throw new Error("Parameter `indexName` is required when calling `browse`.");
|
|
786
|
-
}
|
|
764
|
+
validateRequired("indexName", "browse", indexName);
|
|
787
765
|
const requestPath = "/1/indexes/{indexName}/browse".replace("{indexName}", encodeURIComponent(indexName));
|
|
788
766
|
const headers = {};
|
|
789
767
|
const queryParameters = {};
|
|
@@ -807,9 +785,7 @@ function createSearchClient({
|
|
|
807
785
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
808
786
|
*/
|
|
809
787
|
clearObjects({ indexName }, requestOptions) {
|
|
810
|
-
|
|
811
|
-
throw new Error("Parameter `indexName` is required when calling `clearObjects`.");
|
|
812
|
-
}
|
|
788
|
+
validateRequired("indexName", "clearObjects", indexName);
|
|
813
789
|
const requestPath = "/1/indexes/{indexName}/clear".replace("{indexName}", encodeURIComponent(indexName));
|
|
814
790
|
const headers = {};
|
|
815
791
|
const queryParameters = {};
|
|
@@ -832,9 +808,7 @@ function createSearchClient({
|
|
|
832
808
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
833
809
|
*/
|
|
834
810
|
clearRules({ indexName, forwardToReplicas }, requestOptions) {
|
|
835
|
-
|
|
836
|
-
throw new Error("Parameter `indexName` is required when calling `clearRules`.");
|
|
837
|
-
}
|
|
811
|
+
validateRequired("indexName", "clearRules", indexName);
|
|
838
812
|
const requestPath = "/1/indexes/{indexName}/rules/clear".replace("{indexName}", encodeURIComponent(indexName));
|
|
839
813
|
const headers = {};
|
|
840
814
|
const queryParameters = {};
|
|
@@ -860,9 +834,7 @@ function createSearchClient({
|
|
|
860
834
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
861
835
|
*/
|
|
862
836
|
clearSynonyms({ indexName, forwardToReplicas }, requestOptions) {
|
|
863
|
-
|
|
864
|
-
throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");
|
|
865
|
-
}
|
|
837
|
+
validateRequired("indexName", "clearSynonyms", indexName);
|
|
866
838
|
const requestPath = "/1/indexes/{indexName}/synonyms/clear".replace("{indexName}", encodeURIComponent(indexName));
|
|
867
839
|
const headers = {};
|
|
868
840
|
const queryParameters = {};
|
|
@@ -885,9 +857,7 @@ function createSearchClient({
|
|
|
885
857
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
886
858
|
*/
|
|
887
859
|
customDelete({ path, parameters }, requestOptions) {
|
|
888
|
-
|
|
889
|
-
throw new Error("Parameter `path` is required when calling `customDelete`.");
|
|
890
|
-
}
|
|
860
|
+
validateRequired("path", "customDelete", path);
|
|
891
861
|
const requestPath = "/{path}".replace("{path}", path);
|
|
892
862
|
const headers = {};
|
|
893
863
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -907,9 +877,7 @@ function createSearchClient({
|
|
|
907
877
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
908
878
|
*/
|
|
909
879
|
customGet({ path, parameters }, requestOptions) {
|
|
910
|
-
|
|
911
|
-
throw new Error("Parameter `path` is required when calling `customGet`.");
|
|
912
|
-
}
|
|
880
|
+
validateRequired("path", "customGet", path);
|
|
913
881
|
const requestPath = "/{path}".replace("{path}", path);
|
|
914
882
|
const headers = {};
|
|
915
883
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -930,9 +898,7 @@ function createSearchClient({
|
|
|
930
898
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
931
899
|
*/
|
|
932
900
|
customPost({ path, parameters, body }, requestOptions) {
|
|
933
|
-
|
|
934
|
-
throw new Error("Parameter `path` is required when calling `customPost`.");
|
|
935
|
-
}
|
|
901
|
+
validateRequired("path", "customPost", path);
|
|
936
902
|
const requestPath = "/{path}".replace("{path}", path);
|
|
937
903
|
const headers = {};
|
|
938
904
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -954,9 +920,7 @@ function createSearchClient({
|
|
|
954
920
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
955
921
|
*/
|
|
956
922
|
customPut({ path, parameters, body }, requestOptions) {
|
|
957
|
-
|
|
958
|
-
throw new Error("Parameter `path` is required when calling `customPut`.");
|
|
959
|
-
}
|
|
923
|
+
validateRequired("path", "customPut", path);
|
|
960
924
|
const requestPath = "/{path}".replace("{path}", path);
|
|
961
925
|
const headers = {};
|
|
962
926
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -979,9 +943,7 @@ function createSearchClient({
|
|
|
979
943
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
980
944
|
*/
|
|
981
945
|
deleteApiKey({ key }, requestOptions) {
|
|
982
|
-
|
|
983
|
-
throw new Error("Parameter `key` is required when calling `deleteApiKey`.");
|
|
984
|
-
}
|
|
946
|
+
validateRequired("key", "deleteApiKey", key);
|
|
985
947
|
const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
|
|
986
948
|
const headers = {};
|
|
987
949
|
const queryParameters = {};
|
|
@@ -1004,12 +966,8 @@ function createSearchClient({
|
|
|
1004
966
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1005
967
|
*/
|
|
1006
968
|
deleteBy({ indexName, deleteByParams }, requestOptions) {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
}
|
|
1010
|
-
if (!deleteByParams) {
|
|
1011
|
-
throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");
|
|
1012
|
-
}
|
|
969
|
+
validateRequired("indexName", "deleteBy", indexName);
|
|
970
|
+
validateRequired("deleteByParams", "deleteBy", deleteByParams);
|
|
1013
971
|
const requestPath = "/1/indexes/{indexName}/deleteByQuery".replace("{indexName}", encodeURIComponent(indexName));
|
|
1014
972
|
const headers = {};
|
|
1015
973
|
const queryParameters = {};
|
|
@@ -1032,9 +990,7 @@ function createSearchClient({
|
|
|
1032
990
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1033
991
|
*/
|
|
1034
992
|
deleteIndex({ indexName }, requestOptions) {
|
|
1035
|
-
|
|
1036
|
-
throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");
|
|
1037
|
-
}
|
|
993
|
+
validateRequired("indexName", "deleteIndex", indexName);
|
|
1038
994
|
const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
1039
995
|
const headers = {};
|
|
1040
996
|
const queryParameters = {};
|
|
@@ -1057,12 +1013,8 @@ function createSearchClient({
|
|
|
1057
1013
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1058
1014
|
*/
|
|
1059
1015
|
deleteObject({ indexName, objectID }, requestOptions) {
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
}
|
|
1063
|
-
if (!objectID) {
|
|
1064
|
-
throw new Error("Parameter `objectID` is required when calling `deleteObject`.");
|
|
1065
|
-
}
|
|
1016
|
+
validateRequired("indexName", "deleteObject", indexName);
|
|
1017
|
+
validateRequired("objectID", "deleteObject", objectID);
|
|
1066
1018
|
const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1067
1019
|
const headers = {};
|
|
1068
1020
|
const queryParameters = {};
|
|
@@ -1086,12 +1038,8 @@ function createSearchClient({
|
|
|
1086
1038
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1087
1039
|
*/
|
|
1088
1040
|
deleteRule({ indexName, objectID, forwardToReplicas }, requestOptions) {
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
}
|
|
1092
|
-
if (!objectID) {
|
|
1093
|
-
throw new Error("Parameter `objectID` is required when calling `deleteRule`.");
|
|
1094
|
-
}
|
|
1041
|
+
validateRequired("indexName", "deleteRule", indexName);
|
|
1042
|
+
validateRequired("objectID", "deleteRule", objectID);
|
|
1095
1043
|
const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1096
1044
|
const headers = {};
|
|
1097
1045
|
const queryParameters = {};
|
|
@@ -1116,9 +1064,7 @@ function createSearchClient({
|
|
|
1116
1064
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1117
1065
|
*/
|
|
1118
1066
|
deleteSource({ source }, requestOptions) {
|
|
1119
|
-
|
|
1120
|
-
throw new Error("Parameter `source` is required when calling `deleteSource`.");
|
|
1121
|
-
}
|
|
1067
|
+
validateRequired("source", "deleteSource", source);
|
|
1122
1068
|
const requestPath = "/1/security/sources/{source}".replace("{source}", encodeURIComponent(source));
|
|
1123
1069
|
const headers = {};
|
|
1124
1070
|
const queryParameters = {};
|
|
@@ -1142,12 +1088,8 @@ function createSearchClient({
|
|
|
1142
1088
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1143
1089
|
*/
|
|
1144
1090
|
deleteSynonym({ indexName, objectID, forwardToReplicas }, requestOptions) {
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
}
|
|
1148
|
-
if (!objectID) {
|
|
1149
|
-
throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");
|
|
1150
|
-
}
|
|
1091
|
+
validateRequired("indexName", "deleteSynonym", indexName);
|
|
1092
|
+
validateRequired("objectID", "deleteSynonym", objectID);
|
|
1151
1093
|
const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1152
1094
|
const headers = {};
|
|
1153
1095
|
const queryParameters = {};
|
|
@@ -1172,9 +1114,7 @@ function createSearchClient({
|
|
|
1172
1114
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1173
1115
|
*/
|
|
1174
1116
|
getApiKey({ key }, requestOptions) {
|
|
1175
|
-
|
|
1176
|
-
throw new Error("Parameter `key` is required when calling `getApiKey`.");
|
|
1177
|
-
}
|
|
1117
|
+
validateRequired("key", "getApiKey", key);
|
|
1178
1118
|
const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
|
|
1179
1119
|
const headers = {};
|
|
1180
1120
|
const queryParameters = {};
|
|
@@ -1196,9 +1136,7 @@ function createSearchClient({
|
|
|
1196
1136
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1197
1137
|
*/
|
|
1198
1138
|
getAppTask({ taskID }, requestOptions) {
|
|
1199
|
-
|
|
1200
|
-
throw new Error("Parameter `taskID` is required when calling `getAppTask`.");
|
|
1201
|
-
}
|
|
1139
|
+
validateRequired("taskID", "getAppTask", taskID);
|
|
1202
1140
|
const requestPath = "/1/task/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
|
|
1203
1141
|
const headers = {};
|
|
1204
1142
|
const queryParameters = {};
|
|
@@ -1296,12 +1234,8 @@ function createSearchClient({
|
|
|
1296
1234
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1297
1235
|
*/
|
|
1298
1236
|
getObject({ indexName, objectID, attributesToRetrieve }, requestOptions) {
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
}
|
|
1302
|
-
if (!objectID) {
|
|
1303
|
-
throw new Error("Parameter `objectID` is required when calling `getObject`.");
|
|
1304
|
-
}
|
|
1237
|
+
validateRequired("indexName", "getObject", indexName);
|
|
1238
|
+
validateRequired("objectID", "getObject", objectID);
|
|
1305
1239
|
const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1306
1240
|
const headers = {};
|
|
1307
1241
|
const queryParameters = {};
|
|
@@ -1325,12 +1259,8 @@ function createSearchClient({
|
|
|
1325
1259
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1326
1260
|
*/
|
|
1327
1261
|
getObjects(getObjectsParams, requestOptions) {
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
}
|
|
1331
|
-
if (!getObjectsParams.requests) {
|
|
1332
|
-
throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");
|
|
1333
|
-
}
|
|
1262
|
+
validateRequired("getObjectsParams", "getObjects", getObjectsParams);
|
|
1263
|
+
validateRequired("getObjectsParams.requests", "getObjects", getObjectsParams.requests);
|
|
1334
1264
|
const requestPath = "/1/indexes/*/objects";
|
|
1335
1265
|
const headers = {};
|
|
1336
1266
|
const queryParameters = {};
|
|
@@ -1356,12 +1286,8 @@ function createSearchClient({
|
|
|
1356
1286
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1357
1287
|
*/
|
|
1358
1288
|
getRule({ indexName, objectID }, requestOptions) {
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
}
|
|
1362
|
-
if (!objectID) {
|
|
1363
|
-
throw new Error("Parameter `objectID` is required when calling `getRule`.");
|
|
1364
|
-
}
|
|
1289
|
+
validateRequired("indexName", "getRule", indexName);
|
|
1290
|
+
validateRequired("objectID", "getRule", objectID);
|
|
1365
1291
|
const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1366
1292
|
const headers = {};
|
|
1367
1293
|
const queryParameters = {};
|
|
@@ -1384,9 +1310,7 @@ function createSearchClient({
|
|
|
1384
1310
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1385
1311
|
*/
|
|
1386
1312
|
getSettings({ indexName, getVersion }, requestOptions) {
|
|
1387
|
-
|
|
1388
|
-
throw new Error("Parameter `indexName` is required when calling `getSettings`.");
|
|
1389
|
-
}
|
|
1313
|
+
validateRequired("indexName", "getSettings", indexName);
|
|
1390
1314
|
const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
|
|
1391
1315
|
const headers = {};
|
|
1392
1316
|
const queryParameters = {};
|
|
@@ -1431,12 +1355,8 @@ function createSearchClient({
|
|
|
1431
1355
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1432
1356
|
*/
|
|
1433
1357
|
getSynonym({ indexName, objectID }, requestOptions) {
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
}
|
|
1437
|
-
if (!objectID) {
|
|
1438
|
-
throw new Error("Parameter `objectID` is required when calling `getSynonym`.");
|
|
1439
|
-
}
|
|
1358
|
+
validateRequired("indexName", "getSynonym", indexName);
|
|
1359
|
+
validateRequired("objectID", "getSynonym", objectID);
|
|
1440
1360
|
const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1441
1361
|
const headers = {};
|
|
1442
1362
|
const queryParameters = {};
|
|
@@ -1459,12 +1379,8 @@ function createSearchClient({
|
|
|
1459
1379
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1460
1380
|
*/
|
|
1461
1381
|
getTask({ indexName, taskID }, requestOptions) {
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
}
|
|
1465
|
-
if (!taskID) {
|
|
1466
|
-
throw new Error("Parameter `taskID` is required when calling `getTask`.");
|
|
1467
|
-
}
|
|
1382
|
+
validateRequired("indexName", "getTask", indexName);
|
|
1383
|
+
validateRequired("taskID", "getTask", taskID);
|
|
1468
1384
|
const requestPath = "/1/indexes/{indexName}/task/{taskID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{taskID}", encodeURIComponent(taskID));
|
|
1469
1385
|
const headers = {};
|
|
1470
1386
|
const queryParameters = {};
|
|
@@ -1509,9 +1425,7 @@ function createSearchClient({
|
|
|
1509
1425
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1510
1426
|
*/
|
|
1511
1427
|
getUserId({ userID }, requestOptions) {
|
|
1512
|
-
|
|
1513
|
-
throw new Error("Parameter `userID` is required when calling `getUserId`.");
|
|
1514
|
-
}
|
|
1428
|
+
validateRequired("userID", "getUserId", userID);
|
|
1515
1429
|
const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
|
|
1516
1430
|
const headers = {};
|
|
1517
1431
|
const queryParameters = {};
|
|
@@ -1656,12 +1570,8 @@ function createSearchClient({
|
|
|
1656
1570
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1657
1571
|
*/
|
|
1658
1572
|
multipleBatch(batchParams, requestOptions) {
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
}
|
|
1662
|
-
if (!batchParams.requests) {
|
|
1663
|
-
throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");
|
|
1664
|
-
}
|
|
1573
|
+
validateRequired("batchParams", "multipleBatch", batchParams);
|
|
1574
|
+
validateRequired("batchParams.requests", "multipleBatch", batchParams.requests);
|
|
1665
1575
|
const requestPath = "/1/indexes/*/batch";
|
|
1666
1576
|
const headers = {};
|
|
1667
1577
|
const queryParameters = {};
|
|
@@ -1685,18 +1595,10 @@ function createSearchClient({
|
|
|
1685
1595
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1686
1596
|
*/
|
|
1687
1597
|
operationIndex({ indexName, operationIndexParams }, requestOptions) {
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");
|
|
1693
|
-
}
|
|
1694
|
-
if (!operationIndexParams.operation) {
|
|
1695
|
-
throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");
|
|
1696
|
-
}
|
|
1697
|
-
if (!operationIndexParams.destination) {
|
|
1698
|
-
throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");
|
|
1699
|
-
}
|
|
1598
|
+
validateRequired("indexName", "operationIndex", indexName);
|
|
1599
|
+
validateRequired("operationIndexParams", "operationIndex", operationIndexParams);
|
|
1600
|
+
validateRequired("operationIndexParams.operation", "operationIndex", operationIndexParams.operation);
|
|
1601
|
+
validateRequired("operationIndexParams.destination", "operationIndex", operationIndexParams.destination);
|
|
1700
1602
|
const requestPath = "/1/indexes/{indexName}/operation".replace("{indexName}", encodeURIComponent(indexName));
|
|
1701
1603
|
const headers = {};
|
|
1702
1604
|
const queryParameters = {};
|
|
@@ -1722,15 +1624,9 @@ function createSearchClient({
|
|
|
1722
1624
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1723
1625
|
*/
|
|
1724
1626
|
partialUpdateObject({ indexName, objectID, attributesToUpdate, createIfNotExists }, requestOptions) {
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
if (!objectID) {
|
|
1729
|
-
throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");
|
|
1730
|
-
}
|
|
1731
|
-
if (!attributesToUpdate) {
|
|
1732
|
-
throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");
|
|
1733
|
-
}
|
|
1627
|
+
validateRequired("indexName", "partialUpdateObject", indexName);
|
|
1628
|
+
validateRequired("objectID", "partialUpdateObject", objectID);
|
|
1629
|
+
validateRequired("attributesToUpdate", "partialUpdateObject", attributesToUpdate);
|
|
1734
1630
|
const requestPath = "/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1735
1631
|
const headers = {};
|
|
1736
1632
|
const queryParameters = {};
|
|
@@ -1758,9 +1654,7 @@ function createSearchClient({
|
|
|
1758
1654
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1759
1655
|
*/
|
|
1760
1656
|
removeUserId({ userID }, requestOptions) {
|
|
1761
|
-
|
|
1762
|
-
throw new Error("Parameter `userID` is required when calling `removeUserId`.");
|
|
1763
|
-
}
|
|
1657
|
+
validateRequired("userID", "removeUserId", userID);
|
|
1764
1658
|
const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
|
|
1765
1659
|
const headers = {};
|
|
1766
1660
|
const queryParameters = {};
|
|
@@ -1782,9 +1676,7 @@ function createSearchClient({
|
|
|
1782
1676
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1783
1677
|
*/
|
|
1784
1678
|
replaceSources({ source }, requestOptions) {
|
|
1785
|
-
|
|
1786
|
-
throw new Error("Parameter `source` is required when calling `replaceSources`.");
|
|
1787
|
-
}
|
|
1679
|
+
validateRequired("source", "replaceSources", source);
|
|
1788
1680
|
const requestPath = "/1/security/sources";
|
|
1789
1681
|
const headers = {};
|
|
1790
1682
|
const queryParameters = {};
|
|
@@ -1807,9 +1699,7 @@ function createSearchClient({
|
|
|
1807
1699
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1808
1700
|
*/
|
|
1809
1701
|
restoreApiKey({ key }, requestOptions) {
|
|
1810
|
-
|
|
1811
|
-
throw new Error("Parameter `key` is required when calling `restoreApiKey`.");
|
|
1812
|
-
}
|
|
1702
|
+
validateRequired("key", "restoreApiKey", key);
|
|
1813
1703
|
const requestPath = "/1/keys/{key}/restore".replace("{key}", encodeURIComponent(key));
|
|
1814
1704
|
const headers = {};
|
|
1815
1705
|
const queryParameters = {};
|
|
@@ -1832,12 +1722,8 @@ function createSearchClient({
|
|
|
1832
1722
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1833
1723
|
*/
|
|
1834
1724
|
saveObject({ indexName, body }, requestOptions) {
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
}
|
|
1838
|
-
if (!body) {
|
|
1839
|
-
throw new Error("Parameter `body` is required when calling `saveObject`.");
|
|
1840
|
-
}
|
|
1725
|
+
validateRequired("indexName", "saveObject", indexName);
|
|
1726
|
+
validateRequired("body", "saveObject", body);
|
|
1841
1727
|
const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
1842
1728
|
const headers = {};
|
|
1843
1729
|
const queryParameters = {};
|
|
@@ -1863,21 +1749,11 @@ function createSearchClient({
|
|
|
1863
1749
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1864
1750
|
*/
|
|
1865
1751
|
saveRule({ indexName, objectID, rule, forwardToReplicas }, requestOptions) {
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
}
|
|
1872
|
-
if (!rule) {
|
|
1873
|
-
throw new Error("Parameter `rule` is required when calling `saveRule`.");
|
|
1874
|
-
}
|
|
1875
|
-
if (!rule.objectID) {
|
|
1876
|
-
throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");
|
|
1877
|
-
}
|
|
1878
|
-
if (!rule.consequence) {
|
|
1879
|
-
throw new Error("Parameter `rule.consequence` is required when calling `saveRule`.");
|
|
1880
|
-
}
|
|
1752
|
+
validateRequired("indexName", "saveRule", indexName);
|
|
1753
|
+
validateRequired("objectID", "saveRule", objectID);
|
|
1754
|
+
validateRequired("rule", "saveRule", rule);
|
|
1755
|
+
validateRequired("rule.objectID", "saveRule", rule.objectID);
|
|
1756
|
+
validateRequired("rule.consequence", "saveRule", rule.consequence);
|
|
1881
1757
|
const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1882
1758
|
const headers = {};
|
|
1883
1759
|
const queryParameters = {};
|
|
@@ -1906,12 +1782,8 @@ function createSearchClient({
|
|
|
1906
1782
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1907
1783
|
*/
|
|
1908
1784
|
saveRules({ indexName, rules, forwardToReplicas, clearExistingRules }, requestOptions) {
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
}
|
|
1912
|
-
if (!rules) {
|
|
1913
|
-
throw new Error("Parameter `rules` is required when calling `saveRules`.");
|
|
1914
|
-
}
|
|
1785
|
+
validateRequired("indexName", "saveRules", indexName);
|
|
1786
|
+
validateRequired("rules", "saveRules", rules);
|
|
1915
1787
|
const requestPath = "/1/indexes/{indexName}/rules/batch".replace("{indexName}", encodeURIComponent(indexName));
|
|
1916
1788
|
const headers = {};
|
|
1917
1789
|
const queryParameters = {};
|
|
@@ -1943,21 +1815,11 @@ function createSearchClient({
|
|
|
1943
1815
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1944
1816
|
*/
|
|
1945
1817
|
saveSynonym({ indexName, objectID, synonymHit, forwardToReplicas }, requestOptions) {
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
}
|
|
1952
|
-
if (!synonymHit) {
|
|
1953
|
-
throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");
|
|
1954
|
-
}
|
|
1955
|
-
if (!synonymHit.objectID) {
|
|
1956
|
-
throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");
|
|
1957
|
-
}
|
|
1958
|
-
if (!synonymHit.type) {
|
|
1959
|
-
throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");
|
|
1960
|
-
}
|
|
1818
|
+
validateRequired("indexName", "saveSynonym", indexName);
|
|
1819
|
+
validateRequired("objectID", "saveSynonym", objectID);
|
|
1820
|
+
validateRequired("synonymHit", "saveSynonym", synonymHit);
|
|
1821
|
+
validateRequired("synonymHit.objectID", "saveSynonym", synonymHit.objectID);
|
|
1822
|
+
validateRequired("synonymHit.type", "saveSynonym", synonymHit.type);
|
|
1961
1823
|
const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1962
1824
|
const headers = {};
|
|
1963
1825
|
const queryParameters = {};
|
|
@@ -1986,12 +1848,8 @@ function createSearchClient({
|
|
|
1986
1848
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1987
1849
|
*/
|
|
1988
1850
|
saveSynonyms({ indexName, synonymHit, forwardToReplicas, replaceExistingSynonyms }, requestOptions) {
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
}
|
|
1992
|
-
if (!synonymHit) {
|
|
1993
|
-
throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");
|
|
1994
|
-
}
|
|
1851
|
+
validateRequired("indexName", "saveSynonyms", indexName);
|
|
1852
|
+
validateRequired("synonymHit", "saveSynonyms", synonymHit);
|
|
1995
1853
|
const requestPath = "/1/indexes/{indexName}/synonyms/batch".replace("{indexName}", encodeURIComponent(indexName));
|
|
1996
1854
|
const headers = {};
|
|
1997
1855
|
const queryParameters = {};
|
|
@@ -2040,12 +1898,8 @@ function createSearchClient({
|
|
|
2040
1898
|
};
|
|
2041
1899
|
searchMethodParams = newSignatureRequest;
|
|
2042
1900
|
}
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
}
|
|
2046
|
-
if (!searchMethodParams.requests) {
|
|
2047
|
-
throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");
|
|
2048
|
-
}
|
|
1901
|
+
validateRequired("searchMethodParams", "search", searchMethodParams);
|
|
1902
|
+
validateRequired("searchMethodParams.requests", "search", searchMethodParams.requests);
|
|
2049
1903
|
const requestPath = "/1/indexes/*/queries";
|
|
2050
1904
|
const headers = {};
|
|
2051
1905
|
const queryParameters = {};
|
|
@@ -2071,19 +1925,13 @@ function createSearchClient({
|
|
|
2071
1925
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2072
1926
|
*/
|
|
2073
1927
|
searchDictionaryEntries({ dictionaryName, searchDictionaryEntriesParams }, requestOptions) {
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
}
|
|
2082
|
-
if (!searchDictionaryEntriesParams.query) {
|
|
2083
|
-
throw new Error(
|
|
2084
|
-
"Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`."
|
|
2085
|
-
);
|
|
2086
|
-
}
|
|
1928
|
+
validateRequired("dictionaryName", "searchDictionaryEntries", dictionaryName);
|
|
1929
|
+
validateRequired("searchDictionaryEntriesParams", "searchDictionaryEntries", searchDictionaryEntriesParams);
|
|
1930
|
+
validateRequired(
|
|
1931
|
+
"searchDictionaryEntriesParams.query",
|
|
1932
|
+
"searchDictionaryEntries",
|
|
1933
|
+
searchDictionaryEntriesParams.query
|
|
1934
|
+
);
|
|
2087
1935
|
const requestPath = "/1/dictionaries/{dictionaryName}/search".replace(
|
|
2088
1936
|
"{dictionaryName}",
|
|
2089
1937
|
encodeURIComponent(dictionaryName)
|
|
@@ -2113,12 +1961,8 @@ function createSearchClient({
|
|
|
2113
1961
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2114
1962
|
*/
|
|
2115
1963
|
searchForFacetValues({ indexName, facetName, searchForFacetValuesRequest }, requestOptions) {
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
}
|
|
2119
|
-
if (!facetName) {
|
|
2120
|
-
throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");
|
|
2121
|
-
}
|
|
1964
|
+
validateRequired("indexName", "searchForFacetValues", indexName);
|
|
1965
|
+
validateRequired("facetName", "searchForFacetValues", facetName);
|
|
2122
1966
|
const requestPath = "/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}", encodeURIComponent(indexName)).replace("{facetName}", encodeURIComponent(facetName));
|
|
2123
1967
|
const headers = {};
|
|
2124
1968
|
const queryParameters = {};
|
|
@@ -2144,9 +1988,7 @@ function createSearchClient({
|
|
|
2144
1988
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2145
1989
|
*/
|
|
2146
1990
|
searchRules({ indexName, searchRulesParams }, requestOptions) {
|
|
2147
|
-
|
|
2148
|
-
throw new Error("Parameter `indexName` is required when calling `searchRules`.");
|
|
2149
|
-
}
|
|
1991
|
+
validateRequired("indexName", "searchRules", indexName);
|
|
2150
1992
|
const requestPath = "/1/indexes/{indexName}/rules/search".replace("{indexName}", encodeURIComponent(indexName));
|
|
2151
1993
|
const headers = {};
|
|
2152
1994
|
const queryParameters = {};
|
|
@@ -2172,9 +2014,7 @@ function createSearchClient({
|
|
|
2172
2014
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2173
2015
|
*/
|
|
2174
2016
|
searchSingleIndex({ indexName, searchParams }, requestOptions) {
|
|
2175
|
-
|
|
2176
|
-
throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");
|
|
2177
|
-
}
|
|
2017
|
+
validateRequired("indexName", "searchSingleIndex", indexName);
|
|
2178
2018
|
const requestPath = "/1/indexes/{indexName}/query".replace("{indexName}", encodeURIComponent(indexName));
|
|
2179
2019
|
const headers = {};
|
|
2180
2020
|
const queryParameters = {};
|
|
@@ -2200,9 +2040,7 @@ function createSearchClient({
|
|
|
2200
2040
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2201
2041
|
*/
|
|
2202
2042
|
searchSynonyms({ indexName, searchSynonymsParams }, requestOptions) {
|
|
2203
|
-
|
|
2204
|
-
throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");
|
|
2205
|
-
}
|
|
2043
|
+
validateRequired("indexName", "searchSynonyms", indexName);
|
|
2206
2044
|
const requestPath = "/1/indexes/{indexName}/synonyms/search".replace(
|
|
2207
2045
|
"{indexName}",
|
|
2208
2046
|
encodeURIComponent(indexName)
|
|
@@ -2231,12 +2069,8 @@ function createSearchClient({
|
|
|
2231
2069
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2232
2070
|
*/
|
|
2233
2071
|
searchUserIds(searchUserIdsParams, requestOptions) {
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
}
|
|
2237
|
-
if (!searchUserIdsParams.query) {
|
|
2238
|
-
throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");
|
|
2239
|
-
}
|
|
2072
|
+
validateRequired("searchUserIdsParams", "searchUserIds", searchUserIdsParams);
|
|
2073
|
+
validateRequired("searchUserIdsParams.query", "searchUserIds", searchUserIdsParams.query);
|
|
2240
2074
|
const requestPath = "/1/clusters/mapping/search";
|
|
2241
2075
|
const headers = {};
|
|
2242
2076
|
const queryParameters = {};
|
|
@@ -2260,14 +2094,12 @@ function createSearchClient({
|
|
|
2260
2094
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2261
2095
|
*/
|
|
2262
2096
|
setDictionarySettings(dictionarySettingsParams, requestOptions) {
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
);
|
|
2270
|
-
}
|
|
2097
|
+
validateRequired("dictionarySettingsParams", "setDictionarySettings", dictionarySettingsParams);
|
|
2098
|
+
validateRequired(
|
|
2099
|
+
"dictionarySettingsParams.disableStandardEntries",
|
|
2100
|
+
"setDictionarySettings",
|
|
2101
|
+
dictionarySettingsParams.disableStandardEntries
|
|
2102
|
+
);
|
|
2271
2103
|
const requestPath = "/1/dictionaries/*/settings";
|
|
2272
2104
|
const headers = {};
|
|
2273
2105
|
const queryParameters = {};
|
|
@@ -2292,12 +2124,8 @@ function createSearchClient({
|
|
|
2292
2124
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2293
2125
|
*/
|
|
2294
2126
|
setSettings({ indexName, indexSettings, forwardToReplicas }, requestOptions) {
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
}
|
|
2298
|
-
if (!indexSettings) {
|
|
2299
|
-
throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");
|
|
2300
|
-
}
|
|
2127
|
+
validateRequired("indexName", "setSettings", indexName);
|
|
2128
|
+
validateRequired("indexSettings", "setSettings", indexSettings);
|
|
2301
2129
|
const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
|
|
2302
2130
|
const headers = {};
|
|
2303
2131
|
const queryParameters = {};
|
|
@@ -2324,15 +2152,9 @@ function createSearchClient({
|
|
|
2324
2152
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2325
2153
|
*/
|
|
2326
2154
|
updateApiKey({ key, apiKey }, requestOptions) {
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
if (!apiKey) {
|
|
2331
|
-
throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");
|
|
2332
|
-
}
|
|
2333
|
-
if (!apiKey.acl) {
|
|
2334
|
-
throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");
|
|
2335
|
-
}
|
|
2155
|
+
validateRequired("key", "updateApiKey", key);
|
|
2156
|
+
validateRequired("apiKey", "updateApiKey", apiKey);
|
|
2157
|
+
validateRequired("apiKey.acl", "updateApiKey", apiKey.acl);
|
|
2336
2158
|
const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
|
|
2337
2159
|
const headers = {};
|
|
2338
2160
|
const queryParameters = {};
|