@algolia/client-search 5.0.0-alpha.91 → 5.0.0-alpha.98
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/dist/client-search.cjs +119 -127
- package/dist/client-search.esm.browser.js +162 -146
- package/dist/client-search.esm.node.js +119 -127
- package/dist/client-search.umd.js +2 -2
- package/dist/model/clientMethodProps.d.ts +59 -72
- package/dist/model/clientMethodProps.d.ts.map +1 -1
- package/dist/model/highlightResult.d.ts +1 -1
- package/dist/model/highlightResult.d.ts.map +1 -1
- package/dist/model/searchForFacetValuesResponse.d.ts +8 -0
- package/dist/model/searchForFacetValuesResponse.d.ts.map +1 -1
- package/dist/model/searchResponses.d.ts +2 -2
- package/dist/model/searchResponses.d.ts.map +1 -1
- package/dist/model/searchResult.d.ts +1 -1
- package/dist/model/searchResult.d.ts.map +1 -1
- package/dist/model/searchSynonymsParams.d.ts +10 -0
- package/dist/model/searchSynonymsParams.d.ts.map +1 -1
- package/dist/model/snippetResult.d.ts +1 -1
- package/dist/model/snippetResult.d.ts.map +1 -1
- package/dist/model/userHighlightResult.d.ts +2 -8
- package/dist/model/userHighlightResult.d.ts.map +1 -1
- package/dist/src/searchClient.d.ts +53 -55
- package/dist/src/searchClient.d.ts.map +1 -1
- package/model/clientMethodProps.ts +62 -75
- package/model/highlightResult.ts +3 -1
- package/model/searchForFacetValuesResponse.ts +10 -0
- package/model/searchResponses.ts +2 -2
- package/model/searchResult.ts +3 -1
- package/model/searchSynonymsParams.ts +14 -0
- package/model/snippetResult.ts +3 -1
- package/model/userHighlightResult.ts +2 -8
- package/package.json +7 -7
package/dist/client-search.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var clientCommon = require('@algolia/client-common');
|
|
|
4
4
|
var requesterNodeHttp = require('@algolia/requester-node-http');
|
|
5
5
|
|
|
6
6
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
7
|
-
const apiClientVersion = '5.0.0-alpha.
|
|
7
|
+
const apiClientVersion = '5.0.0-alpha.98';
|
|
8
8
|
function getDefaultHosts(appId) {
|
|
9
9
|
return [
|
|
10
10
|
{
|
|
@@ -229,21 +229,25 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
229
229
|
* @param browseObjects.indexName - The index in which to perform the request.
|
|
230
230
|
* @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000).
|
|
231
231
|
* @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
|
|
232
|
+
* @param browseObjects.searchSynonymsParams - The `searchSynonyms` method parameters.
|
|
232
233
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchSynonyms` method and merged with the transporter requestOptions.
|
|
233
234
|
*/
|
|
234
|
-
browseSynonyms({ indexName,
|
|
235
|
+
browseSynonyms({ indexName, searchSynonymsParams, ...browseSynonymsOptions }, requestOptions) {
|
|
235
236
|
const params = {
|
|
237
|
+
page: 0,
|
|
238
|
+
...searchSynonymsParams,
|
|
236
239
|
hitsPerPage: 1000,
|
|
237
|
-
...browseSynonymsOptions,
|
|
238
240
|
};
|
|
239
241
|
return clientCommon.createIterablePromise({
|
|
240
242
|
func: (previousResponse) => {
|
|
241
243
|
return this.searchSynonyms({
|
|
242
|
-
...params,
|
|
243
244
|
indexName,
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
:
|
|
245
|
+
searchSynonymsParams: {
|
|
246
|
+
...params,
|
|
247
|
+
page: previousResponse
|
|
248
|
+
? previousResponse.page + 1
|
|
249
|
+
: params.page,
|
|
250
|
+
},
|
|
247
251
|
}, requestOptions);
|
|
248
252
|
},
|
|
249
253
|
validate: (response) => response.nbHits < params.hitsPerPage,
|
|
@@ -517,24 +521,20 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
517
521
|
return transporter.request(request, requestOptions);
|
|
518
522
|
},
|
|
519
523
|
/**
|
|
520
|
-
* Delete
|
|
524
|
+
* Delete the records but leave settings and index-specific API keys untouched.
|
|
521
525
|
*
|
|
522
|
-
* @summary Delete all
|
|
523
|
-
* @param
|
|
524
|
-
* @param
|
|
525
|
-
* @param clearAllSynonyms.forwardToReplicas - Indicates whether changed index settings are forwarded to the replica indices.
|
|
526
|
+
* @summary Delete all records from an index.
|
|
527
|
+
* @param clearObjects - The clearObjects object.
|
|
528
|
+
* @param clearObjects.indexName - Index on which to perform the request.
|
|
526
529
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
527
530
|
*/
|
|
528
|
-
|
|
531
|
+
clearObjects({ indexName }, requestOptions) {
|
|
529
532
|
if (!indexName) {
|
|
530
|
-
throw new Error('Parameter `indexName` is required when calling `
|
|
533
|
+
throw new Error('Parameter `indexName` is required when calling `clearObjects`.');
|
|
531
534
|
}
|
|
532
|
-
const requestPath = '/1/indexes/{indexName}/
|
|
535
|
+
const requestPath = '/1/indexes/{indexName}/clear'.replace('{indexName}', encodeURIComponent(indexName));
|
|
533
536
|
const headers = {};
|
|
534
537
|
const queryParameters = {};
|
|
535
|
-
if (forwardToReplicas !== undefined) {
|
|
536
|
-
queryParameters.forwardToReplicas = forwardToReplicas.toString();
|
|
537
|
-
}
|
|
538
538
|
const request = {
|
|
539
539
|
method: 'POST',
|
|
540
540
|
path: requestPath,
|
|
@@ -544,20 +544,24 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
544
544
|
return transporter.request(request, requestOptions);
|
|
545
545
|
},
|
|
546
546
|
/**
|
|
547
|
-
* Delete
|
|
547
|
+
* Delete all rules in the index.
|
|
548
548
|
*
|
|
549
|
-
* @summary Delete all
|
|
550
|
-
* @param
|
|
551
|
-
* @param
|
|
549
|
+
* @summary Delete all rules.
|
|
550
|
+
* @param clearRules - The clearRules object.
|
|
551
|
+
* @param clearRules.indexName - Index on which to perform the request.
|
|
552
|
+
* @param clearRules.forwardToReplicas - Indicates whether changed index settings are forwarded to the replica indices.
|
|
552
553
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
553
554
|
*/
|
|
554
|
-
|
|
555
|
+
clearRules({ indexName, forwardToReplicas }, requestOptions) {
|
|
555
556
|
if (!indexName) {
|
|
556
|
-
throw new Error('Parameter `indexName` is required when calling `
|
|
557
|
+
throw new Error('Parameter `indexName` is required when calling `clearRules`.');
|
|
557
558
|
}
|
|
558
|
-
const requestPath = '/1/indexes/{indexName}/clear'.replace('{indexName}', encodeURIComponent(indexName));
|
|
559
|
+
const requestPath = '/1/indexes/{indexName}/rules/clear'.replace('{indexName}', encodeURIComponent(indexName));
|
|
559
560
|
const headers = {};
|
|
560
561
|
const queryParameters = {};
|
|
562
|
+
if (forwardToReplicas !== undefined) {
|
|
563
|
+
queryParameters.forwardToReplicas = forwardToReplicas.toString();
|
|
564
|
+
}
|
|
561
565
|
const request = {
|
|
562
566
|
method: 'POST',
|
|
563
567
|
path: requestPath,
|
|
@@ -567,19 +571,19 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
567
571
|
return transporter.request(request, requestOptions);
|
|
568
572
|
},
|
|
569
573
|
/**
|
|
570
|
-
* Delete all
|
|
574
|
+
* Delete all synonyms in the index.
|
|
571
575
|
*
|
|
572
|
-
* @summary Delete all
|
|
573
|
-
* @param
|
|
574
|
-
* @param
|
|
575
|
-
* @param
|
|
576
|
+
* @summary Delete all synonyms.
|
|
577
|
+
* @param clearSynonyms - The clearSynonyms object.
|
|
578
|
+
* @param clearSynonyms.indexName - Index on which to perform the request.
|
|
579
|
+
* @param clearSynonyms.forwardToReplicas - Indicates whether changed index settings are forwarded to the replica indices.
|
|
576
580
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
577
581
|
*/
|
|
578
|
-
|
|
582
|
+
clearSynonyms({ indexName, forwardToReplicas }, requestOptions) {
|
|
579
583
|
if (!indexName) {
|
|
580
|
-
throw new Error('Parameter `indexName` is required when calling `
|
|
584
|
+
throw new Error('Parameter `indexName` is required when calling `clearSynonyms`.');
|
|
581
585
|
}
|
|
582
|
-
const requestPath = '/1/indexes/{indexName}/
|
|
586
|
+
const requestPath = '/1/indexes/{indexName}/synonyms/clear'.replace('{indexName}', encodeURIComponent(indexName));
|
|
583
587
|
const headers = {};
|
|
584
588
|
const queryParameters = {};
|
|
585
589
|
if (forwardToReplicas !== undefined) {
|
|
@@ -597,14 +601,14 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
597
601
|
* This method allow you to send requests to the Algolia REST API.
|
|
598
602
|
*
|
|
599
603
|
* @summary Send requests to the Algolia REST API.
|
|
600
|
-
* @param
|
|
601
|
-
* @param
|
|
602
|
-
* @param
|
|
604
|
+
* @param customDelete - The customDelete object.
|
|
605
|
+
* @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
606
|
+
* @param customDelete.parameters - Query parameters to apply to the current query.
|
|
603
607
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
604
608
|
*/
|
|
605
|
-
|
|
609
|
+
customDelete({ path, parameters }, requestOptions) {
|
|
606
610
|
if (!path) {
|
|
607
|
-
throw new Error('Parameter `path` is required when calling `
|
|
611
|
+
throw new Error('Parameter `path` is required when calling `customDelete`.');
|
|
608
612
|
}
|
|
609
613
|
const requestPath = '/1{path}'.replace('{path}', path);
|
|
610
614
|
const headers = {};
|
|
@@ -617,6 +621,82 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
617
621
|
};
|
|
618
622
|
return transporter.request(request, requestOptions);
|
|
619
623
|
},
|
|
624
|
+
/**
|
|
625
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
626
|
+
*
|
|
627
|
+
* @summary Send requests to the Algolia REST API.
|
|
628
|
+
* @param customGet - The customGet object.
|
|
629
|
+
* @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
630
|
+
* @param customGet.parameters - Query parameters to apply to the current query.
|
|
631
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
632
|
+
*/
|
|
633
|
+
customGet({ path, parameters }, requestOptions) {
|
|
634
|
+
if (!path) {
|
|
635
|
+
throw new Error('Parameter `path` is required when calling `customGet`.');
|
|
636
|
+
}
|
|
637
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
638
|
+
const headers = {};
|
|
639
|
+
const queryParameters = parameters ? parameters : {};
|
|
640
|
+
const request = {
|
|
641
|
+
method: 'GET',
|
|
642
|
+
path: requestPath,
|
|
643
|
+
queryParameters,
|
|
644
|
+
headers,
|
|
645
|
+
};
|
|
646
|
+
return transporter.request(request, requestOptions);
|
|
647
|
+
},
|
|
648
|
+
/**
|
|
649
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
650
|
+
*
|
|
651
|
+
* @summary Send requests to the Algolia REST API.
|
|
652
|
+
* @param customPost - The customPost object.
|
|
653
|
+
* @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
654
|
+
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
655
|
+
* @param customPost.body - Parameters to send with the custom request.
|
|
656
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
657
|
+
*/
|
|
658
|
+
customPost({ path, parameters, body }, requestOptions) {
|
|
659
|
+
if (!path) {
|
|
660
|
+
throw new Error('Parameter `path` is required when calling `customPost`.');
|
|
661
|
+
}
|
|
662
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
663
|
+
const headers = {};
|
|
664
|
+
const queryParameters = parameters ? parameters : {};
|
|
665
|
+
const request = {
|
|
666
|
+
method: 'POST',
|
|
667
|
+
path: requestPath,
|
|
668
|
+
queryParameters,
|
|
669
|
+
headers,
|
|
670
|
+
data: body ? body : {},
|
|
671
|
+
};
|
|
672
|
+
return transporter.request(request, requestOptions);
|
|
673
|
+
},
|
|
674
|
+
/**
|
|
675
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
676
|
+
*
|
|
677
|
+
* @summary Send requests to the Algolia REST API.
|
|
678
|
+
* @param customPut - The customPut object.
|
|
679
|
+
* @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
680
|
+
* @param customPut.parameters - Query parameters to apply to the current query.
|
|
681
|
+
* @param customPut.body - Parameters to send with the custom request.
|
|
682
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
683
|
+
*/
|
|
684
|
+
customPut({ path, parameters, body }, requestOptions) {
|
|
685
|
+
if (!path) {
|
|
686
|
+
throw new Error('Parameter `path` is required when calling `customPut`.');
|
|
687
|
+
}
|
|
688
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
689
|
+
const headers = {};
|
|
690
|
+
const queryParameters = parameters ? parameters : {};
|
|
691
|
+
const request = {
|
|
692
|
+
method: 'PUT',
|
|
693
|
+
path: requestPath,
|
|
694
|
+
queryParameters,
|
|
695
|
+
headers,
|
|
696
|
+
data: body ? body : {},
|
|
697
|
+
};
|
|
698
|
+
return transporter.request(request, requestOptions);
|
|
699
|
+
},
|
|
620
700
|
/**
|
|
621
701
|
* Delete an existing API key. The request must be authenticated with the admin API key.
|
|
622
702
|
*
|
|
@@ -809,30 +889,6 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
809
889
|
};
|
|
810
890
|
return transporter.request(request, requestOptions);
|
|
811
891
|
},
|
|
812
|
-
/**
|
|
813
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
814
|
-
*
|
|
815
|
-
* @summary Send requests to the Algolia REST API.
|
|
816
|
-
* @param get - The get object.
|
|
817
|
-
* @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
818
|
-
* @param get.parameters - Query parameters to apply to the current query.
|
|
819
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
820
|
-
*/
|
|
821
|
-
get({ path, parameters }, requestOptions) {
|
|
822
|
-
if (!path) {
|
|
823
|
-
throw new Error('Parameter `path` is required when calling `get`.');
|
|
824
|
-
}
|
|
825
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
826
|
-
const headers = {};
|
|
827
|
-
const queryParameters = parameters ? parameters : {};
|
|
828
|
-
const request = {
|
|
829
|
-
method: 'GET',
|
|
830
|
-
path: requestPath,
|
|
831
|
-
queryParameters,
|
|
832
|
-
headers,
|
|
833
|
-
};
|
|
834
|
-
return transporter.request(request, requestOptions);
|
|
835
|
-
},
|
|
836
892
|
/**
|
|
837
893
|
* Get the permissions and restrictions of a specific API key. When authenticating with the admin API key, you can request information for any of your application\'s keys. When authenticating with other API keys, you can only retrieve information for that key.
|
|
838
894
|
*
|
|
@@ -1368,58 +1424,6 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1368
1424
|
};
|
|
1369
1425
|
return transporter.request(request, requestOptions);
|
|
1370
1426
|
},
|
|
1371
|
-
/**
|
|
1372
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
1373
|
-
*
|
|
1374
|
-
* @summary Send requests to the Algolia REST API.
|
|
1375
|
-
* @param post - The post object.
|
|
1376
|
-
* @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
1377
|
-
* @param post.parameters - Query parameters to apply to the current query.
|
|
1378
|
-
* @param post.body - Parameters to send with the custom request.
|
|
1379
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1380
|
-
*/
|
|
1381
|
-
post({ path, parameters, body }, requestOptions) {
|
|
1382
|
-
if (!path) {
|
|
1383
|
-
throw new Error('Parameter `path` is required when calling `post`.');
|
|
1384
|
-
}
|
|
1385
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
1386
|
-
const headers = {};
|
|
1387
|
-
const queryParameters = parameters ? parameters : {};
|
|
1388
|
-
const request = {
|
|
1389
|
-
method: 'POST',
|
|
1390
|
-
path: requestPath,
|
|
1391
|
-
queryParameters,
|
|
1392
|
-
headers,
|
|
1393
|
-
data: body ? body : {},
|
|
1394
|
-
};
|
|
1395
|
-
return transporter.request(request, requestOptions);
|
|
1396
|
-
},
|
|
1397
|
-
/**
|
|
1398
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
1399
|
-
*
|
|
1400
|
-
* @summary Send requests to the Algolia REST API.
|
|
1401
|
-
* @param put - The put object.
|
|
1402
|
-
* @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
1403
|
-
* @param put.parameters - Query parameters to apply to the current query.
|
|
1404
|
-
* @param put.body - Parameters to send with the custom request.
|
|
1405
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1406
|
-
*/
|
|
1407
|
-
put({ path, parameters, body }, requestOptions) {
|
|
1408
|
-
if (!path) {
|
|
1409
|
-
throw new Error('Parameter `path` is required when calling `put`.');
|
|
1410
|
-
}
|
|
1411
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
1412
|
-
const headers = {};
|
|
1413
|
-
const queryParameters = parameters ? parameters : {};
|
|
1414
|
-
const request = {
|
|
1415
|
-
method: 'PUT',
|
|
1416
|
-
path: requestPath,
|
|
1417
|
-
queryParameters,
|
|
1418
|
-
headers,
|
|
1419
|
-
data: body ? body : {},
|
|
1420
|
-
};
|
|
1421
|
-
return transporter.request(request, requestOptions);
|
|
1422
|
-
},
|
|
1423
1427
|
/**
|
|
1424
1428
|
* Remove a userID and its associated data from the multi-clusters.
|
|
1425
1429
|
*
|
|
@@ -1852,28 +1856,16 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1852
1856
|
* @summary Search for synonyms.
|
|
1853
1857
|
* @param searchSynonyms - The searchSynonyms object.
|
|
1854
1858
|
* @param searchSynonyms.indexName - Index on which to perform the request.
|
|
1855
|
-
* @param searchSynonyms.type - Search for specific [types of synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms).
|
|
1856
|
-
* @param searchSynonyms.page - Returns the requested page number (the first page is 0). Page size is set by `hitsPerPage`. When null, there\'s no pagination.
|
|
1857
|
-
* @param searchSynonyms.hitsPerPage - Maximum number of hits per page.
|
|
1858
1859
|
* @param searchSynonyms.searchSynonymsParams - Body of the `searchSynonyms` operation.
|
|
1859
1860
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1860
1861
|
*/
|
|
1861
|
-
searchSynonyms({ indexName,
|
|
1862
|
+
searchSynonyms({ indexName, searchSynonymsParams }, requestOptions) {
|
|
1862
1863
|
if (!indexName) {
|
|
1863
1864
|
throw new Error('Parameter `indexName` is required when calling `searchSynonyms`.');
|
|
1864
1865
|
}
|
|
1865
1866
|
const requestPath = '/1/indexes/{indexName}/synonyms/search'.replace('{indexName}', encodeURIComponent(indexName));
|
|
1866
1867
|
const headers = {};
|
|
1867
1868
|
const queryParameters = {};
|
|
1868
|
-
if (type !== undefined) {
|
|
1869
|
-
queryParameters.type = type.toString();
|
|
1870
|
-
}
|
|
1871
|
-
if (page !== undefined) {
|
|
1872
|
-
queryParameters.page = page.toString();
|
|
1873
|
-
}
|
|
1874
|
-
if (hitsPerPage !== undefined) {
|
|
1875
|
-
queryParameters.hitsPerPage = hitsPerPage.toString();
|
|
1876
|
-
}
|
|
1877
1869
|
const request = {
|
|
1878
1870
|
method: 'POST',
|
|
1879
1871
|
path: requestPath,
|