@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/src/searchClient.js
CHANGED
|
@@ -5,9 +5,10 @@ import {
|
|
|
5
5
|
createIterablePromise,
|
|
6
6
|
createTransporter,
|
|
7
7
|
getAlgoliaAgent,
|
|
8
|
-
shuffle
|
|
8
|
+
shuffle,
|
|
9
|
+
validateRequired
|
|
9
10
|
} from "@algolia/client-common";
|
|
10
|
-
var apiClientVersion = "5.
|
|
11
|
+
var apiClientVersion = "5.54.0";
|
|
11
12
|
function getDefaultHosts(appId) {
|
|
12
13
|
return [
|
|
13
14
|
{
|
|
@@ -272,7 +273,7 @@ function createSearchClient({
|
|
|
272
273
|
browseRules({ indexName, searchRulesParams, ...browseRulesOptions }, requestOptions) {
|
|
273
274
|
const params = {
|
|
274
275
|
...searchRulesParams,
|
|
275
|
-
hitsPerPage: searchRulesParams
|
|
276
|
+
hitsPerPage: (searchRulesParams == null ? void 0 : searchRulesParams.hitsPerPage) || 1e3
|
|
276
277
|
};
|
|
277
278
|
return createIterablePromise({
|
|
278
279
|
func: (previousResponse) => {
|
|
@@ -309,7 +310,7 @@ function createSearchClient({
|
|
|
309
310
|
}, requestOptions) {
|
|
310
311
|
const params = {
|
|
311
312
|
...searchSynonymsParams,
|
|
312
|
-
page: searchSynonymsParams
|
|
313
|
+
page: (searchSynonymsParams == null ? void 0 : searchSynonymsParams.page) || 0,
|
|
313
314
|
hitsPerPage: 1e3
|
|
314
315
|
};
|
|
315
316
|
return createIterablePromise({
|
|
@@ -341,9 +342,17 @@ function createSearchClient({
|
|
|
341
342
|
* @param chunkedBatch.action - The `batch` `action` to perform on the given array of `objects`, defaults to `addObject`.
|
|
342
343
|
* @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.
|
|
343
344
|
* @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.
|
|
345
|
+
* @param chunkedBatch.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
344
346
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
|
|
345
347
|
*/
|
|
346
|
-
async chunkedBatch({
|
|
348
|
+
async chunkedBatch({
|
|
349
|
+
indexName,
|
|
350
|
+
objects,
|
|
351
|
+
action = "addObject",
|
|
352
|
+
waitForTasks,
|
|
353
|
+
batchSize = 1e3,
|
|
354
|
+
maxRetries = 100
|
|
355
|
+
}, requestOptions) {
|
|
347
356
|
let requests = [];
|
|
348
357
|
const responses = [];
|
|
349
358
|
const objectEntries = objects.entries();
|
|
@@ -356,7 +365,7 @@ function createSearchClient({
|
|
|
356
365
|
}
|
|
357
366
|
if (waitForTasks) {
|
|
358
367
|
for (const resp of responses) {
|
|
359
|
-
await this.waitForTask({ indexName, taskID: resp.taskID });
|
|
368
|
+
await this.waitForTask({ indexName, taskID: resp.taskID, maxRetries });
|
|
360
369
|
}
|
|
361
370
|
}
|
|
362
371
|
return responses;
|
|
@@ -370,11 +379,12 @@ function createSearchClient({
|
|
|
370
379
|
* @param saveObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
371
380
|
* @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.
|
|
372
381
|
* @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.
|
|
382
|
+
* @param saveObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
373
383
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
|
|
374
384
|
*/
|
|
375
|
-
async saveObjects({ indexName, objects, waitForTasks, batchSize }, requestOptions) {
|
|
385
|
+
async saveObjects({ indexName, objects, waitForTasks, batchSize, maxRetries }, requestOptions) {
|
|
376
386
|
return await this.chunkedBatch(
|
|
377
|
-
{ indexName, objects, action: "addObject", waitForTasks, batchSize },
|
|
387
|
+
{ indexName, objects, action: "addObject", waitForTasks, batchSize, maxRetries },
|
|
378
388
|
requestOptions
|
|
379
389
|
);
|
|
380
390
|
},
|
|
@@ -387,16 +397,18 @@ function createSearchClient({
|
|
|
387
397
|
* @param deleteObjects.objectIDs - The objectIDs to delete.
|
|
388
398
|
* @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.
|
|
389
399
|
* @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.
|
|
400
|
+
* @param deleteObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
390
401
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
|
|
391
402
|
*/
|
|
392
|
-
async deleteObjects({ indexName, objectIDs, waitForTasks, batchSize }, requestOptions) {
|
|
403
|
+
async deleteObjects({ indexName, objectIDs, waitForTasks, batchSize, maxRetries }, requestOptions) {
|
|
393
404
|
return await this.chunkedBatch(
|
|
394
405
|
{
|
|
395
406
|
indexName,
|
|
396
407
|
objects: objectIDs.map((objectID) => ({ objectID })),
|
|
397
408
|
action: "deleteObject",
|
|
398
409
|
waitForTasks,
|
|
399
|
-
batchSize
|
|
410
|
+
batchSize,
|
|
411
|
+
maxRetries
|
|
400
412
|
},
|
|
401
413
|
requestOptions
|
|
402
414
|
);
|
|
@@ -411,16 +423,18 @@ function createSearchClient({
|
|
|
411
423
|
* @param partialUpdateObjects.createIfNotExists - To be provided if non-existing objects are passed, otherwise, the call will fail.
|
|
412
424
|
* @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.
|
|
413
425
|
* @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.
|
|
426
|
+
* @param partialUpdateObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
414
427
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
|
|
415
428
|
*/
|
|
416
|
-
async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks, batchSize }, requestOptions) {
|
|
429
|
+
async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks, batchSize, maxRetries }, requestOptions) {
|
|
417
430
|
return await this.chunkedBatch(
|
|
418
431
|
{
|
|
419
432
|
indexName,
|
|
420
433
|
objects,
|
|
421
434
|
action: createIfNotExists ? "partialUpdateObject" : "partialUpdateObjectNoCreate",
|
|
422
435
|
batchSize,
|
|
423
|
-
waitForTasks
|
|
436
|
+
waitForTasks,
|
|
437
|
+
maxRetries
|
|
424
438
|
},
|
|
425
439
|
requestOptions
|
|
426
440
|
);
|
|
@@ -435,9 +449,10 @@ function createSearchClient({
|
|
|
435
449
|
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
436
450
|
* @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.
|
|
437
451
|
* @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
|
|
452
|
+
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
438
453
|
* @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.
|
|
439
454
|
*/
|
|
440
|
-
async replaceAllObjects({ indexName, objects, batchSize, scopes }, requestOptions) {
|
|
455
|
+
async replaceAllObjects({ indexName, objects, batchSize, scopes, maxRetries = 100 }, requestOptions) {
|
|
441
456
|
const randomSuffix = Math.floor(Math.random() * 1e6) + 1e5;
|
|
442
457
|
const tmpIndexName = `${indexName}_tmp_${randomSuffix}`;
|
|
443
458
|
if (scopes === void 0) {
|
|
@@ -456,12 +471,13 @@ function createSearchClient({
|
|
|
456
471
|
requestOptions
|
|
457
472
|
);
|
|
458
473
|
const batchResponses = await this.chunkedBatch(
|
|
459
|
-
{ indexName: tmpIndexName, objects, waitForTasks: true, batchSize },
|
|
474
|
+
{ indexName: tmpIndexName, objects, waitForTasks: true, batchSize, maxRetries },
|
|
460
475
|
requestOptions
|
|
461
476
|
);
|
|
462
477
|
await this.waitForTask({
|
|
463
478
|
indexName: tmpIndexName,
|
|
464
|
-
taskID: copyOperationResponse.taskID
|
|
479
|
+
taskID: copyOperationResponse.taskID,
|
|
480
|
+
maxRetries
|
|
465
481
|
});
|
|
466
482
|
copyOperationResponse = await this.operationIndex(
|
|
467
483
|
{
|
|
@@ -476,7 +492,8 @@ function createSearchClient({
|
|
|
476
492
|
);
|
|
477
493
|
await this.waitForTask({
|
|
478
494
|
indexName: tmpIndexName,
|
|
479
|
-
taskID: copyOperationResponse.taskID
|
|
495
|
+
taskID: copyOperationResponse.taskID,
|
|
496
|
+
maxRetries
|
|
480
497
|
});
|
|
481
498
|
const moveOperationResponse = await this.operationIndex(
|
|
482
499
|
{
|
|
@@ -487,7 +504,8 @@ function createSearchClient({
|
|
|
487
504
|
);
|
|
488
505
|
await this.waitForTask({
|
|
489
506
|
indexName: tmpIndexName,
|
|
490
|
-
taskID: moveOperationResponse.taskID
|
|
507
|
+
taskID: moveOperationResponse.taskID,
|
|
508
|
+
maxRetries
|
|
491
509
|
});
|
|
492
510
|
return { copyOperationResponse, batchResponses, moveOperationResponse };
|
|
493
511
|
} catch (error) {
|
|
@@ -537,12 +555,8 @@ function createSearchClient({
|
|
|
537
555
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
538
556
|
*/
|
|
539
557
|
addApiKey(apiKey, requestOptions) {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
if (!apiKey.acl) {
|
|
544
|
-
throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");
|
|
545
|
-
}
|
|
558
|
+
validateRequired("apiKey", "addApiKey", apiKey);
|
|
559
|
+
validateRequired("apiKey.acl", "addApiKey", apiKey.acl);
|
|
546
560
|
const requestPath = "/1/keys";
|
|
547
561
|
const headers = {};
|
|
548
562
|
const queryParameters = {};
|
|
@@ -567,15 +581,9 @@ function createSearchClient({
|
|
|
567
581
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
568
582
|
*/
|
|
569
583
|
addOrUpdateObject({ indexName, objectID, body }, requestOptions) {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
if (!objectID) {
|
|
574
|
-
throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");
|
|
575
|
-
}
|
|
576
|
-
if (!body) {
|
|
577
|
-
throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");
|
|
578
|
-
}
|
|
584
|
+
validateRequired("indexName", "addOrUpdateObject", indexName);
|
|
585
|
+
validateRequired("objectID", "addOrUpdateObject", objectID);
|
|
586
|
+
validateRequired("body", "addOrUpdateObject", body);
|
|
579
587
|
const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
580
588
|
const headers = {};
|
|
581
589
|
const queryParameters = {};
|
|
@@ -597,12 +605,8 @@ function createSearchClient({
|
|
|
597
605
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
598
606
|
*/
|
|
599
607
|
appendSource(source, requestOptions) {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
}
|
|
603
|
-
if (!source.source) {
|
|
604
|
-
throw new Error("Parameter `source.source` is required when calling `appendSource`.");
|
|
605
|
-
}
|
|
608
|
+
validateRequired("source", "appendSource", source);
|
|
609
|
+
validateRequired("source.source", "appendSource", source.source);
|
|
606
610
|
const requestPath = "/1/security/sources/append";
|
|
607
611
|
const headers = {};
|
|
608
612
|
const queryParameters = {};
|
|
@@ -628,15 +632,9 @@ function createSearchClient({
|
|
|
628
632
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
629
633
|
*/
|
|
630
634
|
assignUserId({ xAlgoliaUserID, assignUserIdParams }, requestOptions) {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
if (!assignUserIdParams) {
|
|
635
|
-
throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");
|
|
636
|
-
}
|
|
637
|
-
if (!assignUserIdParams.cluster) {
|
|
638
|
-
throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");
|
|
639
|
-
}
|
|
635
|
+
validateRequired("xAlgoliaUserID", "assignUserId", xAlgoliaUserID);
|
|
636
|
+
validateRequired("assignUserIdParams", "assignUserId", assignUserIdParams);
|
|
637
|
+
validateRequired("assignUserIdParams.cluster", "assignUserId", assignUserIdParams.cluster);
|
|
640
638
|
const requestPath = "/1/clusters/mapping";
|
|
641
639
|
const headers = {};
|
|
642
640
|
const queryParameters = {};
|
|
@@ -663,15 +661,9 @@ function createSearchClient({
|
|
|
663
661
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
664
662
|
*/
|
|
665
663
|
batch({ indexName, batchWriteParams }, requestOptions) {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
if (!batchWriteParams) {
|
|
670
|
-
throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");
|
|
671
|
-
}
|
|
672
|
-
if (!batchWriteParams.requests) {
|
|
673
|
-
throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");
|
|
674
|
-
}
|
|
664
|
+
validateRequired("indexName", "batch", indexName);
|
|
665
|
+
validateRequired("batchWriteParams", "batch", batchWriteParams);
|
|
666
|
+
validateRequired("batchWriteParams.requests", "batch", batchWriteParams.requests);
|
|
675
667
|
const requestPath = "/1/indexes/{indexName}/batch".replace("{indexName}", encodeURIComponent(indexName));
|
|
676
668
|
const headers = {};
|
|
677
669
|
const queryParameters = {};
|
|
@@ -697,18 +689,10 @@ function createSearchClient({
|
|
|
697
689
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
698
690
|
*/
|
|
699
691
|
batchAssignUserIds({ xAlgoliaUserID, batchAssignUserIdsParams }, requestOptions) {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");
|
|
705
|
-
}
|
|
706
|
-
if (!batchAssignUserIdsParams.cluster) {
|
|
707
|
-
throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");
|
|
708
|
-
}
|
|
709
|
-
if (!batchAssignUserIdsParams.users) {
|
|
710
|
-
throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");
|
|
711
|
-
}
|
|
692
|
+
validateRequired("xAlgoliaUserID", "batchAssignUserIds", xAlgoliaUserID);
|
|
693
|
+
validateRequired("batchAssignUserIdsParams", "batchAssignUserIds", batchAssignUserIdsParams);
|
|
694
|
+
validateRequired("batchAssignUserIdsParams.cluster", "batchAssignUserIds", batchAssignUserIdsParams.cluster);
|
|
695
|
+
validateRequired("batchAssignUserIdsParams.users", "batchAssignUserIds", batchAssignUserIdsParams.users);
|
|
712
696
|
const requestPath = "/1/clusters/mapping/batch";
|
|
713
697
|
const headers = {};
|
|
714
698
|
const queryParameters = {};
|
|
@@ -735,17 +719,13 @@ function createSearchClient({
|
|
|
735
719
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
736
720
|
*/
|
|
737
721
|
batchDictionaryEntries({ dictionaryName, batchDictionaryEntriesParams }, requestOptions) {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
throw new Error(
|
|
746
|
-
"Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`."
|
|
747
|
-
);
|
|
748
|
-
}
|
|
722
|
+
validateRequired("dictionaryName", "batchDictionaryEntries", dictionaryName);
|
|
723
|
+
validateRequired("batchDictionaryEntriesParams", "batchDictionaryEntries", batchDictionaryEntriesParams);
|
|
724
|
+
validateRequired(
|
|
725
|
+
"batchDictionaryEntriesParams.requests",
|
|
726
|
+
"batchDictionaryEntries",
|
|
727
|
+
batchDictionaryEntriesParams.requests
|
|
728
|
+
);
|
|
749
729
|
const requestPath = "/1/dictionaries/{dictionaryName}/batch".replace(
|
|
750
730
|
"{dictionaryName}",
|
|
751
731
|
encodeURIComponent(dictionaryName)
|
|
@@ -772,9 +752,7 @@ function createSearchClient({
|
|
|
772
752
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
773
753
|
*/
|
|
774
754
|
browse({ indexName, browseParams }, requestOptions) {
|
|
775
|
-
|
|
776
|
-
throw new Error("Parameter `indexName` is required when calling `browse`.");
|
|
777
|
-
}
|
|
755
|
+
validateRequired("indexName", "browse", indexName);
|
|
778
756
|
const requestPath = "/1/indexes/{indexName}/browse".replace("{indexName}", encodeURIComponent(indexName));
|
|
779
757
|
const headers = {};
|
|
780
758
|
const queryParameters = {};
|
|
@@ -798,9 +776,7 @@ function createSearchClient({
|
|
|
798
776
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
799
777
|
*/
|
|
800
778
|
clearObjects({ indexName }, requestOptions) {
|
|
801
|
-
|
|
802
|
-
throw new Error("Parameter `indexName` is required when calling `clearObjects`.");
|
|
803
|
-
}
|
|
779
|
+
validateRequired("indexName", "clearObjects", indexName);
|
|
804
780
|
const requestPath = "/1/indexes/{indexName}/clear".replace("{indexName}", encodeURIComponent(indexName));
|
|
805
781
|
const headers = {};
|
|
806
782
|
const queryParameters = {};
|
|
@@ -823,9 +799,7 @@ function createSearchClient({
|
|
|
823
799
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
824
800
|
*/
|
|
825
801
|
clearRules({ indexName, forwardToReplicas }, requestOptions) {
|
|
826
|
-
|
|
827
|
-
throw new Error("Parameter `indexName` is required when calling `clearRules`.");
|
|
828
|
-
}
|
|
802
|
+
validateRequired("indexName", "clearRules", indexName);
|
|
829
803
|
const requestPath = "/1/indexes/{indexName}/rules/clear".replace("{indexName}", encodeURIComponent(indexName));
|
|
830
804
|
const headers = {};
|
|
831
805
|
const queryParameters = {};
|
|
@@ -851,9 +825,7 @@ function createSearchClient({
|
|
|
851
825
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
852
826
|
*/
|
|
853
827
|
clearSynonyms({ indexName, forwardToReplicas }, requestOptions) {
|
|
854
|
-
|
|
855
|
-
throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");
|
|
856
|
-
}
|
|
828
|
+
validateRequired("indexName", "clearSynonyms", indexName);
|
|
857
829
|
const requestPath = "/1/indexes/{indexName}/synonyms/clear".replace("{indexName}", encodeURIComponent(indexName));
|
|
858
830
|
const headers = {};
|
|
859
831
|
const queryParameters = {};
|
|
@@ -876,9 +848,7 @@ function createSearchClient({
|
|
|
876
848
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
877
849
|
*/
|
|
878
850
|
customDelete({ path, parameters }, requestOptions) {
|
|
879
|
-
|
|
880
|
-
throw new Error("Parameter `path` is required when calling `customDelete`.");
|
|
881
|
-
}
|
|
851
|
+
validateRequired("path", "customDelete", path);
|
|
882
852
|
const requestPath = "/{path}".replace("{path}", path);
|
|
883
853
|
const headers = {};
|
|
884
854
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -898,9 +868,7 @@ function createSearchClient({
|
|
|
898
868
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
899
869
|
*/
|
|
900
870
|
customGet({ path, parameters }, requestOptions) {
|
|
901
|
-
|
|
902
|
-
throw new Error("Parameter `path` is required when calling `customGet`.");
|
|
903
|
-
}
|
|
871
|
+
validateRequired("path", "customGet", path);
|
|
904
872
|
const requestPath = "/{path}".replace("{path}", path);
|
|
905
873
|
const headers = {};
|
|
906
874
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -921,9 +889,7 @@ function createSearchClient({
|
|
|
921
889
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
922
890
|
*/
|
|
923
891
|
customPost({ path, parameters, body }, requestOptions) {
|
|
924
|
-
|
|
925
|
-
throw new Error("Parameter `path` is required when calling `customPost`.");
|
|
926
|
-
}
|
|
892
|
+
validateRequired("path", "customPost", path);
|
|
927
893
|
const requestPath = "/{path}".replace("{path}", path);
|
|
928
894
|
const headers = {};
|
|
929
895
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -945,9 +911,7 @@ function createSearchClient({
|
|
|
945
911
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
946
912
|
*/
|
|
947
913
|
customPut({ path, parameters, body }, requestOptions) {
|
|
948
|
-
|
|
949
|
-
throw new Error("Parameter `path` is required when calling `customPut`.");
|
|
950
|
-
}
|
|
914
|
+
validateRequired("path", "customPut", path);
|
|
951
915
|
const requestPath = "/{path}".replace("{path}", path);
|
|
952
916
|
const headers = {};
|
|
953
917
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -970,9 +934,7 @@ function createSearchClient({
|
|
|
970
934
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
971
935
|
*/
|
|
972
936
|
deleteApiKey({ key }, requestOptions) {
|
|
973
|
-
|
|
974
|
-
throw new Error("Parameter `key` is required when calling `deleteApiKey`.");
|
|
975
|
-
}
|
|
937
|
+
validateRequired("key", "deleteApiKey", key);
|
|
976
938
|
const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
|
|
977
939
|
const headers = {};
|
|
978
940
|
const queryParameters = {};
|
|
@@ -995,12 +957,8 @@ function createSearchClient({
|
|
|
995
957
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
996
958
|
*/
|
|
997
959
|
deleteBy({ indexName, deleteByParams }, requestOptions) {
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
}
|
|
1001
|
-
if (!deleteByParams) {
|
|
1002
|
-
throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");
|
|
1003
|
-
}
|
|
960
|
+
validateRequired("indexName", "deleteBy", indexName);
|
|
961
|
+
validateRequired("deleteByParams", "deleteBy", deleteByParams);
|
|
1004
962
|
const requestPath = "/1/indexes/{indexName}/deleteByQuery".replace("{indexName}", encodeURIComponent(indexName));
|
|
1005
963
|
const headers = {};
|
|
1006
964
|
const queryParameters = {};
|
|
@@ -1023,9 +981,7 @@ function createSearchClient({
|
|
|
1023
981
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1024
982
|
*/
|
|
1025
983
|
deleteIndex({ indexName }, requestOptions) {
|
|
1026
|
-
|
|
1027
|
-
throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");
|
|
1028
|
-
}
|
|
984
|
+
validateRequired("indexName", "deleteIndex", indexName);
|
|
1029
985
|
const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
1030
986
|
const headers = {};
|
|
1031
987
|
const queryParameters = {};
|
|
@@ -1048,12 +1004,8 @@ function createSearchClient({
|
|
|
1048
1004
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1049
1005
|
*/
|
|
1050
1006
|
deleteObject({ indexName, objectID }, requestOptions) {
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
}
|
|
1054
|
-
if (!objectID) {
|
|
1055
|
-
throw new Error("Parameter `objectID` is required when calling `deleteObject`.");
|
|
1056
|
-
}
|
|
1007
|
+
validateRequired("indexName", "deleteObject", indexName);
|
|
1008
|
+
validateRequired("objectID", "deleteObject", objectID);
|
|
1057
1009
|
const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1058
1010
|
const headers = {};
|
|
1059
1011
|
const queryParameters = {};
|
|
@@ -1077,12 +1029,8 @@ function createSearchClient({
|
|
|
1077
1029
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1078
1030
|
*/
|
|
1079
1031
|
deleteRule({ indexName, objectID, forwardToReplicas }, requestOptions) {
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
}
|
|
1083
|
-
if (!objectID) {
|
|
1084
|
-
throw new Error("Parameter `objectID` is required when calling `deleteRule`.");
|
|
1085
|
-
}
|
|
1032
|
+
validateRequired("indexName", "deleteRule", indexName);
|
|
1033
|
+
validateRequired("objectID", "deleteRule", objectID);
|
|
1086
1034
|
const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1087
1035
|
const headers = {};
|
|
1088
1036
|
const queryParameters = {};
|
|
@@ -1107,9 +1055,7 @@ function createSearchClient({
|
|
|
1107
1055
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1108
1056
|
*/
|
|
1109
1057
|
deleteSource({ source }, requestOptions) {
|
|
1110
|
-
|
|
1111
|
-
throw new Error("Parameter `source` is required when calling `deleteSource`.");
|
|
1112
|
-
}
|
|
1058
|
+
validateRequired("source", "deleteSource", source);
|
|
1113
1059
|
const requestPath = "/1/security/sources/{source}".replace("{source}", encodeURIComponent(source));
|
|
1114
1060
|
const headers = {};
|
|
1115
1061
|
const queryParameters = {};
|
|
@@ -1133,12 +1079,8 @@ function createSearchClient({
|
|
|
1133
1079
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1134
1080
|
*/
|
|
1135
1081
|
deleteSynonym({ indexName, objectID, forwardToReplicas }, requestOptions) {
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
}
|
|
1139
|
-
if (!objectID) {
|
|
1140
|
-
throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");
|
|
1141
|
-
}
|
|
1082
|
+
validateRequired("indexName", "deleteSynonym", indexName);
|
|
1083
|
+
validateRequired("objectID", "deleteSynonym", objectID);
|
|
1142
1084
|
const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1143
1085
|
const headers = {};
|
|
1144
1086
|
const queryParameters = {};
|
|
@@ -1163,9 +1105,7 @@ function createSearchClient({
|
|
|
1163
1105
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1164
1106
|
*/
|
|
1165
1107
|
getApiKey({ key }, requestOptions) {
|
|
1166
|
-
|
|
1167
|
-
throw new Error("Parameter `key` is required when calling `getApiKey`.");
|
|
1168
|
-
}
|
|
1108
|
+
validateRequired("key", "getApiKey", key);
|
|
1169
1109
|
const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
|
|
1170
1110
|
const headers = {};
|
|
1171
1111
|
const queryParameters = {};
|
|
@@ -1187,9 +1127,7 @@ function createSearchClient({
|
|
|
1187
1127
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1188
1128
|
*/
|
|
1189
1129
|
getAppTask({ taskID }, requestOptions) {
|
|
1190
|
-
|
|
1191
|
-
throw new Error("Parameter `taskID` is required when calling `getAppTask`.");
|
|
1192
|
-
}
|
|
1130
|
+
validateRequired("taskID", "getAppTask", taskID);
|
|
1193
1131
|
const requestPath = "/1/task/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
|
|
1194
1132
|
const headers = {};
|
|
1195
1133
|
const queryParameters = {};
|
|
@@ -1287,12 +1225,8 @@ function createSearchClient({
|
|
|
1287
1225
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1288
1226
|
*/
|
|
1289
1227
|
getObject({ indexName, objectID, attributesToRetrieve }, requestOptions) {
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
}
|
|
1293
|
-
if (!objectID) {
|
|
1294
|
-
throw new Error("Parameter `objectID` is required when calling `getObject`.");
|
|
1295
|
-
}
|
|
1228
|
+
validateRequired("indexName", "getObject", indexName);
|
|
1229
|
+
validateRequired("objectID", "getObject", objectID);
|
|
1296
1230
|
const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1297
1231
|
const headers = {};
|
|
1298
1232
|
const queryParameters = {};
|
|
@@ -1316,12 +1250,8 @@ function createSearchClient({
|
|
|
1316
1250
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1317
1251
|
*/
|
|
1318
1252
|
getObjects(getObjectsParams, requestOptions) {
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
}
|
|
1322
|
-
if (!getObjectsParams.requests) {
|
|
1323
|
-
throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");
|
|
1324
|
-
}
|
|
1253
|
+
validateRequired("getObjectsParams", "getObjects", getObjectsParams);
|
|
1254
|
+
validateRequired("getObjectsParams.requests", "getObjects", getObjectsParams.requests);
|
|
1325
1255
|
const requestPath = "/1/indexes/*/objects";
|
|
1326
1256
|
const headers = {};
|
|
1327
1257
|
const queryParameters = {};
|
|
@@ -1347,12 +1277,8 @@ function createSearchClient({
|
|
|
1347
1277
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1348
1278
|
*/
|
|
1349
1279
|
getRule({ indexName, objectID }, requestOptions) {
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
}
|
|
1353
|
-
if (!objectID) {
|
|
1354
|
-
throw new Error("Parameter `objectID` is required when calling `getRule`.");
|
|
1355
|
-
}
|
|
1280
|
+
validateRequired("indexName", "getRule", indexName);
|
|
1281
|
+
validateRequired("objectID", "getRule", objectID);
|
|
1356
1282
|
const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1357
1283
|
const headers = {};
|
|
1358
1284
|
const queryParameters = {};
|
|
@@ -1375,9 +1301,7 @@ function createSearchClient({
|
|
|
1375
1301
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1376
1302
|
*/
|
|
1377
1303
|
getSettings({ indexName, getVersion }, requestOptions) {
|
|
1378
|
-
|
|
1379
|
-
throw new Error("Parameter `indexName` is required when calling `getSettings`.");
|
|
1380
|
-
}
|
|
1304
|
+
validateRequired("indexName", "getSettings", indexName);
|
|
1381
1305
|
const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
|
|
1382
1306
|
const headers = {};
|
|
1383
1307
|
const queryParameters = {};
|
|
@@ -1422,12 +1346,8 @@ function createSearchClient({
|
|
|
1422
1346
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1423
1347
|
*/
|
|
1424
1348
|
getSynonym({ indexName, objectID }, requestOptions) {
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
}
|
|
1428
|
-
if (!objectID) {
|
|
1429
|
-
throw new Error("Parameter `objectID` is required when calling `getSynonym`.");
|
|
1430
|
-
}
|
|
1349
|
+
validateRequired("indexName", "getSynonym", indexName);
|
|
1350
|
+
validateRequired("objectID", "getSynonym", objectID);
|
|
1431
1351
|
const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1432
1352
|
const headers = {};
|
|
1433
1353
|
const queryParameters = {};
|
|
@@ -1450,12 +1370,8 @@ function createSearchClient({
|
|
|
1450
1370
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1451
1371
|
*/
|
|
1452
1372
|
getTask({ indexName, taskID }, requestOptions) {
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
}
|
|
1456
|
-
if (!taskID) {
|
|
1457
|
-
throw new Error("Parameter `taskID` is required when calling `getTask`.");
|
|
1458
|
-
}
|
|
1373
|
+
validateRequired("indexName", "getTask", indexName);
|
|
1374
|
+
validateRequired("taskID", "getTask", taskID);
|
|
1459
1375
|
const requestPath = "/1/indexes/{indexName}/task/{taskID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{taskID}", encodeURIComponent(taskID));
|
|
1460
1376
|
const headers = {};
|
|
1461
1377
|
const queryParameters = {};
|
|
@@ -1500,9 +1416,7 @@ function createSearchClient({
|
|
|
1500
1416
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1501
1417
|
*/
|
|
1502
1418
|
getUserId({ userID }, requestOptions) {
|
|
1503
|
-
|
|
1504
|
-
throw new Error("Parameter `userID` is required when calling `getUserId`.");
|
|
1505
|
-
}
|
|
1419
|
+
validateRequired("userID", "getUserId", userID);
|
|
1506
1420
|
const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
|
|
1507
1421
|
const headers = {};
|
|
1508
1422
|
const queryParameters = {};
|
|
@@ -1647,12 +1561,8 @@ function createSearchClient({
|
|
|
1647
1561
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1648
1562
|
*/
|
|
1649
1563
|
multipleBatch(batchParams, requestOptions) {
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
}
|
|
1653
|
-
if (!batchParams.requests) {
|
|
1654
|
-
throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");
|
|
1655
|
-
}
|
|
1564
|
+
validateRequired("batchParams", "multipleBatch", batchParams);
|
|
1565
|
+
validateRequired("batchParams.requests", "multipleBatch", batchParams.requests);
|
|
1656
1566
|
const requestPath = "/1/indexes/*/batch";
|
|
1657
1567
|
const headers = {};
|
|
1658
1568
|
const queryParameters = {};
|
|
@@ -1676,18 +1586,10 @@ function createSearchClient({
|
|
|
1676
1586
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1677
1587
|
*/
|
|
1678
1588
|
operationIndex({ indexName, operationIndexParams }, requestOptions) {
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");
|
|
1684
|
-
}
|
|
1685
|
-
if (!operationIndexParams.operation) {
|
|
1686
|
-
throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");
|
|
1687
|
-
}
|
|
1688
|
-
if (!operationIndexParams.destination) {
|
|
1689
|
-
throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");
|
|
1690
|
-
}
|
|
1589
|
+
validateRequired("indexName", "operationIndex", indexName);
|
|
1590
|
+
validateRequired("operationIndexParams", "operationIndex", operationIndexParams);
|
|
1591
|
+
validateRequired("operationIndexParams.operation", "operationIndex", operationIndexParams.operation);
|
|
1592
|
+
validateRequired("operationIndexParams.destination", "operationIndex", operationIndexParams.destination);
|
|
1691
1593
|
const requestPath = "/1/indexes/{indexName}/operation".replace("{indexName}", encodeURIComponent(indexName));
|
|
1692
1594
|
const headers = {};
|
|
1693
1595
|
const queryParameters = {};
|
|
@@ -1713,15 +1615,9 @@ function createSearchClient({
|
|
|
1713
1615
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1714
1616
|
*/
|
|
1715
1617
|
partialUpdateObject({ indexName, objectID, attributesToUpdate, createIfNotExists }, requestOptions) {
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
if (!objectID) {
|
|
1720
|
-
throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");
|
|
1721
|
-
}
|
|
1722
|
-
if (!attributesToUpdate) {
|
|
1723
|
-
throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");
|
|
1724
|
-
}
|
|
1618
|
+
validateRequired("indexName", "partialUpdateObject", indexName);
|
|
1619
|
+
validateRequired("objectID", "partialUpdateObject", objectID);
|
|
1620
|
+
validateRequired("attributesToUpdate", "partialUpdateObject", attributesToUpdate);
|
|
1725
1621
|
const requestPath = "/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1726
1622
|
const headers = {};
|
|
1727
1623
|
const queryParameters = {};
|
|
@@ -1749,9 +1645,7 @@ function createSearchClient({
|
|
|
1749
1645
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1750
1646
|
*/
|
|
1751
1647
|
removeUserId({ userID }, requestOptions) {
|
|
1752
|
-
|
|
1753
|
-
throw new Error("Parameter `userID` is required when calling `removeUserId`.");
|
|
1754
|
-
}
|
|
1648
|
+
validateRequired("userID", "removeUserId", userID);
|
|
1755
1649
|
const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
|
|
1756
1650
|
const headers = {};
|
|
1757
1651
|
const queryParameters = {};
|
|
@@ -1773,9 +1667,7 @@ function createSearchClient({
|
|
|
1773
1667
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1774
1668
|
*/
|
|
1775
1669
|
replaceSources({ source }, requestOptions) {
|
|
1776
|
-
|
|
1777
|
-
throw new Error("Parameter `source` is required when calling `replaceSources`.");
|
|
1778
|
-
}
|
|
1670
|
+
validateRequired("source", "replaceSources", source);
|
|
1779
1671
|
const requestPath = "/1/security/sources";
|
|
1780
1672
|
const headers = {};
|
|
1781
1673
|
const queryParameters = {};
|
|
@@ -1798,9 +1690,7 @@ function createSearchClient({
|
|
|
1798
1690
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1799
1691
|
*/
|
|
1800
1692
|
restoreApiKey({ key }, requestOptions) {
|
|
1801
|
-
|
|
1802
|
-
throw new Error("Parameter `key` is required when calling `restoreApiKey`.");
|
|
1803
|
-
}
|
|
1693
|
+
validateRequired("key", "restoreApiKey", key);
|
|
1804
1694
|
const requestPath = "/1/keys/{key}/restore".replace("{key}", encodeURIComponent(key));
|
|
1805
1695
|
const headers = {};
|
|
1806
1696
|
const queryParameters = {};
|
|
@@ -1823,12 +1713,8 @@ function createSearchClient({
|
|
|
1823
1713
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1824
1714
|
*/
|
|
1825
1715
|
saveObject({ indexName, body }, requestOptions) {
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
}
|
|
1829
|
-
if (!body) {
|
|
1830
|
-
throw new Error("Parameter `body` is required when calling `saveObject`.");
|
|
1831
|
-
}
|
|
1716
|
+
validateRequired("indexName", "saveObject", indexName);
|
|
1717
|
+
validateRequired("body", "saveObject", body);
|
|
1832
1718
|
const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
1833
1719
|
const headers = {};
|
|
1834
1720
|
const queryParameters = {};
|
|
@@ -1854,21 +1740,11 @@ function createSearchClient({
|
|
|
1854
1740
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1855
1741
|
*/
|
|
1856
1742
|
saveRule({ indexName, objectID, rule, forwardToReplicas }, requestOptions) {
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
}
|
|
1863
|
-
if (!rule) {
|
|
1864
|
-
throw new Error("Parameter `rule` is required when calling `saveRule`.");
|
|
1865
|
-
}
|
|
1866
|
-
if (!rule.objectID) {
|
|
1867
|
-
throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");
|
|
1868
|
-
}
|
|
1869
|
-
if (!rule.consequence) {
|
|
1870
|
-
throw new Error("Parameter `rule.consequence` is required when calling `saveRule`.");
|
|
1871
|
-
}
|
|
1743
|
+
validateRequired("indexName", "saveRule", indexName);
|
|
1744
|
+
validateRequired("objectID", "saveRule", objectID);
|
|
1745
|
+
validateRequired("rule", "saveRule", rule);
|
|
1746
|
+
validateRequired("rule.objectID", "saveRule", rule.objectID);
|
|
1747
|
+
validateRequired("rule.consequence", "saveRule", rule.consequence);
|
|
1872
1748
|
const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1873
1749
|
const headers = {};
|
|
1874
1750
|
const queryParameters = {};
|
|
@@ -1897,12 +1773,8 @@ function createSearchClient({
|
|
|
1897
1773
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1898
1774
|
*/
|
|
1899
1775
|
saveRules({ indexName, rules, forwardToReplicas, clearExistingRules }, requestOptions) {
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
}
|
|
1903
|
-
if (!rules) {
|
|
1904
|
-
throw new Error("Parameter `rules` is required when calling `saveRules`.");
|
|
1905
|
-
}
|
|
1776
|
+
validateRequired("indexName", "saveRules", indexName);
|
|
1777
|
+
validateRequired("rules", "saveRules", rules);
|
|
1906
1778
|
const requestPath = "/1/indexes/{indexName}/rules/batch".replace("{indexName}", encodeURIComponent(indexName));
|
|
1907
1779
|
const headers = {};
|
|
1908
1780
|
const queryParameters = {};
|
|
@@ -1934,21 +1806,11 @@ function createSearchClient({
|
|
|
1934
1806
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1935
1807
|
*/
|
|
1936
1808
|
saveSynonym({ indexName, objectID, synonymHit, forwardToReplicas }, requestOptions) {
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
}
|
|
1943
|
-
if (!synonymHit) {
|
|
1944
|
-
throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");
|
|
1945
|
-
}
|
|
1946
|
-
if (!synonymHit.objectID) {
|
|
1947
|
-
throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");
|
|
1948
|
-
}
|
|
1949
|
-
if (!synonymHit.type) {
|
|
1950
|
-
throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");
|
|
1951
|
-
}
|
|
1809
|
+
validateRequired("indexName", "saveSynonym", indexName);
|
|
1810
|
+
validateRequired("objectID", "saveSynonym", objectID);
|
|
1811
|
+
validateRequired("synonymHit", "saveSynonym", synonymHit);
|
|
1812
|
+
validateRequired("synonymHit.objectID", "saveSynonym", synonymHit.objectID);
|
|
1813
|
+
validateRequired("synonymHit.type", "saveSynonym", synonymHit.type);
|
|
1952
1814
|
const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1953
1815
|
const headers = {};
|
|
1954
1816
|
const queryParameters = {};
|
|
@@ -1977,12 +1839,8 @@ function createSearchClient({
|
|
|
1977
1839
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1978
1840
|
*/
|
|
1979
1841
|
saveSynonyms({ indexName, synonymHit, forwardToReplicas, replaceExistingSynonyms }, requestOptions) {
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
}
|
|
1983
|
-
if (!synonymHit) {
|
|
1984
|
-
throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");
|
|
1985
|
-
}
|
|
1842
|
+
validateRequired("indexName", "saveSynonyms", indexName);
|
|
1843
|
+
validateRequired("synonymHit", "saveSynonyms", synonymHit);
|
|
1986
1844
|
const requestPath = "/1/indexes/{indexName}/synonyms/batch".replace("{indexName}", encodeURIComponent(indexName));
|
|
1987
1845
|
const headers = {};
|
|
1988
1846
|
const queryParameters = {};
|
|
@@ -2031,12 +1889,8 @@ function createSearchClient({
|
|
|
2031
1889
|
};
|
|
2032
1890
|
searchMethodParams = newSignatureRequest;
|
|
2033
1891
|
}
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
}
|
|
2037
|
-
if (!searchMethodParams.requests) {
|
|
2038
|
-
throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");
|
|
2039
|
-
}
|
|
1892
|
+
validateRequired("searchMethodParams", "search", searchMethodParams);
|
|
1893
|
+
validateRequired("searchMethodParams.requests", "search", searchMethodParams.requests);
|
|
2040
1894
|
const requestPath = "/1/indexes/*/queries";
|
|
2041
1895
|
const headers = {};
|
|
2042
1896
|
const queryParameters = {};
|
|
@@ -2062,19 +1916,13 @@ function createSearchClient({
|
|
|
2062
1916
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2063
1917
|
*/
|
|
2064
1918
|
searchDictionaryEntries({ dictionaryName, searchDictionaryEntriesParams }, requestOptions) {
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
}
|
|
2073
|
-
if (!searchDictionaryEntriesParams.query) {
|
|
2074
|
-
throw new Error(
|
|
2075
|
-
"Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`."
|
|
2076
|
-
);
|
|
2077
|
-
}
|
|
1919
|
+
validateRequired("dictionaryName", "searchDictionaryEntries", dictionaryName);
|
|
1920
|
+
validateRequired("searchDictionaryEntriesParams", "searchDictionaryEntries", searchDictionaryEntriesParams);
|
|
1921
|
+
validateRequired(
|
|
1922
|
+
"searchDictionaryEntriesParams.query",
|
|
1923
|
+
"searchDictionaryEntries",
|
|
1924
|
+
searchDictionaryEntriesParams.query
|
|
1925
|
+
);
|
|
2078
1926
|
const requestPath = "/1/dictionaries/{dictionaryName}/search".replace(
|
|
2079
1927
|
"{dictionaryName}",
|
|
2080
1928
|
encodeURIComponent(dictionaryName)
|
|
@@ -2104,12 +1952,8 @@ function createSearchClient({
|
|
|
2104
1952
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2105
1953
|
*/
|
|
2106
1954
|
searchForFacetValues({ indexName, facetName, searchForFacetValuesRequest }, requestOptions) {
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
}
|
|
2110
|
-
if (!facetName) {
|
|
2111
|
-
throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");
|
|
2112
|
-
}
|
|
1955
|
+
validateRequired("indexName", "searchForFacetValues", indexName);
|
|
1956
|
+
validateRequired("facetName", "searchForFacetValues", facetName);
|
|
2113
1957
|
const requestPath = "/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}", encodeURIComponent(indexName)).replace("{facetName}", encodeURIComponent(facetName));
|
|
2114
1958
|
const headers = {};
|
|
2115
1959
|
const queryParameters = {};
|
|
@@ -2135,9 +1979,7 @@ function createSearchClient({
|
|
|
2135
1979
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2136
1980
|
*/
|
|
2137
1981
|
searchRules({ indexName, searchRulesParams }, requestOptions) {
|
|
2138
|
-
|
|
2139
|
-
throw new Error("Parameter `indexName` is required when calling `searchRules`.");
|
|
2140
|
-
}
|
|
1982
|
+
validateRequired("indexName", "searchRules", indexName);
|
|
2141
1983
|
const requestPath = "/1/indexes/{indexName}/rules/search".replace("{indexName}", encodeURIComponent(indexName));
|
|
2142
1984
|
const headers = {};
|
|
2143
1985
|
const queryParameters = {};
|
|
@@ -2163,9 +2005,7 @@ function createSearchClient({
|
|
|
2163
2005
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2164
2006
|
*/
|
|
2165
2007
|
searchSingleIndex({ indexName, searchParams }, requestOptions) {
|
|
2166
|
-
|
|
2167
|
-
throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");
|
|
2168
|
-
}
|
|
2008
|
+
validateRequired("indexName", "searchSingleIndex", indexName);
|
|
2169
2009
|
const requestPath = "/1/indexes/{indexName}/query".replace("{indexName}", encodeURIComponent(indexName));
|
|
2170
2010
|
const headers = {};
|
|
2171
2011
|
const queryParameters = {};
|
|
@@ -2191,9 +2031,7 @@ function createSearchClient({
|
|
|
2191
2031
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2192
2032
|
*/
|
|
2193
2033
|
searchSynonyms({ indexName, searchSynonymsParams }, requestOptions) {
|
|
2194
|
-
|
|
2195
|
-
throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");
|
|
2196
|
-
}
|
|
2034
|
+
validateRequired("indexName", "searchSynonyms", indexName);
|
|
2197
2035
|
const requestPath = "/1/indexes/{indexName}/synonyms/search".replace(
|
|
2198
2036
|
"{indexName}",
|
|
2199
2037
|
encodeURIComponent(indexName)
|
|
@@ -2222,12 +2060,8 @@ function createSearchClient({
|
|
|
2222
2060
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2223
2061
|
*/
|
|
2224
2062
|
searchUserIds(searchUserIdsParams, requestOptions) {
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
}
|
|
2228
|
-
if (!searchUserIdsParams.query) {
|
|
2229
|
-
throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");
|
|
2230
|
-
}
|
|
2063
|
+
validateRequired("searchUserIdsParams", "searchUserIds", searchUserIdsParams);
|
|
2064
|
+
validateRequired("searchUserIdsParams.query", "searchUserIds", searchUserIdsParams.query);
|
|
2231
2065
|
const requestPath = "/1/clusters/mapping/search";
|
|
2232
2066
|
const headers = {};
|
|
2233
2067
|
const queryParameters = {};
|
|
@@ -2251,14 +2085,12 @@ function createSearchClient({
|
|
|
2251
2085
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2252
2086
|
*/
|
|
2253
2087
|
setDictionarySettings(dictionarySettingsParams, requestOptions) {
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
);
|
|
2261
|
-
}
|
|
2088
|
+
validateRequired("dictionarySettingsParams", "setDictionarySettings", dictionarySettingsParams);
|
|
2089
|
+
validateRequired(
|
|
2090
|
+
"dictionarySettingsParams.disableStandardEntries",
|
|
2091
|
+
"setDictionarySettings",
|
|
2092
|
+
dictionarySettingsParams.disableStandardEntries
|
|
2093
|
+
);
|
|
2262
2094
|
const requestPath = "/1/dictionaries/*/settings";
|
|
2263
2095
|
const headers = {};
|
|
2264
2096
|
const queryParameters = {};
|
|
@@ -2283,12 +2115,8 @@ function createSearchClient({
|
|
|
2283
2115
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2284
2116
|
*/
|
|
2285
2117
|
setSettings({ indexName, indexSettings, forwardToReplicas }, requestOptions) {
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
}
|
|
2289
|
-
if (!indexSettings) {
|
|
2290
|
-
throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");
|
|
2291
|
-
}
|
|
2118
|
+
validateRequired("indexName", "setSettings", indexName);
|
|
2119
|
+
validateRequired("indexSettings", "setSettings", indexSettings);
|
|
2292
2120
|
const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
|
|
2293
2121
|
const headers = {};
|
|
2294
2122
|
const queryParameters = {};
|
|
@@ -2315,15 +2143,9 @@ function createSearchClient({
|
|
|
2315
2143
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2316
2144
|
*/
|
|
2317
2145
|
updateApiKey({ key, apiKey }, requestOptions) {
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
if (!apiKey) {
|
|
2322
|
-
throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");
|
|
2323
|
-
}
|
|
2324
|
-
if (!apiKey.acl) {
|
|
2325
|
-
throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");
|
|
2326
|
-
}
|
|
2146
|
+
validateRequired("key", "updateApiKey", key);
|
|
2147
|
+
validateRequired("apiKey", "updateApiKey", apiKey);
|
|
2148
|
+
validateRequired("apiKey.acl", "updateApiKey", apiKey.acl);
|
|
2327
2149
|
const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
|
|
2328
2150
|
const headers = {};
|
|
2329
2151
|
const queryParameters = {};
|
|
@@ -2342,7 +2164,4 @@ export {
|
|
|
2342
2164
|
apiClientVersion,
|
|
2343
2165
|
createSearchClient
|
|
2344
2166
|
};
|
|
2345
|
-
//# sourceMappingURL=searchClient.js.mapClientVersion,
|
|
2346
|
-
createSearchClient
|
|
2347
|
-
};
|
|
2348
2167
|
//# sourceMappingURL=searchClient.js.map
|