You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts
+73-3Lines changed: 73 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -27,10 +27,13 @@ import type { BrowseResponse } from '../model/browseResponse';
27
27
importtype{
28
28
BrowseOptions,
29
29
ChunkedBatchOptions,
30
+
DeleteObjectsOptions,
31
+
PartialUpdateObjectsOptions,
30
32
ReplaceAllObjectsOptions,
33
+
SaveObjectsOptions,
31
34
WaitForApiKeyOptions,
32
-
WaitForTaskOptions,
33
35
WaitForAppTaskOptions,
36
+
WaitForTaskOptions,
34
37
AddOrUpdateObjectProps,
35
38
AssignUserIdProps,
36
39
BatchProps,
@@ -577,6 +580,74 @@ export function createSearchClient({
577
580
returnresponses;
578
581
},
579
582
583
+
/**
584
+
* Helper: Saves the given array of objects in the given index. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it.
585
+
*
586
+
* @summary Helper: Saves the given array of objects in the given index. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it.
587
+
* @param saveObjects - The `saveObjects` object.
588
+
* @param saveObjects.indexName - The `indexName` to save `objects` in.
589
+
* @param saveObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
590
+
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
591
+
*/
592
+
asyncsaveObjects(
593
+
{ indexName, objects }: SaveObjectsOptions,
594
+
requestOptions?: RequestOptions
595
+
): Promise<BatchResponse[]>{
596
+
returnawaitthis.chunkedBatch(
597
+
{ indexName, objects,action: 'addObject'},
598
+
requestOptions
599
+
);
600
+
},
601
+
602
+
/**
603
+
* Helper: Deletes every records for the given objectIDs. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objectIDs in it.
604
+
*
605
+
* @summary Helper: Deletes every records for the given objectIDs. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objectIDs in it.
606
+
* @param deleteObjects - The `deleteObjects` object.
607
+
* @param deleteObjects.indexName - The `indexName` to delete `objectIDs` from.
608
+
* @param deleteObjects.objectIDs - The objectIDs to delete.
609
+
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
* Helper: Replaces object content of all the given objects according to their respective `objectID` field. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it.
627
+
*
628
+
* @summary Helper: Replaces object content of all the given objects according to their respective `objectID` field. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it.
629
+
* @param partialUpdateObjects - The `partialUpdateObjects` object.
630
+
* @param partialUpdateObjects.indexName - The `indexName` to update `objects` in.
631
+
* @param partialUpdateObjects.objects - The array of `objects` to update in the given Algolia `indexName`.
632
+
* @param partialUpdateObjects.createIfNotExists - To be provided if non-existing objects are passed, otherwise, the call will fail..
633
+
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
* Helper: Replaces all objects (records) in the given `index_name` with the given `objects`. A temporary index is created during this process in order to backup your data.
582
653
* See https://api-clients-automation.netlify.app/docs/contributing/add-new-api-client#5-helpers for implementation details.
@@ -586,7 +657,7 @@ export function createSearchClient({
586
657
* @param replaceAllObjects.indexName - The `indexName` to replace `objects` in.
587
658
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
588
659
* @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.
589
-
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
660
+
* @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.
0 commit comments